[gnome-control-center] details: Split removable media as a separate panel



commit 8713eac981379391de5222dc9d38c0c349688f83
Author: Mohammed Sadiq <sadiq sadiqpk org>
Date:   Thu May 25 14:13:19 2017 +0530

    details: Split removable media as a separate panel
    
    As part of the preparation to split all these pages as
    separate panels in the future.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=779216

 panels/info/Makefile.am                     |    2 +
 panels/info/cc-info-panel.c                 |  513 +------------------
 panels/info/cc-info-removable-media-panel.c |  625 +++++++++++++++++++++
 panels/info/cc-info-removable-media-panel.h |   34 ++
 panels/info/info-removable-media.ui         |  460 ++++++++++++++++
 panels/info/info.gresource.xml              |    1 +
 panels/info/info.ui                         |  781 +++++++++++----------------
 7 files changed, 1448 insertions(+), 968 deletions(-)
---
diff --git a/panels/info/Makefile.am b/panels/info/Makefile.am
index 547c9a5..e1c3c66 100644
--- a/panels/info/Makefile.am
+++ b/panels/info/Makefile.am
@@ -25,6 +25,8 @@ libinfo_la_SOURCES =          \
        cc-info-overview-panel.h                \
        cc-info-default-apps-panel.c            \
        cc-info-default-apps-panel.h            \
+       cc-info-removable-media-panel.c         \
+       cc-info-removable-media-panel.h         \
        gsd-disk-space-helper.h \
        gsd-disk-space-helper.c \
        info-cleanup.h          \
diff --git a/panels/info/cc-info-panel.c b/panels/info/cc-info-panel.c
index 4be3d99..656171f 100644
--- a/panels/info/cc-info-panel.c
+++ b/panels/info/cc-info-panel.c
@@ -23,6 +23,7 @@
 #include "cc-info-panel.h"
 #include "cc-info-overview-panel.h"
 #include "cc-info-default-apps-panel.h"
+#include "cc-info-removable-media-panel.h"
 #include "cc-info-resources.h"
 #include "info-cleanup.h"
 
@@ -46,18 +47,6 @@
 
 #include "gsd-disk-space-helper.h"
 
-/* Autorun options */
-#define PREF_MEDIA_AUTORUN_NEVER                "autorun-never"
-#define PREF_MEDIA_AUTORUN_X_CONTENT_START_APP  "autorun-x-content-start-app"
-#define PREF_MEDIA_AUTORUN_X_CONTENT_IGNORE     "autorun-x-content-ignore"
-#define PREF_MEDIA_AUTORUN_X_CONTENT_OPEN_FOLDER "autorun-x-content-open-folder"
-
-#define CUSTOM_ITEM_ASK "cc-item-ask"
-#define CUSTOM_ITEM_DO_NOTHING "cc-item-do-nothing"
-#define CUSTOM_ITEM_OPEN_FOLDER "cc-item-open-folder"
-
-#define MEDIA_HANDLING_SCHEMA "org.gnome.desktop.media-handling"
-
 #define WID(w) (GtkWidget *) gtk_builder_get_object (self->priv->builder, w)
 
 CC_PANEL_REGISTER (CcInfoPanel, cc_info_panel)
@@ -68,11 +57,6 @@ CC_PANEL_REGISTER (CcInfoPanel, cc_info_panel)
 struct _CcInfoPanelPrivate
 {
   GtkBuilder    *builder;
-  GtkWidget     *extra_options_dialog;
-
-  /* Media */
-  GSettings     *media_settings;
-  GtkWidget     *other_application_combo;
 };
 
 static void
@@ -81,22 +65,11 @@ cc_info_panel_dispose (GObject *object)
   CcInfoPanelPrivate *priv = CC_INFO_PANEL (object)->priv;
 
   g_clear_object (&priv->builder);
-  g_clear_pointer (&priv->extra_options_dialog, gtk_widget_destroy);
 
   G_OBJECT_CLASS (cc_info_panel_parent_class)->dispose (object);
 }
 
 static void
-cc_info_panel_finalize (GObject *object)
-{
-  CcInfoPanelPrivate *priv = CC_INFO_PANEL (object)->priv;
-
-  g_clear_object (&priv->media_settings);
-
-  G_OBJECT_CLASS (cc_info_panel_parent_class)->finalize (object);
-}
-
-static void
 cc_info_panel_class_init (CcInfoPanelClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -104,10 +77,10 @@ cc_info_panel_class_init (CcInfoPanelClass *klass)
   g_type_class_add_private (klass, sizeof (CcInfoPanelPrivate));
 
   object_class->dispose = cc_info_panel_dispose;
-  object_class->finalize = cc_info_panel_finalize;
 
   g_type_ensure (CC_TYPE_INFO_OVERVIEW_PANEL);
   g_type_ensure (CC_TYPE_INFO_DEFAULT_APPS_PANEL);
+  g_type_ensure (CC_TYPE_INFO_REMOVABLE_MEDIA_PANEL);
 }
 
 static void
@@ -137,483 +110,6 @@ on_section_changed (GtkTreeSelection  *selection,
 
   gtk_tree_path_free (path);
 }
