~ubuntu-branches/ubuntu/precise/gnome-control-center/precise-updates

« back to all changes in this revision

Viewing changes to .pc/05_run_update_manager.patch/panels/info/cc-info-panel.c

  • Committer: Package Import Robot
  • Author(s): Sebastien Bacher, Jeremy Bicha, Ken VanDine
  • Date: 2012-02-15 23:16:31 UTC
  • mfrom: (1.1.56)
  • Revision ID: package-import@ubuntu.com-20120215231631-vk7me0mhofpsq0hp
Tags: 1:3.3.5-0ubuntu1
* Upload the new serie, that will bring in quite some fixes, we revert
  some problematic or risky changes as well
* The new version includes those fixes:
  - "Change Password in User Accounts panel focuses "New password" field, 
     skipping "Current password"" (lp: #821759)
  - The dialog to add online accounts should have a title 
    (lp: #822380)
  - "Remove Profile" button clickable in Color panel when 
     no profile selected (lp: #869603)
  - Move Removable Media into System Info (lp: #835880)
  - Sound preferences: mouse scrolling balance only works for right.
    (lp: #918017)
  - gnome-control-center SIGSEGV in actualize_printers_list() 
    (lp: #903009)
  - selecting preffered applications is not an info (lp: #890143)
  - Add a keyboard shortcut by default for take screenshot of a selection"
    (lp: #625518)
* debian/patches/revert_git_datetime_port.patch:
  - revert use of datetimed, we don't use systemd and ubuntu-system-service 
    doesn't support it yet
* debian/patches/revert_git_drop_library.patch:
  - consolidate "01_allow_external_panels.patch", don't drop the library
    we use it from other components on ubuntu, the patch will be improved
    later to not use a copy of files like it does in that version
* debian/patches/revert_git_stop_using_gconf.patch,
  debian/patches/revert_ua_gsettings.patch,
  debian/patches/revert_git_keyboard_gsettings.patch:
  - revert keyboard porting to gsettings, compiz still use gconf and we
    didn't update gnome-shell to the new serie (yet)

[ Jeremy Bicha ]
* New upstream release (Thanks Rico Tzchichholz!)
* debian/control.in:
  - Bump minimum dependency versions and add libwacom dependency
* debian/rules: Build without -Wl,-z,defs
* debian/watch: Watch for unstable releases
* Refreshed patches:
  - 01_allow_external_panels.patch
  - 04_add_theme_selection.patch
  - 50_ubuntu_systemwide_prefs.patch
  - 58_ubuntu_icon_views_redesign.patch
  - 59_install_gcm_components_on_demand.patch
  - 91_configure_cheese.patch
* Dropped upstream patches:
  - 00git_handle_media_dialog_close.patch
  - 03_show_wacom_under_unity.patch
  - 90_git_sound_tab_order.patch
  - 91_git_build_use_fontconfig.patch
  - 92_git_minimal_output_height.patch
  - 93_change_window_role_on_panel_change.patch
  - 94_git_adding_shortcuts.patch
  - 95_git_ctrlw_shortcut.patch
  - git_extra_keywords.patch

[ Ken VanDine ]
* debian/patches/96_sound_nua_panel.patch
  - refreshed with latest changes from ronoc

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
#include "cc-info-panel.h"
25
25
 
26
 
#include <sys/vfs.h>
27
26
#include <polkit/polkit.h>
28
27
 
29
28
#include <glib.h>
38
37
 
39
38
#include "hostname-helper.h"
40
39
 
 
40
/* Autorun options */
 
41
#define PREF_MEDIA_AUTORUN_NEVER                "autorun-never"
 
42
#define PREF_MEDIA_AUTORUN_X_CONTENT_START_APP  "autorun-x-content-start-app"
 
43
#define PREF_MEDIA_AUTORUN_X_CONTENT_IGNORE     "autorun-x-content-ignore"
 
44
#define PREF_MEDIA_AUTORUN_X_CONTENT_OPEN_FOLDER "autorun-x-content-open-folder"
 
45
 
 
46
#define CUSTOM_ITEM_ASK "cc-item-ask"
 
47
#define CUSTOM_ITEM_DO_NOTHING "cc-item-do-nothing"
 
48
#define CUSTOM_ITEM_OPEN_FOLDER "cc-item-open-folder"
 
49
 
 
50
#define MEDIA_HANDLING_SCHEMA "org.gnome.desktop.media-handling"
 
51
 
 
52
/* Session */
41
53
#define GNOME_SESSION_MANAGER_SCHEMA        "org.gnome.desktop.session"
42
54
#define KEY_SESSION_NAME          "session-name"
43
55
 
77
89
  guint64        total_bytes;
78
90
  GCancellable  *cancellable;
79
91
 
 
92
  /* Media */
 
93
  GSettings     *media_settings;
 
94
  GtkWidget     *other_application_combo;
 
95
 
80
96
  GDBusConnection     *session_bus;
81
97
  GDBusProxy          *pk_proxy;
82
98
  GDBusProxy          *pk_transaction_proxy;
522
538
      priv->hostnamed_proxy = NULL;
523
539
    }
524
540
 
 
541
  if (priv->media_settings != NULL)
 
542
    {
 
543
      g_object_unref (priv->media_settings);
 
544
      priv->media_settings = NULL;
 
545
    }
 
546
 
 
547
  if (priv->session_settings != NULL)
 
548
    {
 
549
      g_object_unref (priv->session_settings);
 
550
      priv->session_settings = NULL;
 
551
    }
 
552
 
525
553
  G_OBJECT_CLASS (cc_info_panel_parent_class)->finalize (object);
526
554
}
527
555
 
946
974
                                1, 2, 5, 6);
947
975
}
948
976
 
 
977
static char **
 
978
remove_elem_from_str_array (char **v,
 
979
                            const char *s)
 
980
{
 
981
  GPtrArray *array;
 
982
  guint idx;
 
983
 
 
984
  array = g_ptr_array_new ();
 
985
 
 
986
  for (idx = 0; v[idx] != NULL; idx++) {
 
987
    if (g_strcmp0 (v[idx], s) == 0) {
 
988
      continue;
 
989
    }
 
990
 
 
991
    g_ptr_array_add (array, v[idx]);
 
992
  }
 
993
 
 
994
  g_ptr_array_add (array, NULL);
 
995
 
 
996
  g_free (v);
 
997
 
 
998
  return (char **) g_ptr_array_free (array, FALSE);
 
999
}
 
1000
 
 
1001
static char **
 
1002
add_elem_to_str_array (char **v,
 
1003
                       const char *s)
 
1004
{
 
1005
  GPtrArray *array;
 
1006
  guint idx;
 
1007
 
 
1008
  array = g_ptr_array_new ();
 
1009
 
 
1010
  for (idx = 0; v[idx] != NULL; idx++) {
 
1011
    g_ptr_array_add (array, v[idx]);
 
1012
  }
 
1013
 
 
1014
  g_ptr_array_add (array, g_strdup (s));
 
1015
  g_ptr_array_add (array, NULL);
 
1016
 
 
1017
  g_free (v);
 
1018
 
 
1019
  return (char **) g_ptr_array_free (array, FALSE);
 
1020
}
 
1021
 
 
1022
static int
 
1023
media_panel_g_strv_find (char **strv,
 
1024
                         const char *find_me)
 
1025
{
 
1026
  guint index;
 
1027
 
 
1028
  g_return_val_if_fail (find_me != NULL, -1);
 
1029
 
 
1030
  for (index = 0; strv[index] != NULL; ++index) {
 
1031
    if (g_strcmp0 (strv[index], find_me) == 0) {
 
1032
      return index;
 
1033
    }
 
1034
  }
 
1035
 
 
1036
  return -1;
 
1037
}
 
1038
 
 
1039
static void
 
1040
autorun_get_preferences (CcInfoPanel *self,
 
1041
                         const char *x_content_type,
 
1042
                         gboolean *pref_start_app,
 
1043
                         gboolean *pref_ignore,
 
1044
                         gboolean *pref_open_folder)
 
1045
{
 
1046
  char **x_content_start_app;
 
1047
  char **x_content_ignore;
 
1048
  char **x_content_open_folder;
 
1049
 
 
1050
  g_return_if_fail (pref_start_app != NULL);
 
1051
  g_return_if_fail (pref_ignore != NULL);
 
1052
  g_return_if_fail (pref_open_folder != NULL);
 
1053
 
 
1054
  *pref_start_app = FALSE;
 
1055
  *pref_ignore = FALSE;
 
1056
  *pref_open_folder = FALSE;
 
1057
  x_content_start_app = g_settings_get_strv (self->priv->media_settings,
 
1058
                                             PREF_MEDIA_AUTORUN_X_CONTENT_START_APP);
 
1059
  x_content_ignore = g_settings_get_strv (self->priv->media_settings,
 
1060
                                          PREF_MEDIA_AUTORUN_X_CONTENT_IGNORE);
 
1061
  x_content_open_folder = g_settings_get_strv (self->priv->media_settings,
 
1062
                                               PREF_MEDIA_AUTORUN_X_CONTENT_OPEN_FOLDER);
 
1063
  if (x_content_start_app != NULL) {
 
1064
    *pref_start_app = media_panel_g_strv_find (x_content_start_app, x_content_type) != -1;
 
1065
  }
 
1066
  if (x_content_ignore != NULL) {
 
1067
    *pref_ignore = media_panel_g_strv_find (x_content_ignore, x_content_type) != -1;
 
1068
  }
 
1069
  if (x_content_open_folder != NULL) {
 
1070
    *pref_open_folder = media_panel_g_strv_find (x_content_open_folder, x_content_type) != -1;
 
1071
  }
 
1072
  g_strfreev (x_content_ignore);
 
1073
  g_strfreev (x_content_start_app);
 
1074
  g_strfreev (x_content_open_folder);
 
1075
}
 
1076
 
 
1077
static void
 
1078
autorun_set_preferences (CcInfoPanel *self,
 
1079
                         const char *x_content_type,
 
1080
                         gboolean pref_start_app,
 
1081
                         gboolean pref_ignore,
 
1082
                         gboolean pref_open_folder)
 
1083
{
 
1084
  char **x_content_start_app;
 
1085
  char **x_content_ignore;
 
1086
  char **x_content_open_folder;
 
1087
 
 
1088
  g_assert (x_content_type != NULL);
 
1089
 
 
1090
  x_content_start_app = g_settings_get_strv (self->priv->media_settings,
 
1091
                                             PREF_MEDIA_AUTORUN_X_CONTENT_START_APP);
 
1092
  x_content_ignore = g_settings_get_strv (self->priv->media_settings,
 
1093
                                          PREF_MEDIA_AUTORUN_X_CONTENT_IGNORE);
 
1094
  x_content_open_folder = g_settings_get_strv (self->priv->media_settings,
 
1095
                                               PREF_MEDIA_AUTORUN_X_CONTENT_OPEN_FOLDER);
 
1096
 
 
1097
  x_content_start_app = remove_elem_from_str_array (x_content_start_app, x_content_type);
 
1098
  if (pref_start_app) {
 
1099
    x_content_start_app = add_elem_to_str_array (x_content_start_app, x_content_type);
 
1100
  }
 
1101
  g_settings_set_strv (self->priv->media_settings,
 
1102
                       PREF_MEDIA_AUTORUN_X_CONTENT_START_APP, (const gchar * const*) x_content_start_app);
 
1103
 
 
1104
  x_content_ignore = remove_elem_from_str_array (x_content_ignore, x_content_type);
 
1105
  if (pref_ignore) {
 
1106
    x_content_ignore = add_elem_to_str_array (x_content_ignore, x_content_type);
 
1107
  }
 
1108
  g_settings_set_strv (self->priv->media_settings,
 
1109
                       PREF_MEDIA_AUTORUN_X_CONTENT_IGNORE, (const gchar * const*) x_content_ignore);
 
1110
 
 
1111
  x_content_open_folder = remove_elem_from_str_array (x_content_open_folder, x_content_type);
 
1112
  if (pref_open_folder) {
 
1113
    x_content_open_folder = add_elem_to_str_array (x_content_open_folder, x_content_type);
 
1114
  }
 
1115
  g_settings_set_strv (self->priv->media_settings,
 
1116
                       PREF_MEDIA_AUTORUN_X_CONTENT_OPEN_FOLDER, (const gchar * const*) x_content_open_folder);
 
1117
 
 
1118
  g_strfreev (x_content_open_folder);
 
1119
  g_strfreev (x_content_ignore);
 
1120
  g_strfreev (x_content_start_app);
 
1121
 
 
1122
}
 
1123
 
 
1124
static void
 
1125
custom_item_activated_cb (GtkAppChooserButton *button,
 
1126
                          const gchar *item,
 
1127
                          gpointer user_data)
 
1128
{
 
1129
  CcInfoPanel *self = user_data;
 
1130
  gchar *content_type;
 
1131
 
 
1132
  content_type = gtk_app_chooser_get_content_type (GTK_APP_CHOOSER (button));
 
1133
 
 
1134
  if (g_strcmp0 (item, CUSTOM_ITEM_ASK) == 0) {
 
1135
    autorun_set_preferences (self, content_type,
 
1136
                             FALSE, FALSE, FALSE);
 
1137
  } else if (g_strcmp0 (item, CUSTOM_ITEM_OPEN_FOLDER) == 0) {
 
1138
    autorun_set_preferences (self, content_type,
 
1139
                             FALSE, FALSE, TRUE);
 
1140
  } else if (g_strcmp0 (item, CUSTOM_ITEM_DO_NOTHING) == 0) {
 
1141
    autorun_set_preferences (self, content_type,
 
1142
                             FALSE, TRUE, FALSE);
 
1143
  }
 
1144
 
 
1145
  g_free (content_type);
 
1146
}
 
1147
 
 
1148
static void
 
1149
combo_box_changed_cb (GtkComboBox *combo_box,
 
1150
                      gpointer user_data)
 
1151
{
 
1152
  CcInfoPanel *self = user_data;
 
1153
  GAppInfo *info;
 
1154
  gchar *content_type;
 
1155
 
 
1156
  info = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (combo_box));
 
1157
 
 
1158
  if (info == NULL)
 
1159
    return;
 
1160
 
 
1161
  content_type = gtk_app_chooser_get_content_type (GTK_APP_CHOOSER (combo_box));
 
1162
  autorun_set_preferences (self, content_type,
 
1163
                           TRUE, FALSE, FALSE);
 
1164
  g_app_info_set_as_default_for_type (info, content_type, NULL);
 
1165
 
 
1166
  g_object_unref (info);
 
1167
  g_free (content_type);
 
1168
}
 
1169
 
 
1170
static void
 
1171
prepare_combo_box (CcInfoPanel *self,
 
1172
                   GtkWidget *combo_box,
 
1173
                   const gchar *heading)
 
1174
{
 
1175
  GtkAppChooserButton *app_chooser = GTK_APP_CHOOSER_BUTTON (combo_box);
 
1176
  gboolean pref_ask;
 
1177
  gboolean pref_start_app;
 
1178
  gboolean pref_ignore;
 
1179
  gboolean pref_open_folder;
 
1180
  GAppInfo *info;
 
1181
  gchar *content_type;
 
1182
 
 
1183
  content_type = gtk_app_chooser_get_content_type (GTK_APP_CHOOSER (app_chooser));
 
1184
 
 
1185
  /* fetch preferences for this content type */
 
1186
  autorun_get_preferences (self, content_type,
 
1187
                           &pref_start_app, &pref_ignore, &pref_open_folder);
 
1188
  pref_ask = !pref_start_app && !pref_ignore && !pref_open_folder;
 
1189
 
 
1190
  info = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (combo_box));
 
1191
 
 
1192
  /* append the separator only if we have >= 1 apps in the chooser */
 
1193
  if (info != NULL) {
 
1194
    gtk_app_chooser_button_append_separator (app_chooser);
 
1195
    g_object_unref (info);
 
1196
  }
 
1197
 
 
1198
  gtk_app_chooser_button_append_custom_item (app_chooser, CUSTOM_ITEM_ASK,
 
1199
                                             _("Ask what to do"),
 
1200
                                             NULL);
 
1201
 
 
1202
  gtk_app_chooser_button_append_custom_item (app_chooser, CUSTOM_ITEM_DO_NOTHING,
 
1203
                                             _("Do nothing"),
 
1204
                                             NULL);
 
1205
 
 
1206
  gtk_app_chooser_button_append_custom_item (app_chooser, CUSTOM_ITEM_OPEN_FOLDER,
 
1207
                                             _("Open folder"),
 
1208
                                             NULL);
 
1209
 
 
1210
  gtk_app_chooser_button_set_show_dialog_item (app_chooser, TRUE);
 
1211
  gtk_app_chooser_button_set_heading (app_chooser, _(heading));
 
1212
 
 
1213
  if (pref_ask) {
 
1214
    gtk_app_chooser_button_set_active_custom_item (app_chooser, CUSTOM_ITEM_ASK);
 
1215
  } else if (pref_ignore) {
 
1216
    gtk_app_chooser_button_set_active_custom_item (app_chooser, CUSTOM_ITEM_DO_NOTHING);
 
1217
  } else if (pref_open_folder) {
 
1218
    gtk_app_chooser_button_set_active_custom_item (app_chooser, CUSTOM_ITEM_OPEN_FOLDER);
 
1219
  }
 
1220
 
 
1221
  g_signal_connect (app_chooser, "changed",
 
1222
                    G_CALLBACK (combo_box_changed_cb), self);
 
1223
  g_signal_connect (app_chooser, "custom-item-activated",
 
1224
                    G_CALLBACK (custom_item_activated_cb), self);
 
1225
 
 
1226
  g_free (content_type);
 
1227
}
 
1228
 
 
1229
static void
 
1230
other_type_combo_box_changed (GtkComboBox *combo_box,
 
1231
                              CcInfoPanel *self)
 
1232
{
 
1233
  GtkTreeIter iter;
 
1234
  GtkTreeModel *model;
 
1235
  char *x_content_type;
 
1236
  GtkWidget *action_container;
 
1237
 
 
1238
  x_content_type = NULL;
 
1239
 
 
1240
  if (!gtk_combo_box_get_active_iter (combo_box, &iter)) {
 
1241
    return;
 
1242
  }
 
1243
 
 
1244
  model = gtk_combo_box_get_model (combo_box);
 
1245
  if (model == NULL) {
 
1246
    return;
 
1247
  }
 
1248
 
 
1249
  gtk_tree_model_get (model, &iter,
 
1250
                      2, &x_content_type,
 
1251
                      -1);
 
1252
 
 
1253
  action_container = GTK_WIDGET (gtk_builder_get_object (self->priv->builder,
 
1254
                                                         "media_other_action_container"));
 
1255
  if (self->priv->other_application_combo != NULL) {
 
1256
    gtk_widget_destroy (self->priv->other_application_combo);
 
1257
  }
 
1258
 
 
1259
  self->priv->other_application_combo = gtk_app_chooser_button_new (x_content_type);
 
1260
  gtk_box_pack_start (GTK_BOX (action_container), self->priv->other_application_combo, TRUE, TRUE, 0);
 
1261
  prepare_combo_box (self, self->priv->other_application_combo, NULL);
 
1262
  gtk_widget_show (self->priv->other_application_combo);
 
1263
 
 
1264
  g_free (x_content_type);
 
1265
}
 
1266
 
 
1267
static void
 
1268
on_extra_options_dialog_response (GtkWidget    *dialog,
 
1269
                                  int           response,
 
1270
                                  CcInfoPanel *self)
 
1271
{
 
1272
  gtk_widget_hide (dialog);
 
1273
 
 
1274
  if (self->priv->other_application_combo != NULL) {
 
1275
    gtk_widget_destroy (self->priv->other_application_combo);
 
1276
    self->priv->other_application_combo = NULL;
 
1277
  }
 
1278
}
 
1279
 
 
1280
static void
 
1281
on_extra_options_button_clicked (GtkWidget    *button,
 
1282
                                 CcInfoPanel *self)
 
1283
{
 
1284
  GtkWidget *dialog;
 
1285
  GtkWidget *combo_box;
 
1286
 
 
1287
  dialog = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "extra_options_dialog"));
 
