[gnome-software: 8/14] gs-details-page: Move various signal connections to XML




commit b36cc64a546116e67d43dc90c91931fb09dd3de8
Author: Philip Withnall <pwithnall endlessos org>
Date:   Thu Aug 12 12:21:22 2021 +0100

    gs-details-page: Move various signal connections to XML
    
    This introduces no functional changes, but tidies up the code a little.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 src/gs-details-page.c  | 47 +++++++++++------------------------------------
 src/gs-details-page.ui | 11 +++++++++++
 2 files changed, 22 insertions(+), 36 deletions(-)
---
diff --git a/src/gs-details-page.c b/src/gs-details-page.c
index 948fc1bf2..92c19c8a7 100644
--- a/src/gs-details-page.c
+++ b/src/gs-details-page.c
@@ -2030,50 +2030,14 @@ gs_details_page_setup (GsPage *page,
        self->plugin_loader = g_object_ref (plugin_loader);
        self->cancellable = g_object_ref (cancellable);
 
-       g_signal_connect (self->button_review, "clicked",
-                         G_CALLBACK (gs_details_page_write_review_cb),
-                         self);
-       g_signal_connect (self->star_eventbox, "button-press-event",
-                         G_CALLBACK (gs_details_page_star_pressed_cb),
-                         self);
-
        /* hide some UI when offline */
        g_signal_connect_object (self->plugin_loader, "notify::network-available",
                                 G_CALLBACK (gs_details_page_network_available_notify_cb),
                                 self, 0);
 
-       /* setup details */
-       g_signal_connect (self->button_install, "clicked",
-                         G_CALLBACK (gs_details_page_app_install_button_cb),
-                         self);
-       g_signal_connect (self->button_update, "clicked",
-                         G_CALLBACK (gs_details_page_app_update_button_cb),
-                         self);
-       g_signal_connect (self->button_remove, "clicked",
-                         G_CALLBACK (gs_details_page_app_remove_button_cb),
-                         self);
-       g_signal_connect (self->button_cancel, "clicked",
-                         G_CALLBACK (gs_details_page_app_cancel_button_cb),
-                         self);
-       g_signal_connect (self->button_more_reviews, "clicked",
-                         G_CALLBACK (gs_details_page_more_reviews_button_cb),
-                         self);
-       g_signal_connect (self->button_details_launch, "clicked",
-                         G_CALLBACK (gs_details_page_app_launch_button_cb),
-                         self);
-       g_signal_connect (self->button_details_add_shortcut, "clicked",
-                         G_CALLBACK (gs_details_page_app_add_shortcut_button_cb),
-                         self);
-       g_signal_connect (self->button_details_remove_shortcut, "clicked",
-                         G_CALLBACK (gs_details_page_app_remove_shortcut_button_cb),
-                         self);
-
        gtk_list_box_set_sort_func (GTK_LIST_BOX (self->origin_popover_list_box),
                                    origin_popover_list_sort_func,
                                    NULL, NULL);
-       g_signal_connect (self->origin_popover_list_box, "row-activated",
-                         G_CALLBACK (origin_popover_row_activated_cb),
-                         self);
 
        adj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (self->scrolledwindow_details));
        gtk_container_set_focus_vadjustment (GTK_CONTAINER (self->box_details), adj);
@@ -2283,6 +2247,17 @@ gs_details_page_class_init (GsDetailsPageClass *klass)
        gtk_widget_class_bind_template_callback (widget_class, gs_details_page_link_row_activated_cb);
        gtk_widget_class_bind_template_callback (widget_class, 
gs_details_page_license_tile_get_involved_activated_cb);
        gtk_widget_class_bind_template_callback (widget_class, 
gs_details_page_translation_infobar_response_cb);
+       gtk_widget_class_bind_template_callback (widget_class, gs_details_page_write_review_cb);
+       gtk_widget_class_bind_template_callback (widget_class, gs_details_page_star_pressed_cb);
+       gtk_widget_class_bind_template_callback (widget_class, gs_details_page_app_install_button_cb);
+       gtk_widget_class_bind_template_callback (widget_class, gs_details_page_app_update_button_cb);
+       gtk_widget_class_bind_template_callback (widget_class, gs_details_page_app_remove_button_cb);
+       gtk_widget_class_bind_template_callback (widget_class, gs_details_page_app_cancel_button_cb);
+       gtk_widget_class_bind_template_callback (widget_class, gs_details_page_more_reviews_button_cb);
+       gtk_widget_class_bind_template_callback (widget_class, gs_details_page_app_launch_button_cb);
+       gtk_widget_class_bind_template_callback (widget_class, gs_details_page_app_add_shortcut_button_cb);
+       gtk_widget_class_bind_template_callback (widget_class, gs_details_page_app_remove_shortcut_button_cb);
+       gtk_widget_class_bind_template_callback (widget_class, origin_popover_row_activated_cb);
 }
 
 static void
