gimp r25224 - in trunk: . app/display app/menus



Author: neo
Date: Tue Mar 25 14:07:10 2008
New Revision: 25224
URL: http://svn.gnome.org/viewvc/gimp?rev=25224&view=rev

Log:
2008-03-25  Sven Neumann  <sven gimp org>

	* app/display/gimpstatusbar.[ch]: added gimp_statusbar_peek(), a
	method to access the contents of the statusbar.

	* app/display/gimpdisplayshell.c
	(gimp_display_shell_window_state_event): when the iconfied state
	changes, call gimp_display_shell_progress_window_state_changed().

	* app/display/gimpdisplayshell-progress.[ch]: when the image
	window is iconified, display the progress message in the window
	title so that it appears in the task bar.

	* app/menus/plug-in-menus.c: formatting.


Modified:
   trunk/ChangeLog
   trunk/app/display/gimpdisplayshell-progress.c
   trunk/app/display/gimpdisplayshell-progress.h
   trunk/app/display/gimpdisplayshell.c
   trunk/app/display/gimpstatusbar.c
   trunk/app/display/gimpstatusbar.h
   trunk/app/menus/plug-in-menus.c

Modified: trunk/app/display/gimpdisplayshell-progress.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-progress.c	(original)
+++ trunk/app/display/gimpdisplayshell-progress.c	Tue Mar 25 14:07:10 2008
@@ -28,9 +28,18 @@
 
 #include "gimpdisplayshell.h"
 #include "gimpdisplayshell-progress.h"
+#include "gimpdisplayshell-title.h"
 #include "gimpstatusbar.h"
 
 
+/*  Progress is shown in the status-bar. If the image window is iconified,
+ *  the progress messages are also shown in the window title so that they
+ *  appear in the task bar.
+ */
+
+static gboolean gimp_display_shell_is_iconified (GimpDisplayShell *shell);
+
+
 static GimpProgress *
 gimp_display_shell_progress_start (GimpProgress *progress,
                                    const gchar  *message,
@@ -38,8 +47,15 @@
 {
   GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress);
 
-  return gimp_progress_start (GIMP_PROGRESS (shell->statusbar),
-                              message, cancelable);
+  progress = gimp_progress_start (GIMP_PROGRESS (shell->statusbar),
+                                  message, cancelable);
+
+  if (progress && gimp_display_shell_is_iconified (shell))
+    {
+      gdk_window_set_title (GTK_WIDGET (shell)->window, message);
+    }
+
+  return progress;
 }
 
 static void
@@ -48,6 +64,9 @@
   GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress);
 
   gimp_progress_end (GIMP_PROGRESS (shell->statusbar));
+
+  if (gimp_display_shell_is_iconified (shell))
+    gimp_display_shell_title_update (shell);
 }
 
 static gboolean
@@ -65,6 +84,12 @@
   GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress);
 
   gimp_progress_set_text (GIMP_PROGRESS (shell->statusbar), message);
+
+  if (gimp_progress_is_active (GIMP_PROGRESS (shell->statusbar)) &&
+      gimp_display_shell_is_iconified (shell))
+    {
+      gdk_window_set_title (GTK_WIDGET (shell)->window, message);
+    }
 }
 
 static void
@@ -130,6 +155,16 @@
   return FALSE;
 }
 
+static gboolean
+gimp_display_shell_is_iconified (GimpDisplayShell *shell)
+{
+  GtkWidget *widget = GTK_WIDGET (shell);
+
+  return (GTK_WIDGET_DRAWABLE (widget) &&
+          gdk_window_get_state (widget->window) == GDK_WINDOW_STATE_ICONIFIED);
+}
+
+
 void
 gimp_display_shell_progress_iface_init (GimpProgressInterface *iface)
 {
@@ -143,3 +178,23 @@
   iface->get_window = gimp_display_shell_progress_get_window;
   iface->message    = gimp_display_shell_progress_message;
 }
