[evince] shell: move EvZoomAction signal connection to composite template



commit ddaad7fc411273809983749b348339d1f03b3a4e
Author: Pablo Correa Gómez <ablocorrea hotmail com>
Date:   Thu Mar 31 23:05:48 2022 +0200

    shell: move EvZoomAction signal connection to composite template

 shell/ev-zoom-action.c      | 22 +++++++---------------
 shell/evince-zoom-action.ui |  3 +++
 2 files changed, 10 insertions(+), 15 deletions(-)
---
diff --git a/shell/ev-zoom-action.c b/shell/ev-zoom-action.c
index 0a23af444..cd7bffb87 100644
--- a/shell/ev-zoom-action.c
+++ b/shell/ev-zoom-action.c
@@ -235,10 +235,10 @@ focus_out_cb (EvZoomAction *zoom_action)
 }
 
 static void
-entry_icon_press_callback (GtkEntry            *entry,
-                           GtkEntryIconPosition icon_pos,
-                           GdkEvent            *event,
-                           EvZoomAction        *zoom_action)
+entry_icon_press_cb (GtkEntry            *entry,
+                    GtkEntryIconPosition icon_pos,
+                    GdkEvent            *event,
+                    EvZoomAction        *zoom_action)
 {
        EvZoomActionPrivate *priv = GET_PRIVATE (zoom_action);
         guint button = 0;
@@ -358,6 +358,9 @@ ev_zoom_action_class_init (EvZoomActionClass *klass)
                                                       EvZoomAction,
                                                       entry);
        gtk_widget_class_bind_template_child_private (widget_class, EvZoomAction, popup);
+       gtk_widget_class_bind_template_callback (widget_class, entry_icon_press_cb);
+       gtk_widget_class_bind_template_callback (widget_class, entry_activated_cb);
+       gtk_widget_class_bind_template_callback (widget_class, focus_out_cb);
 
         g_object_class_install_property (object_class,
                                          PROP_DOCUMENT_MODEL,
@@ -394,17 +397,6 @@ ev_zoom_action_init (EvZoomAction *zoom_action)
 
         gtk_widget_init_template (GTK_WIDGET (zoom_action));
 
-        g_signal_connect (priv->entry, "icon-press",
-                          G_CALLBACK (entry_icon_press_callback),
-                          zoom_action);
-        g_signal_connect (priv->entry, "activate",
-                          G_CALLBACK (entry_activated_cb),
-                          zoom_action);
-
-        g_signal_connect_swapped (priv->entry, "focus-out-event",
-                                  G_CALLBACK (focus_out_cb),
-                                  zoom_action);
-
        /* TODO: In GTK4, GtkPopoverMenu has a menu-model property.
            So this could be moved to the template instead after the
            GTK4 move
diff --git a/shell/evince-zoom-action.ui b/shell/evince-zoom-action.ui
index 910c77f01..be8f190aa 100644
--- a/shell/evince-zoom-action.ui
+++ b/shell/evince-zoom-action.ui
@@ -12,6 +12,9 @@
         <property name="xalign">1.0</property>
         <property name="max-width-chars">0</property>
         <property name="visible">True</property>
+        <signal name="icon-press" handler="entry_icon_press_cb"/>
+        <signal name="activate" handler="entry_activated_cb"/>
+        <signal name="focus-out-event" handler="focus_out_cb" swapped="yes"/>
       </object>
     </child>
   </template>


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