gimp r26572 - trunk/app/display



Author: neo
Date: Fri Aug 15 16:32:09 2008
New Revision: 26572
URL: http://svn.gnome.org/viewvc/gimp?rev=26572&view=rev

Log:
2008-08-15  Sven Neumann  <sven gimp org>

	* app/display/gimpstatusbar.[ch]: added some logic to avoid that
	an info message replaces a warning. Allow info messages to
	replaced other info messages.

	* app/display/gimpdisplay-handlers.c: changed accordingly.



Modified:
   trunk/app/display/gimpdisplay-handlers.c
   trunk/app/display/gimpstatusbar.c
   trunk/app/display/gimpstatusbar.h

Modified: trunk/app/display/gimpdisplay-handlers.c
==============================================================================
--- trunk/app/display/gimpdisplay-handlers.c	(original)
+++ trunk/app/display/gimpdisplay-handlers.c	Fri Aug 15 16:32:09 2008
@@ -154,12 +154,9 @@
                             GimpDisplay *display)
 {
   GtkWidget *statusbar = GIMP_DISPLAY_SHELL (display->shell)->statusbar;
-  gchar     *filename;
-
-  filename = file_utils_uri_display_name (uri);
-
-  gimp_statusbar_push_temp (GIMP_STATUSBAR (statusbar), GTK_STOCK_SAVE,
-                            _("Image saved to '%s'"), filename);
+  gchar     *filename  = file_utils_uri_display_name (uri);
 
+  gimp_statusbar_push_temp (GIMP_STATUSBAR (statusbar), GIMP_MESSAGE_INFO,
+                            GTK_STOCK_SAVE, _("Image saved to '%s'"), filename);
   g_free (filename);
 }

Modified: trunk/app/display/gimpstatusbar.c
==============================================================================
--- trunk/app/display/gimpstatusbar.c	(original)
+++ trunk/app/display/gimpstatusbar.c	Fri Aug 15 16:32:09 2008
@@ -496,8 +496,8 @@
   const gchar   *stock_id;
   gboolean       handle_msg = FALSE;
 
-  /*  don't accept a message if we are already displaying one  */
-  if (statusbar->temp_timeout_id)
+  /*  don't accept a message if we are already displaying a more severe one  */
+  if (statusbar->temp_timeout_id && statusbar->temp_severity > severity)
     return FALSE;
 
   /*  we can only handle short one-liners  */
@@ -536,7 +536,7 @@
   g_object_unref (layout);
 
   if (handle_msg)
-    gimp_statusbar_push_temp (statusbar, stock_id, "%s", message);
+    gimp_statusbar_push_temp (statusbar, severity, stock_id, "%s", message);
 
   return handle_msg;
 }
@@ -1030,33 +1030,37 @@
 }
 
 void
-gimp_statusbar_push_temp (GimpStatusbar *statusbar,
-                          const gchar   *stock_id,
-                          const gchar   *format,
+gimp_statusbar_push_temp (GimpStatusbar       *statusbar,
+                          GimpMessageSeverity  severity,
+                          const gchar         *stock_id,
+                          const gchar         *format,
                           ...)
 {
   va_list args;
 
-  g_return_if_fail (GIMP_IS_STATUSBAR (statusbar));
-  g_return_if_fail (format != NULL);
-
   va_start (args, format);
-  gimp_statusbar_push_temp_valist (statusbar, stock_id, format, args);
+  gimp_statusbar_push_temp_valist (statusbar, severity, stock_id, format, args);
   va_end (args);
 }
 
 void
-gimp_statusbar_push_temp_valist (GimpStatusbar *statusbar,
-                                 const gchar   *stock_id,
-                                 const gchar   *format,
-                                 va_list        args)
+gimp_statusbar_push_temp_valist (GimpStatusbar       *statusbar,
+                                 GimpMessageSeverity  severity,
+                                 const gchar         *stock_id,
+                                 const gchar         *format,
+                                 va_list              args)
 {
   GimpStatusbarMsg *msg = NULL;
   gchar            *message;
 
   g_return_if_fail (GIMP_IS_STATUSBAR (statusbar));
+  g_return_if_fail (severity <= GIMP_MESSAGE_WARNING);
   g_return_if_fail (format != NULL);
 
+  /*  don't accept a message if we are already displaying a more severe one  */
+  if (statusbar->temp_timeout_id && statusbar->temp_severity > severity)
+    return;
+
   message = gimp_statusbar_vprintf (format, args);
 
   if (statusbar->temp_timeout_id)
@@ -1066,6 +1070,8 @@
     g_timeout_add (MESSAGE_TIMEOUT,
                    (GSourceFunc) gimp_statusbar_temp_timeout, statusbar);
 
+  statusbar->temp_severity = severity;
+
   if (statusbar->messages)
     {
       msg = statusbar->messages->data;

Modified: trunk/app/display/gimpstatusbar.h
==============================================================================
--- trunk/app/display/gimpstatusbar.h	(original)
+++ trunk/app/display/gimpstatusbar.h	Fri Aug 15 16:32:09 2008
@@ -37,31 +37,32 @@
 
 struct _GimpStatusbar
 {
-  GtkStatusbar      parent_instance;
+  GtkStatusbar         parent_instance;
 
-  GimpDisplayShell *shell;
+  GimpDisplayShell    *shell;
 
-  GSList           *messages;
-  GHashTable       *context_ids;
-  guint             seq_context_id;
+  GSList              *messages;
+  GHashTable          *context_ids;
+  guint                seq_context_id;
 
-  GdkPixbuf        *icon;
+  GdkPixbuf           *icon;
 
-  guint             temp_context_id;
-  guint             temp_timeout_id;
+  guint                temp_context_id;
+  guint                temp_timeout_id;
+  GimpMessageSeverity  temp_severity;
 
-  gchar             cursor_format_str[CURSOR_FORMAT_LENGTH];
-  gchar             length_format_str[CURSOR_FORMAT_LENGTH];
+  gchar                cursor_format_str[CURSOR_FORMAT_LENGTH];
+  gchar                length_format_str[CURSOR_FORMAT_LENGTH];
 
-  GtkWidget        *cursor_label;
-  GtkWidget        *unit_combo;
-  GtkWidget        *scale_combo;
+  GtkWidget           *cursor_label;
+  GtkWidget           *unit_combo;
+  GtkWidget           *scale_combo;
 
-  GtkWidget        *progressbar;
-  GtkWidget        *cancel_button;
-  gboolean          progress_active;
-  gboolean          progress_shown;
-  gdouble           progress_value;
+  GtkWidget           *progressbar;
+  GtkWidget           *cancel_button;
+  gboolean             progress_active;
+  gboolean             progress_shown;
+  gdouble              progress_value;
 };
 
 struct _GimpStatusbarClass
@@ -120,10 +121,12 @@
                                              const gchar         *context);
 
 void        gimp_statusbar_push_temp        (GimpStatusbar       *statusbar,
+                                             GimpMessageSeverity  severity,
                                              const gchar         *stock_id,
                                              const gchar         *format,
-                                             ...) G_GNUC_PRINTF(3,4);
+                                             ...) G_GNUC_PRINTF(4,5);
 void        gimp_statusbar_push_temp_valist (GimpStatusbar       *statusbar,
+                                             GimpMessageSeverity  severity,
                                              const gchar         *stock_id,
                                              const gchar         *format,
                                              va_list              args);



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