diff --git a/ChangeLog b/ChangeLog index 98d74451a0..d5af4389ea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2008-04-14 Sven Neumann + + * 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. + 2008-04-13 Sven Neumann * app/tools/gimptool.h: formatting. diff --git a/app/display/gimpdisplayshell-title.c b/app/display/gimpdisplayshell-title.c index 190ede6663..d68faf847a 100644 --- a/app/display/gimpdisplayshell-title.c +++ b/app/display/gimpdisplayshell-title.c @@ -108,13 +108,14 @@ gimp_display_shell_update_title_idle (gpointer data) 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; diff --git a/app/display/gimpstatusbar.c b/app/display/gimpstatusbar.c index 64a79847c3..8c6a2995e4 100644 --- a/app/display/gimpstatusbar.c +++ b/app/display/gimpstatusbar.c @@ -180,11 +180,6 @@ gimp_statusbar_init (GimpStatusbar *statusbar) 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 @@ gimp_statusbar_set_text (GimpStatusbar *statusbar, 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 @@ gimp_statusbar_update (GimpStatusbar *statusbar) 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 @@ gimp_statusbar_fill (GimpStatusbar *statusbar) void gimp_statusbar_push (GimpStatusbar *statusbar, const gchar *context, + const gchar *stock_id, const gchar *format, ...) { @@ -659,13 +653,14 @@ gimp_statusbar_push (GimpStatusbar *statusbar, 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 @@ gimp_statusbar_push_valist (GimpStatusbar *statusbar, } } - 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 @@ gimp_statusbar_push_valist (GimpStatusbar *statusbar, 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 @@ gimp_statusbar_push_coords (GimpStatusbar *statusbar, 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_statusbar_push_coords (GimpStatusbar *statusbar, 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 @@ gimp_statusbar_push_coords (GimpStatusbar *statusbar, 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 @@ gimp_statusbar_push_length (GimpStatusbar *statusbar, 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_length (GimpStatusbar *statusbar, } gimp_statusbar_push (statusbar, context, + stock_id, statusbar->length_format_str, title, value * unit_factor / resolution, @@ -830,6 +832,7 @@ gimp_statusbar_push_length (GimpStatusbar *statusbar, void gimp_statusbar_replace (GimpStatusbar *statusbar, const gchar *context, + const gchar *stock_id, const gchar *format, ...) { @@ -840,13 +843,14 @@ gimp_statusbar_replace (GimpStatusbar *statusbar, 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 @@ gimp_statusbar_replace_valist (GimpStatusbar *statusbar, 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 @@ gimp_statusbar_replace_valist (GimpStatusbar *statusbar, } } - 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) diff --git a/app/display/gimpstatusbar.h b/app/display/gimpstatusbar.h index 9597e44ec5..69b789d16f 100644 --- a/app/display/gimpstatusbar.h +++ b/app/display/gimpstatusbar.h @@ -82,14 +82,17 @@ void gimp_statusbar_fill (GimpStatusbar *statusbar); 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 @@ void gimp_statusbar_push_coords (GimpStatusbar *statusbar, 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, diff --git a/app/tools/gimpeditselectiontool.c b/app/tools/gimpeditselectiontool.c index 918ecf467a..f3b3856188 100644 --- a/app/tools/gimpeditselectiontool.c +++ b/app/tools/gimpeditselectiontool.c @@ -159,7 +159,9 @@ gimp_edit_selection_tool_start (GimpTool *parent_tool, 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; diff --git a/app/tools/gimptool.c b/app/tools/gimptool.c index f5296d6f21..a20945e637 100644 --- a/app/tools/gimptool.c +++ b/app/tools/gimptool.c @@ -840,6 +840,7 @@ gimp_tool_push_status (GimpTool *tool, ...) { GimpDisplayShell *shell; + const gchar *stock_id; va_list args; g_return_if_fail (GIMP_IS_TOOL (tool)); @@ -848,10 +849,12 @@ gimp_tool_push_status (GimpTool *tool, 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 @@ gimp_tool_push_status_coords (GimpTool *tool, 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 @@ gimp_tool_push_status_length (GimpTool *tool, 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 @@ gimp_tool_replace_status (GimpTool *tool, ...) { GimpDisplayShell *shell; + const gchar *stock_id; va_list args; g_return_if_fail (GIMP_IS_TOOL (tool)); @@ -922,10 +932,12 @@ gimp_tool_replace_status (GimpTool *tool, 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);