1288
  combo_box = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "media_other_type_combobox"));
 
1289
  gtk_window_set_transient_for (GTK_WINDOW (dialog),
 
1290
                                GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))));
 
1291
  gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
 
1292
  g_signal_connect (dialog,
 
1293
                    "response",
 
1294
                    G_CALLBACK (on_extra_options_dialog_response),
 
1295
                    self);
 
1296
  /* update other_application_combo */
 
1297
  other_type_combo_box_changed (GTK_COMBO_BOX (combo_box), self);
 
1298
  gtk_window_present (GTK_WINDOW (dialog));
 
1299
}
 
1300
 
 
1301
static void
 
1302
info_panel_setup_media (CcInfoPanel *self)
 
1303
{
 
1304
  guint n;
 
1305
  GList *l, *content_types;
 
1306
  GtkWidget *other_type_combo_box;
 
1307
  GtkWidget *extras_button;
 
1308
  GtkListStore *other_type_list_store;
 
1309
  GtkCellRenderer *renderer;
 
1310
  GtkTreeIter iter;
 
1311
  GtkBuilder *builder = self->priv->builder;
 
1312
 
 
1313
  struct {
 
1314
    const gchar *widget_name;
 
1315
    const gchar *content_type;
 
1316
    const gchar *heading;
 
1317
  } const defs[] = {
 
1318
    { "media_audio_cdda_combobox", "x-content/audio-cdda", N_("Select an application for audio CDs") },
 
1319
    { "media_video_dvd_combobox", "x-content/video-dvd", N_("Select an application for video DVDs") },
 
1320
    { "media_music_player_combobox", "x-content/audio-player", N_("Select an application to run when a music player is connected") },
 
1321
    { "media_dcf_combobox", "x-content/image-dcf", N_("Select an application to run when a camera is connected") },
 
1322
    { "media_software_combobox", "x-content/unix-software", N_("Select an application for software CDs") },
 
1323
  };
 
1324
 
 
1325
  struct {
 
1326
    const gchar *content_type;
 
1327
    const gchar *description;
 
1328
  } const other_defs[] = {
 
1329
    /* translators: these strings are duplicates of shared-mime-info
 
1330
     * strings, just here to fix capitalization of the English originals.
 
1331
     * If the shared-mime-info translation works for your language,
 
1332
     * simply leave these untranslated.
 
1333
     */
 
1334
    { "x-content/audio-dvd", N_("audio DVD") },
 
1335
    { "x-content/blank-bd", N_("blank Blu-ray disc") },
 
1336
    { "x-content/blank-cd", N_("blank CD disc") },
 
1337
    { "x-content/blank-dvd", N_("blank DVD disc") },
 
1338
    { "x-content/blank-hddvd", N_("blank HD DVD disc") },
 
1339
    { "x-content/video-bluray", N_("Blu-ray video disc") },
 
1340
    { "x-content/ebook-reader", N_("e-book reader") },
 
1341
    { "x-content/video-hddvd", N_("HD DVD video disc") },
 
1342
    { "x-content/image-picturecd", N_("Picture CD") },
 
1343
    { "x-content/video-svcd", N_("Super Video CD") },
 
1344
    { "x-content/video-vcd", N_("Video CD") }
 
1345
  };
 
1346
 
 
1347
  for (n = 0; n < G_N_ELEMENTS (defs); n++) {
 
1348
    prepare_combo_box (self,
 
1349
                       GTK_WIDGET (gtk_builder_get_object (builder, defs[n].widget_name)),
 
1350
                       defs[n].heading);
 
1351
  }
 
1352
 
 
1353
  other_type_combo_box = GTK_WIDGET (gtk_builder_get_object (builder, "media_other_type_combobox"));
 
1354
 
 
1355
  other_type_list_store = gtk_list_store_new (3,
 
1356
                                              G_TYPE_ICON,
 
1357
                                              G_TYPE_STRING,
 
1358
                                              G_TYPE_STRING);
 
1359
 
 
1360
  gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (other_type_list_store),
 
1361
                                        1, GTK_SORT_ASCENDING);
 
