[gnome-control-center/wip/gbsneto/split-info-panel: 2/2] info: remove Default Applications section



commit 8dadbf9a36c4ed312565cfeacd2952b2c9798275
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Aug 3 00:23:07 2016 -0300

    info: remove Default Applications section
    
    The Default Applications section was moved to a new,
    dedicate panel and is not needed anymore.
    
    This patch removes the Default Applications section from
    the Details panel.

 panels/info/cc-info-panel.c |  125 -------------------------
 panels/info/info.ui         |  218 +------------------------------------------
 2 files changed, 2 insertions(+), 341 deletions(-)
---
diff --git a/panels/info/cc-info-panel.c b/panels/info/cc-info-panel.c
index 79729dd..b142918 100644
--- a/panels/info/cc-info-panel.c
+++ b/panels/info/cc-info-panel.c
@@ -69,16 +69,6 @@ typedef struct {
   char *renderer;
 } GraphicsData;
 
-typedef struct 
-{
-  const char *content_type;
-  const char *label;
-  /* A pattern used to filter supported mime types
-     when changing preferred applications. NULL
-     means no other types should be changed */
-  const char *extra_type_filter;
-} DefaultAppData;
-
 struct _CcInfoPanelPrivate
 {
   GtkBuilder    *builder;
@@ -840,115 +830,6 @@ bail:
   g_free (str);
 }
 
-static void
-default_app_changed (GtkAppChooserButton *button,
-                     CcInfoPanel         *self)
-{
-  GAppInfo *info;
-  GError *error = NULL;
-  DefaultAppData *app_data;
-  int i;
-
-  info = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (button));
-  app_data = g_object_get_data (G_OBJECT (button), "cc-default-app-data");
-
-  if (g_app_info_set_as_default_for_type (info, app_data->content_type, &error) == FALSE)
-    {
-      g_warning ("Failed to set '%s' as the default application for '%s': %s",
-                 g_app_info_get_name (info), app_data->content_type, error->message);
-      g_error_free (error);
-      error = NULL;
-    }
-  else
-    {
-      g_debug ("Set '%s' as the default handler for '%s'",
-               g_app_info_get_name (info), app_data->content_type);
-    }
-
-  if (app_data->extra_type_filter)
-    {
-      const char *const *mime_types;
-      GPatternSpec *pattern;
-
-      pattern = g_pattern_spec_new (app_data->extra_type_filter);
-      mime_types = g_app_info_get_supported_types (info);
-
-      for (i = 0; mime_types && mime_types[i]; i++)
-        {
-          if (!g_pattern_match_string (pattern, mime_types[i]))
-            continue;
-
-          if (g_app_info_set_as_default_for_type (info, mime_types[i], &error) == FALSE)
-            {
-              g_warning ("Failed to set '%s' as the default application for secondary "
-                         "content type '%s': %s",
-                         g_app_info_get_name (info), mime_types[i], error->message);
-              g_error_free (error);
-            }
-          else
-            {
-              g_debug ("Set '%s' as the default handler for '%s'",
-              g_app_info_get_name (info), mime_types[i]);
-            }
-        }
-
-      g_pattern_spec_free (pattern);
-    }
-
-  g_object_unref (info);
-}
-
-static void
-info_panel_setup_default_app (CcInfoPanel    *self,
-                              DefaultAppData *data,
-                              guint           left_attach,
-                              guint           top_attach)
-{
-  GtkWidget *button;
-  GtkWidget *grid;
-  GtkWidget *label;
-
-  grid = WID ("default_apps_grid");
-
-  button = gtk_app_chooser_button_new (data->content_type);
-  g_object_set_data (G_OBJECT (button), "cc-default-app-data", data);
-
-  gtk_app_chooser_button_set_show_default_item (GTK_APP_CHOOSER_BUTTON (button), TRUE);
-  gtk_grid_attach (GTK_GRID (grid), button, left_attach, top_attach,
-                   1, 1);
-  g_signal_connect (G_OBJECT (button), "changed",
-                    G_CALLBACK (default_app_changed), self);
-  gtk_widget_show (button);
-
-  label = WID(data->label);
-  gtk_label_set_mnemonic_widget (GTK_LABEL (label), button);
-}
-
-static DefaultAppData preferred_app_infos[] = {
-  /* for web, we need to support text/html,
-     application/xhtml+xml and x-scheme-handler/https,
-     hence the "*" pattern
-  */
-  { "x-scheme-handler/http", "web-label", "*" },
-  { "x-scheme-handler/mailto", "mail-label", NULL },
-  { "text/calendar", "calendar-label", NULL },
-  { "audio/x-vorbis+ogg", "music-label", "audio/*" },
-  { "video/x-ogm+ogg", "video-label", "video/*" },
-  { "image/jpeg", "photos-label", "image/*" }
-};
-
-static void
-info_panel_setup_default_apps (CcInfoPanel  *self)
-{
-  int i;
-
-  for (i = 0; i < G_N_ELEMENTS(preferred_app_infos); i++)
-    {
-      info_panel_setup_default_app (self, &preferred_app_infos[i],
-                                    1, i);
-    }
-}
-
 static char **
 remove_elem_from_str_array (char **v,
                             const char *s)
