[gnome-photos/gnome-3-16] selection-toolbar: Simplify the callbacks



commit 328d95bddf3268fdfe1064c85fade9e561685da3
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Oct 26 13:02:15 2015 +0100

    selection-toolbar: Simplify the callbacks

 src/photos-selection-toolbar.c |   27 +++++++++++----------------
 1 files changed, 11 insertions(+), 16 deletions(-)
---
diff --git a/src/photos-selection-toolbar.c b/src/photos-selection-toolbar.c
index 4bdb277..4082eed 100644
--- a/src/photos-selection-toolbar.c
+++ b/src/photos-selection-toolbar.c
@@ -340,9 +340,8 @@ photos_selection_toolbar_set_item_listeners (PhotosSelectionToolbar *self, GList
 
 
 static void
-photos_selection_toolbar_selection_changed (PhotosSelectionController *sel_cntrlr, gpointer user_data)
+photos_selection_toolbar_selection_changed (PhotosSelectionToolbar *self)
 {
-  PhotosSelectionToolbar *self = PHOTOS_SELECTION_TOOLBAR (user_data);
   PhotosSelectionToolbarPrivate *priv = self->priv;
   GList *selection;
 
@@ -358,14 +357,10 @@ photos_selection_toolbar_selection_changed (PhotosSelectionController *sel_cntrl
 
 
 static void
-photos_selection_toolbar_selection_mode_changed (PhotosSelectionController *sel_cntrlr,
-                                                 gboolean mode,
-                                                 gpointer user_data)
+photos_selection_toolbar_selection_mode_changed (PhotosSelectionToolbar *self, gboolean mode)
 {
-  PhotosSelectionToolbar *self = PHOTOS_SELECTION_TOOLBAR (user_data);
-
   if (mode)
-    photos_selection_toolbar_selection_changed (sel_cntrlr, self);
+    photos_selection_toolbar_selection_changed (self);
   else
     gtk_revealer_set_reveal_child (GTK_REVEALER (self), FALSE);
 }
@@ -494,14 +489,14 @@ photos_selection_toolbar_init (PhotosSelectionToolbar *self)
   priv->item_mngr = g_object_ref (state->item_mngr);
 
   priv->sel_cntrlr = photos_selection_controller_dup_singleton ();
-  g_signal_connect (priv->sel_cntrlr,
-                    "selection-changed",
-                    G_CALLBACK (photos_selection_toolbar_selection_changed),
-                    self);
-  g_signal_connect (priv->sel_cntrlr,
-                    "selection-mode-changed",
-                    G_CALLBACK (photos_selection_toolbar_selection_mode_changed),
-                    self);
+  g_signal_connect_swapped (priv->sel_cntrlr,
+                            "selection-changed",
+                            G_CALLBACK (photos_selection_toolbar_selection_changed),
+                            self);
+  g_signal_connect_swapped (priv->sel_cntrlr,
+                            "selection-mode-changed",
+                            G_CALLBACK (photos_selection_toolbar_selection_mode_changed),
+                            self);
 }
 
 


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