-static char **
-remove_elem_from_str_array (char **v,
-                            const char *s)
-{
-  GPtrArray *array;
-  guint idx;
-
-  array = g_ptr_array_new ();
-
-  for (idx = 0; v[idx] != NULL; idx++) {
-    if (g_strcmp0 (v[idx], s) == 0) {
-      continue;
-    }
-
-    g_ptr_array_add (array, v[idx]);
-  }
-
-  g_ptr_array_add (array, NULL);
-
-  g_free (v);
-
-  return (char **) g_ptr_array_free (array, FALSE);
-}
-
-static char **
-add_elem_to_str_array (char **v,
-                       const char *s)
-{
-  GPtrArray *array;
-  guint idx;
-
-  array = g_ptr_array_new ();
-
-  for (idx = 0; v[idx] != NULL; idx++) {
-    g_ptr_array_add (array, v[idx]);
-  }
-
-  g_ptr_array_add (array, g_strdup (s));
-  g_ptr_array_add (array, NULL);
-
-  g_free (v);
-
-  return (char **) g_ptr_array_free (array, FALSE);
-}
-
-static int
-media_panel_g_strv_find (char **strv,
-                         const char *find_me)
-{
-  guint index;
-
-  g_return_val_if_fail (find_me != NULL, -1);
-
-  for (index = 0; strv[index] != NULL; ++index) {
-    if (g_strcmp0 (strv[index], find_me) == 0) {
-      return index;
-    }
-  }
-
-  return -1;
-}
-
-static void
-autorun_get_preferences (CcInfoPanel *self,
-                         const char *x_content_type,
-                         gboolean *pref_start_app,
-                         gboolean *pref_ignore,
-                         gboolean *pref_open_folder)
-{
-  char **x_content_start_app;
-  char **x_content_ignore;
-  char **x_content_open_folder;
-
-  g_return_if_fail (pref_start_app != NULL);
-  g_return_if_fail (pref_ignore != NULL);
-  g_return_if_fail (pref_open_folder != NULL);
-
-  *pref_start_app = FALSE;
-  *pref_ignore = FALSE;
-  *pref_open_folder = FALSE;
-  x_content_start_app = g_settings_get_strv (self->priv->media_settings,
-                                             PREF_MEDIA_AUTORUN_X_CONTENT_START_APP);
-  x_content_ignore = g_settings_get_strv (self->priv->media_settings,
-                                          PREF_MEDIA_AUTORUN_X_CONTENT_IGNORE);
-  x_content_open_folder = g_settings_get_strv (self->priv->media_settings,
-                                               PREF_MEDIA_AUTORUN_X_CONTENT_OPEN_FOLDER);
-  if (x_content_start_app != NULL) {
-    *pref_start_app = media_panel_g_strv_find (x_content_start_app, x_content_type) != -1;
-  }
-  if (x_content_ignore != NULL) {
-    *pref_ignore = media_panel_g_strv_find (x_content_ignore, x_content_type) != -1;
-  }
-  if (x_content_open_folder != NULL) {
-    *pref_open_folder = media_panel_g_strv_find (x_content_open_folder, x_content_type) != -1;
-  }
-  g_strfreev (x_content_ignore);
-  g_strfreev (x_content_start_app);
-  g_strfreev (x_content_open_folder);
-}
-
-static void
-autorun_set_preferences (CcInfoPanel *self,
-                         const char *x_content_type,
-                         gboolean pref_start_app,
-                         gboolean pref_ignore,
-                         gboolean pref_open_folder)
-{
-  char **x_content_start_app;
-  char **x_content_ignore;
-  char **x_content_open_folder;
-
-  g_assert (x_content_type != NULL);
-
-  x_content_start_app = g_settings_get_strv (self->priv->media_settings,
-                                             PREF_MEDIA_AUTORUN_X_CONTENT_START_APP);
-  x_content_ignore = g_settings_get_strv (self->priv->media_settings,
-                                          PREF_MEDIA_AUTORUN_X_CONTENT_IGNORE);
-  x_content_open_folder = g_settings_get_strv (self->priv->media_settings,
-                                               PREF_MEDIA_AUTORUN_X_CONTENT_OPEN_FOLDER);
-
-  x_content_start_app = remove_elem_from_str_array (x_content_start_app, x_content_type);
-  if (pref_start_app) {
-    x_content_start_app = add_elem_to_str_array (x_content_start_app, x_content_type);
-  }
-  g_settings_set_strv (self->priv->media_settings,
-                       PREF_MEDIA_AUTORUN_X_CONTENT_START_APP, (const gchar * const*) x_content_start_app);
-
-  x_content_ignore = remove_elem_from_str_array (x_content_ignore, x_content_type);
-  if (pref_ignore) {
-    x_content_ignore = add_elem_to_str_array (x_content_ignore, x_content_type);
-  }
-  g_settings_set_strv (self->priv->media_settings,
-                       PREF_MEDIA_AUTORUN_X_CONTENT_IGNORE, (const gchar * const*) x_content_ignore);
-
-  x_content_open_folder = remove_elem_from_str_array (x_content_open_folder, x_content_type);
-  if (pref_open_folder) {
-    x_content_open_folder = add_elem_to_str_array (x_content_open_folder, x_content_type);
-  }
-  g_settings_set_strv (self->priv->media_settings,
-                       PREF_MEDIA_AUTORUN_X_CONTENT_OPEN_FOLDER, (const gchar * const*) 
x_content_open_folder);
-
-  g_strfreev (x_content_open_folder);
-  g_strfreev (x_content_ignore);
-  g_strfreev (x_content_start_app);
-
-}
-
-static void
-custom_item_activated_cb (GtkAppChooserButton *button,
-                          const gchar *item,
-                          gpointer user_data)
-{
-  CcInfoPanel *self = user_data;
-  gchar *content_type;
-
-  content_type = gtk_app_chooser_get_content_type (GTK_APP_CHOOSER (button));
-
-  if (g_strcmp0 (item, CUSTOM_ITEM_ASK) == 0) {
-    autorun_set_preferences (self, content_type,
-                             FALSE, FALSE, FALSE);
-  } else if (g_strcmp0 (item, CUSTOM_ITEM_OPEN_FOLDER) == 0) {
-    autorun_set_preferences (self, content_type,
-                             FALSE, FALSE, TRUE);
-  } else if (g_strcmp0 (item, CUSTOM_ITEM_DO_NOTHING) == 0) {
-    autorun_set_preferences (self, content_type,
-                             FALSE, TRUE, FALSE);
-  }
-
-  g_free (content_type);
-}
-
-static void
-combo_box_changed_cb (GtkComboBox *combo_box,
-                      gpointer user_data)
-{
-  CcInfoPanel *self = user_data;
-  GAppInfo *info;
-  gchar *content_type;
-
-  info = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (combo_box));
-
-  if (info == NULL)
-    return;
-
-  content_type = gtk_app_chooser_get_content_type (GTK_APP_CHOOSER (combo_box));
-  autorun_set_preferences (self, content_type,
-                           TRUE, FALSE, FALSE);
-  g_app_info_set_as_default_for_type (info, content_type, NULL);
-
-  g_object_unref (info);
-  g_free (content_type);
-}
-
-static void
-prepare_combo_box (CcInfoPanel *self,
-                   GtkWidget *combo_box,
-                   const gchar *heading)
-{
-  GtkAppChooserButton *app_chooser = GTK_APP_CHOOSER_BUTTON (combo_box);
-  gboolean pref_ask;
-  gboolean pref_start_app;
-  gboolean pref_ignore;
-  gboolean pref_open_folder;
-  GAppInfo *info;
-  gchar *content_type;
-
-  content_type = gtk_app_chooser_get_content_type (GTK_APP_CHOOSER (app_chooser));
-
-  /* fetch preferences for this content type */
-  autorun_get_preferences (self, content_type,
-                           &pref_start_app, &pref_ignore, &pref_open_folder);
-  pref_ask = !pref_start_app && !pref_ignore && !pref_open_folder;
-
-  info = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (combo_box));
-
-  /* append the separator only if we have >= 1 apps in the chooser */
-  if (info != NULL) {
-    gtk_app_chooser_button_append_separator (app_chooser);
-    g_object_unref (info);
-  }
-
-  gtk_app_chooser_button_append_custom_item (app_chooser, CUSTOM_ITEM_ASK,
-                                             _("Ask what to do"),
-                                             NULL);
-
-  gtk_app_chooser_button_append_custom_item (app_chooser, CUSTOM_ITEM_DO_NOTHING,
-                                             _("Do nothing"),
-                                             NULL);
-
-  gtk_app_chooser_button_append_custom_item (app_chooser, CUSTOM_ITEM_OPEN_FOLDER,
-                                             _("Open folder"),
-                                             NULL);
-
-  gtk_app_chooser_button_set_show_dialog_item (app_chooser, TRUE);
-  gtk_app_chooser_button_set_heading (app_chooser, _(heading));
-
-  if (pref_ask) {
-    gtk_app_chooser_button_set_active_custom_item (app_chooser, CUSTOM_ITEM_ASK);
-  } else if (pref_ignore) {
-    gtk_app_chooser_button_set_active_custom_item (app_chooser, CUSTOM_ITEM_DO_NOTHING);
-  } else if (pref_open_folder) {
-    gtk_app_chooser_button_set_active_custom_item (app_chooser, CUSTOM_ITEM_OPEN_FOLDER);
-  }
-
-  g_signal_connect (app_chooser, "changed",
-                    G_CALLBACK (combo_box_changed_cb), self);
-  g_signal_connect (app_chooser, "custom-item-activated",
-                    G_CALLBACK (custom_item_activated_cb), self);
-
-  g_free (content_type);
-}
-
-static void
-other_type_combo_box_changed (GtkComboBox *combo_box,
-                              CcInfoPanel *self)
-{
-  GtkTreeIter iter;
-  GtkTreeModel *model;
-  char *x_content_type;
-  GtkWidget *action_container;
-  GtkWidget *action_label;
-
-  x_content_type = NULL;
-
-  if (!gtk_combo_box_get_active_iter (combo_box, &iter)) {
-    return;
-  }
-
-  model = gtk_combo_box_get_model (combo_box);
-  if (model == NULL) {
-    return;
-  }
-
-  gtk_tree_model_get (model, &iter,
-                      1, &x_content_type,
-                      -1);
-
-  action_container = GTK_WIDGET (gtk_builder_get_object (self->priv->builder,
-                                                         "media_other_action_container"));
-  if (self->priv->other_application_combo != NULL) {
-    gtk_widget_destroy (self->priv->other_application_combo);
-  }
-
-  self->priv->other_application_combo = gtk_app_chooser_button_new (x_content_type);
-  gtk_box_pack_start (GTK_BOX (action_container), self->priv->other_application_combo, TRUE, TRUE, 0);
-  prepare_combo_box (self, self->priv->other_application_combo, NULL);
-  gtk_widget_show (self->priv->other_application_combo);
-
-  action_label = GTK_WIDGET (gtk_builder_get_object (self->priv->builder,
-                                                     "media_other_action_label"));
-
-  gtk_label_set_mnemonic_widget (GTK_LABEL (action_label), self->priv->other_application_combo);
-
-  g_free (x_content_type);
-}
-
-static void
-on_extra_options_dialog_response (GtkWidget    *dialog,
-                                  int           response,
-                                  CcInfoPanel *self)
-{
-  gtk_widget_hide (dialog);
-
-  if (self->priv->other_application_combo != NULL) {
-    gtk_widget_destroy (self->priv->other_application_combo);
-    self->priv->other_application_combo = NULL;
-  }
-}
-
-static void
-on_extra_options_button_clicked (GtkWidget    *button,
-                                 CcInfoPanel *self)
-{
-  GtkWidget *dialog;
-  GtkWidget *combo_box;
-
-  dialog = self->priv->extra_options_dialog;
-  combo_box = GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "media_other_type_combobox"));
-  gtk_window_set_transient_for (GTK_WINDOW (dialog),
-                                GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))));
-  gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
-  gtk_window_set_title (GTK_WINDOW (dialog), _("Other Media"));
-  g_signal_connect (dialog,
-                    "response",
-                    G_CALLBACK (on_extra_options_dialog_response),
-                    self);
-  g_signal_connect (dialog,
-                    "delete-event",
-                    G_CALLBACK (gtk_widget_hide_on_delete),
-                    NULL);
-  /* update other_application_combo */
-  other_type_combo_box_changed (GTK_COMBO_BOX (combo_box), self);
-  gtk_window_present (GTK_WINDOW (dialog));
-}
-
-static void
-info_panel_setup_media (CcInfoPanel *self)
-{
-  guint n;
-  GList *l, *content_types;
-  GtkWidget *other_type_combo_box;
-  GtkWidget *extras_button;
-  GtkListStore *other_type_list_store;
-  GtkCellRenderer *renderer;
-  GtkTreeIter iter;
-  GtkBuilder *builder = self->priv->builder;
-
-  struct {
-    const gchar *widget_name;
-    const gchar *content_type;
-    const gchar *heading;
-  } const defs[] = {
-    { "media_audio_cdda_combobox", "x-content/audio-cdda", N_("Select an application for audio CDs") },
-    { "media_video_dvd_combobox", "x-content/video-dvd", N_("Select an application for video DVDs") },
-    { "media_music_player_combobox", "x-content/audio-player", N_("Select an application to run when a music 
player is connected") },
-    { "media_dcf_combobox", "x-content/image-dcf", N_("Select an application to run when a camera is 
connected") },
-    { "media_software_combobox", "x-content/unix-software", N_("Select an application for software CDs") },
-  };
-
-  struct {
-    const gchar *content_type;
-    const gchar *description;
-  } const other_defs[] = {
-    /* translators: these strings are duplicates of shared-mime-info
-     * strings, just here to fix capitalization of the English originals.
-     * If the shared-mime-info translation works for your language,
-     * simply leave these untranslated.
-     */
-    { "x-content/audio-dvd", N_("audio DVD") },
-    { "x-content/blank-bd", N_("blank Blu-ray disc") },
-    { "x-content/blank-cd", N_("blank CD disc") },
-    { "x-content/blank-dvd", N_("blank DVD disc") },
-    { "x-content/blank-hddvd", N_("blank HD DVD disc") },
-    { "x-content/video-bluray", N_("Blu-ray video disc") },
-    { "x-content/ebook-reader", N_("e-book reader") },
-    { "x-content/video-hddvd", N_("HD DVD video disc") },
-    { "x-content/image-picturecd", N_("Picture CD") },
-    { "x-content/video-svcd", N_("Super Video CD") },
-    { "x-content/video-vcd", N_("Video CD") },
-    { "x-content/win32-software", N_("Windows software") },
-  };
-
-  for (n = 0; n < G_N_ELEMENTS (defs); n++) {
-    prepare_combo_box (self,
-                       GTK_WIDGET (gtk_builder_get_object (builder, defs[n].widget_name)),
-                       defs[n].heading);
-  }
-
-  other_type_combo_box = GTK_WIDGET (gtk_builder_get_object (builder, "media_other_type_combobox"));
-
-  other_type_list_store = gtk_list_store_new (2,
-                                              G_TYPE_STRING,
-                                              G_TYPE_STRING);
-
-  gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (other_type_list_store),
-                                        1, GTK_SORT_ASCENDING);
-
-
-  content_types = g_content_types_get_registered ();
-
-  for (l = content_types; l != NULL; l = l->next) {
-    char *content_type = l->data;
-    char *description = NULL;
-
-    if (!g_str_has_prefix (content_type, "x-content/"))
-      continue;
-
-    for (n = 0; n < G_N_ELEMENTS (defs); n++) {
-      if (g_content_type_is_a (content_type, defs[n].content_type)) {
-        goto skip;
-      }
-    }
-
-    for (n = 0; n < G_N_ELEMENTS (other_defs); n++) {
-       if (strcmp (content_type, other_defs[n].content_type) == 0) {
-         const gchar *s = other_defs[n].description;
-         if (s == _(s))
-           description = g_content_type_get_description (content_type);
-         else
-           description = g_strdup (_(s));
-
-         break;
-       }
-    }
-
-    if (description == NULL) {
-      g_debug ("Content type '%s' is missing from the info panel", content_type);
-      description = g_content_type_get_description (content_type);
-    }
-
-    gtk_list_store_append (other_type_list_store, &iter);
-
-    gtk_list_store_set (other_type_list_store, &iter,
-                        0, description,
-                        1, content_type,
-                        -1);
-    g_free (description);
-  skip:
-    ;
-  }
-
-  g_list_free_full (content_types, g_free);
-
-  gtk_combo_box_set_model (GTK_COMBO_BOX (other_type_combo_box),
-                           GTK_TREE_MODEL (other_type_list_store));
-
-  renderer = gtk_cell_renderer_text_new ();
-  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (other_type_combo_box), renderer, TRUE);
-  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (other_type_combo_box), renderer,
-                                  "text", 0,
-                                  NULL);
-
-  g_signal_connect (other_type_combo_box,
-                    "changed",
-                    G_CALLBACK (other_type_combo_box_changed),
-                    self);
-
-  gtk_combo_box_set_active (GTK_COMBO_BOX (other_type_combo_box), 0);
-
-  extras_button = GTK_WIDGET (gtk_builder_get_object (builder, "extra_options_button"));
-  g_signal_connect (extras_button,
-                    "clicked",
-                    G_CALLBACK (on_extra_options_button_clicked),
-                    self);
-
-  g_settings_bind (self->priv->media_settings,
-                   PREF_MEDIA_AUTORUN_NEVER,
-                   gtk_builder_get_object (self->priv->builder, "media_autorun_never_checkbutton"),
-                   "active",
-                   G_SETTINGS_BIND_DEFAULT);
-
-  g_settings_bind (self->priv->media_settings,
-                   PREF_MEDIA_AUTORUN_NEVER,
-                   GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "media_handling_vbox")),
-                   "sensitive",
-                   G_SETTINGS_BIND_INVERT_BOOLEAN);
-}
 
 static void
 info_panel_setup_selector (CcInfoPanel  *self)
