added stock-id parameters to all statusbar setters.

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.


svn path=/trunk/; revision=25477
This commit is contained in:
Sven Neumann
2008-04-14 06:28:43 +00:00
committed by Sven Neumann
parent 9db8d2ef35
commit e7c5bf8086
6 changed files with 66 additions and 25 deletions

View File

@ -1,3 +1,15 @@
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.
2008-04-13 Sven Neumann <sven@gimp.org> 2008-04-13 Sven Neumann <sven@gimp.org>
* app/tools/gimptool.h: formatting. * app/tools/gimptool.h: formatting.

View File

@ -108,13 +108,14 @@ gimp_display_shell_update_title_idle (gpointer data)
config->image_status_format); config->image_status_format);
gimp_statusbar_replace (GIMP_STATUSBAR (shell->statusbar), "title", gimp_statusbar_replace (GIMP_STATUSBAR (shell->statusbar), "title",
"%s", title); NULL, "%s", title);
} }
else else
{ {
gdk_window_set_title (GTK_WIDGET (shell)->window, GIMP_NAME); 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; return FALSE;

View File

@ -180,11 +180,6 @@ gimp_statusbar_init (GimpStatusbar *statusbar)
gtk_widget_show (hbox); gtk_widget_show (hbox);
statusbar->cursor_label = gtk_label_new ("8888, 8888"); 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_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_box_pack_start (GTK_BOX (hbox), statusbar->cursor_label, FALSE, FALSE, 0);
gtk_widget_show (statusbar->cursor_label); gtk_widget_show (statusbar->cursor_label);
@ -541,11 +536,11 @@ gimp_statusbar_set_text (GimpStatusbar *statusbar,
static void static void
gimp_statusbar_update (GimpStatusbar *statusbar) gimp_statusbar_update (GimpStatusbar *statusbar)
{ {
const gchar *text = NULL; GimpStatusbarMsg *msg = NULL;
if (statusbar->messages) if (statusbar->messages)
{ {
GimpStatusbarMsg *msg = statusbar->messages->data; msg = statusbar->messages->data;
/* only allow progress messages while the progress is active */ /* only allow progress messages while the progress is active */
if (statusbar->progress_active) if (statusbar->progress_active)
@ -556,20 +551,18 @@ gimp_statusbar_update (GimpStatusbar *statusbar)
if (context_id != msg->context_id) if (context_id != msg->context_id)
return; 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); gimp_statusbar_set_text (statusbar, temp);
g_free (temp); g_free (temp);
} }
else 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 void
gimp_statusbar_push (GimpStatusbar *statusbar, gimp_statusbar_push (GimpStatusbar *statusbar,
const gchar *context, const gchar *context,
const gchar *stock_id,
const gchar *format, const gchar *format,
...) ...)
{ {
@ -659,13 +653,14 @@ gimp_statusbar_push (GimpStatusbar *statusbar,
g_return_if_fail (format != NULL); g_return_if_fail (format != NULL);
va_start (args, format); 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); va_end (args);
} }
void void
gimp_statusbar_push_valist (GimpStatusbar *statusbar, gimp_statusbar_push_valist (GimpStatusbar *statusbar,
const gchar *context, const gchar *context,
const gchar *stock_id,
const gchar *format, const gchar *format,
va_list args) 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->context_id = context_id;
msg->stock_id = g_strdup (stock_id);
msg->text = message; msg->text = message;
if (statusbar->temp_timeout_id) if (statusbar->temp_timeout_id)
@ -722,6 +718,7 @@ gimp_statusbar_push_valist (GimpStatusbar *statusbar,
void void
gimp_statusbar_push_coords (GimpStatusbar *statusbar, gimp_statusbar_push_coords (GimpStatusbar *statusbar,
const gchar *context, const gchar *context,
const gchar *stock_id,
const gchar *title, const gchar *title,
gdouble x, gdouble x,
const gchar *separator, const gchar *separator,
@ -742,6 +739,7 @@ gimp_statusbar_push_coords (GimpStatusbar *statusbar,
if (shell->unit == GIMP_UNIT_PIXEL) if (shell->unit == GIMP_UNIT_PIXEL)
{ {
gimp_statusbar_push (statusbar, context, gimp_statusbar_push (statusbar, context,
stock_id,
statusbar->cursor_format_str, statusbar->cursor_format_str,
title, title,
(gint) RINT (x), (gint) RINT (x),
@ -759,6 +757,7 @@ gimp_statusbar_push_coords (GimpStatusbar *statusbar,
gimp_image_get_resolution (shell->display->image, &xres, &yres); gimp_image_get_resolution (shell->display->image, &xres, &yres);
gimp_statusbar_push (statusbar, context, gimp_statusbar_push (statusbar, context,
stock_id,
statusbar->cursor_format_str, statusbar->cursor_format_str,
title, title,
x * unit_factor / xres, x * unit_factor / xres,
@ -771,6 +770,7 @@ gimp_statusbar_push_coords (GimpStatusbar *statusbar,
void void
gimp_statusbar_push_length (GimpStatusbar *statusbar, gimp_statusbar_push_length (GimpStatusbar *statusbar,
const gchar *context, const gchar *context,
const gchar *stock_id,
const gchar *title, const gchar *title,
GimpOrientationType axis, GimpOrientationType axis,
gdouble value, gdouble value,
@ -789,6 +789,7 @@ gimp_statusbar_push_length (GimpStatusbar *statusbar,
if (shell->unit == GIMP_UNIT_PIXEL) if (shell->unit == GIMP_UNIT_PIXEL)
{ {
gimp_statusbar_push (statusbar, context, gimp_statusbar_push (statusbar, context,
stock_id,
statusbar->length_format_str, statusbar->length_format_str,
title, title,
(gint) RINT (value), (gint) RINT (value),
@ -820,6 +821,7 @@ gimp_statusbar_push_length (GimpStatusbar *statusbar,
} }
gimp_statusbar_push (statusbar, context, gimp_statusbar_push (statusbar, context,
stock_id,
statusbar->length_format_str, statusbar->length_format_str,
title, title,
value * unit_factor / resolution, value * unit_factor / resolution,
@ -830,6 +832,7 @@ gimp_statusbar_push_length (GimpStatusbar *statusbar,
void void
gimp_statusbar_replace (GimpStatusbar *statusbar, gimp_statusbar_replace (GimpStatusbar *statusbar,
const gchar *context, const gchar *context,
const gchar *stock_id,
const gchar *format, const gchar *format,
...) ...)
{ {
@ -840,13 +843,14 @@ gimp_statusbar_replace (GimpStatusbar *statusbar,
g_return_if_fail (format != NULL); g_return_if_fail (format != NULL);
va_start (args, format); 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); va_end (args);
} }
void void
gimp_statusbar_replace_valist (GimpStatusbar *statusbar, gimp_statusbar_replace_valist (GimpStatusbar *statusbar,
const gchar *context, const gchar *context,
const gchar *stock_id,
const gchar *format, const gchar *format,
va_list args) va_list args)
{ {
@ -869,6 +873,9 @@ gimp_statusbar_replace_valist (GimpStatusbar *statusbar,
if (msg->context_id == context_id) if (msg->context_id == context_id)
{ {
g_free (msg->stock_id);
msg->stock_id = g_strdup (stock_id);
g_free (msg->text); g_free (msg->text);
msg->text = message; 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->context_id = context_id;
msg->stock_id = g_strdup (stock_id);
msg->text = message; msg->text = message;
if (statusbar->temp_timeout_id) if (statusbar->temp_timeout_id)

View File

@ -82,14 +82,17 @@ void gimp_statusbar_fill (GimpStatusbar *statusbar);
void gimp_statusbar_push (GimpStatusbar *statusbar, void gimp_statusbar_push (GimpStatusbar *statusbar,
const gchar *context, const gchar *context,
const gchar *stock_id,
const gchar *format, const gchar *format,
...) G_GNUC_PRINTF(3,4); ...) G_GNUC_PRINTF(4,5);
void gimp_statusbar_push_valist (GimpStatusbar *statusbar, void gimp_statusbar_push_valist (GimpStatusbar *statusbar,
const gchar *context, const gchar *context,
const gchar *stock_id,
const gchar *format, const gchar *format,
va_list args); va_list args);
void gimp_statusbar_push_coords (GimpStatusbar *statusbar, void gimp_statusbar_push_coords (GimpStatusbar *statusbar,
const gchar *context, const gchar *context,
const gchar *stock_id,
const gchar *title, const gchar *title,
gdouble x, gdouble x,
const gchar *separator, const gchar *separator,
@ -97,16 +100,19 @@ void gimp_statusbar_push_coords (GimpStatusbar *statusbar,
const gchar *help); const gchar *help);
void gimp_statusbar_push_length (GimpStatusbar *statusbar, void gimp_statusbar_push_length (GimpStatusbar *statusbar,
const gchar *context, const gchar *context,
const gchar *stock_id,
const gchar *title, const gchar *title,
GimpOrientationType axis, GimpOrientationType axis,
gdouble value, gdouble value,
const gchar *help); const gchar *help);
void gimp_statusbar_replace (GimpStatusbar *statusbar, void gimp_statusbar_replace (GimpStatusbar *statusbar,
const gchar *context, const gchar *context,
const gchar *stock_id,
const gchar *format, const gchar *format,
...) G_GNUC_PRINTF(3,4); ...) G_GNUC_PRINTF(4,5);
void gimp_statusbar_replace_valist (GimpStatusbar *statusbar, void gimp_statusbar_replace_valist (GimpStatusbar *statusbar,
const gchar *context, const gchar *context,
const gchar *stock_id,
const gchar *format, const gchar *format,
va_list args); va_list args);
const gchar * gimp_statusbar_peek (GimpStatusbar *statusbar, const gchar * gimp_statusbar_peek (GimpStatusbar *statusbar,

View File

@ -159,7 +159,9 @@ gimp_edit_selection_tool_start (GimpTool *parent_tool,
gint num_groups; gint num_groups;
const gchar *undo_desc; 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; edit_select->propagate_release = propagate_release;

View File

@ -840,6 +840,7 @@ gimp_tool_push_status (GimpTool *tool,
...) ...)
{ {
GimpDisplayShell *shell; GimpDisplayShell *shell;
const gchar *stock_id;
va_list args; va_list args;
g_return_if_fail (GIMP_IS_TOOL (tool)); g_return_if_fail (GIMP_IS_TOOL (tool));
@ -848,10 +849,12 @@ gimp_tool_push_status (GimpTool *tool,
shell = GIMP_DISPLAY_SHELL (display->shell); shell = GIMP_DISPLAY_SHELL (display->shell);
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool->tool_info));
va_start (args, format); va_start (args, format);
gimp_statusbar_push_valist (GIMP_STATUSBAR (shell->statusbar), gimp_statusbar_push_valist (GIMP_STATUSBAR (shell->statusbar),
G_OBJECT_TYPE_NAME (tool), G_OBJECT_TYPE_NAME (tool), stock_id,
format, args); format, args);
va_end (args); va_end (args);
@ -870,14 +873,17 @@ gimp_tool_push_status_coords (GimpTool *tool,
const gchar *help) const gchar *help)
{ {
GimpDisplayShell *shell; GimpDisplayShell *shell;
const gchar *stock_id;
g_return_if_fail (GIMP_IS_TOOL (tool)); g_return_if_fail (GIMP_IS_TOOL (tool));
g_return_if_fail (GIMP_IS_DISPLAY (display)); g_return_if_fail (GIMP_IS_DISPLAY (display));
shell = GIMP_DISPLAY_SHELL (display->shell); 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), 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); title, x, separator, y, help);
tool->status_displays = g_list_remove (tool->status_displays, display); tool->status_displays = g_list_remove (tool->status_displays, display);
@ -893,14 +899,17 @@ gimp_tool_push_status_length (GimpTool *tool,
const gchar *help) const gchar *help)
{ {
GimpDisplayShell *shell; GimpDisplayShell *shell;
const gchar *stock_id;
g_return_if_fail (GIMP_IS_TOOL (tool)); g_return_if_fail (GIMP_IS_TOOL (tool));
g_return_if_fail (GIMP_IS_DISPLAY (display)); g_return_if_fail (GIMP_IS_DISPLAY (display));
shell = GIMP_DISPLAY_SHELL (display->shell); 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), gimp_statusbar_push_length (GIMP_STATUSBAR (shell->statusbar),
G_OBJECT_TYPE_NAME (tool), G_OBJECT_TYPE_NAME (tool), stock_id,
title, axis, value, help); title, axis, value, help);
tool->status_displays = g_list_remove (tool->status_displays, display); tool->status_displays = g_list_remove (tool->status_displays, display);
@ -914,6 +923,7 @@ gimp_tool_replace_status (GimpTool *tool,
...) ...)
{ {
GimpDisplayShell *shell; GimpDisplayShell *shell;
const gchar *stock_id;
va_list args; va_list args;
g_return_if_fail (GIMP_IS_TOOL (tool)); g_return_if_fail (GIMP_IS_TOOL (tool));
@ -922,10 +932,12 @@ gimp_tool_replace_status (GimpTool *tool,
shell = GIMP_DISPLAY_SHELL (display->shell); shell = GIMP_DISPLAY_SHELL (display->shell);
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool->tool_info));
va_start (args, format); va_start (args, format);
gimp_statusbar_replace_valist (GIMP_STATUSBAR (shell->statusbar), gimp_statusbar_replace_valist (GIMP_STATUSBAR (shell->statusbar),
G_OBJECT_TYPE_NAME (tool), G_OBJECT_TYPE_NAME (tool), stock_id,
format, args); format, args);
va_end (args); va_end (args);