[frogr] Update state string when the 'description-update' signal is emitted.



commit 93a2f2704fa9935a330dd94fc71499ce3e5caedf
Author: Mario Sanchez Prada <msanchez igalia com>
Date:   Fri Apr 22 18:47:43 2011 +0200

    Update state string when the 'description-update' signal is emitted.

 src/frogr-main-view.c |   36 +++++++++++++++++++++++++++++++-----
 1 files changed, 31 insertions(+), 5 deletions(-)
---
diff --git a/src/frogr-main-view.c b/src/frogr-main-view.c
index bf1abf1..ca688f2 100644
--- a/src/frogr-main-view.c
+++ b/src/frogr-main-view.c
@@ -197,6 +197,9 @@ static void _model_picture_removed (FrogrController *controller,
                                     FrogrPicture *picture,
                                     gpointer data);
 
+static void _model_description_updated (FrogrController *controller,
+                                        gpointer data);
+
 static void _update_state_description (FrogrMainView *mainview);
 
 static gchar *_craft_state_description (FrogrMainView *mainview);
@@ -1172,22 +1175,42 @@ _model_picture_removed (FrogrController *controller,
   _remove_picture_from_ui (mainview, picture);
 }
 
-static void _update_state_description (FrogrMainView *mainview)
+static void
+_model_description_updated (FrogrController *controller,
+                            gpointer data)
 {
+  FrogrMainView *mainview = NULL;
   FrogrMainViewPrivate *priv = NULL;
-  gchar *description = NULL;
 
+  mainview = FROGR_MAIN_VIEW (data);
   priv = FROGR_MAIN_VIEW_GET_PRIVATE (mainview);
 
+  /* Do not force updating the status bar when loading pictures */
+  if (frogr_controller_get_state (priv->controller) != FROGR_STATE_LOADING_PICTURES)
+    {
+      const gchar *description = NULL;
+
+      description = frogr_main_view_model_get_state_description (priv->model);
+      frogr_main_view_set_status_text (mainview, description);
+    }
+}
+
+static void
+_update_state_description (FrogrMainView *mainview)
+{
+  FrogrMainViewPrivate *priv = NULL;
+  gchar *description = NULL;
+
+  priv = FROGR_MAIN_VIEW_GET_PRIVATE (mainview);
   description = _craft_state_description (mainview);
   frogr_main_view_model_set_state_description (priv->model, description);
-  frogr_main_view_set_status_text (mainview, description);
+  g_free (description);
 
   DEBUG ("state description changed: %s", description);
-  g_free (description);
 }
 
-static gchar *_craft_state_description (FrogrMainView *mainview)
+static gchar *
+_craft_state_description (FrogrMainView *mainview)
 {
   FrogrMainViewPrivate *priv = NULL;
   FrogrAccount *account = NULL;
@@ -1600,6 +1623,9 @@ frogr_main_view_init (FrogrMainView *self)
   g_signal_connect (G_OBJECT (priv->model), "picture-removed",
                     G_CALLBACK (_model_picture_removed), self);
 
+  g_signal_connect (G_OBJECT (priv->model), "description-updated",
+                    G_CALLBACK (_model_description_updated), self);
+
   gtk_builder_connect_signals (builder, self);
 
   /* Show the UI, but hiding some widgets */



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