made "enabled" an object property and removed the "enabled_changed"

2003-11-23  Sven Neumann  <sven@gimp.org>

	* libgimpwidgets/gimpcolordisplay.[ch]: made "enabled" an object
	property and removed the "enabled_changed" signal.

	* libgimpwidgets/gimpcolordisplaystack.c
	* app/widgets/gimpcolordisplayeditor.c: connect to "notify::enabled"
	instead.

	* libgimpwidgets/gimpwidgets.def: added new symbols.
This commit is contained in:
Sven Neumann 2003-11-23 13:08:56 +00:00 committed by Sven Neumann
parent cea0108806
commit c7f6f8c8a1
6 changed files with 84 additions and 31 deletions

View File

@ -1,3 +1,14 @@
2003-11-23 Sven Neumann <sven@gimp.org>
* libgimpwidgets/gimpcolordisplay.[ch]: made "enabled" an object
property and removed the "enabled_changed" signal.
* libgimpwidgets/gimpcolordisplaystack.c
* app/widgets/gimpcolordisplayeditor.c: connect to "notify::enabled"
instead.
* libgimpwidgets/gimpwidgets.def: added new symbols.
2003-11-23 Michael Natterer <mitch@gimp.org>
* libgimpwidgets/gimpcolordisplay.[ch]: added new signal

View File

