Emit a "toggled" signal.

--Sven
This commit is contained in:
Sven Neumann 2000-08-27 22:41:52 +00:00
parent b53273ea70
commit 0016d9edb4
5 changed files with 62 additions and 2 deletions

View file

@ -1,3 +1,11 @@
2000-08-28 Sven Neumann <sven@gimp.org>
* libgimp/gimpchainbutton.[ch]: emit a "toggled" signal. This
is rarely useful since in most cases you want to connect to
the "changed" signal of the attached size_entries since you can
not know otherwise which of the attached entries needs to be
adjusted. Providing the signal is good style nevertheless.
2000-08-27 Michael Natterer <mitch@gimp.org>
* libgimp/gimp.c: NULL is the default log domain, not "".

View file

@ -59,8 +59,17 @@ static gint gimp_chain_button_draw_lines (GtkWidget *widget,
GdkEventExpose *eevent,
GimpChainButton *gcb);
enum
{
TOGGLED,
LAST_SIGNAL
};
static guint gimp_chain_button_signals[LAST_SIGNAL] = { 0 };
static GtkTableClass *parent_class = NULL;
static void
gimp_chain_button_destroy (GtkObject *object)
{
@ -95,6 +104,19 @@ gimp_chain_button_class_init (GimpChainButtonClass *class)
object_class->destroy = gimp_chain_button_destroy;
gimp_chain_button_signals[TOGGLED] =
gtk_signal_new ("toggled",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpChainButtonClass,
toggled),
gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
gtk_object_class_add_signals (object_class, gimp_chain_button_signals,
LAST_SIGNAL);
class->toggled = NULL;
widget_class->realize = gimp_chain_button_realize;
}
@ -306,6 +328,8 @@ gimp_chain_button_clicked_callback (GtkWidget *widget,
gtk_pixmap_set (GTK_PIXMAP(gcb->pixmap), gcb->chain, gcb->chain_mask);
else
gtk_pixmap_set (GTK_PIXMAP(gcb->pixmap), gcb->broken, gcb->broken_mask);
gtk_signal_emit (GTK_OBJECT (gcb), gimp_chain_button_signals[TOGGLED]);
}
static gint

View file

@ -72,7 +72,9 @@ struct _GimpChainButton
struct _GimpChainButtonClass
{
GtkButtonClass parent_class;
GtkTableClass parent_class;
void (* toggled) (GimpChainButton *gcb);
};

View file

@ -59,8 +59,17 @@ static gint gimp_chain_button_draw_lines (GtkWidget *widget,
GdkEventExpose *eevent,
GimpChainButton *gcb);
enum
{
TOGGLED,
LAST_SIGNAL
};
static guint gimp_chain_button_signals[LAST_SIGNAL] = { 0 };
static GtkTableClass *parent_class = NULL;
static void
gimp_chain_button_destroy (GtkObject *object)
{
@ -95,6 +104,19 @@ gimp_chain_button_class_init (GimpChainButtonClass *class)
object_class->destroy = gimp_chain_button_destroy;
gimp_chain_button_signals[TOGGLED] =
gtk_signal_new ("toggled",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpChainButtonClass,
toggled),
gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
gtk_object_class_add_signals (object_class, gimp_chain_button_signals,
LAST_SIGNAL);
class->toggled = NULL;
widget_class->realize = gimp_chain_button_realize;
}
@ -306,6 +328,8 @@ gimp_chain_button_clicked_callback (GtkWidget *widget,
gtk_pixmap_set (GTK_PIXMAP(gcb->pixmap), gcb->chain, gcb->chain_mask);
else
gtk_pixmap_set (GTK_PIXMAP(gcb->pixmap), gcb->broken, gcb->broken_mask);
gtk_signal_emit (GTK_OBJECT (gcb), gimp_chain_button_signals[TOGGLED]);
}
static gint

View file

@ -72,7 +72,9 @@ struct _GimpChainButton
struct _GimpChainButtonClass
{
GtkButtonClass parent_class;
GtkTableClass parent_class;
void (* toggled) (GimpChainButton *gcb);
};