[libpanel/wip/chergert/fix-14] frame: use template callbacks for tab-view signals



commit d16ca670d9cc5fe9744ab0242bd1d0139e143738
Author: Christian Hergert <chergert redhat com>
Date:   Tue Sep 13 05:42:31 2022 -0700

    frame: use template callbacks for tab-view signals

 src/panel-frame.c  | 13 ++++---------
 src/panel-frame.ui |  3 ++-
 2 files changed, 6 insertions(+), 10 deletions(-)
---
diff --git a/src/panel-frame.c b/src/panel-frame.c
index efeb657..8c8e548 100644
--- a/src/panel-frame.c
+++ b/src/panel-frame.c
@@ -502,8 +502,8 @@ panel_frame_unroot (GtkWidget *widget)
 }
 
 static void
-setup_menu_cb (AdwTabView *tab_view,
-               AdwTabPage *page)
+panel_frame_setup_menu_cb (AdwTabView *tab_view,
+                           AdwTabPage *page)
 {
   GMenuModel *menu_model = NULL;
   PanelJoinedMenu *joined;
@@ -713,7 +713,8 @@ panel_frame_class_init (PanelFrameClass *klass)
   gtk_widget_class_bind_template_child_private (widget_class, PanelFrame, frame_menu);
   gtk_widget_class_bind_template_child_private (widget_class, PanelFrame, drop_controls);
   gtk_widget_class_bind_template_child_private (widget_class, PanelFrame, controls_overlay);
-  gtk_widget_class_bind_template_callback (widget_class, setup_menu_cb);
+  gtk_widget_class_bind_template_callback (widget_class, panel_frame_setup_menu_cb);
+  gtk_widget_class_bind_template_callback (widget_class, panel_frame_notify_selected_page_cb);
 
   gtk_widget_class_install_action (widget_class, "page.move-right", NULL, page_move_right_action);
   gtk_widget_class_install_action (widget_class, "page.move-left", NULL, page_move_left_action);
@@ -760,12 +761,6 @@ panel_frame_init (PanelFrame *self)
   panel_joined_menu_append_menu (menu, priv->frame_menu);
   g_clear_object (&menu);
 
-  g_signal_connect_object (priv->tab_view,
-                           "notify::selected-page",
-                           G_CALLBACK (panel_frame_notify_selected_page_cb),
-                           self,
-                           G_CONNECT_AFTER | G_CONNECT_SWAPPED);
-
   panel_frame_set_header (self, PANEL_FRAME_HEADER (panel_frame_switcher_new ()));
 
   panel_frame_update_actions (self);
diff --git a/src/panel-frame.ui b/src/panel-frame.ui
index 764743e..1f57983 100644
--- a/src/panel-frame.ui
+++ b/src/panel-frame.ui
@@ -40,7 +40,8 @@
                 <property name="hexpand">true</property>
                 <child>
                   <object class="AdwTabView" id="tab_view">
-                    <signal name="setup-menu" handler="setup_menu_cb"/>
+                    <signal name="notify::selected-page" handler="panel_frame_notify_selected_page_cb" 
swapped="true" after="true" object="PanelFrame"/>
+                    <signal name="setup-menu" handler="panel_frame_setup_menu_cb"/>
                     <layout>
                       <property name="name">pages</property>
                     </layout>


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