1362
 
 
1363
 
 
1364
  content_types = g_content_types_get_registered ();
 
1365
 
 
1366
  for (l = content_types; l != NULL; l = l->next) {
 
1367
    char *content_type = l->data;
 
1368
    char *description = NULL;
 
1369
    GIcon *icon;
 
1370
 
 
1371
    if (!g_str_has_prefix (content_type, "x-content/"))
 
1372
      continue;
 
1373
 
 
1374
    for (n = 0; n < G_N_ELEMENTS (defs); n++) {
 
1375
      if (g_content_type_is_a (content_type, defs[n].content_type)) {
 
1376
        goto skip;
 
1377
      }
 
1378
    }
 
1379
 
 
1380
    for (n = 0; n < G_N_ELEMENTS (other_defs); n++) {
 
1381
       if (strcmp (content_type, other_defs[n].content_type) == 0) {
 
1382
         const gchar *s = other_defs[n].description;
 
1383
         if (s == _(s))
 
1384
           description = g_content_type_get_description (content_type);
 
1385
         else
 
1386
           description = g_strdup (_(s));
 
1387
 
 
1388
         break;
 
1389
       }
 
1390
    }
 
1391
 
 
1392
    gtk_list_store_append (other_type_list_store, &iter);
 
1393
    icon = g_content_type_get_icon (content_type);
 
1394
 
 
1395
    gtk_list_store_set (other_type_list_store, &iter,
 
1396
                        0, icon,
 
1397
                        1, description,
 
1398
                        2, content_type,
 
1399
                        -1);
 
1400
    g_free (description);
 
1401
    g_object_unref (icon);
 
1402
  skip:
 
1403
    ;
 
1404
  }
 
