[gnome-control-center/signal-connect-object: 10/16] applications: Connect signals with g_signal_connect_object in swapped form



commit 43b6b07b04366bdc09429c1b588b6de128fd885e
Author: Robert Ancell <robert ancell canonical com>
Date:   Fri Nov 22 12:10:58 2019 +1300

    applications: Connect signals with g_signal_connect_object in swapped form

 panels/applications/cc-applications-panel.c  | 54 ++++++++++++----------------
 panels/applications/cc-applications-panel.ui | 32 ++++++++---------
 2 files changed, 38 insertions(+), 48 deletions(-)
---
diff --git a/panels/applications/cc-applications-panel.c b/panels/applications/cc-applications-panel.c
index 139da3ef9..477de50bf 100644
--- a/panels/applications/cc-applications-panel.c
+++ b/panels/applications/cc-applications-panel.c
@@ -147,8 +147,7 @@ privacy_link_cb (CcApplicationsPanel *self)
 }
 
 static void
-open_software_cb (GtkButton           *button,
-                  CcApplicationsPanel *self)
+open_software_cb (CcApplicationsPanel *self)
 {
   const gchar *argv[] = { "gnome-software", "--details", "appid", NULL };
 
@@ -528,9 +527,8 @@ add_static_permission_row (CcApplicationsPanel *self,
 }
 
 static void
-permission_row_activated_cb (GtkListBox          *list,
-                             GtkListBoxRow       *list_row,
-                             CcApplicationsPanel *self)
+permission_row_activated_cb (CcApplicationsPanel *self,
+                             GtkListBoxRow       *list_row)
 {
   GtkWidget *row = GTK_WIDGET (list_row);
 
@@ -694,8 +692,8 @@ update_integration_section (CcApplicationsPanel *self,
 /* --- handler section --- */
 
 static void
-unset_cb (CcActionRow         *row,
-          CcApplicationsPanel *self)
+unset_cb (CcApplicationsPanel *self,
+          CcActionRow         *row)
 {
   const gchar *type;
   GtkListBoxRow *selected;
@@ -763,7 +761,7 @@ add_scheme (CcApplicationsPanel *self,
   g_signal_connect_object (row,
                            "activated",
                            G_CALLBACK (unset_cb),
-                           self, 0);
+                           self, G_CONNECT_SWAPPED);
 
   if (after)
     {
@@ -796,7 +794,7 @@ add_file_type (CcApplicationsPanel *self,
   cc_action_row_set_subtitle (row, glob ? glob : "");
   cc_action_row_set_action (row, _("Unset"), TRUE);
   g_object_set_data_full (G_OBJECT (row), "type", g_strdup (type), g_free);
-  g_signal_connect (row, "activated", G_CALLBACK (unset_cb), self);
+  g_signal_connect_object (row, "activated", G_CALLBACK (unset_cb), self, G_CONNECT_SWAPPED);
 
   if (after)
     {
@@ -1063,9 +1061,8 @@ add_handler_row (CcApplicationsPanel *self,
 }
 
 static void
-handler_row_activated_cb (GtkListBox          *list,
-                          GtkListBoxRow       *list_row,
-                          CcApplicationsPanel *self)
+handler_row_activated_cb (CcApplicationsPanel *self,
+                          GtkListBoxRow       *list_row)
 {
   GtkWidget *row = GTK_WIDGET (list_row);
 
@@ -1110,8 +1107,7 @@ app_info_recommended_for (GAppInfo    *info,
 }
 
 static void
-handler_reset_cb (GtkButton           *button,
-                  CcApplicationsPanel *self)
+handler_reset_cb (CcApplicationsPanel *self)
 {
   GtkListBoxRow *selected;
   GAppInfo *info;
@@ -1186,9 +1182,8 @@ update_handler_sections (CcApplicationsPanel *self,
 /* --- usage section --- */
 
 static void
-storage_row_activated_cb (GtkListBox          *list,
-                          GtkListBoxRow       *list_row,
-                          CcApplicationsPanel *self)
+storage_row_activated_cb (CcApplicationsPanel *self,
+                          GtkListBoxRow       *list_row)
 {
   GtkWidget *row = GTK_WIDGET (list_row);
 
@@ -1452,16 +1447,14 @@ filter_sidebar_rows (GtkListBoxRow *row,
 }
 
 static void
-apps_changed (GAppInfoMonitor     *monitor,
-              CcApplicationsPanel *self)
+apps_changed (CcApplicationsPanel *self)
 {
   populate_applications (self);
 }
 
 static void
-row_activated_cb (GtkListBox          *list,
-                  GtkListBoxRow       *row,
-                  CcApplicationsPanel *self)
+row_activated_cb (CcApplicationsPanel *self,
+                  GtkListBoxRow       *row)
 {
   update_panel (self, row);
   g_signal_emit_by_name (self, "sidebar-activated");
@@ -1511,8 +1504,7 @@ select_app (CcApplicationsPanel *self,
 }
 
 static void
-on_sidebar_search_entry_activated_cb (GtkSearchEntry      *search_entry,
-                                      CcApplicationsPanel *self)
+on_sidebar_search_entry_activated_cb (CcApplicationsPanel *self)
 {
   GtkListBoxRow *row;
 
@@ -1531,15 +1523,13 @@ on_sidebar_search_entry_activated_cb (GtkSearchEntry      *search_entry,
 }
 
 static void
-on_sidebar_search_entry_search_changed_cb (GtkSearchEntry      *search_entry,
-                                           CcApplicationsPanel *self)
+on_sidebar_search_entry_search_changed_cb (CcApplicationsPanel *self)
 {
   gtk_list_box_invalidate_filter (self->sidebar_listbox);
 }
 
 static void
-on_sidebar_search_entry_search_stopped_cb (GtkSearchEntry      *search_entry,
-                                           CcApplicationsPanel *self)
+on_sidebar_search_entry_search_stopped_cb (CcApplicationsPanel *self)
 {
   gtk_entry_set_text (self->sidebar_search_entry, "");
 }
@@ -1735,10 +1725,10 @@ cc_applications_panel_init (CcApplicationsPanel *self)
                                              provider,
                                              GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
 
-  g_signal_connect (self->sidebar_listbox, "row-activated",
-                    G_CALLBACK (row_activated_cb), self);
+  g_signal_connect_object (self->sidebar_listbox, "row-activated",
+                           G_CALLBACK (row_activated_cb), self, G_CONNECT_SWAPPED);
 
-  g_signal_connect (self->header_button, "clicked", G_CALLBACK (open_software_cb), self);
+  g_signal_connect_object (self->header_button, "clicked", G_CALLBACK (open_software_cb), self, 
G_CONNECT_SWAPPED);
 
   gtk_list_box_set_header_func (GTK_LIST_BOX (self->permission_list),
                                 cc_list_box_update_header_func,
@@ -1779,7 +1769,7 @@ cc_applications_panel_init (CcApplicationsPanel *self)
   populate_applications (self);
 
   self->monitor = g_app_info_monitor_get ();
-  self->monitor_id = g_signal_connect (self->monitor, "changed", G_CALLBACK (apps_changed), self);
+  self->monitor_id = g_signal_connect_object (self->monitor, "changed", G_CALLBACK (apps_changed), self, 
G_CONNECT_SWAPPED);
 
   g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION,
                             G_DBUS_PROXY_FLAGS_NONE,
diff --git a/panels/applications/cc-applications-panel.ui b/panels/applications/cc-applications-panel.ui
index a73f08c9b..dc8c05d92 100644
--- a/panels/applications/cc-applications-panel.ui
+++ b/panels/applications/cc-applications-panel.ui
@@ -61,7 +61,7 @@
                         <property name="can-focus">1</property>
                         <property name="receives-default">1</property>
                         <property name="halign">center</property>
-                        <signal name="clicked" handler="open_software_cb"/>
+                        <signal name="clicked" handler="open_software_cb" object="CcApplicationsPanel" 
swapped="yes"/>
                       </object>
                       <packing>
                         <property name="fill">0</property>
@@ -120,11 +120,11 @@
                           <object class="GtkListBox" id="permission_list">
                             <property name="visible">1</property>
                             <property name="selection-mode">none</property>
-                            <signal name="row-activated" handler="permission_row_activated_cb"/>
+                            <signal name="row-activated" handler="permission_row_activated_cb" 
object="CcApplicationsPanel" swapped="yes"/>
                             <child>
                               <object class="CcToggleRow" id="camera">
                                 <property name="title" translatable="yes">Camera</property>
-                                <signal name="notify::allowed" handler="camera_cb" swapped="yes"/>
+                                <signal name="notify::allowed" handler="camera_cb" 
object="CcApplicationsPanel" swapped="yes"/>
                               </object>
                             </child>
                             <child>
@@ -136,7 +136,7 @@
                             <child>
                               <object class="CcToggleRow" id="microphone">
                                 <property name="title" translatable="yes">Microphone</property>
-                                <signal name="notify::allowed" handler="microphone_cb" swapped="yes"/>
+                                <signal name="notify::allowed" handler="microphone_cb" 
object="CcApplicationsPanel" swapped="yes"/>
                               </object>
                             </child>
                             <child>
@@ -148,7 +148,7 @@
                             <child>
                               <object class="CcToggleRow" id="location">
                                 <property name="title" translatable="yes">Location Services</property>
-                                <signal name="notify::allowed" handler="location_cb" swapped="yes"/>
+                                <signal name="notify::allowed" handler="location_cb" 
object="CcApplicationsPanel" swapped="yes"/>
                               </object>
                             </child>
                             <child>
@@ -179,7 +179,7 @@
                             <property name="max-width-chars">50</property>
                             <property name="label" translatable="yes">Individual permissions for 
applications can be reviewed in the &lt;a href=&quot;privacy&quot;&gt;Privacy&lt;/a&gt; Settings.</property>
                             <property name="use-markup">1</property>
-                            <signal name="activate-link" handler="privacy_link_cb" swapped="yes"/>
+                            <signal name="activate-link" handler="privacy_link_cb" 
object="CcApplicationsPanel" swapped="yes"/>
                           </object>
                         </child>
                       </object>
@@ -228,7 +228,7 @@
                             <child>
                               <object class="CcToggleRow" id="search">
                                 <property name="title" translatable="yes">Search</property>
-                                <signal name="notify::allowed" handler="search_cb" swapped="yes"/>
+                                <signal name="notify::allowed" handler="search_cb" 
object="CcApplicationsPanel" swapped="yes"/>
                               </object>
                             </child>
                             <child>
@@ -240,13 +240,13 @@
                             <child>
                               <object class="CcToggleRow" id="notification">
                                 <property name="title" translatable="yes">Notifications</property>
-                                <signal name="notify::allowed" handler="notification_cb" swapped="yes"/>
+                                <signal name="notify::allowed" handler="notification_cb" 
object="CcApplicationsPanel" swapped="yes"/>
                               </object>
                             </child>
                             <child>
                               <object class="CcToggleRow" id="sound">
                                 <property name="title" translatable="yes">Sounds</property>
-                                <signal name="notify::allowed" handler="sound_cb" swapped="yes"/>
+                                <signal name="notify::allowed" handler="sound_cb" 
object="CcApplicationsPanel" swapped="yes"/>
                               </object>
                             </child>
                             <child>
@@ -313,7 +313,7 @@
                                 <property name="halign">end</property>
                                 <property name="valign">center</property>
                                 <property name="label" translatable="yes">Reset</property>
-                                <signal name="clicked" handler="handler_reset_cb"/>
+                                <signal name="clicked" handler="handler_reset_cb" 
object="CcApplicationsPanel" swapped="yes"/>
                               </object>
                             </child>
                           </object>
@@ -322,7 +322,7 @@
                           <object class="GtkListBox" id="handler_list">
                             <property name="visible">1</property>
                             <property name="selection-mode">none</property>
-                            <signal name="row-activated" handler="handler_row_activated_cb"/>
+                            <signal name="row-activated" handler="handler_row_activated_cb" 
object="CcApplicationsPanel" swapped="yes"/>
                             <style>
                               <class name="view"/>
                               <class name="frame"/>
@@ -372,7 +372,7 @@
                           <object class="GtkListBox" id="usage_list">
                             <property name="visible">1</property>
                             <property name="selection-mode">none</property>
-                            <signal name="row-activated" handler="storage_row_activated_cb"/>
+                            <signal name="row-activated" handler="storage_row_activated_cb" 
object="CcApplicationsPanel" swapped="yes"/>
                             <child>
                               <object class="CcInfoRow" id="storage">
                                 <property name="title" translatable="yes">Storage</property>
@@ -424,9 +424,9 @@
         <property name="has-focus">True</property>
         <property name="margin">12</property>
         <property name="margin-bottom">6</property>
-        <signal name="activate" handler="on_sidebar_search_entry_activated_cb" object="CcApplicationsPanel" 
swapped="no" />
-        <signal name="search-changed" handler="on_sidebar_search_entry_search_changed_cb" 
object="CcApplicationsPanel" swapped="no" />
-        <signal name="stop-search" handler="on_sidebar_search_entry_search_stopped_cb" 
object="CcApplicationsPanel" swapped="no" />
+        <signal name="activate" handler="on_sidebar_search_entry_activated_cb" object="CcApplicationsPanel" 
swapped="yes" />
+        <signal name="search-changed" handler="on_sidebar_search_entry_search_changed_cb" 
object="CcApplicationsPanel" swapped="yes" />
+        <signal name="stop-search" handler="on_sidebar_search_entry_search_stopped_cb" 
object="CcApplicationsPanel" swapped="yes" />
       </object>
     </child>
     <child>
@@ -584,7 +584,7 @@
               <object class="GtkButton" id="clear_cache_button">
                 <property name="visible">1</property>
                 <property name="label" translatable="yes">Clear Cacheā€¦</property>
-                <signal name="clicked" handler="clear_cache_cb" swapped="yes"/>
+                <signal name="clicked" handler="clear_cache_cb" object="CcApplicationsPanel" swapped="yes"/>
               </object>
               <packing>
                 <property name="pack-type">end</property>


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