gimp r25477 - in trunk: . app/display app/tools



Author: neo
Date: Mon Apr 14 07:28:43 2008
New Revision: 25477
URL: http://svn.gnome.org/viewvc/gimp?rev=25477&view=rev

Log:
2008-04-14  Sven Neumann  <sven gimp org>

	* app/display/gimpstatusbar.[ch]: added stock-id parameters to 
all
	statusbar setters.

	* app/display/gimpdisplayshell-title.c: pass NULL as stock-id.

	* app/tools/gimptool.c: pass the tool icon to the statusbar.

	* app/tools/gimpeditselectiontool.c 
(gimp_edit_selection_tool_start):
	inherit the tool-info from the parent tool.



Modified:
   trunk/ChangeLog
   trunk/app/display/gimpdisplayshell-title.c
   trunk/app/display/gimpstatusbar.c
   trunk/app/display/gimpstatusbar.h
   trunk/app/tools/gimpeditselectiontool.c
   trunk/app/tools/gimptool.c

Modified: trunk/app/display/gimpdisplayshell-title.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-title.c	(original)
+++ trunk/app/display/gimpdisplayshell-title.c	Mon Apr 14 07:28:43 2008
@@ -108,13 +108,14 @@
                                        config->image_status_format);
 
       gimp_statusbar_replace (GIMP_STATUSBAR (shell->statusbar), "title",
-                              "%s", title);
+                              NULL, "%s", title);
     }
   else
     {
       gdk_window_set_title (GTK_WIDGET (shell)->window, GIMP_NAME);
 
-      gimp_statusbar_replace (GIMP_STATUSBAR (shell->statusbar), "title", "");
+      gimp_statusbar_replace (GIMP_STATUSBAR (shell->statusbar), "title",
+                              NULL, " ");
     }
 
   return FALSE;

Modified: trunk/app/display/gimpstatusbar.c
==============================================================================
--- trunk/app/display/gimpstatusbar.c	(original)
+++ trunk/app/display/gimpstatusbar.c	Mon Apr 14 07:28:43 2008
@@ -180,11 +180,6 @@
   gtk_widget_show (hbox);
 
   statusbar->cursor_label = gtk_label_new ("8888, 8888");
-#if 0
-  gimp_label_set_attributes (GTK_LABEL (statusbar->cursor_label),
-                             PANGO_ATTR_SCALE,  PANGO_SCALE_SMALL,
-                             -1);
-#endif
   gtk_misc_set_alignment (GTK_MISC (statusbar->cursor_label), 0.5, 0.5);
   gtk_box_pack_start (GTK_BOX (hbox), statusbar->cursor_label, FALSE, FALSE, 0);
   gtk_widget_show (statusbar->cursor_label);
@@ -541,11 +536,11 @@
 static void
 gimp_statusbar_update (GimpStatusbar *statusbar)
 {
-  const gchar *text = NULL;
+  GimpStatusbarMsg *msg = NULL;
 
   if (statusbar->messages)
     {
-      GimpStatusbarMsg *msg = statusbar->messages->data;
+      msg = statusbar->messages->data;
 
       /*  only allow progress messages while the progress is active  */
       if (statusbar->progress_active)
@@ -556,20 +551,18 @@
           if (context_id != msg->context_id)
             return;
         }
-
-      text = msg->text;
     }
 
-  if (text && statusbar->temp_timeout_id)
+  if (msg && msg->stock_id && msg->text)
     {
-      gchar *temp = g_strconcat (statusbar->icon_spaces, text, NULL);
+      gchar *temp = g_strconcat (statusbar->icon_spaces, msg->text, NULL);
 
       gimp_statusbar_set_text (statusbar, temp);
       g_free (temp);
     }
   else
     {
-      gimp_statusbar_set_text (statusbar, text ? text : "");
+      gimp_statusbar_set_text (statusbar, msg && msg->text ? msg->text : "");
     }
 }
 
@@ -649,6 +642,7 @@
 void
 gimp_statusbar_push (GimpStatusbar *statusbar,
                      const gchar   *context,
+                     const gchar   *stock_id,
                      const gchar   *format,
                      ...)
 {
@@ -659,13 +653,14 @@
   g_return_if_fail (format != NULL);
 
   va_start (args, format);
-  gimp_statusbar_push_valist (statusbar, context, format, args);
+  gimp_statusbar_push_valist (statusbar, context, stock_id, format, args);
   va_end (args);
 }
 
 void
 gimp_statusbar_push_valist (GimpStatusbar *statusbar,
                             const gchar   *context,
+                            const gchar   *stock_id,
                             const gchar   *format,
                             va_list        args)
 {
@@ -706,9 +701,10 @@
         }
     }
 