@@ -1466,11 +1347,6 @@ info_panel_setup_selector (CcInfoPanel  *self)
 
   gtk_list_store_append (model, &iter);
   gtk_list_store_set (model, &iter, section_name_column,
-                      _("Default Applications"),
-                      -1);
-
-  gtk_list_store_append (model, &iter);
-  gtk_list_store_set (model, &iter, section_name_column,
                       _("Removable Media"),
                       -1);
 
@@ -1605,7 +1481,6 @@ cc_info_panel_init (CcInfoPanel *self)
 
   info_panel_setup_selector (self);
   info_panel_setup_overview (self);
-  info_panel_setup_default_apps (self);
   info_panel_setup_media (self);
   info_panel_setup_virt (self);
 }
diff --git a/panels/info/info.ui b/panels/info/info.ui
index 1967fdf..7bf0487 100644
--- a/panels/info/info.ui
+++ b/panels/info/info.ui
@@ -582,220 +582,6 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkBox" id="default_apps_container">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="halign">center</property>
-                        <property name="valign">start</property>
-                        <property name="border_width">20</property>
-                        <property name="spacing">10</property>
-                        <property name="orientation">vertical</property>
-                        <child>
-                          <object class="GtkGrid" id="default_apps_grid">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="column_spacing">12</property>
-                            <property name="row_spacing">12</property>
-                            <child>
-                              <object class="GtkLabel" id="web-label">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="xalign">1</property>
-                                <property name="label" translatable="yes">_Web</property>
-                                <property name="use_underline">True</property>
-                                <style>
-                                  <class name="dim-label"/>
-                                </style>
-                              </object>
-                            </child>
-                            <child>
-                              <object class="GtkLabel" id="mail-label">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="xalign">1</property>
-                                <property name="label" translatable="yes">_Mail</property>
-                                <property name="use_underline">True</property>
-                                <style>
-                                  <class name="dim-label"/>
-                                </style>
-                              </object>
-                              <packing>
-                                <property name="top_attach">1</property>
-                                <property name="left_attach">0</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkLabel" id="calendar-label">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="xalign">1</property>
-                                <property name="label" translatable="yes">_Calendar</property>
-                                <property name="use_underline">True</property>
-                                <style>
-                                  <class name="dim-label"/>
-                                </style>
-                              </object>
-                              <packing>
-                                <property name="top_attach">2</property>
-                                <property name="left_attach">0</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkLabel" id="music-label">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="xalign">1</property>
-                                <property name="label" translatable="yes">M_usic</property>
-                                <property name="use_underline">True</property>
-                                <style>
-                                  <class name="dim-label"/>
-                                </style>
-                              </object>
-                              <packing>
-                                <property name="top_attach">3</property>
-                                <property name="left_attach">0</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkLabel" id="video-label">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="xalign">1</property>
-                                <property name="label" translatable="yes">_Video</property>
-                                <property name="use_underline">True</property>
-                                <style>
-                                  <class name="dim-label"/>
-                                </style>
-                              </object>
-                              <packing>
-                                <property name="top_attach">4</property>
-                                <property name="left_attach">0</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkLabel" id="label25">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="label">    </property>
-                              </object>
-                              <packing>
-                                <property name="left_attach">2</property>
-                                <property name="top_attach">0</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkLabel" id="label26">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="label">    </property>
-                              </object>
-                              <packing>
-                                <property name="left_attach">2</property>
-                                <property name="top_attach">1</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkLabel" id="label27">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="label">    </property>
-                              </object>
-                              <packing>
-                                <property name="left_attach">2</property>
-                                <property name="top_attach">2</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkLabel" id="label28">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="label">    </property>
-                              </object>
-                              <packing>
-                                <property name="left_attach">2</property>
-                                <property name="top_attach">3</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkLabel" id="label29">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="label">    </property>
-                              </object>
-                              <packing>
-                                <property name="left_attach">2</property>
-                                <property name="top_attach">4</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkLabel" id="photos-label">
-                                <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>
-                                <style>
-                                  <class name="dim-label"/>
-                                </style>
-                              </object>
-                              <packing>
-                                <property name="top_attach">5</property>
-                                <property name="left_attach">0</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkLabel" id="label33">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="label">    </property>
-                              </object>
-                              <packing>
-                                <property name="left_attach">2</property>
-                                <property name="top_attach">5</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <placeholder/>
-                            </child>
-                            <child>
-                              <placeholder/>
-                            </child>
-                            <child>
-                              <placeholder/>
-                            </child>
-                            <child>
-                              <placeholder/>
-                            </child>
-                            <child>
-                              <placeholder/>
-                            </child>
-                            <child>
-                              <placeholder/>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="position">0</property>
-                          </packing>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="position">1</property>
-                      </packing>
-                    </child>
-                    <child type="tab">
-                      <object class="GtkLabel" id="label3">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">Default Applications</property>
-                      </object>
-                      <packing>
-                        <property name="position">1</property>
-                        <property name="tab_fill">False</property>
-                      </packing>
-                    </child>
-                    <child>
                       <object class="GtkBox" id="media_preferences_vbox">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
@@ -1113,7 +899,7 @@
                         </child>
                       </object>
                       <packing>
-                        <property name="position">2</property>
+                        <property name="position">1</property>
                       </packing>
                     </child>
                     <child type="tab">
@@ -1123,7 +909,7 @@
                         <property name="label" translatable="yes">Removable Media</property>
                       </object>
                       <packing>
-                        <property name="position">2</property>
+                        <property name="position">1</property>
                         <property name="tab_fill">False</property>
                       </packing>
                     </child>


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