code cleanup, seems to fix bug #376668.

2006-11-22  Sven Neumann  <sven@gimp.org>

	* libgimpwidgets/gimpchainbutton.c: code cleanup, seems to fix
bug
	#376668.
This commit is contained in:
Sven Neumann 2006-11-22 08:05:13 +00:00 committed by Sven Neumann
parent 2e54bc77e0
commit 886e2f0139
2 changed files with 21 additions and 13 deletions

View file

@ -1,3 +1,8 @@
2006-11-22 Sven Neumann <sven@gimp.org>
* libgimpwidgets/gimpchainbutton.c: code cleanup, seems to fix bug
#376668.
2006-11-21 Michael Natterer <mitch@gimp.org>
* tools/pdbgen/pdb/brush.pdb (brush_get_pixels): the pixmap's size

View file

@ -59,6 +59,7 @@ static void gimp_chain_button_clicked_callback (GtkWidget *widget,
static gboolean gimp_chain_button_draw_lines (GtkWidget *widget,
GdkEventExpose *eevent,
GimpChainButton *button);
static void gimp_chain_button_update_image (GimpChainButton *button);
G_DEFINE_TYPE (GimpChainButton, gimp_chain_button, GTK_TYPE_TABLE)
@ -125,7 +126,6 @@ gimp_chain_button_init (GimpChainButton *button)
gtk_button_set_relief (GTK_BUTTON (button->button), GTK_RELIEF_NONE);
gtk_container_add (GTK_CONTAINER (button->button), button->image);
gtk_widget_show (button->image);
g_signal_connect (button->button, "clicked",
G_CALLBACK (gimp_chain_button_clicked_callback),
@ -150,11 +150,8 @@ gimp_chain_button_constructor (GType type,
button = GIMP_CHAIN_BUTTON (object);
gtk_image_set_from_stock
(GTK_IMAGE (button->image),
gimp_chain_stock_items[((button->position & GIMP_CHAIN_LEFT) << 1) +
button->active ? 0 : 1],
GTK_ICON_SIZE_BUTTON);
gimp_chain_button_update_image (button);
gtk_widget_show (button->image);
if (button->position & GIMP_CHAIN_LEFT) /* are we a vertical chainbutton? */
{
@ -266,15 +263,9 @@ gimp_chain_button_set_active (GimpChainButton *button,
if (button->active != active)
{
guint num;
button->active = active ? TRUE : FALSE;
num = ((button->position & GIMP_CHAIN_LEFT) << 1) + (active ? 0 : 1);
gtk_image_set_from_stock (GTK_IMAGE (button->image),
gimp_chain_stock_items[num],
GTK_ICON_SIZE_BUTTON);
gimp_chain_button_update_image (button);
}
}
@ -401,3 +392,15 @@ gimp_chain_button_draw_lines (GtkWidget *widget,
return TRUE;
}
static void
gimp_chain_button_update_image (GimpChainButton *button)
{
guint i;
i = ((button->position & GIMP_CHAIN_LEFT) << 1) + (button->active ? 0 : 1);
gtk_image_set_from_stock (GTK_IMAGE (button->image),
gimp_chain_stock_items[num],
GTK_ICON_SIZE_BUTTON);
}