[gimp] app: some cosmetic cleanup in the multiple selection code



commit 7ea16558b6cb2738866b7681c6e1e38dc80af847
Author: Michael Natterer <mitch gimp org>
Date:   Sun Apr 4 15:00:26 2010 +0200

    app: some cosmetic cleanup in the multiple selection code

 app/widgets/gimpcontainertreeview.c |   21 +++++++++------------
 app/widgets/gimpcontainerview.c     |   20 ++++++--------------
 2 files changed, 15 insertions(+), 26 deletions(-)
---
diff --git a/app/widgets/gimpcontainertreeview.c b/app/widgets/gimpcontainertreeview.c
index 10e13ad..4866ae2 100644
--- a/app/widgets/gimpcontainertreeview.c
+++ b/app/widgets/gimpcontainertreeview.c
@@ -1408,13 +1408,13 @@ static gint
 gimp_container_tree_view_get_selected (GimpContainerView    *view,
                                        GList               **items)
 {
-  GimpContainerTreeView    *tree_view = GIMP_CONTAINER_TREE_VIEW (view);
-  GtkTreeSelection         *selection;
-  gint                      selected_count;
-  GList                    *selected_rows;
-  GList                    *current_row;
-  GtkTreeIter               iter;
-  GimpViewRenderer         *renderer;
+  GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (view);
+  GtkTreeSelection      *selection;
+  gint                   selected_count;
+  GList                 *selected_rows;
+  GList                 *current_row;
+  GtkTreeIter            iter;
+  GimpViewRenderer      *renderer;
 
   selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view->view));
   selected_count = gtk_tree_selection_count_selected_rows (selection);
@@ -1428,7 +1428,7 @@ gimp_container_tree_view_get_selected (GimpContainerView    *view,
   selected_rows = gtk_tree_selection_get_selected_rows (selection, NULL);
 
   *items = NULL;
-  for (current_row = g_list_first (selected_rows);
+  for (current_row = selected_rows;
        current_row;
        current_row = g_list_next (current_row))
     {
@@ -1440,9 +1440,7 @@ gimp_container_tree_view_get_selected (GimpContainerView    *view,
                           -1);
 
       if (renderer->viewable)
-        {
-          *items = g_list_prepend (*items, renderer->viewable);
-        }
+        *items = g_list_prepend (*items, renderer->viewable);
 
       g_object_unref (renderer);
     }
@@ -1454,4 +1452,3 @@ gimp_container_tree_view_get_selected (GimpContainerView    *view,
 
   return selected_count;
 }
-
diff --git a/app/widgets/gimpcontainerview.c b/app/widgets/gimpcontainerview.c
index c8c0652..e652c5d 100644
--- a/app/widgets/gimpcontainerview.c
+++ b/app/widgets/gimpcontainerview.c
@@ -819,27 +819,19 @@ gimp_container_view_real_get_selected (GimpContainerView    *view,
   GimpObject               *object;
 
   if (list)
-    {
-      *list = NULL;
-    }
+    *list = NULL;
 
-  if (!private->container
-      || !private->context)
-    {
-      return 0;
-    }
+  if (! private->container || ! private->context)
+    return 0;
 
   children_type = gimp_container_get_children_type (private->container);
   object = gimp_context_get_by_type (private->context,
                                      children_type);
 
-  if (list
-      && object)
-    {
-      *list = g_list_append (*list, object);
-    }
+  if (list && object)
+    *list = g_list_append (*list, object);
 
-  return object != NULL;
+  return object ? 1 : 0;
 }
 
 void



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