gimp r25927 - in trunk: . plug-ins/help plug-ins/help-browser



Author: neo
Date: Wed Jun 11 17:43:57 2008
New Revision: 25927
URL: http://svn.gnome.org/viewvc/gimp?rev=25927&view=rev

Log:
2008-06-11  Sven Neumann  <sven gimp org>

	* plug-ins/help/help.c (load_help_idle): don't show progress for
	local help lookups, they are fast enough.

	* plug-ins/help-browser/help-browser.c: added the same progress
	code here. Might want to move it to the dialog window later.



Modified:
   trunk/ChangeLog
   trunk/plug-ins/help-browser/help-browser.c
   trunk/plug-ins/help/help.c

Modified: trunk/plug-ins/help-browser/help-browser.c
==============================================================================
--- trunk/plug-ins/help-browser/help-browser.c	(original)
+++ trunk/plug-ins/help-browser/help-browser.c	Wed Jun 11 17:43:57 2008
@@ -64,6 +64,8 @@
                                          const gchar      *help_locales,
                                          const gchar      *help_id);
 
+static GimpHelpProgress * help_browser_progress_new (void);
+
 
 /*  local variables  */
 
@@ -248,13 +250,25 @@
 
   if (domain)
     {
-      GList          *locales = gimp_help_parse_locales (help_locales);
-      GimpHelpLocale *locale;
-      gchar          *uri;
-      gboolean        fatal_error;
+      GimpHelpProgress *progress = NULL;
+      GimpHelpLocale   *locale;
+      GList            *locales;
+      gchar            *uri;
+      gboolean          fatal_error;
+
+      locales = gimp_help_parse_locales (help_locales);
+
+      if (! g_str_has_prefix (domain->help_uri, "file:"))
+        progress = help_browser_progress_new ();
 
-      uri = gimp_help_domain_map (domain, locales, help_id, NULL,
-                                  &locale, &fatal_error);
+      uri = gimp_help_domain_map (domain, locales, help_id,
+                                  progress, &locale, &fatal_error);
+
+      if (progress)
+        gimp_help_progress_free (progress);
+
+      g_list_foreach (locales, (GFunc) g_free, NULL);
+      g_list_free (locales);
 
       if (uri)
         {
@@ -267,10 +281,42 @@
         {
           success = FALSE;
         }
-
-      g_list_foreach (locales, (GFunc) g_free, NULL);
-      g_list_free (locales);
     }
 
   return success;
 }
+
+
+static void
+help_browser_progress_start (const gchar *message,
+                             gboolean     cancelable,
+                             gpointer     user_data)
+{
+  gimp_progress_init (message);
+}
+
+static void
+help_browser_progress_update (gdouble  value,
+                              gpointer user_data)
+{
+  gimp_progress_update (value);
+}
+
+static void
+help_browser_progress_end (gpointer user_data)
+{
+  gimp_progress_end ();
+}
+
+static GimpHelpProgress *
+help_browser_progress_new (void)
+{
+  static const GimpHelpProgressVTable vtable =
+  {
+    help_browser_progress_start,
+    help_browser_progress_end,
+    help_browser_progress_update
+  };
+
+  return gimp_help_progress_new (&vtable, NULL);
+}

Modified: trunk/plug-ins/help/help.c
==============================================================================
--- trunk/plug-ins/help/help.c	(original)
+++ trunk/plug-ins/help/help.c	Wed Jun 11 17:43:57 2008
@@ -265,43 +265,48 @@
 
   if (domain)
     {
-      GimpHelpProgress *progress = load_help_progress_new ();
+      GimpHelpProgress *progress = NULL;
       GList            *locales;
-      gchar            *full_uri;
+      gchar            *uri;
       gboolean          fatal_error;
 
-      locales  = gimp_help_parse_locales (idle_help->help_locales);
-      full_uri = gimp_help_domain_map (domain, locales, idle_help->help_id,
-                                       progress, NULL, &fatal_error);
+      locales = gimp_help_parse_locales (idle_help->help_locales);
+
+      if (! g_str_has_prefix (domain->help_uri, "file:"))
+        progress = load_help_progress_new ();
+
+      uri = gimp_help_domain_map (domain, locales, idle_help->help_id,
+                                  progress, NULL, &fatal_error);
+
+      if (progress)
+        gimp_help_progress_free (progress);
 
       g_list_foreach (locales, (GFunc) g_free, NULL);
       g_list_free (locales);
 
-      if (full_uri)
+      if (uri)
         {
           GimpParam *return_vals;
           gint       n_return_vals;
 
 #ifdef GIMP_HELP_DEBUG
           g_printerr ("help: calling '%s' for '%s'\n",
-                      idle_help->procedure, full_uri);
+                      idle_help->procedure, uri);
 #endif
 
           return_vals = gimp_run_procedure (idle_help->procedure,
                                             &n_return_vals,
-                                            GIMP_PDB_STRING, full_uri,
+                                            GIMP_PDB_STRING, uri,
                                             GIMP_PDB_END);
 
           gimp_destroy_params (return_vals, n_return_vals);
 
-          g_free (full_uri);
+          g_free (uri);
         }
       else if (fatal_error)
         {
           g_main_loop_quit (main_loop);
         }
-
-      gimp_help_progress_free (progress);
     }
 
   g_free (idle_help->procedure);



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