+
+void
+gimp_display_shell_progress_window_state_changed (GimpDisplayShell *shell)
+{
+  if (! gimp_progress_is_active (GIMP_PROGRESS (shell)))
+    return;
+
+  if (gimp_display_shell_is_iconified (shell))
+    {
+      const gchar *msg = gimp_statusbar_peek (GIMP_STATUSBAR (shell->statusbar),
+                                              "progress");
+      if (msg)
+        {
+          gdk_window_set_title (GTK_WIDGET (shell)->window, msg);
+          return;
+        }
+    }
+
+  gimp_display_shell_title_update (shell);
+}

Modified: trunk/app/display/gimpdisplayshell-progress.h
==============================================================================
--- trunk/app/display/gimpdisplayshell-progress.h	(original)
+++ trunk/app/display/gimpdisplayshell-progress.h	Tue Mar 25 14:07:10 2008
@@ -22,7 +22,9 @@
 #include "core/gimpprogress.h"
 
 
-void gimp_display_shell_progress_iface_init (GimpProgressInterface *iface);
+void gimp_display_shell_progress_iface_init      (GimpProgressInterface *iface);
+
+void gimp_display_shell_progress_window_state_changed (GimpDisplayShell *shell);
 
 
 #endif /*  __GIMP_DISPLAY_SHELL_PROGRESS_H__  */

Modified: trunk/app/display/gimpdisplayshell.c
==============================================================================
--- trunk/app/display/gimpdisplayshell.c	(original)
+++ trunk/app/display/gimpdisplayshell.c	Tue Mar 25 14:07:10 2008
@@ -602,6 +602,11 @@
         }
     }
 
+  if (event->changed_mask & GDK_WINDOW_STATE_ICONIFIED)
+    {
+      gimp_display_shell_progress_window_state_changed (shell);
+    }
+
   return FALSE;
 }
 

Modified: trunk/app/display/gimpstatusbar.c
==============================================================================
--- trunk/app/display/gimpstatusbar.c	(original)
+++ trunk/app/display/gimpstatusbar.c	Tue Mar 25 14:07:10 2008
@@ -825,6 +825,31 @@
   gimp_statusbar_update (statusbar);
 }
 
+const gchar *
+gimp_statusbar_peek (GimpStatusbar *statusbar,
+                     const gchar   *context)
+{
+  GSList *list;
+  guint   context_id;
+
+  g_return_if_fail (GIMP_IS_STATUSBAR (statusbar));
+  g_return_if_fail (context != NULL);
+
+  context_id = gimp_statusbar_get_context_id (statusbar, context);
+
+  for (list = statusbar->messages; list; list = list->next)
+    {
+      GimpStatusbarMsg *msg = list->data;
+
+      if (msg->context_id == context_id)
+        {
+          return msg->text;
+        }
+    }
+
+  return NULL;
+}
+
 void
 gimp_statusbar_pop (GimpStatusbar *statusbar,
                     const gchar   *context)

Modified: trunk/app/display/gimpstatusbar.h
==============================================================================
--- trunk/app/display/gimpstatusbar.h	(original)
+++ trunk/app/display/gimpstatusbar.h	Tue Mar 25 14:07:10 2008
@@ -109,6 +109,8 @@
                                              const gchar         *context,
                                              const gchar         *format,
                                              va_list              args);
+const gchar * gimp_statusbar_peek           (GimpStatusbar       *statusbar,
+                                             const gchar         *context);
 void        gimp_statusbar_pop              (GimpStatusbar       *statusbar,
                                              const gchar         *context);
 

Modified: trunk/app/menus/plug-in-menus.c
==============================================================================
--- trunk/app/menus/plug-in-menus.c	(original)
+++ trunk/app/menus/plug-in-menus.c	Tue Mar 25 14:07:10 2008
@@ -510,7 +510,7 @@
                                            action_path))
             {
               GIMP_LOG (MENUS, "adding menu '%s' at path '%s' for action '%s'",
-                       menu_item_name, action_path, menu_path);
+                        menu_item_name, action_path, menu_path);
 
               gtk_ui_manager_add_ui (GTK_UI_MANAGER (manager), merge_id,
                                      parent_action_path, menu_item_name,



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