1405
 
 
1406
  g_list_free_full (content_types, g_free);
 
1407
 
 
1408
  gtk_combo_box_set_model (GTK_COMBO_BOX (other_type_combo_box),
 
1409
                           GTK_TREE_MODEL (other_type_list_store));
 
1410
 
 
1411
  renderer = gtk_cell_renderer_pixbuf_new ();
 
1412
  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (other_type_combo_box), renderer, FALSE);
 
1413
  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (other_type_combo_box), renderer,
 
1414
                                  "gicon", 0,
 
1415
                                  NULL);
 
1416
 
 
1417
  renderer = gtk_cell_renderer_text_new ();
 
1418
  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (other_type_combo_box), renderer, TRUE);
 
1419
  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (other_type_combo_box), renderer,
 
1420
                                  "text", 1,
 
1421
                                  NULL);
 
1422
 
 
1423
  g_signal_connect (other_type_combo_box,
 
1424
                    "changed",
 
1425
                    G_CALLBACK (other_type_combo_box_changed),
 
1426
                    self);
 
1427
 
 
1428
  gtk_combo_box_set_active (GTK_COMBO_BOX (other_type_combo_box), 0);
 
1429
 
 
1430
  extras_button = GTK_WIDGET (gtk_builder_get_object (builder, "extra_options_button"));
 
