[gnome-photos] selection-controller, selection-toolbar: Clean up



commit ff1e34b97888d80d6ea4dd60d17594d47701edf3
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Oct 26 12:58:11 2015 +0100

    selection-controller, selection-toolbar: Clean up

 src/photos-selection-controller.c |    9 +--------
 src/photos-selection-toolbar.c    |    7 +------
 2 files changed, 2 insertions(+), 14 deletions(-)
---
diff --git a/src/photos-selection-controller.c b/src/photos-selection-controller.c
index 725aa46..18363b7 100644
--- a/src/photos-selection-controller.c
+++ b/src/photos-selection-controller.c
@@ -218,14 +218,7 @@ photos_selection_controller_set_selection (PhotosSelectionController *self, GLis
   g_list_free_full (priv->selection, g_free);
   priv->selection = NULL;
 
-  if (selection != NULL)
-    {
-      GList *l;
-
-      for (l = selection; l != NULL; l = l->next)
-        priv->selection = g_list_prepend (priv->selection, g_strdup (l->data));
-    }
-
+  priv->selection = g_list_copy_deep (selection, (GCopyFunc) g_strdup, NULL);
   g_signal_emit (self, signals[SELECTION_CHANGED], 0);
 }
 
diff --git a/src/photos-selection-toolbar.c b/src/photos-selection-toolbar.c
index 6cb4781..9d8b06e 100644
--- a/src/photos-selection-toolbar.c
+++ b/src/photos-selection-toolbar.c
@@ -410,12 +410,7 @@ photos_selection_toolbar_dispose (GObject *object)
   PhotosSelectionToolbar *self = PHOTOS_SELECTION_TOOLBAR (object);
   PhotosSelectionToolbarPrivate *priv = self->priv;
 
-  if (priv->item_listeners != NULL)
-    {
-      g_hash_table_unref (priv->item_listeners);
-      priv->item_listeners = NULL;
-    }
-
+  g_clear_pointer (&priv->item_listeners, (GDestroyNotify) g_hash_table_unref);
   g_clear_object (&priv->item_mngr);
   g_clear_object (&priv->sel_cntrlr);
 


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