@ -86,6 +86,7 @@ static void gimp_color_display_editor_reordered (GimpColorDisplayStack *
GimpColorDisplayEditor *editor);
static void gimp_color_display_editor_enabled (GimpColorDisplay *display,
GParamSpec *pspec,
GimpColorDisplayEditor *editor);
static void gimp_color_display_editor_enable_toggled (GtkCellRendererToggle *toggle,
const gchar *path,
@ -399,7 +400,7 @@ gimp_color_display_editor_new (GimpColorDisplayStack *stack)
DEST_COLUMN_FILTER, display,
-1);
g_signal_connect_object (display, "enabled_changed",
g_signal_connect_object (display, "notify::enabled",
G_CALLBACK (gimp_color_display_editor_enabled),
G_OBJECT (editor), 0);
}
@ -590,7 +591,7 @@ gimp_color_display_editor_added (GimpColorDisplayStack *stack,
DEST_COLUMN_FILTER, display,
-1);
g_signal_connect_object (display, "enabled_changed",
g_signal_connect_object (display, "notify::enabled",
G_CALLBACK (gimp_color_display_editor_enabled),
G_OBJECT (editor), 0);
@ -700,6 +701,7 @@ gimp_color_display_editor_reordered (GimpColorDisplayStack *stack,
static void
gimp_color_display_editor_enabled (GimpColorDisplay *display,
GParamSpec *pspec,
GimpColorDisplayEditor *editor)
{
GtkTreeIter iter;

View File

@ -30,16 +30,28 @@
#include "gimpcolordisplay.h"
enum
{
PROP_0,
PROP_ENABLED
};
enum
{
CHANGED,
ENABLED_CHANGED,
LAST_SIGNAL
};
static void gimp_color_display_class_init (GimpColorDisplayClass *klass);
static void gimp_color_display_init (GimpColorDisplay *display);
static void gimp_color_display_class_init (GimpColorDisplayClass *klass);
static void gimp_color_display_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_color_display_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static GObjectClass *parent_class = NULL;
@ -64,7 +76,7 @@ gimp_color_display_get_type (void)
NULL, /* class_data */
sizeof (GimpColorDisplay),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_color_display_init,
NULL /* instance_init */
};
display_type = g_type_register_static (G_TYPE_OBJECT,
@ -78,8 +90,19 @@ gimp_color_display_get_type (void)
static void
gimp_color_display_class_init (GimpColorDisplayClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->set_property = gimp_color_display_set_property;
object_class->get_property = gimp_color_display_get_property;
g_object_class_install_property (object_class, PROP_ENABLED,
g_param_spec_boolean ("enabled", NULL, NULL,
TRUE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
display_signals[CHANGED] =
g_signal_new ("changed",
G_TYPE_FROM_CLASS (klass),
@ -89,15 +112,6 @@ gimp_color_display_class_init (GimpColorDisplayClass *klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
display_signals[ENABLED_CHANGED] =
g_signal_new ("enabled_changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpColorDisplayClass, enabled_changed),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
klass->name = "Unnamed";
klass->help_id = NULL;
@ -111,9 +125,41 @@ gimp_color_display_class_init (GimpColorDisplayClass *klass)
}
static void
gimp_color_display_init (GimpColorDisplay *display)
gimp_color_display_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
display->enabled = TRUE;
GimpColorDisplay *display = GIMP_COLOR_DISPLAY (object);
switch (property_id)
{
case PROP_ENABLED:
display->enabled = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
gimp_color_display_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
GimpColorDisplay *display = GIMP_COLOR_DISPLAY (object);
switch (property_id)
{
case PROP_ENABLED:
g_value_set_boolean (value, display->enabled);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
GimpColorDisplay *
@ -215,14 +261,6 @@ gimp_color_display_changed (GimpColorDisplay *display)
g_signal_emit (display, display_signals[CHANGED], 0);
}
void
gimp_color_display_enabled_changed (GimpColorDisplay *display)
{
g_return_if_fail (GIMP_IS_COLOR_DISPLAY (display));
g_signal_emit (display, display_signals[ENABLED_CHANGED], 0);
}
void
gimp_color_display_set_enabled (GimpColorDisplay *display,
gboolean enabled)
@ -231,9 +269,9 @@ gimp_color_display_set_enabled (GimpColorDisplay *display,
if (enabled != display->enabled)
{
display->enabled = enabled ? TRUE : FALSE;
gimp_color_display_enabled_changed (display);
g_object_set (display,
"enabled", enabled,
NULL);
}
}

View File

@ -64,7 +64,6 @@ struct _GimpColorDisplayClass
/* signals */
void (* changed) (GimpColorDisplay *display);
void (* enabled_changed) (GimpColorDisplay *display);
};
@ -85,7 +84,6 @@ GtkWidget * gimp_color_display_configure (GimpColorDisplay *display);
void gimp_color_display_configure_reset (GimpColorDisplay *display);
void gimp_color_display_changed (GimpColorDisplay *display);
void gimp_color_display_enabled_changed (GimpColorDisplay *display);
void gimp_color_display_set_enabled (GimpColorDisplay *display,
gboolean enabled);

View File

@ -50,6 +50,7 @@ static void gimp_color_display_stack_finalize (GObject *o
static void gimp_color_display_stack_display_changed (GimpColorDisplay *display,
GimpColorDisplayStack *stack);
static void gimp_color_display_stack_display_enabled (GimpColorDisplay *display,
GParamSpec *pspec,
GimpColorDisplayStack *stack);
@ -219,7 +220,7 @@ gimp_color_display_stack_add (GimpColorDisplayStack *stack,
g_signal_connect_object (display, "changed",
G_CALLBACK (gimp_color_display_stack_display_changed),
G_OBJECT (stack), 0);
g_signal_connect_object (display, "enabled_changed",
g_signal_connect_object (display, "notify::enabled",
G_CALLBACK (gimp_color_display_stack_display_enabled),
G_OBJECT (stack), 0);
@ -336,6 +337,7 @@ gimp_color_display_stack_display_changed (GimpColorDisplay *display,
static void
gimp_color_display_stack_display_enabled (GimpColorDisplay *display,
GParamSpec *pspec,
GimpColorDisplayStack *stack)
{
gimp_color_display_stack_changed (stack);

View File

@ -25,6 +25,8 @@ EXPORTS
gimp_color_display_configure
gimp_color_display_configure_reset
gimp_color_display_convert
gimp_color_display_get_enabled
gimp_color_display_set_enabled
gimp_color_display_get_type
gimp_color_display_load_state
gimp_color_display_new