1431
  g_signal_connect (extras_button,
 
1432
                    "clicked",
 
1433
                    G_CALLBACK (on_extra_options_button_clicked),
 
1434
                    self);
 
1435
 
 
1436
  g_settings_bind (self->priv->media_settings,
 
1437
                   PREF_MEDIA_AUTORUN_NEVER,
 
1438
                   gtk_builder_get_object (self->priv->builder, "media_autorun_never_checkbutton"),
 
1439
                   "active",
 
1440
                   G_SETTINGS_BIND_DEFAULT);
 
1441
 
 
1442
  g_settings_bind (self->priv->media_settings,
 
1443
                   PREF_MEDIA_AUTORUN_NEVER,
 
1444
                   GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "media_handling_vbox")),
 
1445
                   "sensitive",
 
1446
                   G_SETTINGS_BIND_INVERT_BOOLEAN);
 
1447
}
 
1448
 
949
1449
static void
950
1450
info_panel_setup_selector (CcInfoPanel  *self)
951
1451
{
990
1490
 
991
1491
  gtk_list_store_append (model, &iter);
992
1492
  gtk_list_store_set (model, &iter, section_name_column,
 
1493
                      _("Removable Media"),
 
1494
                      -1);
 
1495
 
 
1496
  gtk_list_store_append (model, &iter);
 
1497
  gtk_list_store_set (model, &iter, section_name_column,
993
1498
                      _("Graphics"),
994
1499
                      -1);
995
1500
 
1403
1908
  self->priv->builder = gtk_builder_new ();
1404
1909
 
1405
1910
  self->priv->session_settings = g_settings_new (GNOME_SESSION_MANAGER_SCHEMA);
 
1911
  self->priv->media_settings = g_settings_new (MEDIA_HANDLING_SCHEMA);
1406
1912
 
1407
1913
  self->priv->session_bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
1408
1914
 
1449
1955
  info_panel_setup_selector (self);
1450
1956
  info_panel_setup_overview (self);
1451
1957
  info_panel_setup_default_apps (self);
 
1958
  info_panel_setup_media (self);
1452
1959
  info_panel_setup_graphics (self);
1453
1960
}
1454
1961