@@ -688,8 +184,6 @@ cc_info_panel_init (CcInfoPanel *self)
 
   self->priv->builder = gtk_builder_new ();
 
-  self->priv->media_settings = g_settings_new (MEDIA_HANDLING_SCHEMA);
-
   if (gtk_builder_add_from_resource (self->priv->builder,
                                      "/org/gnome/control-center/info/info.ui",
                                      &error) == 0)
@@ -699,9 +193,6 @@ cc_info_panel_init (CcInfoPanel *self)
       return;
     }
 
-  self->priv->extra_options_dialog = WID ("extra_options_dialog");
-
   info_panel_setup_selector (self);
   info_panel_setup_overview (self);
-  info_panel_setup_media (self);
 }
diff --git a/panels/info/cc-info-removable-media-panel.c b/panels/info/cc-info-removable-media-panel.c
new file mode 100644
index 0000000..5c6c3d3
--- /dev/null
+++ b/panels/info/cc-info-removable-media-panel.c
@@ -0,0 +1,625 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2017 Mohammed Sadiq <sadiq sadiqpk org>
+ * Copyright (C) 2010 Red Hat, Inc
+ * Copyright (C) 2008 William Jon McCann <jmccann redhat com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <config.h>
+
+#include "cc-info-panel.h"
+#include "cc-info-resources.h"
+#include "info-cleanup.h"
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <gio/gio.h>
+#include <gio/gunixmounts.h>
+#include <gio/gdesktopappinfo.h>
+
+#include <glibtop/fsusage.h>
+#include <glibtop/mountlist.h>
+#include <glibtop/mem.h>
+#include <glibtop/sysinfo.h>
+
+#ifdef GDK_WINDOWING_WAYLAND
+#include <gdk/gdkwayland.h>
+#endif
+#ifdef GDK_WINDOWING_X11
+#include <gdk/gdkx.h>
+#endif
+
+#include "gsd-disk-space-helper.h"
+
+#include "cc-info-removable-media-panel.h"
+
+
+/* Autorun options */
+#define PREF_MEDIA_AUTORUN_NEVER                "autorun-never"
+#define PREF_MEDIA_AUTORUN_X_CONTENT_START_APP  "autorun-x-content-start-app"
+#define PREF_MEDIA_AUTORUN_X_CONTENT_IGNORE     "autorun-x-content-ignore"
+#define PREF_MEDIA_AUTORUN_X_CONTENT_OPEN_FOLDER "autorun-x-content-open-folder"
+
+#define CUSTOM_ITEM_ASK "cc-item-ask"
+#define CUSTOM_ITEM_DO_NOTHING "cc-item-do-nothing"
+#define CUSTOM_ITEM_OPEN_FOLDER "cc-item-open-folder"
+
+#define MEDIA_HANDLING_SCHEMA "org.gnome.desktop.media-handling"
+
+struct _CcInfoRemovableMediaPanel
+{
+  GtkBox     parent_instance;
+
+  /* Media */
+  GSettings *media_settings;
+  GtkWidget *other_application_combo;
+
+  GtkWidget *extra_options_button;
+  GtkWidget *media_autorun_never_checkbutton;
+  GtkWidget *media_handling_vbox;
+
+  GtkWidget *media_audio_cdda_combobox;
+  GtkWidget *media_video_dvd_combobox;
+  GtkWidget *media_music_player_combobox;
+  GtkWidget *media_dcf_combobox;
+  GtkWidget *media_software_combobox;
+
+  GtkWidget *media_dialog;
+  GtkWidget *media_other_type_combobox;
+  GtkWidget *media_other_action_label;
+  GtkWidget *media_other_action_container;
+};
+
+
+G_DEFINE_TYPE (CcInfoRemovableMediaPanel, cc_info_removable_media_panel, GTK_TYPE_BOX)
+
+static char **
+remove_elem_from_str_array (char       **v,
+                            const char  *s)
+{
+  GPtrArray *array;
+  guint idx;
+
+  array = g_ptr_array_new ();
+
+  for (idx = 0; v[idx] != NULL; idx++) {
+    if (g_strcmp0 (v[idx], s) == 0) {
+      continue;
+    }
+
+    g_ptr_array_add (array, v[idx]);
+  }
+
+  g_ptr_array_add (array, NULL);
+
+  g_free (v);
+
+  return (char **) g_ptr_array_free (array, FALSE);
+}
+
+static char **
+add_elem_to_str_array (char       **v,
+                       const char  *s)
+{
+  GPtrArray *array;
+  guint idx;
+
+  array = g_ptr_array_new ();
+
+  for (idx = 0; v[idx] != NULL; idx++) {
+    g_ptr_array_add (array, v[idx]);
+  }
+
+  g_ptr_array_add (array, g_strdup (s));
+  g_ptr_array_add (array, NULL);
+
+  g_free (v);
+
+  return (char **) g_ptr_array_free (array, FALSE);
+}
+
+static int
+media_panel_g_strv_find (char       **strv,
+                         const char  *find_me)
+{
+  guint index;
+
+  g_return_val_if_fail (find_me != NULL, -1);
+
+  for (index = 0; strv[index] != NULL; ++index) {
+    if (g_strcmp0 (strv[index], find_me) == 0) {
+      return index;
+    }
+  }
+
+  return -1;
+}
+
+static void
+autorun_get_preferences (CcInfoRemovableMediaPanel *self,
+                         const char                *x_content_type,
+                         gboolean                  *pref_start_app,
+                         gboolean                  *pref_ignore,
+                         gboolean                  *pref_open_folder)
+{
+  char **x_content_start_app;
+  char **x_content_ignore;
+  char **x_content_open_folder;
+
+  g_return_if_fail (pref_start_app != NULL);
+  g_return_if_fail (pref_ignore != NULL);
+  g_return_if_fail (pref_open_folder != NULL);
+
+  *pref_start_app = FALSE;
+  *pref_ignore = FALSE;
+  *pref_open_folder = FALSE;
+  x_content_start_app = g_settings_get_strv (self->media_settings,
+                                             PREF_MEDIA_AUTORUN_X_CONTENT_START_APP);
+  x_content_ignore = g_settings_get_strv (self->media_settings,
+                                          PREF_MEDIA_AUTORUN_X_CONTENT_IGNORE);
+  x_content_open_folder = g_settings_get_strv (self->media_settings,
+                                               PREF_MEDIA_AUTORUN_X_CONTENT_OPEN_FOLDER);
+  if (x_content_start_app != NULL) {
+    *pref_start_app = media_panel_g_strv_find (x_content_start_app, x_content_type) != -1;
+  }
+  if (x_content_ignore != NULL) {
+    *pref_ignore = media_panel_g_strv_find (x_content_ignore, x_content_type) != -1;
+  }
+  if (x_content_open_folder != NULL) {
+    *pref_open_folder = media_panel_g_strv_find (x_content_open_folder, x_content_type) != -1;
+  }
+  g_strfreev (x_content_ignore);
+  g_strfreev (x_content_start_app);
+  g_strfreev (x_content_open_folder);
+}
+
+static void
+autorun_set_preferences (CcInfoRemovableMediaPanel *self,
+                         const char                *x_content_type,
+                         gboolean                   pref_start_app,
+                         gboolean                   pref_ignore,
+                         gboolean                   pref_open_folder)
+{
+  char **x_content_start_app;
+  char **x_content_ignore;
+  char **x_content_open_folder;
+
+  g_assert (x_content_type != NULL);
+
+  x_content_start_app = g_settings_get_strv (self->media_settings,
+                                             PREF_MEDIA_AUTORUN_X_CONTENT_START_APP);
+  x_content_ignore = g_settings_get_strv (self->media_settings,
+                                          PREF_MEDIA_AUTORUN_X_CONTENT_IGNORE);
+  x_content_open_folder = g_settings_get_strv (self->media_settings,
+                                               PREF_MEDIA_AUTORUN_X_CONTENT_OPEN_FOLDER);
+
+  x_content_start_app = remove_elem_from_str_array (x_content_start_app, x_content_type);
+  if (pref_start_app) {
+    x_content_start_app = add_elem_to_str_array (x_content_start_app, x_content_type);
+  }
+  g_settings_set_strv (self->media_settings,
+                       PREF_MEDIA_AUTORUN_X_CONTENT_START_APP, (const gchar * const*) x_content_start_app);
+
+  x_content_ignore = remove_elem_from_str_array (x_content_ignore, x_content_type);
+  if (pref_ignore) {
+    x_content_ignore = add_elem_to_str_array (x_content_ignore, x_content_type);
+  }
+  g_settings_set_strv (self->media_settings,
+                       PREF_MEDIA_AUTORUN_X_CONTENT_IGNORE, (const gchar * const*) x_content_ignore);
+
+  x_content_open_folder = remove_elem_from_str_array (x_content_open_folder, x_content_type);
+  if (pref_open_folder) {
+    x_content_open_folder = add_elem_to_str_array (x_content_open_folder, x_content_type);
+  }
+  g_settings_set_strv (self->media_settings,
+                       PREF_MEDIA_AUTORUN_X_CONTENT_OPEN_FOLDER, (const gchar * const*) 
x_content_open_folder);
+
+  g_strfreev (x_content_open_folder);
+  g_strfreev (x_content_ignore);
+  g_strfreev (x_content_start_app);
+
+}
+
+static void
+custom_item_activated_cb (GtkAppChooserButton *button,
+                          const gchar         *item,
+                          gpointer             user_data)
+{
+  CcInfoRemovableMediaPanel *self = user_data;
+  gchar *content_type;
+
+  content_type = gtk_app_chooser_get_content_type (GTK_APP_CHOOSER (button));
+
+  if (g_strcmp0 (item, CUSTOM_ITEM_ASK) == 0) {
+    autorun_set_preferences (self, content_type,
+                             FALSE, FALSE, FALSE);
+  } else if (g_strcmp0 (item, CUSTOM_ITEM_OPEN_FOLDER) == 0) {
+    autorun_set_preferences (self, content_type,
+                             FALSE, FALSE, TRUE);
+  } else if (g_strcmp0 (item, CUSTOM_ITEM_DO_NOTHING) == 0) {
+    autorun_set_preferences (self, content_type,
+                             FALSE, TRUE, FALSE);
+  }
+
+  g_free (content_type);
+}
+
+static void
+combo_box_changed_cb (GtkComboBox *combo_box,
+                      gpointer     user_data)
+{
+  CcInfoRemovableMediaPanel *self = user_data;
+  GAppInfo *info;
+  gchar *content_type;
+
+  info = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (combo_box));
+
+  if (info == NULL)
+    return;
+
+  content_type = gtk_app_chooser_get_content_type (GTK_APP_CHOOSER (combo_box));
+  autorun_set_preferences (self, content_type,
+                           TRUE, FALSE, FALSE);
+  g_app_info_set_as_default_for_type (info, content_type, NULL);
+
+  g_object_unref (info);
+  g_free (content_type);
+}
+
+static void
+prepare_combo_box (CcInfoRemovableMediaPanel *self,
+                   GtkWidget                 *combo_box,
+                   const gchar               *heading)
+{
+  GtkAppChooserButton *app_chooser = GTK_APP_CHOOSER_BUTTON (combo_box);
+  gboolean pref_ask;
+  gboolean pref_start_app;
+  gboolean pref_ignore;
+  gboolean pref_open_folder;
+  GAppInfo *info;
+  gchar *content_type;
+
+  content_type = gtk_app_chooser_get_content_type (GTK_APP_CHOOSER (app_chooser));
+
+  /* fetch preferences for this content type */
+  autorun_get_preferences (self, content_type,
+                           &pref_start_app, &pref_ignore, &pref_open_folder);
+  pref_ask = !pref_start_app && !pref_ignore && !pref_open_folder;
+
+  info = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (combo_box));
+
+  /* append the separator only if we have >= 1 apps in the chooser */
+  if (info != NULL) {
+    gtk_app_chooser_button_append_separator (app_chooser);
+    g_object_unref (info);
+  }
+
+  gtk_app_chooser_button_append_custom_item (app_chooser, CUSTOM_ITEM_ASK,
+                                             _("Ask what to do"),
+                                             NULL);
+
+  gtk_app_chooser_button_append_custom_item (app_chooser, CUSTOM_ITEM_DO_NOTHING,
+                                             _("Do nothing"),
+                                             NULL);
+
+  gtk_app_chooser_button_append_custom_item (app_chooser, CUSTOM_ITEM_OPEN_FOLDER,
+                                             _("Open folder"),
+                                             NULL);
+
+  gtk_app_chooser_button_set_show_dialog_item (app_chooser, TRUE);
+
+  if (heading)
+    gtk_app_chooser_button_set_heading (app_chooser, _(heading));
+
+  if (pref_ask) {
+    gtk_app_chooser_button_set_active_custom_item (app_chooser, CUSTOM_ITEM_ASK);
+  } else if (pref_ignore) {
+    gtk_app_chooser_button_set_active_custom_item (app_chooser, CUSTOM_ITEM_DO_NOTHING);
+  } else if (pref_open_folder) {
+    gtk_app_chooser_button_set_active_custom_item (app_chooser, CUSTOM_ITEM_OPEN_FOLDER);
+  }
+
+  g_signal_connect (app_chooser, "changed",
+                    G_CALLBACK (combo_box_changed_cb), self);
+  g_signal_connect (app_chooser, "custom-item-activated",
+                    G_CALLBACK (custom_item_activated_cb), self);
+
+  g_free (content_type);
+}
+
+static void
+other_type_combo_box_changed (GtkComboBox               *combo_box,
+                              CcInfoRemovableMediaPanel *self)
+{
+  GtkTreeIter iter;
+  GtkTreeModel *model;
+  char *x_content_type;
+  GtkWidget *action_container;
+  GtkWidget *action_label;
+
+  x_content_type = NULL;
+
+  if (!gtk_combo_box_get_active_iter (combo_box, &iter)) {
+    return;
+  }
+
+  model = gtk_combo_box_get_model (combo_box);
+  if (model == NULL) {
+    return;
+  }
+
+  gtk_tree_model_get (model, &iter,
+                      1, &x_content_type,
+                      -1);
+
+  action_container = self->media_other_action_container;
+
+  if (self->other_application_combo != NULL) {
+    gtk_widget_destroy (self->other_application_combo);
+  }
+
+  self->other_application_combo = gtk_app_chooser_button_new (x_content_type);
+  gtk_box_pack_start (GTK_BOX (action_container), self->other_application_combo, TRUE, TRUE, 0);
+  prepare_combo_box (self, self->other_application_combo, NULL);
+  gtk_widget_show (self->other_application_combo);
+
+  action_label = self->media_other_action_label;
+
+  gtk_label_set_mnemonic_widget (GTK_LABEL (action_label), self->other_application_combo);
+
+  g_free (x_content_type);
+}
+
+static void
+on_extra_options_dialog_response (GtkWidget                 *dialog,
+                                  int                        response,
+                                  CcInfoRemovableMediaPanel *self)
+{
+  gtk_widget_hide (dialog);
+
+  if (self->other_application_combo != NULL) {
+    gtk_widget_destroy (self->other_application_combo);
+    self->other_application_combo = NULL;
+  }
+}
+
+static void
+on_extra_options_button_clicked (GtkWidget                 *button,
+                                 CcInfoRemovableMediaPanel *self)
+{
+  GtkWidget *combo_box;
+
+  combo_box = self->media_other_type_combobox;
+
+  gtk_window_set_transient_for (GTK_WINDOW (self->media_dialog),
+                                GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))));
+  gtk_window_set_modal (GTK_WINDOW (self->media_dialog), TRUE);
+  gtk_window_set_title (GTK_WINDOW (self->media_dialog), _("Other Media"));
+  g_signal_connect (self->media_dialog,
+                    "response",
+                    G_CALLBACK (on_extra_options_dialog_response),
+                    self);
+  g_signal_connect (self->media_dialog,
+                    "delete-event",
+                    G_CALLBACK (gtk_widget_hide_on_delete),
+                    NULL);
+  /* update other_application_combo */
+  other_type_combo_box_changed (GTK_COMBO_BOX (combo_box), self);
+  gtk_window_present (GTK_WINDOW (self->media_dialog));
+}
+
+#define OFFSET(x)             (G_STRUCT_OFFSET (CcInfoRemovableMediaPanel, x))
+#define WIDGET_FROM_OFFSET(x) (G_STRUCT_MEMBER (GtkWidget*, self, x))
+
+static void
+info_panel_setup_media (CcInfoRemovableMediaPanel *self)
+{
+  guint n;
+  GList *l, *content_types;
+  GtkWidget *other_type_combo_box;
+  GtkWidget *extras_button;
+  GtkListStore *other_type_list_store;
+  GtkCellRenderer *renderer;
+  GtkTreeIter iter;
+
+  struct {
+    gint widget_offset;
+    const gchar *content_type;
+    const gchar *heading;
+  } const defs[] = {
+    { OFFSET (media_audio_cdda_combobox), "x-content/audio-cdda", N_("Select an application for audio CDs") 
},
+    { OFFSET (media_video_dvd_combobox), "x-content/video-dvd", N_("Select an application for video DVDs") },
+    { OFFSET (media_music_player_combobox), "x-content/audio-player", N_("Select an application to run when 
a music player is connected") },
+    { OFFSET (media_dcf_combobox), "x-content/image-dcf", N_("Select an application to run when a camera is 
connected") },
+    { OFFSET (media_software_combobox), "x-content/unix-software", N_("Select an application for software 
CDs") },
+  };
+
+  struct {
+    const gchar *content_type;
+    const gchar *description;
+  } const other_defs[] = {
+    /* translators: these strings are duplicates of shared-mime-info
+     * strings, just here to fix capitalization of the English originals.
+     * If the shared-mime-info translation works for your language,
+     * simply leave these untranslated.
+     */
+    { "x-content/audio-dvd", N_("audio DVD") },
+    { "x-content/blank-bd", N_("blank Blu-ray disc") },
+    { "x-content/blank-cd", N_("blank CD disc") },
+    { "x-content/blank-dvd", N_("blank DVD disc") },
+    { "x-content/blank-hddvd", N_("blank HD DVD disc") },
+    { "x-content/video-bluray", N_("Blu-ray video disc") },
+    { "x-content/ebook-reader", N_("e-book reader") },
+    { "x-content/video-hddvd", N_("HD DVD video disc") },
+    { "x-content/image-picturecd", N_("Picture CD") },
+    { "x-content/video-svcd", N_("Super Video CD") },
+    { "x-content/video-vcd", N_("Video CD") },
+    { "x-content/win32-software", N_("Windows software") },
+  };
+
+  for (n = 0; n < G_N_ELEMENTS (defs); n++) {
+    prepare_combo_box (self,
+                       WIDGET_FROM_OFFSET (defs[n].widget_offset),
+                       defs[n].heading);
+  }
+
+  other_type_combo_box = self->media_other_type_combobox;
+
+  other_type_list_store = gtk_list_store_new (2,
+                                              G_TYPE_STRING,
+                                              G_TYPE_STRING);
+
+  gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (other_type_list_store),
+                                        1, GTK_SORT_ASCENDING);
+
+
+  content_types = g_content_types_get_registered ();
+
+  for (l = content_types; l != NULL; l = l->next) {
+    char *content_type = l->data;
+    char *description = NULL;
+
+    if (!g_str_has_prefix (content_type, "x-content/"))
+      continue;
+
+    for (n = 0; n < G_N_ELEMENTS (defs); n++) {
+      if (g_content_type_is_a (content_type, defs[n].content_type)) {
+        goto skip;
+      }
+    }
+
+    for (n = 0; n < G_N_ELEMENTS (other_defs); n++) {
+       if (strcmp (content_type, other_defs[n].content_type) == 0) {
+         const gchar *s = other_defs[n].description;
+         if (s == _(s))
+           description = g_content_type_get_description (content_type);
+         else
+           description = g_strdup (_(s));
+
+         break;
+       }
+    }
+
+    if (description == NULL) {
+      g_debug ("Content type '%s' is missing from the info panel", content_type);
+      description = g_content_type_get_description (content_type);
+    }
+
+    gtk_list_store_append (other_type_list_store, &iter);
+
+    gtk_list_store_set (other_type_list_store, &iter,
+                        0, description,
+                        1, content_type,
+                        -1);
+    g_free (description);
+  skip:
+    ;
+  }
+
+  g_list_free_full (content_types, g_free);
+
+  gtk_combo_box_set_model (GTK_COMBO_BOX (other_type_combo_box),
+                           GTK_TREE_MODEL (other_type_list_store));
+
+  renderer = gtk_cell_renderer_text_new ();
+  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (other_type_combo_box), renderer, TRUE);
+  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (other_type_combo_box), renderer,
+                                  "text", 0,
+                                  NULL);
+
+  g_signal_connect (other_type_combo_box,
+                    "changed",
+                    G_CALLBACK (other_type_combo_box_changed),
+                    self);
+
+  gtk_combo_box_set_active (GTK_COMBO_BOX (other_type_combo_box), 0);
+
+  extras_button = self->extra_options_button;
+  g_signal_connect (extras_button,
+                    "clicked",
+                    G_CALLBACK (on_extra_options_button_clicked),
+                    self);
+
+  g_settings_bind (self->media_settings,
+                   PREF_MEDIA_AUTORUN_NEVER,
+                   self->media_autorun_never_checkbutton,
+                   "active",
+                   G_SETTINGS_BIND_DEFAULT);
+
+  g_settings_bind (self->media_settings,
+                   PREF_MEDIA_AUTORUN_NEVER,
+                   self->media_handling_vbox,
+                   "sensitive",
+                   G_SETTINGS_BIND_INVERT_BOOLEAN);
+}
+
+
+static void
+cc_info_removable_media_panel_finalize (GObject *object)
+{
+  CcInfoRemovableMediaPanel *self = CC_INFO_REMOVABLE_MEDIA_PANEL (object);
+
+  g_clear_object (&self->media_settings);
+
+  G_OBJECT_CLASS (cc_info_removable_media_panel_parent_class)->finalize (object);
+}
+
+static void
+cc_info_removable_media_panel_dispose (GObject *object)
+{
+  CcInfoRemovableMediaPanel *self = CC_INFO_REMOVABLE_MEDIA_PANEL (object);
+
+  g_clear_pointer (&self->media_dialog, gtk_widget_destroy);
+
+  G_OBJECT_CLASS (cc_info_removable_media_panel_parent_class)->dispose (object);
+}
+
+static void
+cc_info_removable_media_panel_class_init (CcInfoRemovableMediaPanelClass *klass)
+{
+  GObjectClass   *object_class = G_OBJECT_CLASS (klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  object_class->finalize = cc_info_removable_media_panel_finalize;
+  object_class->dispose = cc_info_removable_media_panel_dispose;
+
+  gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/control-center/info/info-removable-media.ui");
+
+  gtk_widget_class_bind_template_child (widget_class, CcInfoRemovableMediaPanel, media_handling_vbox);
+  gtk_widget_class_bind_template_child (widget_class, CcInfoRemovableMediaPanel, 
media_autorun_never_checkbutton);
+  gtk_widget_class_bind_template_child (widget_class, CcInfoRemovableMediaPanel, extra_options_button);
+
+  gtk_widget_class_bind_template_child (widget_class, CcInfoRemovableMediaPanel, media_audio_cdda_combobox);
+  gtk_widget_class_bind_template_child (widget_class, CcInfoRemovableMediaPanel, media_video_dvd_combobox);
+  gtk_widget_class_bind_template_child (widget_class, CcInfoRemovableMediaPanel, 
media_music_player_combobox);
+  gtk_widget_class_bind_template_child (widget_class, CcInfoRemovableMediaPanel, media_dcf_combobox);
+  gtk_widget_class_bind_template_child (widget_class, CcInfoRemovableMediaPanel, media_software_combobox);
+
+  gtk_widget_class_bind_template_child (widget_class, CcInfoRemovableMediaPanel, media_dialog);
+  gtk_widget_class_bind_template_child (widget_class, CcInfoRemovableMediaPanel, media_other_type_combobox);
+  gtk_widget_class_bind_template_child (widget_class, CcInfoRemovableMediaPanel, media_other_action_label);
+  gtk_widget_class_bind_template_child (widget_class, CcInfoRemovableMediaPanel, 
media_other_action_container);
+}
+
+static void
+cc_info_removable_media_panel_init (CcInfoRemovableMediaPanel *self)
+{
+  gtk_widget_init_template (GTK_WIDGET (self));
+  self->media_settings = g_settings_new (MEDIA_HANDLING_SCHEMA);
+
+  info_panel_setup_media (self);
+}
diff --git a/panels/info/cc-info-removable-media-panel.h b/panels/info/cc-info-removable-media-panel.h
new file mode 100644
index 0000000..f126336
--- /dev/null
+++ b/panels/info/cc-info-removable-media-panel.h
@@ -0,0 +1,34 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2017 Mohammed Sadiq <sadiq sadiqpk org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef CC_INFO_REMOVABLE_MEDIA_PANEL_H
+#define CC_INFO_REMOVABLE_MEDIA_PANEL_H
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define CC_TYPE_INFO_REMOVABLE_MEDIA_PANEL (cc_info_removable_media_panel_get_type ())
+
+G_DECLARE_FINAL_TYPE (CcInfoRemovableMediaPanel, cc_info_removable_media_panel, CC, 
INFO_REMOVABLE_MEDIA_PANEL, GtkBox)
+
+
+G_END_DECLS
+
+#endif /* CC_INFO_REMOVABLE_MEDIA_PANEL_H */
diff --git a/panels/info/info-removable-media.ui b/panels/info/info-removable-media.ui
new file mode 100644
index 0000000..25dbc7c
--- /dev/null
+++ b/panels/info/info-removable-media.ui
@@ -0,0 +1,460 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <template class="CcInfoRemovableMediaPanel" parent="GtkBox">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="orientation">horizontal</property>
+    <child>
+      <object class="GtkAlignment" id="alignment1">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <child>
+          <object class="GtkBox" id="media_preferences_vbox3">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="border_width">10</property>
+            <property name="spacing">10</property>
+            <property name="orientation">vertical</property>
+            <child>
+              <object class="GtkBox" id="media_handling_vbox">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="spacing">10</property>
+                <property name="valign">start</property>
+                <property name="vexpand">False</property>
+                <property name="orientation">vertical</property>
+                <child>
+                  <object class="GtkBox" id="vbox44">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="spacing">10</property>
+                    <property name="orientation">vertical</property>
+                    <child>
+                      <object class="GtkLabel" id="label42">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">Select how media should be 
handled</property>
+                        <attributes>
+                          <attribute name="weight" value="bold"/>
+                        </attributes>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkAlignment" id="alignment18">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="left_padding">12</property>
+                        <child>
+                          <object class="GtkBox" id="vbox52">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="spacing">6</property>
+                            <property name="orientation">vertical</property>
+                            <child>
+                              <object class="GtkTable" id="table4">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="n_rows">5</property>
+                                <property name="n_columns">2</property>
+                                <property name="column_spacing">6</property>
+                                <property name="row_spacing">6</property>
+                                <child>
+                                  <object class="GtkLabel" id="label44">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="xalign">1</property>
+                                    <property name="label" translatable="yes">CD _audio</property>
+                                    <property name="use_underline">True</property>
+                                    <property name="mnemonic_widget">media_audio_cdda_combobox</property>
+                                    <style>
+                                     <class name="dim-label"/>
+                                    </style>
+                                  </object>
+                                  <packing>
+                                    <property name="x_options">GTK_FILL</property>
+                                    <property name="y_options"></property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkLabel" id="label50">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="xalign">1</property>
+                                    <property name="label" translatable="yes">_DVD video</property>
+                                    <property name="use_underline">True</property>
+                                    <property name="mnemonic_widget">media_video_dvd_combobox</property>
+                                    <style>
+                                     <class name="dim-label"/>
+                                    </style>
+                                  </object>
+                                  <packing>
+                                    <property name="top_attach">1</property>
+                                    <property name="bottom_attach">2</property>
+                                    <property name="x_options">GTK_FILL</property>
+                                    <property name="y_options"></property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkAppChooserButton" id="media_audio_cdda_combobox">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="content_type">x-content/audio-cdda</property>
+                                  </object>
+                                  <packing>
+                                    <property name="left_attach">1</property>
+                                    <property name="right_attach">2</property>
+                                    <property name="y_options">GTK_FILL</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkAppChooserButton" id="media_video_dvd_combobox">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="content_type">x-content/video-dvd</property>
+                                  </object>
+                                  <packing>
+                                    <property name="left_attach">1</property>
+                                    <property name="right_attach">2</property>
+                                    <property name="top_attach">1</property>
+                                    <property name="bottom_attach">2</property>
+                                    <property name="x_options">GTK_FILL</property>
+                                    <property name="y_options">GTK_FILL</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkLabel" id="label54">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="xalign">1</property>
+                                    <property name="label" translatable="yes">_Music player</property>
+                                    <property name="use_underline">True</property>
+                                    <property name="mnemonic_widget">media_music_player_combobox</property>
+                                    <style>
+                                     <class name="dim-label"/>
+                                    </style>
+                                  </object>
+                                  <packing>
+                                    <property name="top_attach">2</property>
+                                    <property name="bottom_attach">3</property>
+                                    <property name="x_options">GTK_FILL</property>
+                                    <property name="y_options"></property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkAppChooserButton" id="media_music_player_combobox">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="content_type">x-content/audio-player</property>
+                                  </object>
+                                  <packing>
+                                    <property name="left_attach">1</property>
+                                    <property name="right_attach">2</property>
+                                    <property name="top_attach">2</property>
+                                    <property name="bottom_attach">3</property>
+                                    <property name="x_options">GTK_FILL</property>
+                                    <property name="y_options">GTK_FILL</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkLabel" id="label59">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="xalign">1</property>
+                                    <property name="label" translatable="yes">_Photos</property>
+                                    <property name="use_underline">True</property>
+                                    <property name="mnemonic_widget">media_dcf_combobox</property>
+                                    <style>
+                                     <class name="dim-label"/>
+                                    </style>
+                                  </object>
+                                  <packing>
+                                    <property name="top_attach">3</property>
+                                    <property name="bottom_attach">4</property>
+                                    <property name="x_options">GTK_FILL</property>
+                                    <property name="y_options"></property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkAppChooserButton" id="media_dcf_combobox">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="content_type">x-content/image-dcf</property>
+                                  </object>
+                                  <packing>
+                                    <property name="left_attach">1</property>
+                                    <property name="right_attach">2</property>
+                                    <property name="top_attach">3</property>
+                                    <property name="bottom_attach">4</property>
+                                    <property name="x_options">GTK_FILL</property>
+                                    <property name="y_options">GTK_FILL</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkLabel" id="label57">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="xalign">1</property>
+                                    <property name="label" translatable="yes">_Software</property>
+                                    <property name="use_underline">True</property>
+                                    <property name="mnemonic_widget">media_software_combobox</property>
+                                    <style>
+                                     <class name="dim-label"/>
+                                    </style>
+                                  </object>
+                                  <packing>
+                                    <property name="top_attach">4</property>
+                                    <property name="bottom_attach">5</property>
+                                    <property name="x_options">GTK_FILL</property>
+                                    <property name="y_options"></property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkAppChooserButton" id="media_software_combobox">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="content_type">x-content/unix-software</property>
+                                  </object>
+                                  <packing>
+                                    <property name="left_attach">1</property>
+                                    <property name="right_attach">2</property>
+                                    <property name="top_attach">4</property>
+                                    <property name="bottom_attach">5</property>
+                                    <property name="x_options">GTK_FILL</property>
+                                    <property name="y_options">GTK_FILL</property>
+                                  </packing>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkBox" id="hbox2">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="orientation">horizontal</property>
+                                <child>
+                                  <object class="GtkButton" id="extra_options_button">
+                                    <property name="label" translatable="yes">_Other Media…</property>
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="receives_default">True</property>
+                                    <property name="use_action_appearance">False</property>
+                                    <property name="use_underline">True</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="pack_type">end</property>
+                                    <property name="position">0</property>
+                                  </packing>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="media_autorun_never_checkbutton">
+                <property name="label" translatable="yes">_Never prompt or start programs on media 
insertion</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_underline">True</property>
+                <property name="xalign">0</property>
+                <property name="draw_indicator">True</property>
+                <property name="valign">end</property>
+                <property name="vexpand">False</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">True</property>
+        <property name="fill">False</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+  </template>
+
+  <object class="GtkDialog" id="media_dialog">
+    <property name="can_focus">False</property>
+    <property name="border_width">10</property>
+    <property name="resizable">False</property>
+    <property name="modal">True</property>
+    <property name="destroy_with_parent">True</property>
+    <property name="type_hint">dialog</property>
+    <property name="use_header_bar">1</property>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="extras-dialog-vbox">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">2</property>
+        <child>
+          <object class="GtkBox" id="vbox1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="border_width">5</property>
+            <property name="orientation">vertical</property>
+            <child>
+              <object class="GtkBox" id="vbox50">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="spacing">10</property>
+                <property name="orientation">vertical</property>
+                <child>
+                  <object class="GtkLabel" id="label61">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">Select how other media should be 
handled</property>
+                    <attributes>
+                      <attribute name="weight" value="bold"/>
+                    </attributes>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkAlignment" id="alignment20">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="left_padding">12</property>
+                    <child>
+                      <object class="GtkBox" id="vbox51">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="spacing">6</property>
+                        <property name="orientation">vertical</property>
+                        <child>
+                          <object class="GtkGrid" id="table5">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="column_spacing">6</property>
+                            <property name="row_spacing">10</property>
+                            <child>
+                              <object class="GtkComboBox" id="media_other_type_combobox">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="top_attach">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="media_other_action_label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">_Action:</property>
+                                <property name="use_underline">True</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">0</property>
+                                <property name="top_attach">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkBox" id="media_other_action_container">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="top_attach">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="label63">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">_Type:</property>
+                                <property name="use_underline">True</property>
+                                <property name="mnemonic_widget">media_other_type_combobox</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">0</property>
+                                <property name="top_attach">0</property>
+                              </packing>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/panels/info/info.gresource.xml b/panels/info/info.gresource.xml
index ae80be4..ce49a67 100644
--- a/panels/info/info.gresource.xml
+++ b/panels/info/info.gresource.xml
@@ -4,6 +4,7 @@
     <file preprocess="xml-stripblanks">info.ui</file>
     <file preprocess="xml-stripblanks">info-overview.ui</file>
     <file preprocess="xml-stripblanks">info-default-apps.ui</file>
+    <file preprocess="xml-stripblanks">info-removable-media.ui</file>
     <file>GnomeLogoVerticalMedium.svg</file>
   </gresource>
 </gresources>
diff --git a/panels/info/info.ui b/panels/info/info.ui
index a050230..bebfc5d 100644
--- a/panels/info/info.ui
+++ b/panels/info/info.ui
@@ -1,145 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
-  <object class="GtkDialog" id="extra_options_dialog">
-    <property name="can_focus">False</property>
-    <property name="border_width">10</property>
-    <property name="resizable">False</property>
-    <property name="modal">True</property>
-    <property name="destroy_with_parent">True</property>
-    <property name="type_hint">dialog</property>
-    <property name="use_header_bar">1</property>
-    <child internal-child="vbox">
-      <object class="GtkBox" id="extras-dialog-vbox">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="orientation">vertical</property>
-        <property name="spacing">2</property>
-        <child>
-          <object class="GtkBox" id="vbox1">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="border_width">5</property>
-            <property name="orientation">vertical</property>
-            <child>
-              <object class="GtkBox" id="vbox50">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="spacing">10</property>
-                <property name="orientation">vertical</property>
-                <child>
-                  <object class="GtkLabel" id="label61">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">Select how other media should be 
handled</property>
-                    <attributes>
-                      <attribute name="weight" value="bold"/>
-                    </attributes>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkAlignment" id="alignment20">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="left_padding">12</property>
-                    <child>
-                      <object class="GtkBox" id="vbox51">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="spacing">6</property>
-                        <property name="orientation">vertical</property>
-                        <child>
-                          <object class="GtkGrid" id="table5">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="column_spacing">6</property>
-                            <property name="row_spacing">10</property>
-                            <child>
-                              <object class="GtkComboBox" id="media_other_type_combobox">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                              </object>
-                              <packing>
-                                <property name="left_attach">1</property>
-                                <property name="top_attach">0</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkLabel" id="media_other_action_label">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="xalign">0</property>
-                                <property name="label" translatable="yes">_Action:</property>
-                                <property name="use_underline">True</property>
-                              </object>
-                              <packing>
-                                <property name="left_attach">0</property>
-                                <property name="top_attach">1</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkBox" id="media_other_action_container">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                              </object>
-                              <packing>
-                                <property name="left_attach">1</property>
-                                <property name="top_attach">1</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkLabel" id="label63">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="xalign">0</property>
-                                <property name="label" translatable="yes">_Type:</property>
-                                <property name="use_underline">True</property>
-                                <property name="mnemonic_widget">media_other_type_combobox</property>
-                              </object>
-                              <packing>
-                                <property name="left_attach">0</property>
-                                <property name="top_attach">0</property>
-                              </packing>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">True</property>
-                            <property name="position">1</property>
-                          </packing>
-                        </child>
-                      </object>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-      </object>
-    </child>
-  </object>
       <object class="GtkBox" id="info_vbox">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
@@ -221,326 +82,332 @@
                         <property name="tab_fill">False</property>
                       </packing>
                     </child>
+                    <!-- here -->
+                    <!-- <child>
+                         <object class="GtkBox" id="media_preferences_vbox">
+                         <property name="visible">True</property>
+                         <property name="can_focus">False</property>
+                         <property name="orientation">horizontal</property>
+                         <child>
+                         <object class="GtkAlignment" id="alignment1">
+                         <property name="visible">True</property>
+                         <property name="can_focus">False</property>
+                         <child>
+                         <object class="GtkBox" id="media_preferences_vbox3">
+                         <property name="visible">True</property>
+                         <property name="can_focus">False</property>
+                         <property name="border_width">10</property>
+                         <property name="spacing">10</property>
+                         <property name="orientation">vertical</property>
+                         <child>
+                         <object class="GtkBox" id="media_handling_vbox">
+                         <property name="visible">True</property>
+                         <property name="can_focus">False</property>
+                         <property name="spacing">10</property>
+                         <property name="valign">start</property>
+                         <property name="vexpand">False</property>
+                         <property name="orientation">vertical</property>
+                         <child>
+                         <object class="GtkBox" id="vbox44">
+                         <property name="visible">True</property>
+                         <property name="can_focus">False</property>
+                         <property name="spacing">10</property>
+                         <property name="orientation">vertical</property>
+                         <child>
+                         <object class="GtkLabel" id="label42">
+                         <property name="visible">True</property>
+                         <property name="can_focus">False</property>
+                         <property name="xalign">0</property>
+                         <property name="label" translatable="yes">Select how media should be 
handled</property>
+                         <attributes>
+                         <attribute name="weight" value="bold"/>
+                         </attributes>
+                         </object>
+                         <packing>
+                         <property name="expand">False</property>
+                         <property name="fill">False</property>
+                         <property name="position">0</property>
+                         </packing>
+                         </child>
+                         <child>
+                         <object class="GtkAlignment" id="alignment18">
+                         <property name="visible">True</property>
+                         <property name="can_focus">False</property>
+                         <property name="left_padding">12</property>
+                         <child>
+                         <object class="GtkBox" id="vbox52">
+                         <property name="visible">True</property>
+                         <property name="can_focus">False</property>
+                         <property name="spacing">6</property>
+                         <property name="orientation">vertical</property>
+                         <child>
+                         <object class="GtkTable" id="table4">
+                         <property name="visible">True</property>
+                         <property name="can_focus">False</property>
+                         <property name="n_rows">5</property>
+                         <property name="n_columns">2</property>
+                         <property name="column_spacing">6</property>
+                         <property name="row_spacing">6</property>
+                         <child>
+                         <object class="GtkLabel" id="label44">
+                         <property name="visible">True</property>
+                         <property name="can_focus">False</property>
+                         <property name="xalign">1</property>
+                         <property name="label" translatable="yes">CD _audio</property>
+                         <property name="use_underline">True</property>
+                         <property name="mnemonic_widget">media_audio_cdda_combobox</property>
+                         <style>
+                         <class name="dim-label"/>
+                         </style>
+                         </object>
+                         <packing>
+                         <property name="x_options">GTK_FILL</property>
+                         <property name="y_options"></property>
+                         </packing>
+                         </child>
+                         <child>
+                         <object class="GtkLabel" id="label50">
+                         <property name="visible">True</property>
+                         <property name="can_focus">False</property>
+                         <property name="xalign">1</property>
+                         <property name="label" translatable="yes">_DVD video</property>
+                         <property name="use_underline">True</property>
+                         <property name="mnemonic_widget">media_video_dvd_combobox</property>
+                         <style>
+                         <class name="dim-label"/>
+                         </style>
+                         </object>
+                         <packing>
+                         <property name="top_attach">1</property>
+                         <property name="bottom_attach">2</property>
+                         <property name="x_options">GTK_FILL</property>
+                         <property name="y_options"></property>
+                         </packing>
+                         </child>
+                         <child>
+                         <object class="GtkAppChooserButton" id="media_audio_cdda_combobox">
+                         <property name="visible">True</property>
+                         <property name="can_focus">False</property>
+                         <property name="content_type">x-content/audio-cdda</property>
+                         </object>
+                         <packing>
+                         <property name="left_attach">1</property>
+                         <property name="right_attach">2</property>
+                         <property name="y_options">GTK_FILL</property>
+                         </packing>
+                         </child>
+                         <child>
+                         <object class="GtkAppChooserButton" id="media_video_dvd_combobox">
+                         <property name="visible">True</property>
+                         <property name="can_focus">False</property>
+                         <property name="content_type">x-content/video-dvd</property>
+                         </object>
+                         <packing>
+                         <property name="left_attach">1</property>
+                         <property name="right_attach">2</property>
+                         <property name="top_attach">1</property>
+                         <property name="bottom_attach">2</property>
+                         <property name="x_options">GTK_FILL</property>
+                         <property name="y_options">GTK_FILL</property>
+                         </packing>
+                         </child>
+                         <child>
+                         <object class="GtkLabel" id="label54">
+                         <property name="visible">True</property>
+                         <property name="can_focus">False</property>
+                         <property name="xalign">1</property>
+                         <property name="label" translatable="yes">_Music player</property>
+                         <property name="use_underline">True</property>
+                         <property name="mnemonic_widget">media_music_player_combobox</property>
+                         <style>
+                         <class name="dim-label"/>
+                         </style>
+                         </object>
+                         <packing>
+                         <property name="top_attach">2</property>
+                         <property name="bottom_attach">3</property>
+                         <property name="x_options">GTK_FILL</property>
+                         <property name="y_options"></property>
+                         </packing>
+                         </child>
+                         <child>
+                         <object class="GtkAppChooserButton" id="media_music_player_combobox">
+                         <property name="visible">True</property>
+                         <property name="can_focus">False</property>
+                         <property name="content_type">x-content/audio-player</property>
+                         </object>
+                         <packing>
+                         <property name="left_attach">1</property>
+                         <property name="right_attach">2</property>
+                         <property name="top_attach">2</property>
+                         <property name="bottom_attach">3</property>
+                         <property name="x_options">GTK_FILL</property>
+                         <property name="y_options">GTK_FILL</property>
+                         </packing>
+                         </child>
+                         <child>
+                         <object class="GtkLabel" id="label59">
+                         <property name="visible">True</property>
+                         <property name="can_focus">False</property>
+                         <property name="xalign">1</property>
+                         <property name="label" translatable="yes">_Photos</property>
+                         <property name="use_underline">True</property>
+                         <property name="mnemonic_widget">media_dcf_combobox</property>
+                         <style>
+                         <class name="dim-label"/>
+                         </style>
+                         </object>
+                         <packing>
+                         <property name="top_attach">3</property>
+                         <property name="bottom_attach">4</property>
+                         <property name="x_options">GTK_FILL</property>
+                         <property name="y_options"></property>
+                         </packing>
+                         </child>
+                         <child>
+                         <object class="GtkAppChooserButton" id="media_dcf_combobox">
+                         <property name="visible">True</property>
+                         <property name="can_focus">False</property>
+                         <property name="content_type">x-content/image-dcf</property>
+                         </object>
+                         <packing>
+                         <property name="left_attach">1</property>
+                         <property name="right_attach">2</property>
+                         <property name="top_attach">3</property>
+                         <property name="bottom_attach">4</property>
+                         <property name="x_options">GTK_FILL</property>
+                         <property name="y_options">GTK_FILL</property>
+                         </packing>
+                         </child>
+                         <child>
+                         <object class="GtkLabel" id="label57">
+                         <property name="visible">True</property>
+                         <property name="can_focus">False</property>
+                         <property name="xalign">1</property>
+                         <property name="label" translatable="yes">_Software</property>
+                         <property name="use_underline">True</property>
+                         <property name="mnemonic_widget">media_software_combobox</property>
+                         <style>
+                         <class name="dim-label"/>
+                         </style>
+                         </object>
+                         <packing>
+                         <property name="top_attach">4</property>
+                         <property name="bottom_attach">5</property>
+                         <property name="x_options">GTK_FILL</property>
+                         <property name="y_options"></property>
+                         </packing>
+                         </child>
+                         <child>
+                         <object class="GtkAppChooserButton" id="media_software_combobox">
+                         <property name="visible">True</property>
+                         <property name="can_focus">False</property>
+                         <property name="content_type">x-content/unix-software</property>
+                         </object>
+                         <packing>
+                         <property name="left_attach">1</property>
+                         <property name="right_attach">2</property>
+                         <property name="top_attach">4</property>
+                         <property name="bottom_attach">5</property>
+                         <property name="x_options">GTK_FILL</property>
+                         <property name="y_options">GTK_FILL</property>
+                         </packing>
+                         </child>
+                         </object>
+                         <packing>
+                         <property name="expand">False</property>
+                         <property name="fill">True</property>
+                         <property name="position">0</property>
+                         </packing>
+                         </child>
+                         <child>
+                         <object class="GtkBox" id="hbox2">
+                         <property name="visible">True</property>
+                         <property name="can_focus">False</property>
+                         <property name="orientation">horizontal</property>
+                         <child>
+                         <object class="GtkButton" id="extra_options_button">
+                         <property name="label" translatable="yes">_Other Media…</property>
+                         <property name="visible">True</property>
+                         <property name="can_focus">True</property>
+                         <property name="receives_default">True</property>
+                         <property name="use_action_appearance">False</property>
+                         <property name="use_underline">True</property>
+                         </object>
+                         <packing>
+                         <property name="expand">False</property>
+                         <property name="fill">False</property>
+                         <property name="pack_type">end</property>
+                         <property name="position">0</property>
+                         </packing>
+                         </child>
+                         </object>
+                         <packing>
+                         <property name="expand">True</property>
+                         <property name="fill">True</property>
+                         <property name="position">1</property>
+                         </packing>
+                         </child>
+                         </object>
+                         </child>
+                         </object>
+                         <packing>
+                         <property name="expand">False</property>
+                         <property name="fill">True</property>
+                         <property name="position">1</property>
+                         </packing>
+                         </child>
+                         </object>
+                         <packing>
+                         <property name="expand">False</property>
+                         <property name="fill">True</property>
+                         <property name="position">0</property>
+                         </packing>
+                         </child>
+                         </object>
+                         <packing>
+                         <property name="expand">False</property>
+                         <property name="fill">False</property>
+                         <property name="position">0</property>
+                         </packing>
+                         </child>
+                         <child>
+                         <object class="GtkCheckButton" id="media_autorun_never_checkbutton">
+                         <property name="label" translatable="yes">_Never prompt or start programs on media 
insertion</property>
+                         <property name="visible">True</property>
+                         <property name="can_focus">True</property>
+                         <property name="receives_default">False</property>
+                         <property name="use_action_appearance">False</property>
+                         <property name="use_underline">True</property>
+                         <property name="xalign">0</property>
+                         <property name="draw_indicator">True</property>
+                         <property name="valign">end</property>
+                         <property name="vexpand">False</property>
+                         </object>
+                         <packing>
+                         <property name="expand">False</property>
+                         <property name="fill">False</property>
+                         <property name="position">1</property>
+                         </packing>
+                         </child>
+                         </object>
+                         </child>
+                         </object>
+                         <packing>
+                         <property name="expand">True</property>
+                         <property name="fill">False</property>
+                         <property name="position">0</property>
+                         </packing>
+                         </child>
+                         </object>
+                         <packing>
+                         <property name="position">2</property>
+                         </packing>
+                         </child> -->
                     <child>
-                      <object class="GtkBox" id="media_preferences_vbox">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="orientation">horizontal</property>
-                        <child>
-                          <object class="GtkAlignment" id="alignment1">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <child>
-                              <object class="GtkBox" id="media_preferences_vbox3">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="border_width">10</property>
-                                <property name="spacing">10</property>
-                                <property name="orientation">vertical</property>
-                                <child>
-                                  <object class="GtkBox" id="media_handling_vbox">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="spacing">10</property>
-                                    <property name="valign">start</property>
-                                    <property name="vexpand">False</property>
-                                    <property name="orientation">vertical</property>
-                                    <child>
-                                      <object class="GtkBox" id="vbox44">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">False</property>
-                                        <property name="spacing">10</property>
-                                        <property name="orientation">vertical</property>
-                                        <child>
-                                          <object class="GtkLabel" id="label42">
-                                            <property name="visible">True</property>
-                                            <property name="can_focus">False</property>
-                                            <property name="xalign">0</property>
-                                            <property name="label" translatable="yes">Select how media 
should be handled</property>
-                                            <attributes>
-                                              <attribute name="weight" value="bold"/>
-                                            </attributes>
-                                          </object>
-                                          <packing>
-                                            <property name="expand">False</property>
-                                            <property name="fill">False</property>
-                                            <property name="position">0</property>
-                                          </packing>
-                                        </child>
-                                        <child>
-                                          <object class="GtkAlignment" id="alignment18">
-                                            <property name="visible">True</property>
-                                            <property name="can_focus">False</property>
-                                            <property name="left_padding">12</property>
-                                            <child>
-                                              <object class="GtkBox" id="vbox52">
-                                                <property name="visible">True</property>
-                                                <property name="can_focus">False</property>
-                                                <property name="spacing">6</property>
-                                                <property name="orientation">vertical</property>
-                                                <child>
-                                                  <object class="GtkTable" id="table4">
-                                                    <property name="visible">True</property>
-                                                    <property name="can_focus">False</property>
-                                                    <property name="n_rows">5</property>
-                                                    <property name="n_columns">2</property>
-                                                    <property name="column_spacing">6</property>
-                                                    <property name="row_spacing">6</property>
-                                                    <child>
-                                                      <object class="GtkLabel" id="label44">
-                                                        <property name="visible">True</property>
-                                                        <property name="can_focus">False</property>
-                                                        <property name="xalign">1</property>
-                                                        <property name="label" translatable="yes">CD 
_audio</property>
-                                                        <property name="use_underline">True</property>
-                                                        <property 
name="mnemonic_widget">media_audio_cdda_combobox</property>
-                                                        <style>
-                                                          <class name="dim-label"/>
-                                                        </style>
-                                                      </object>
-                                                      <packing>
-                                                        <property name="x_options">GTK_FILL</property>
-                                                        <property name="y_options"></property>
-                                                      </packing>
-                                                    </child>
-                                                    <child>
-                                                      <object class="GtkLabel" id="label50">
-                                                        <property name="visible">True</property>
-                                                        <property name="can_focus">False</property>
-                                                        <property name="xalign">1</property>
-                                                        <property name="label" translatable="yes">_DVD 
video</property>
-                                                        <property name="use_underline">True</property>
-                                                        <property 
name="mnemonic_widget">media_video_dvd_combobox</property>
-                                                        <style>
-                                                          <class name="dim-label"/>
-                                                        </style>
-                                                      </object>
-                                                      <packing>
-                                                        <property name="top_attach">1</property>
-                                                        <property name="bottom_attach">2</property>
-                                                        <property name="x_options">GTK_FILL</property>
-                                                        <property name="y_options"></property>
-                                                      </packing>
-                                                    </child>
-                                                    <child>
-                                                      <object class="GtkAppChooserButton" 
id="media_audio_cdda_combobox">
-                                                        <property name="visible">True</property>
-                                                        <property name="can_focus">False</property>
-                                                        <property 
name="content_type">x-content/audio-cdda</property>
-                                                      </object>
-                                                      <packing>
-                                                        <property name="left_attach">1</property>
-                                                        <property name="right_attach">2</property>
-                                                        <property name="y_options">GTK_FILL</property>
-                                                      </packing>
-                                                    </child>
-                                                    <child>
-                                                      <object class="GtkAppChooserButton" 
id="media_video_dvd_combobox">
-                                                        <property name="visible">True</property>
-                                                        <property name="can_focus">False</property>
-                                                        <property 
name="content_type">x-content/video-dvd</property>
-                                                      </object>
-                                                      <packing>
-                                                        <property name="left_attach">1</property>
-                                                        <property name="right_attach">2</property>
-                                                        <property name="top_attach">1</property>
-                                                        <property name="bottom_attach">2</property>
-                                                        <property name="x_options">GTK_FILL</property>
-                                                        <property name="y_options">GTK_FILL</property>
-                                                      </packing>
-                                                    </child>
-                                                    <child>
-                                                      <object class="GtkLabel" id="label54">
-                                                        <property name="visible">True</property>
-                                                        <property name="can_focus">False</property>
-                                                        <property name="xalign">1</property>
-                                                        <property name="label" translatable="yes">_Music 
player</property>
-                                                        <property name="use_underline">True</property>
-                                                        <property 
name="mnemonic_widget">media_music_player_combobox</property>
-                                                        <style>
-                                                          <class name="dim-label"/>
-                                                        </style>
-                                                      </object>
-                                                      <packing>
-                                                        <property name="top_attach">2</property>
-                                                        <property name="bottom_attach">3</property>
-                                                        <property name="x_options">GTK_FILL</property>
-                                                        <property name="y_options"></property>
-                                                      </packing>
-                                                    </child>
-                                                    <child>
-                                                      <object class="GtkAppChooserButton" 
id="media_music_player_combobox">
-                                                        <property name="visible">True</property>
-                                                        <property name="can_focus">False</property>
-                                                        <property 
name="content_type">x-content/audio-player</property>
-                                                      </object>
-                                                      <packing>
-                                                        <property name="left_attach">1</property>
-                                                        <property name="right_attach">2</property>
-                                                        <property name="top_attach">2</property>
-                                                        <property name="bottom_attach">3</property>
-                                                        <property name="x_options">GTK_FILL</property>
-                                                        <property name="y_options">GTK_FILL</property>
-                                                      </packing>
-                                                    </child>
-                                                    <child>
-                                                      <object class="GtkLabel" id="label59">
-                                                        <property name="visible">True</property>
-                                                        <property name="can_focus">False</property>
-                                                        <property name="xalign">1</property>
-                                                        <property name="label" 
translatable="yes">_Photos</property>
-                                                        <property name="use_underline">True</property>
-                                                        <property 
name="mnemonic_widget">media_dcf_combobox</property>
-                                                        <style>
-                                                          <class name="dim-label"/>
-                                                        </style>
-                                                      </object>
-                                                      <packing>
-                                                        <property name="top_attach">3</property>
-                                                        <property name="bottom_attach">4</property>
-                                                        <property name="x_options">GTK_FILL</property>
-                                                        <property name="y_options"></property>
-                                                      </packing>
-                                                    </child>
-                                                    <child>
-                                                      <object class="GtkAppChooserButton" 
id="media_dcf_combobox">
-                                                        <property name="visible">True</property>
-                                                        <property name="can_focus">False</property>
-                                                        <property 
name="content_type">x-content/image-dcf</property>
-                                                      </object>
-                                                      <packing>
-                                                        <property name="left_attach">1</property>
-                                                        <property name="right_attach">2</property>
-                                                        <property name="top_attach">3</property>
-                                                        <property name="bottom_attach">4</property>
-                                                        <property name="x_options">GTK_FILL</property>
-                                                        <property name="y_options">GTK_FILL</property>
-                                                      </packing>
-                                                    </child>
-                                                    <child>
-                                                      <object class="GtkLabel" id="label57">
-                                                        <property name="visible">True</property>
-                                                        <property name="can_focus">False</property>
-                                                        <property name="xalign">1</property>
-                                                        <property name="label" 
translatable="yes">_Software</property>
-                                                        <property name="use_underline">True</property>
-                                                        <property 
name="mnemonic_widget">media_software_combobox</property>
-                                                        <style>
-                                                          <class name="dim-label"/>
-                                                        </style>
-                                                      </object>
-                                                      <packing>
-                                                        <property name="top_attach">4</property>
-                                                        <property name="bottom_attach">5</property>
-                                                        <property name="x_options">GTK_FILL</property>
-                                                        <property name="y_options"></property>
-                                                      </packing>
-                                                    </child>
-                                                    <child>
-                                                      <object class="GtkAppChooserButton" 
id="media_software_combobox">
-                                                        <property name="visible">True</property>
-                                                        <property name="can_focus">False</property>
-                                                        <property 
name="content_type">x-content/unix-software</property>
-                                                      </object>
-                                                      <packing>
-                                                        <property name="left_attach">1</property>
-                                                        <property name="right_attach">2</property>
-                                                        <property name="top_attach">4</property>
-                                                        <property name="bottom_attach">5</property>
-                                                        <property name="x_options">GTK_FILL</property>
-                                                        <property name="y_options">GTK_FILL</property>
-                                                      </packing>
-                                                    </child>
-                                                  </object>
-                                                  <packing>
-                                                    <property name="expand">False</property>
-                                                    <property name="fill">True</property>
-                                                    <property name="position">0</property>
-                                                  </packing>
-                                                </child>
-                                                <child>
-                                                  <object class="GtkBox" id="hbox2">
-                                                    <property name="visible">True</property>
-                                                    <property name="can_focus">False</property>
-                                                    <property name="orientation">horizontal</property>
-                                                    <child>
-                                                      <object class="GtkButton" id="extra_options_button">
-                                                        <property name="label" translatable="yes">_Other 
Media…</property>
-                                                        <property name="visible">True</property>
-                                                        <property name="can_focus">True</property>
-                                                        <property name="receives_default">True</property>
-                                                        <property 
name="use_action_appearance">False</property>
-                                                        <property name="use_underline">True</property>
-                                                      </object>
-                                                      <packing>
-                                                        <property name="expand">False</property>
-                                                        <property name="fill">False</property>
-                                                        <property name="pack_type">end</property>
-                                                        <property name="position">0</property>
-                                                      </packing>
-                                                    </child>
-                                                  </object>
-                                                  <packing>
-                                                    <property name="expand">True</property>
-                                                    <property name="fill">True</property>
-                                                    <property name="position">1</property>
-                                                  </packing>
-                                                </child>
-                                              </object>
-                                            </child>
-                                          </object>
-                                          <packing>
-                                            <property name="expand">False</property>
-                                            <property name="fill">True</property>
-                                            <property name="position">1</property>
-                                          </packing>
-                                        </child>
-                                      </object>
-                                      <packing>
-                                        <property name="expand">False</property>
-                                        <property name="fill">True</property>
-                                        <property name="position">0</property>
-                                      </packing>
-                                    </child>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">False</property>
-                                    <property name="position">0</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkCheckButton" id="media_autorun_never_checkbutton">
-                                    <property name="label" translatable="yes">_Never prompt or start 
programs on media insertion</property>
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">False</property>
-                                    <property name="use_action_appearance">False</property>
-                                    <property name="use_underline">True</property>
-                                    <property name="xalign">0</property>
-                                    <property name="draw_indicator">True</property>
-                                    <property name="valign">end</property>
-                                    <property name="vexpand">False</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">False</property>
-                                    <property name="position">1</property>
-                                  </packing>
-                                </child>
-                              </object>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="expand">True</property>
-                            <property name="fill">False</property>
-                            <property name="position">0</property>
-                          </packing>
-                        </child>
+                      <object class="CcInfoRemovableMediaPanel" id="media_preferences_vbox">
+                        <property name="visible">true</property>
                       </object>
-                      <packing>
-                        <property name="position">2</property>
-                      </packing>
                     </child>
                     <child type="tab">
                       <object class="GtkLabel" id="label16">


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]