[gnome-control-center/gbsneto/panel-headerbar-cleanup: 13/19] shell: Remove cc_shell_embed_widget_in_header




commit 5017f3b21efbf1f382634f116cb391fa16e3f6c2
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Jan 19 18:45:13 2022 -0300

    shell: Remove cc_shell_embed_widget_in_header
    
    It is now unused.

 shell/cc-shell.c  | 23 ---------------------
 shell/cc-shell.h  |  7 -------
 shell/cc-window.c | 61 -------------------------------------------------------
 3 files changed, 91 deletions(-)
---
diff --git a/shell/cc-shell.c b/shell/cc-shell.c
index 416f00394..3c74ada93 100644
--- a/shell/cc-shell.c
+++ b/shell/cc-shell.c
@@ -151,29 +151,6 @@ cc_shell_get_toplevel (CcShell *shell)
   return NULL;
 }
 
-void
-cc_shell_embed_widget_in_header (CcShell         *shell,
-                                 GtkWidget       *widget,
-                                 GtkPositionType  position)
-{
-  CcShellInterface *iface;
-
-  g_return_if_fail (CC_IS_SHELL (shell));
-
-  iface = CC_SHELL_GET_IFACE (shell);
-
-  if (!iface->embed_widget_in_header)
-    {
-      g_warning ("Object of type \"%s\" does not implement required interface"
-                 " method \"embed_widget_in_header\",",
-                 G_OBJECT_TYPE_NAME (shell));
-    }
-  else
-    {
-      iface->embed_widget_in_header (shell, widget, position);
-    }
-}
-
 void
 cc_shell_set_custom_titlebar (CcShell   *self,
                               GtkWidget *titlebar)
diff --git a/shell/cc-shell.h b/shell/cc-shell.h
index 96d0ca30c..9bf4ddca5 100644
--- a/shell/cc-shell.h
+++ b/shell/cc-shell.h
@@ -54,9 +54,6 @@ struct _CcShellInterface
                                            GVariant     *parameters,
                                            GError      **error);
   GtkWidget * (*get_toplevel)             (CcShell      *shell);
-  void        (*embed_widget_in_header)   (CcShell         *shell,
-                                           GtkWidget       *widget,
-                                           GtkPositionType  position);
   void        (*set_custom_titlebar)      (CcShell      *self,
                                            GtkWidget    *titlebar);
 };
@@ -72,10 +69,6 @@ gboolean        cc_shell_set_active_panel_from_id (CcShell      *shell,
                                                    GError      **error);
 GtkWidget *     cc_shell_get_toplevel             (CcShell      *shell);
 
-void            cc_shell_embed_widget_in_header   (CcShell         *shell,
-                                                   GtkWidget       *widget,
-                                                   GtkPositionType  position);
-
 void            cc_shell_set_custom_titlebar      (CcShell      *self,
                                                    GtkWidget    *titlebar);
 
diff --git a/shell/cc-window.c b/shell/cc-window.c
index c3cc91d12..a29aa88a5 100644
--- a/shell/cc-window.c
+++ b/shell/cc-window.c
@@ -72,7 +72,6 @@ struct _CcWindow
   char       *current_panel_id;
   GQueue     *previous_panels;
 
-  GPtrArray  *custom_widgets;
   GtkWidget  *custom_titlebar;
 
   CcShellModel *store;
@@ -125,30 +124,6 @@ in_flatpak_sandbox (void)
   return g_strcmp0 (PROFILE, "development") == 0;
 }
 
-static void
-remove_all_custom_widgets (CcWindow *self)
-{
-  guint i;
-
-  CC_ENTRY;
-
-  /* remove from the header */
-  for (i = 0; i < self->custom_widgets->len; i++)
-    {
-      GtkWidget *parent;
-      GtkWidget *widget;
-
-      widget = g_ptr_array_index (self->custom_widgets, i);
-      parent = gtk_widget_get_parent (widget);
-
-      g_assert (parent == GTK_WIDGET (self->top_right_box) || parent == GTK_WIDGET (self->top_left_box));
-      gtk_box_remove (GTK_BOX (parent), widget);
-    }
-  g_ptr_array_set_size (self->custom_widgets, 0);
-
-  CC_EXIT;
-}
-
 static void
 on_sidebar_activated_cb (CcWindow *self)
 {
@@ -176,7 +151,6 @@ activate_panel (CcWindow          *self,
     CC_RETURN (FALSE);
 
   /* clear any custom widgets */
-  remove_all_custom_widgets (self);
   cc_shell_set_custom_titlebar (CC_SHELL (self), NULL);
 
   timer = g_timer_new ();
@@ -629,38 +603,6 @@ cc_window_set_active_panel_from_id (CcShell      *shell,
   return set_active_panel_from_id (CC_WINDOW (shell), start_id, parameters, TRUE, TRUE, error);
 }
 
-static void
-cc_window_embed_widget_in_header (CcShell         *shell,
-                                  GtkWidget       *widget,
-                                  GtkPositionType  position)
-{
-  CcWindow *self = CC_WINDOW (shell);
-
-  CC_ENTRY;
-
-  /* add to header */
-  switch (position)
-    {
-    case GTK_POS_RIGHT:
-      gtk_box_append (self->top_right_box, widget);
-      break;
-
-    case GTK_POS_LEFT:
-      gtk_box_append (self->top_left_box, widget);
-      break;
-
-    case GTK_POS_TOP:
-    case GTK_POS_BOTTOM:
-    default:
-      g_warning ("Invalid position passed");
-      return;
-    }
-
-  g_ptr_array_add (self->custom_widgets, g_object_ref (widget));
-
-  CC_EXIT;
-}
-
 static GtkWidget *
 cc_window_get_toplevel (CcShell *self)
 {
@@ -694,7 +636,6 @@ static void
 cc_shell_iface_init (CcShellInterface *iface)
 {
   iface->set_active_panel_from_id = cc_window_set_active_panel_from_id;
-  iface->embed_widget_in_header = cc_window_embed_widget_in_header;
   iface->get_toplevel = cc_window_get_toplevel;
   iface->set_custom_titlebar = cc_window_set_custom_titlebar;
 }
@@ -826,7 +767,6 @@ cc_window_dispose (GObject *object)
   CcWindow *self = CC_WINDOW (object);
 
   g_clear_pointer (&self->current_panel_id, g_free);
-  g_clear_pointer (&self->custom_widgets, g_ptr_array_unref);
   g_clear_object (&self->store);
   g_clear_object (&self->active_panel);
 
@@ -929,7 +869,6 @@ cc_window_init (CcWindow *self)
   gtk_widget_init_template (GTK_WIDGET (self));
 
   self->settings = g_settings_new ("org.gnome.ControlCenter");
-  self->custom_widgets = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
   self->previous_panels = g_queue_new ();
   self->previous_list_view = cc_panel_list_get_view (self->panel_list);
 


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