diff --git a/src/gs-details-page.ui b/src/gs-details-page.ui
index 2a1ee9820..58adccc6e 100644
--- a/src/gs-details-page.ui
+++ b/src/gs-details-page.ui
@@ -200,6 +200,7 @@
                                             <child>
                                               <object class="GtkEventBox" id="star_eventbox">
                                                 <property name="visible">True</property>
+                                                <signal name="button-press-event" 
handler="gs_details_page_star_pressed_cb"/>
                                                 <child>
                                                   <object class="GsStarWidget" id="star">
                                                     <property name="visible">True</property>
@@ -240,6 +241,7 @@
                                             <property name="receives_default">True</property>
                                             <property name="halign">start</property>
                                             <property name="valign">center</property>
+                                            <signal name="clicked" 
handler="gs_details_page_app_install_button_cb"/>
                                             <style>
                                               <class name="suggested-action"/>
                                             </style>
@@ -253,6 +255,7 @@
                                             <property name="label" translatable="yes">_Open</property>
                                             <property name="use_underline">True</property>
                                             <property name="valign">center</property>
+                                            <signal name="clicked" 
handler="gs_details_page_app_launch_button_cb"/>
                                             <style>
                                               <class name="suggested-action"/>
                                             </style>
@@ -268,6 +271,7 @@
                                             <property name="receives_default">True</property>
                                             <property name="halign">start</property>
                                             <property name="valign">center</property>
+                                            <signal name="clicked" 
handler="gs_details_page_app_update_button_cb"/>
                                           </object>
                                         </child>
                                         <child>
@@ -277,6 +281,7 @@
                                             <property name="receives_default">True</property>
                                             <property name="halign">start</property>
                                             <property name="valign">center</property>
+                                            <signal name="clicked" 
handler="gs_details_page_app_remove_button_cb"/>
                                             <child>
                                               <object class="GtkImage">
                                                 <property name="icon-name">user-trash-symbolic</property>
@@ -305,6 +310,7 @@
                                                 <property name="can_focus">True</property>
                                                 <property name="receives_default">True</property>
                                                 <property name="valign">center</property>
+                                                <signal name="clicked" 
handler="gs_details_page_app_cancel_button_cb"/>
                                               </object>
                                             </child>
                                             <child>
@@ -346,6 +352,7 @@
                                             <property name="use_underline">True</property>
                                             <property name="label" translatable="yes" comments="Translators: 
A label for a button to add a shortcut to the selected application.">_Add shortcut</property>
                                             <property name="valign">center</property>
+                                            <signal name="clicked" 
handler="gs_details_page_app_add_shortcut_button_cb"/>
                                             <style>
                                               <class name="suggested-action"/>
                                             </style>
@@ -361,6 +368,7 @@
                                             <property name="use_underline">True</property>
                                             <property name="label" translatable="yes" comments="Translators: 
A label for a button to remove a shortcut to the selected application.">Re_move shortcut</property>
                                             <property name="valign">center</property>
+                                            <signal name="clicked" 
handler="gs_details_page_app_remove_shortcut_button_cb"/>
                                           </object>
                                           <packing>
                                             <property name="pack-type">end</property>
@@ -932,6 +940,7 @@
                                     <property name="halign">start</property>
                                     <property name="valign">start</property>
                                     <property name="margin_bottom">18</property>
+                                    <signal name="clicked" handler="gs_details_page_write_review_cb"/>
                                   </object>
                                 </child>
                                 <child>
@@ -953,6 +962,7 @@
                                     <property name="halign">start</property>
                                     <property name="valign">start</property>
                                     <property name="margin_top">12</property>
+                                    <signal name="clicked" handler="gs_details_page_more_reviews_button_cb"/>
                                   </object>
                                 </child>
                               </object>
@@ -1085,6 +1095,7 @@
               <object class="GtkListBox" id="origin_popover_list_box">
                 <property name="selection-mode">none</property>
                 <property name="visible">true</property>
+                <signal name="row-activated" handler="origin_popover_row_activated_cb"/>
                 <style>
                   <class name="content"/>
                 </style>


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