simply use gimp_button_new() instead of g_object_new(). Don't set the

2006-06-10  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpeditor.c (gimp_editor_add_action_button): simply
	use gimp_button_new() instead of g_object_new(). Don't set the
	"use-stock" property and reordered some code. Keeps GtkButton from
	thinking that is has constructed the button's child itself and
	thus makes the function more rubust against changes in GtkButton.
This commit is contained in:
Michael Natterer
2006-06-10 17:48:33 +00:00
committed by Michael Natterer
parent e93c060f40
commit 10c8c709d3
2 changed files with 15 additions and 9 deletions

View File

@ -615,22 +615,14 @@ gimp_editor_add_action_button (GimpEditor *editor,
}
else
{
button = g_object_new (GIMP_TYPE_BUTTON,
"use-stock", TRUE,
NULL);
button = gimp_button_new ();
}
gtk_action_connect_proxy (action, button);
gtk_box_pack_start (GTK_BOX (editor->button_box), button, TRUE, TRUE, 0);
gtk_widget_show (button);
g_object_get (action,
"stock-id", &stock_id,
"tooltip", &tooltip,
NULL);
help_id = g_object_get_qdata (G_OBJECT (action), GIMP_HELP_ID);
old_child = gtk_bin_get_child (GTK_BIN (button));
if (old_child)
@ -642,6 +634,10 @@ gimp_editor_add_action_button (GimpEditor *editor,
g_free (stock_id);
gtk_action_connect_proxy (action, button);
gtk_box_pack_start (GTK_BOX (editor->button_box), button, TRUE, TRUE, 0);
gtk_widget_show (button);
va_start (args, action_name);
action_name = va_arg (args, const gchar *);
@ -698,6 +694,8 @@ gimp_editor_add_action_button (GimpEditor *editor,
NULL);
}
help_id = g_object_get_qdata (G_OBJECT (action), GIMP_HELP_ID);
if (tooltip || help_id)
gimp_help_set_help_data (button, tooltip, help_id);