[frogr] Always show progress bar dialogs after a small timeout



commit 2778fcf4eed47965852fc91a6b888a51cbaf599a
Author: Mario Sanchez Prada <msanchez igalia com>
Date:   Sat Apr 23 21:00:16 2011 +0200

    Always show progress bar dialogs after a small timeout

 src/frogr-controller.c |   26 +++++++++++++++++++++-----
 1 files changed, 21 insertions(+), 5 deletions(-)
---
diff --git a/src/frogr-controller.c b/src/frogr-controller.c
index 03ccacf..3116061 100644
--- a/src/frogr-controller.c
+++ b/src/frogr-controller.c
@@ -197,6 +197,8 @@ static void _fetch_tags (FrogrController *self);
 
 static void _fetch_tags_cb (GObject *object, GAsyncResult *res, gpointer data);
 
+static gboolean _show_progress_on_idle (const gchar *text);
+
 static gboolean _show_details_dialog_on_idle (GSList *pictures);
 
 static gboolean _show_add_tags_dialog_on_idle (GSList *pictures);
@@ -1402,6 +1404,20 @@ _fetch_tags_cb (GObject *object, GAsyncResult *res, gpointer data)
 }
 
 static gboolean
+_show_progress_on_idle (const gchar *text)
+{
+  FrogrController *controller = NULL;
+  FrogrControllerPrivate *priv = NULL;
+
+  controller = frogr_controller_get_instance ();
+  priv = FROGR_CONTROLLER_GET_PRIVATE (controller);
+
+  frogr_main_view_show_progress (priv->mainview, text);
+
+  return FALSE;
+}
+
+static gboolean
 _show_details_dialog_on_idle (GSList *pictures)
 {
   FrogrController *controller = NULL;
@@ -1991,7 +2007,7 @@ frogr_controller_show_details_dialog (FrogrController *self,
       /* Fetch the tags list first if needed */
       if (frogr_main_view_model_n_tags (mainview_model) == 0 && !priv->tags_fetched)
         {
-          frogr_main_view_show_progress (priv->mainview, _("Retrieving list of tagsâ?¦"));
+          gdk_threads_add_timeout (DEFAULT_TIMEOUT, (GSourceFunc) _show_progress_on_idle, _("Retrieving list of tagsâ?¦"));
           _fetch_tags (self);
         }
     }
@@ -2017,7 +2033,7 @@ frogr_controller_show_add_tags_dialog (FrogrController *self,
       /* Fetch the tags list first if needed */
       if (frogr_main_view_model_n_tags (mainview_model) == 0 && !priv->tags_fetched)
         {
-          frogr_main_view_show_progress (priv->mainview, _("Retrieving list of tagsâ?¦"));
+          gdk_threads_add_timeout (DEFAULT_TIMEOUT, (GSourceFunc) _show_progress_on_idle, _("Retrieving list of tagsâ?¦"));
           _fetch_tags (self);
         }
     }
@@ -2041,7 +2057,7 @@ frogr_controller_show_create_new_set_dialog (FrogrController *self,
   /* Fetch the sets first if needed */
   if (frogr_main_view_model_n_sets (mainview_model) == 0 && !priv->sets_fetched)
     {
-      frogr_main_view_show_progress (priv->mainview, _("Retrieving list of setsâ?¦"));
+      gdk_threads_add_timeout (DEFAULT_TIMEOUT, (GSourceFunc) _show_progress_on_idle, _("Retrieving list of setsâ?¦"));
       _fetch_sets (self);
     }
 
@@ -2064,7 +2080,7 @@ frogr_controller_show_add_to_set_dialog (FrogrController *self,
   /* Fetch the sets first if needed */
   if (frogr_main_view_model_n_sets (mainview_model) == 0 && !priv->sets_fetched)
     {
-      frogr_main_view_show_progress (priv->mainview, _("Retrieving list of setsâ?¦"));
+      gdk_threads_add_timeout (DEFAULT_TIMEOUT, (GSourceFunc) _show_progress_on_idle, _("Retrieving list of setsâ?¦"));
       _fetch_sets (self);
     }
 
@@ -2087,7 +2103,7 @@ frogr_controller_show_add_to_group_dialog (FrogrController *self,
   /* Fetch the groups first if needed */
   if (frogr_main_view_model_n_groups (mainview_model) == 0 && !priv->groups_fetched)
     {
-      frogr_main_view_show_progress (priv->mainview, _("Retrieving list of groupsâ?¦"));
+      gdk_threads_add_timeout (DEFAULT_TIMEOUT, (GSourceFunc) _show_progress_on_idle, _("Retrieving list of groupsâ?¦"));
       _fetch_groups (self);
     }
 



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