[frogr] New private helper function _n_pictures()



commit cd37847bd1d39abbef798a7e9fbac0544ea8b2d7
Author: Mario Sanchez Prada <msanchez igalia com>
Date:   Sun Apr 24 23:43:15 2011 -0700

    New private helper function _n_pictures()

 src/frogr-main-view.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/src/frogr-main-view.c b/src/frogr-main-view.c
index 70d4ff5..0a162f2 100644
--- a/src/frogr-main-view.c
+++ b/src/frogr-main-view.c
@@ -173,6 +173,7 @@ static gboolean _on_icon_view_query_tooltip (GtkWidget *icon_view,
                                              gpointer data);
 
 static GSList *_get_selected_pictures (FrogrMainView *self);
+static gint _n_pictures (FrogrMainView *self);
 static gint _n_selected_pictures (FrogrMainView *self);
 static void _add_picture_to_ui (FrogrMainView *self, FrogrPicture *picture);
 static void _remove_picture_from_ui (FrogrMainView *self, FrogrPicture *picture);
@@ -685,7 +686,7 @@ _on_icon_view_key_press_event (GtkWidget *widget,
     return TRUE;
 
   /* Do nothing if there's no picture loaded yet */
-  if (!frogr_main_view_model_n_pictures (priv->model))
+  if (!_n_pictures (mainview))
     return TRUE;
 
   /* Remove selected pictures if pressed Supr */
@@ -718,7 +719,7 @@ _on_icon_view_button_press_event (GtkWidget *widget,
     return TRUE;
 
   /* Do nothing if there's no picture loaded yet */
-  if (!frogr_main_view_model_n_pictures (priv->model))
+  if (!_n_pictures (mainview))
     return TRUE;
 
   /* Check if we clicked on top of an item */
@@ -989,6 +990,15 @@ _get_selected_pictures (FrogrMainView *self)
 }
 
 static gint
+_n_pictures (FrogrMainView *self)
+{
+  FrogrMainViewPrivate *priv = FROGR_MAIN_VIEW_GET_PRIVATE (self);
+
+  /* Just return the number of pictures in the model */
+  return frogr_main_view_model_n_pictures (priv->model);
+}
+
+static gint
 _n_selected_pictures (FrogrMainView *self)
 {
   FrogrMainViewPrivate *priv = FROGR_MAIN_VIEW_GET_PRIVATE (self);
@@ -1578,7 +1588,7 @@ _update_ui (FrogrMainView *self)
       break;
 
     case FROGR_STATE_IDLE:
-      has_pics = (frogr_main_view_model_n_pictures (priv->model) > 0);
+      has_pics = (_n_pictures (self) > 0);
       has_accounts = (priv->accounts_menu != NULL);
 
       gtk_widget_set_sensitive (priv->add_button, TRUE);



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