Implement (peditor_color_widget_changed): Use correct signature for the

2001-12-17  Bradford Hovinen  <hovinen@ximian.com>

	* gconf-property-editor.c (gconf_property_editor_get_key):
	Implement
	(peditor_color_widget_changed): Use correct signature for the
	signal handler
This commit is contained in:
Bradford Hovinen 2001-12-17 18:18:22 +00:00 committed by Bradford Hovinen (Gdict maintainer)
parent 7241f04206
commit aa5de9e7cc
3 changed files with 23 additions and 16 deletions

View file

@ -2,6 +2,15 @@
* gconf-property-editor.c (peditor_color_value_changed): Use a * gconf-property-editor.c (peditor_color_value_changed): Use a
local stack variable for the color rather than a pointer. Duh. local stack variable for the color rather than a pointer. Duh.
(peditor_select_menu_widget_changed): Use
gtk_option_menu_get_history
(peditor_select_menu_widget_changed): Accept option_menu as
parameter
(gconf_peditor_new_select_menu): Connect changed signal rather
than activate signal on the menu items
(gconf_property_editor_get_key): Implement
(peditor_color_widget_changed): Use correct signature for the
signal handler
2001-12-08 Bradford Hovinen <hovinen@ximian.com> 2001-12-08 Bradford Hovinen <hovinen@ximian.com>

View file

@ -239,6 +239,12 @@ gconf_property_editor_finalize (GObject *object)
G_OBJECT_CLASS (parent_class)->finalize (object); G_OBJECT_CLASS (parent_class)->finalize (object);
} }
const gchar *
gconf_property_editor_get_key (GConfPropertyEditor *peditor)
{
return peditor->p->key;
}
static void static void
peditor_boolean_value_changed (GConfEngine *engine, guint cnxn_id, GConfEntry *entry, GConfPropertyEditor *peditor) peditor_boolean_value_changed (GConfEngine *engine, guint cnxn_id, GConfEntry *entry, GConfPropertyEditor *peditor)
{ {
@ -372,14 +378,12 @@ peditor_color_value_changed (GConfEngine *engine, guint cnxn_id, GConfEntry *ent
} }
static void static void
peditor_color_widget_changed (GConfPropertyEditor *peditor, GnomeColorPicker *cp) peditor_color_widget_changed (GConfPropertyEditor *peditor, guint r, guint g, guint b, guint a, GnomeColorPicker *cp)
{ {
gchar *str; gchar *str;
guint8 r, g, b, a;
GConfValue *value; GConfValue *value;
gnome_color_picker_get_i8 (cp, &r, &g, &b, &a); str = g_strdup_printf ("#%02x%02x%02x", r >> 8, g >> 8, b >> 8);
str = g_strdup_printf ("#%02x%02x%02x", r, g, b);
gconf_change_set_set_string (peditor->p->changeset, peditor->p->key, str); gconf_change_set_set_string (peditor->p->changeset, peditor->p->key, str);
gconf_change_set_check_value (peditor->p->changeset, peditor->p->key, &value); gconf_change_set_check_value (peditor->p->changeset, peditor->p->key, &value);
@ -431,16 +435,12 @@ peditor_select_menu_value_changed (GConfEngine *engine, guint cnxn_id, GConfEntr
} }
static void static void
peditor_select_menu_widget_changed (GConfPropertyEditor *peditor, GtkMenuItem *item) peditor_select_menu_widget_changed (GConfPropertyEditor *peditor, GtkOptionMenu *option_menu)
{ {
GtkOptionMenu *option_menu;
GtkMenu *menu;
gint idx; gint idx;
GConfValue *value; GConfValue *value;
option_menu = g_object_get_data (G_OBJECT (peditor), "option-menu"); idx = gtk_option_menu_get_history (option_menu);
menu = GTK_MENU (gtk_option_menu_get_menu (option_menu));
idx = g_list_index (GTK_MENU_SHELL (menu)->children, item);
gconf_change_set_set_int (peditor->p->changeset, peditor->p->key, idx); gconf_change_set_set_int (peditor->p->changeset, peditor->p->key, idx);
@ -454,7 +454,6 @@ gconf_peditor_new_select_menu (GConfChangeSet *changeset, gchar *key, GtkWidget
GObject *peditor; GObject *peditor;
GConfEngine *engine; GConfEngine *engine;
GConfEntry *gconf_entry; GConfEntry *gconf_entry;
GtkMenu *menu;
GList *item; GList *item;
peditor = g_object_new (gconf_property_editor_get_type (), peditor = g_object_new (gconf_property_editor_get_type (),
@ -464,11 +463,8 @@ gconf_peditor_new_select_menu (GConfChangeSet *changeset, gchar *key, GtkWidget
"object", option_menu, "object", option_menu,
NULL); NULL);
menu = GTK_MENU (gtk_option_menu_get_menu (GTK_OPTION_MENU (option_menu))); g_signal_connect_swapped (G_OBJECT (option_menu), "changed",
(GCallback) peditor_select_menu_widget_changed, peditor);
for (item = GTK_MENU_SHELL (menu)->children; item != NULL; item = item->next)
g_signal_connect_swapped (G_OBJECT (item->data), "activate",
(GCallback) peditor_select_menu_widget_changed, peditor);
g_object_set_data (peditor, "option-menu", option_menu); g_object_set_data (peditor, "option-menu", option_menu);

View file

@ -54,6 +54,8 @@ struct _GConfPropertyEditorClass
GType gconf_property_editor_get_type (void); GType gconf_property_editor_get_type (void);
const gchar *gconf_property_editor_get_key (GConfPropertyEditor *peditor);
GObject *gconf_peditor_new_boolean (GConfChangeSet *changeset, GObject *gconf_peditor_new_boolean (GConfChangeSet *changeset,
gchar *key, gchar *key,
GtkWidget *checkbox); GtkWidget *checkbox);