summaryrefslogtreecommitdiff
path: root/capplets/common
diff options
context:
space:
mode:
authorBradford Hovinen <hovinen@ximian.com>2001-12-17 19:32:15 +0000
committerBradford Hovinen (Gdict maintainer) <hovinen@src.gnome.org>2001-12-17 19:32:15 +0000
commit250f23b97b497346e6a60b667b9d8a09ca524c3b (patch)
tree4fc5caae94ee02d5dccb5fdf465c751a7097a30e /capplets/common
parent7b408b24fca3ca1b1c9a703bc3bd3dcc66bc745b (diff)
downloadgnome-control-center-250f23b97b497346e6a60b667b9d8a09ca524c3b.tar.gz
Work correctly with multiple callback signatures
2001-12-17 Bradford Hovinen <hovinen@ximian.com> * gconf-property-editor.c (peditor_string_widget_changed): Work correctly with multiple callback signatures (gconf_peditor_new_string): Use changed signal
Diffstat (limited to 'capplets/common')
-rw-r--r--capplets/common/ChangeLog4
-rw-r--r--capplets/common/gconf-property-editor.c28
-rw-r--r--capplets/common/gconf-property-editor.h3
3 files changed, 20 insertions, 15 deletions
diff --git a/capplets/common/ChangeLog b/capplets/common/ChangeLog
index bedac4105..09d410e0a 100644
--- a/capplets/common/ChangeLog
+++ b/capplets/common/ChangeLog
@@ -13,6 +13,10 @@
signal handler
(peditor_select_menu_value_changed): Use
gtk_option_menu_set_history
+ (guard_value_changed, gconf_peditor_widget_set_guard): Implement
+ (peditor_string_widget_changed): Work correctly with multiple
+ callback signatures
+ (gconf_peditor_new_string): Use changed signal
2001-12-08 Bradford Hovinen <hovinen@ximian.com>
diff --git a/capplets/common/gconf-property-editor.c b/capplets/common/gconf-property-editor.c
index 3ab359fc3..fc806eb68 100644
--- a/capplets/common/gconf-property-editor.c
+++ b/capplets/common/gconf-property-editor.c
@@ -311,9 +311,13 @@ peditor_string_value_changed (GConfEngine *engine, guint cnxn_id, GConfEntry *en
}
static void
-peditor_string_widget_changed (GConfPropertyEditor *peditor, GtkEntry *entry)
+peditor_string_widget_changed (GConfPropertyEditor *peditor)
{
GConfValue *value;
+ GtkEntry *entry;
+
+ /* I do this so that we don't have to deal with multiple callback signatures */
+ entry = g_object_get_data (peditor, "entry");
gconf_change_set_set_string (peditor->p->changeset, peditor->p->key, gtk_entry_get_text (entry));
gconf_change_set_check_value (peditor->p->changeset, peditor->p->key, &value);
@@ -334,11 +338,7 @@ gconf_peditor_new_string (GConfChangeSet *changeset, gchar *key, GtkWidget *entr
"object", entry,
NULL);
- g_signal_connect_swapped (G_OBJECT (entry), "insert_at_cursor",
- (GCallback) peditor_string_widget_changed, peditor);
- g_signal_connect_swapped (G_OBJECT (entry), "delete_from_cursor",
- (GCallback) peditor_string_widget_changed, peditor);
- g_signal_connect_swapped (G_OBJECT (entry), "paste_clipboard",
+ g_signal_connect_swapped (G_OBJECT (entry), "changed",
(GCallback) peditor_string_widget_changed, peditor);
g_object_set_data (peditor, "entry", entry);
@@ -534,17 +534,19 @@ gconf_peditor_new_select_radio (GConfChangeSet *changeset, gchar *key, GSList *r
}
static void
-guard_value_changed (GConfEngine *engine, guint cnxn_id, GConfEntry *entry, GtkWidget *widget)
-{
-}
-
-static void
-guard_widget_changed (GConfPropertyEditor *peditor, gchar *key, GConfValue *value, GtkWidget *widget)
+guard_value_changed (GConfPropertyEditor *peditor, const gchar *key, const GConfValue *value, GtkWidget *widget)
{
+ gtk_widget_set_sensitive (widget, gconf_value_get_bool (value));
}
void
-peditor_widget_set_guard (GConfPropertyEditor *peditor, GtkWidget *widget, gchar *key)
+gconf_peditor_widget_set_guard (GConfPropertyEditor *peditor, GtkWidget *widget)
{
+ GConfEngine *engine;
+
+ engine = gconf_engine_get_default ();
+ gtk_widget_set_sensitive (widget, gconf_engine_get_bool (engine, peditor->p->key, NULL));
+
+ g_signal_connect (G_OBJECT (peditor), "value-changed", (GCallback) guard_value_changed, widget);
}
diff --git a/capplets/common/gconf-property-editor.h b/capplets/common/gconf-property-editor.h
index 22b334e2e..367321ce9 100644
--- a/capplets/common/gconf-property-editor.h
+++ b/capplets/common/gconf-property-editor.h
@@ -76,8 +76,7 @@ GObject *gconf_peditor_new_select_radio (GConfChangeSet *changeset,
GSList *radio_group);
void gconf_peditor_widget_set_guard (GConfPropertyEditor *peditor,
- GtkWidget *widget,
- gchar *key);
+ GtkWidget *widget);
G_END_DECLS