-  msg = g_slice_new0 (GimpStatusbarMsg);
+  msg = g_slice_new (GimpStatusbarMsg);
 
   msg->context_id = context_id;
+  msg->stock_id   = g_strdup (stock_id);
   msg->text       = message;
 
   if (statusbar->temp_timeout_id)
@@ -722,6 +718,7 @@
 void
 gimp_statusbar_push_coords (GimpStatusbar *statusbar,
                             const gchar   *context,
+                            const gchar   *stock_id,
                             const gchar   *title,
                             gdouble        x,
                             const gchar   *separator,
@@ -742,6 +739,7 @@
   if (shell->unit == GIMP_UNIT_PIXEL)
     {
       gimp_statusbar_push (statusbar, context,
+                           stock_id,
                            statusbar->cursor_format_str,
                            title,
                            (gint) RINT (x),
@@ -759,6 +757,7 @@
       gimp_image_get_resolution (shell->display->image, &xres, &yres);
 
       gimp_statusbar_push (statusbar, context,
+                           stock_id,
                            statusbar->cursor_format_str,
                            title,
                            x * unit_factor / xres,
@@ -771,6 +770,7 @@
 void
 gimp_statusbar_push_length (GimpStatusbar       *statusbar,
                             const gchar         *context,
+                            const gchar         *stock_id,
                             const gchar         *title,
                             GimpOrientationType  axis,
                             gdouble              value,
@@ -789,6 +789,7 @@
   if (shell->unit == GIMP_UNIT_PIXEL)
     {
       gimp_statusbar_push (statusbar, context,
+                           stock_id,
                            statusbar->length_format_str,
                            title,
                            (gint) RINT (value),
@@ -820,6 +821,7 @@
         }
 
       gimp_statusbar_push (statusbar, context,
+                           stock_id,
                            statusbar->length_format_str,
                            title,
                            value * unit_factor / resolution,
@@ -830,6 +832,7 @@
 void
 gimp_statusbar_replace (GimpStatusbar *statusbar,
                         const gchar   *context,
+                        const gchar   *stock_id,
                         const gchar   *format,
                         ...)
 {
@@ -840,13 +843,14 @@
   g_return_if_fail (format != NULL);
 
   va_start (args, format);
-  gimp_statusbar_replace_valist (statusbar, context, format, args);
+  gimp_statusbar_replace_valist (statusbar, context, stock_id, format, args);
   va_end (args);
 }
 
 void
 gimp_statusbar_replace_valist (GimpStatusbar *statusbar,
                                const gchar   *context,
+                               const gchar   *stock_id,
                                const gchar   *format,
                                va_list        args)
 {
@@ -869,6 +873,9 @@
 
       if (msg->context_id == context_id)
         {
+          g_free (msg->stock_id);
+          msg->stock_id = g_strdup (stock_id);
+
           g_free (msg->text);
           msg->text = message;
 
@@ -879,9 +886,10 @@
         }
     }
 
-  msg = g_slice_new0 (GimpStatusbarMsg);
+  msg = g_slice_new (GimpStatusbarMsg);
 
   msg->context_id = context_id;
+  msg->stock_id   = g_strdup (stock_id);
   msg->text       = message;
 
   if (statusbar->temp_timeout_id)

Modified: trunk/app/display/gimpstatusbar.h
==============================================================================
--- trunk/app/display/gimpstatusbar.h	(original)
+++ trunk/app/display/gimpstatusbar.h	Mon Apr 14 07:28:43 2008
@@ -82,14 +82,17 @@
 
 void        gimp_statusbar_push             (GimpStatusbar       *statusbar,
                                              const gchar         *context,
+                                             const gchar         *stock_id,
                                              const gchar         *format,
-                                             ...) G_GNUC_PRINTF(3,4);
+                                             ...) G_GNUC_PRINTF(4,5);
 void        gimp_statusbar_push_valist      (GimpStatusbar       *statusbar,
                                              const gchar         *context,
+                                             const gchar         *stock_id,
                                              const gchar         *format,
                                              va_list              args);
 void        gimp_statusbar_push_coords      (GimpStatusbar       *statusbar,
                                              const gchar         *context,
+                                             const gchar         *stock_id,
                                              const gchar         *title,
                                              gdouble              x,
                                              const gchar         *separator,
@@ -97,16 +100,19 @@
                                              const gchar         *help);
 void        gimp_statusbar_push_length      (GimpStatusbar       *statusbar,
                                              const gchar         *context,
+                                             const gchar         *stock_id,
                                              const gchar         *title,
                                              GimpOrientationType  axis,
                                              gdouble              value,
                                              const gchar         *help);
 void        gimp_statusbar_replace          (GimpStatusbar       *statusbar,
                                              const gchar         *context,
+                                             const gchar         *stock_id,
                                              const gchar         *format,
-                                             ...) G_GNUC_PRINTF(3,4);
+                                             ...) G_GNUC_PRINTF(4,5);
 void        gimp_statusbar_replace_valist   (GimpStatusbar       *statusbar,
                                              const gchar         *context,
+                                             const gchar         *stock_id,
                                              const gchar         *format,
                                              va_list              args);
 const gchar * gimp_statusbar_peek           (GimpStatusbar       *statusbar,

Modified: trunk/app/tools/gimpeditselectiontool.c
==============================================================================
--- trunk/app/tools/gimpeditselectiontool.c	(original)
+++ trunk/app/tools/gimpeditselectiontool.c	Mon Apr 14 07:28:43 2008
@@ -159,7 +159,9 @@
   gint                   num_groups;
   const gchar           *undo_desc;
 
-  edit_select = g_object_new (GIMP_TYPE_EDIT_SELECTION_TOOL, NULL);
+  edit_select = g_object_new (GIMP_TYPE_EDIT_SELECTION_TOOL,
+                              "tool-info", parent_tool->tool_info,
+                              NULL);
 
   edit_select->propagate_release = propagate_release;
 

Modified: trunk/app/tools/gimptool.c
==============================================================================
--- trunk/app/tools/gimptool.c	(original)
+++ trunk/app/tools/gimptool.c	Mon Apr 14 07:28:43 2008
@@ -840,6 +840,7 @@
                        ...)
 {
   GimpDisplayShell *shell;
+  const gchar      *stock_id;
   va_list           args;
 
   g_return_if_fail (GIMP_IS_TOOL (tool));
@@ -848,10 +849,12 @@
 
   shell = GIMP_DISPLAY_SHELL (display->shell);
 
+  stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool->tool_info));
+
   va_start (args, format);
 
   gimp_statusbar_push_valist (GIMP_STATUSBAR (shell->statusbar),
-                              G_OBJECT_TYPE_NAME (tool),
+                              G_OBJECT_TYPE_NAME (tool), stock_id,
                               format, args);
 
   va_end (args);
@@ -870,14 +873,17 @@
                               const gchar *help)
 {
   GimpDisplayShell *shell;
+  const gchar      *stock_id;
 
   g_return_if_fail (GIMP_IS_TOOL (tool));
   g_return_if_fail (GIMP_IS_DISPLAY (display));
 
   shell = GIMP_DISPLAY_SHELL (display->shell);
 
+  stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool->tool_info));
+
   gimp_statusbar_push_coords (GIMP_STATUSBAR (shell->statusbar),
-                              G_OBJECT_TYPE_NAME (tool),
+                              G_OBJECT_TYPE_NAME (tool), stock_id,
                               title, x, separator, y, help);
 
   tool->status_displays = g_list_remove (tool->status_displays, display);
@@ -893,14 +899,17 @@
                               const gchar         *help)
 {
   GimpDisplayShell *shell;
+  const gchar      *stock_id;
 
   g_return_if_fail (GIMP_IS_TOOL (tool));
   g_return_if_fail (GIMP_IS_DISPLAY (display));
 
   shell = GIMP_DISPLAY_SHELL (display->shell);
 
+  stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool->tool_info));
+
   gimp_statusbar_push_length (GIMP_STATUSBAR (shell->statusbar),
-                              G_OBJECT_TYPE_NAME (tool),
+                              G_OBJECT_TYPE_NAME (tool), stock_id,
                               title, axis, value, help);
 
   tool->status_displays = g_list_remove (tool->status_displays, display);
@@ -914,6 +923,7 @@
                           ...)
 {
   GimpDisplayShell *shell;
+  const gchar      *stock_id;
   va_list           args;
 
   g_return_if_fail (GIMP_IS_TOOL (tool));
@@ -922,10 +932,12 @@
 
   shell = GIMP_DISPLAY_SHELL (display->shell);
 
+  stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool->tool_info));
+
   va_start (args, format);
 
   gimp_statusbar_replace_valist (GIMP_STATUSBAR (shell->statusbar),
-                                 G_OBJECT_TYPE_NAME (tool),
+                                 G_OBJECT_TYPE_NAME (tool), stock_id,
                                  format, args);
 
   va_end (args);



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