1
/* -*- mode: c; style: linux -*- */
3
/* gconf-property-editor.c
4
* Copyright (C) 2001 Ximian, Inc.
6
* Written by Bradford Hovinen <hovinen@ximian.com>
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation; either version 2, or (at your option)
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program; if not, write to the Free Software
20
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
32
#include "gconf-property-editor.h"
33
#include "cc-marshal.h"
45
PROP_CONV_TO_WIDGET_CB,
46
PROP_CONV_FROM_WIDGET_CB,
52
struct _GConfPropertyEditorPrivate
56
GConfChangeSet *changeset;
58
GConfPEditorValueConvFn conv_to_widget_cb;
59
GConfPEditorValueConvFn conv_from_widget_cb;
60
GConfClientNotifyFunc callback;
64
GFreeFunc data_free_cb;
70
GConfPEditorGetValueFn enum_val_true_fn;
71
gpointer enum_val_true_fn_data;
74
} GConfPropertyEditorEnumData;
76
static guint peditor_signals[LAST_SIGNAL];
78
static void gconf_property_editor_set_prop (GObject *object,
82
static void gconf_property_editor_get_prop (GObject *object,
87
static void gconf_property_editor_finalize (GObject *object);
89
static GObject *gconf_peditor_new (const gchar *key,
90
GConfClientNotifyFunc cb,
91
GConfChangeSet *changeset,
93
const gchar *first_prop_name,
95
const gchar *first_custom,
98
G_DEFINE_TYPE (GConfPropertyEditor, gconf_property_editor, G_TYPE_OBJECT)
100
#define GCONF_PROPERTY_EDITOR_GET_PRIVATE(object) \
101
(G_TYPE_INSTANCE_GET_PRIVATE ((object), gconf_property_editor_get_type (), GConfPropertyEditorPrivate))
105
gconf_property_editor_conv_default (GConfPropertyEditor *peditor,
106
const GConfValue *value)
108
return gconf_value_copy (value);
112
gconf_property_editor_init (GConfPropertyEditor *gconf_property_editor)
114
gconf_property_editor->p = GCONF_PROPERTY_EDITOR_GET_PRIVATE (gconf_property_editor);
115
gconf_property_editor->p->conv_to_widget_cb = gconf_property_editor_conv_default;
116
gconf_property_editor->p->conv_from_widget_cb = gconf_property_editor_conv_default;
117
gconf_property_editor->p->inited = FALSE;
121
gconf_property_editor_class_init (GConfPropertyEditorClass *class)
123
GObjectClass *object_class;
125
object_class = G_OBJECT_CLASS (class);
127
object_class->finalize = gconf_property_editor_finalize;
128
object_class->set_property = gconf_property_editor_set_prop;
129
object_class->get_property = gconf_property_editor_get_prop;
131
g_object_class_install_property
132
(object_class, PROP_KEY,
133
g_param_spec_string ("key",
135
_("GConf key to which this property editor is attached"),
138
g_object_class_install_property
139
(object_class, PROP_CALLBACK,
140
g_param_spec_pointer ("callback",
142
_("Issue this callback when the value associated with key gets changed"),
144
g_object_class_install_property
145
(object_class, PROP_CHANGESET,
146
g_param_spec_pointer ("changeset",
148
_("GConf change set containing data to be forwarded to the gconf client on apply"),
150
g_object_class_install_property
151
(object_class, PROP_CONV_TO_WIDGET_CB,
152
g_param_spec_pointer ("conv-to-widget-cb",
153
_("Conversion to widget callback"),
154
_("Callback to be issued when data are to be converted from GConf to the widget"),
156
g_object_class_install_property
157
(object_class, PROP_CONV_FROM_WIDGET_CB,
158
g_param_spec_pointer ("conv-from-widget-cb",
159
_("Conversion from widget callback"),
160
_("Callback to be issued when data are to be converted to GConf from the widget"),
162
g_object_class_install_property
163
(object_class, PROP_UI_CONTROL,
164
g_param_spec_object ("ui-control",
166
_("Object that controls the property (normally a widget)"),
170
peditor_signals[VALUE_CHANGED] =
171
g_signal_new ("value-changed",
172
G_TYPE_FROM_CLASS (object_class), 0,
173
G_STRUCT_OFFSET (GConfPropertyEditorClass, value_changed),
175
(GSignalCMarshaller) cc_marshal_VOID__STRING_POINTER,
176
G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_POINTER);
178
g_object_class_install_property
179
(object_class, PROP_DATA,
180
g_param_spec_pointer ("data",
181
_("Property editor object data"),
182
_("Custom data required by the specific property editor"),
185
g_object_class_install_property
186
(object_class, PROP_DATA_FREE_CB,
187
g_param_spec_pointer ("data-free-cb",
188
_("Property editor data freeing callback"),
189
_("Callback to be issued when property editor object data is to be freed"),
192
g_type_class_add_private (class, sizeof (GConfPropertyEditorPrivate));
196
gconf_property_editor_set_prop (GObject *object,
201
GConfPropertyEditor *peditor;
205
g_return_if_fail (object != NULL);
206
g_return_if_fail (IS_GCONF_PROPERTY_EDITOR (object));
208
peditor = GCONF_PROPERTY_EDITOR (object);
212
peditor->p->key = g_value_dup_string (value);
216
client = gconf_client_get_default ();
217
cb = g_value_get_pointer (value);
218
peditor->p->callback = (GConfClientNotifyFunc) cb;
219
if (peditor->p->handler_id != 0) {
220
gconf_client_notify_remove (client,
221
peditor->p->handler_id);
223
peditor->p->handler_id =
224
gconf_client_notify_add (client, peditor->p->key,
225
peditor->p->callback,
226
peditor, NULL, NULL);
227
g_object_unref (client);
231
peditor->p->changeset = g_value_get_pointer (value);
234
case PROP_CONV_TO_WIDGET_CB:
235
peditor->p->conv_to_widget_cb = g_value_get_pointer (value);
238
case PROP_CONV_FROM_WIDGET_CB:
239
peditor->p->conv_from_widget_cb = g_value_get_pointer (value);
242
case PROP_UI_CONTROL:
243
peditor->p->ui_control = g_value_get_object (value);
244
g_object_weak_ref (peditor->p->ui_control, (GWeakNotify) g_object_unref, object);
247
peditor->p->data = g_value_get_pointer (value);
249
case PROP_DATA_FREE_CB:
250
peditor->p->data_free_cb = g_value_get_pointer (value);
253
g_warning ("Bad argument set");
259
gconf_property_editor_get_prop (GObject *object,
264
GConfPropertyEditor *peditor;
266
g_return_if_fail (object != NULL);
267
g_return_if_fail (IS_GCONF_PROPERTY_EDITOR (object));
269
peditor = GCONF_PROPERTY_EDITOR (object);
273
g_value_set_string (value, peditor->p->key);
277
g_value_set_pointer (value, peditor->p->changeset);
281
g_value_set_pointer (value, peditor->p->data);
284
g_warning ("Bad argument get");
290
gconf_property_editor_finalize (GObject *object)
292
GConfPropertyEditor *gconf_property_editor;
294
g_return_if_fail (object != NULL);
295
g_return_if_fail (IS_GCONF_PROPERTY_EDITOR (object));
297
gconf_property_editor = GCONF_PROPERTY_EDITOR (object);
299
g_free (gconf_property_editor->p->key);
301
if (gconf_property_editor->p->data_free_cb)
302
gconf_property_editor->p->data_free_cb (gconf_property_editor->p->data);
304
if (gconf_property_editor->p->handler_id != 0) {
307
client = gconf_client_get_default ();
308
gconf_client_notify_remove (client,
309
gconf_property_editor->p->handler_id);
310
g_object_unref (client);
313
G_OBJECT_CLASS (gconf_property_editor_parent_class)->finalize (object);
317
gconf_peditor_new (const gchar *key,
318
GConfClientNotifyFunc cb,
319
GConfChangeSet *changeset,
321
const gchar *first_prop_name,
323
const gchar *first_custom,
328
GConfEntry *gconf_entry;
330
g_return_val_if_fail (key != NULL, NULL);
331
g_return_val_if_fail (cb != NULL, NULL);
333
obj = g_object_new (gconf_property_editor_get_type (),
336
"changeset", changeset,
337
"ui-control", ui_control,
340
g_object_set_valist (obj, first_prop_name, var_args);
345
va_start (custom_args, first_custom);
346
g_object_set_valist (obj, first_custom, custom_args);
347
va_end (custom_args);
350
client = gconf_client_get_default ();
351
gconf_entry = gconf_client_get_entry (client, GCONF_PROPERTY_EDITOR (obj)->p->key, NULL, TRUE, NULL);
352
GCONF_PROPERTY_EDITOR (obj)->p->callback (client, 0, gconf_entry, obj);
353
GCONF_PROPERTY_EDITOR (obj)->p->inited = TRUE;
355
gconf_entry_free (gconf_entry);
356
g_object_unref (client);
362
gconf_property_editor_get_key (GConfPropertyEditor *peditor)
364
return peditor->p->key;
368
gconf_property_editor_get_ui_control (GConfPropertyEditor *peditor)
370
return peditor->p->ui_control;
374
peditor_set_gconf_value (GConfPropertyEditor *peditor,
379
if (peditor->p->changeset != NULL) {
381
gconf_change_set_set (peditor->p->changeset, peditor->p->key, value);
383
gconf_change_set_unset (peditor->p->changeset, peditor->p->key);
385
GConfClient *client = gconf_client_get_default();
388
gconf_client_set (client, peditor->p->key, value, NULL);
390
gconf_client_unset (client, peditor->p->key, NULL);
392
g_object_unref (client);
398
peditor_boolean_value_changed (GConfClient *client,
401
GConfPropertyEditor *peditor)
403
GConfValue *value, *value_wid;
405
if (peditor->p->changeset != NULL)
406
gconf_change_set_remove (peditor->p->changeset, peditor->p->key);
408
if (entry && (value = gconf_entry_get_value (entry))) {
409
value_wid = peditor->p->conv_to_widget_cb (peditor, value);
410
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (peditor->p->ui_control), gconf_value_get_bool (value_wid));
411
gconf_value_free (value_wid);
416
peditor_switch_value_changed (GConfClient *client,
419
GConfPropertyEditor *peditor)
421
GConfValue *value, *value_wid;
423
if (peditor->p->changeset != NULL)
424
gconf_change_set_remove (peditor->p->changeset, peditor->p->key);
426
if (entry && (value = gconf_entry_get_value (entry))) {
427
value_wid = peditor->p->conv_to_widget_cb (peditor, value);
428
gtk_switch_set_active (GTK_SWITCH (peditor->p->ui_control), gconf_value_get_bool (value_wid));
429
gconf_value_free (value_wid);
434
peditor_boolean_widget_changed (GConfPropertyEditor *peditor,
437
GConfValue *value, *value_wid;
439
if (!peditor->p->inited) return;
440
value_wid = gconf_value_new (GCONF_VALUE_BOOL);
441
gconf_value_set_bool (value_wid, gtk_toggle_button_get_active (tb));
442
value = peditor->p->conv_from_widget_cb (peditor, value_wid);
443
peditor_set_gconf_value (peditor, peditor->p->key, value);
444
g_signal_emit (peditor, peditor_signals[VALUE_CHANGED], 0, peditor->p->key, value);
445
gconf_value_free (value_wid);
446
gconf_value_free (value);
450
peditor_switch_widget_changed (GtkSwitch *sw,
452
GConfPropertyEditor *peditor)
454
GConfValue *value, *value_wid;
456
if (!peditor->p->inited) return;
457
value_wid = gconf_value_new (GCONF_VALUE_BOOL);
458
gconf_value_set_bool (value_wid, gtk_switch_get_active (sw));
459
value = peditor->p->conv_from_widget_cb (peditor, value_wid);
460
peditor_set_gconf_value (peditor, peditor->p->key, value);
461
g_signal_emit (peditor, peditor_signals[VALUE_CHANGED], 0, peditor->p->key, value);
462
gconf_value_free (value_wid);
463
gconf_value_free (value);
467
gconf_peditor_new_boolean (GConfChangeSet *changeset,
470
const gchar *first_property_name,
476
g_return_val_if_fail (key != NULL, NULL);
477
g_return_val_if_fail (checkbox != NULL, NULL);
478
g_return_val_if_fail (GTK_IS_TOGGLE_BUTTON (checkbox), NULL);
480
va_start (var_args, first_property_name);
482
peditor = gconf_peditor_new
484
(GConfClientNotifyFunc) peditor_boolean_value_changed,
493
g_signal_connect_swapped (checkbox, "toggled",
494
(GCallback) peditor_boolean_widget_changed, peditor);
500
gconf_peditor_new_switch (GConfChangeSet *changeset,
503
const gchar *first_property_name,
509
g_return_val_if_fail (key != NULL, NULL);
510
g_return_val_if_fail (sw != NULL, NULL);
511
g_return_val_if_fail (GTK_IS_SWITCH (sw), NULL);
513
va_start (var_args, first_property_name);
515
peditor = gconf_peditor_new
517
(GConfClientNotifyFunc) peditor_switch_value_changed,
526
g_signal_connect (sw, "notify::active",
527
(GCallback) peditor_switch_widget_changed, peditor);
533
peditor_integer_value_changed (GConfClient *client,
536
GConfPropertyEditor *peditor)
538
GConfValue *value, *value_wid;
539
const char *entry_current_text;
540
int entry_current_integer;
542
if (peditor->p->changeset != NULL)
543
gconf_change_set_remove (peditor->p->changeset, peditor->p->key);
545
if (entry && (value = gconf_entry_get_value (entry))) {
546
value_wid = peditor->p->conv_to_widget_cb (peditor, value);
547
entry_current_text = gtk_entry_get_text (GTK_ENTRY (peditor->p->ui_control));
548
entry_current_integer = strtol (entry_current_text, NULL, 10);
549
if (entry_current_integer != gconf_value_get_int (value)) {
550
char *buf = g_strdup_printf ("%d", gconf_value_get_int (value_wid));
551
gtk_entry_set_text (GTK_ENTRY (peditor->p->ui_control), buf);
554
gconf_value_free (value_wid);
559
peditor_integer_widget_changed (GConfPropertyEditor *peditor,
562
GConfValue *value, *value_wid;
564
if (!peditor->p->inited) return;
566
value_wid = gconf_value_new (GCONF_VALUE_INT);
568
gconf_value_set_int (value_wid, strtol (gtk_entry_get_text (entry), NULL, 10));
569
value = peditor->p->conv_from_widget_cb (peditor, value_wid);
571
peditor_set_gconf_value (peditor, peditor->p->key, value);
573
g_signal_emit (peditor, peditor_signals[VALUE_CHANGED], 0, peditor->p->key, value);
574
gconf_value_free (value_wid);
575
gconf_value_free (value);
579
gconf_peditor_new_integer_valist (GConfChangeSet *changeset,
582
const gchar *first_property_name,
587
peditor = gconf_peditor_new
589
(GConfClientNotifyFunc) peditor_integer_value_changed,
595
g_signal_connect_swapped (entry, "changed",
596
(GCallback) peditor_integer_widget_changed, peditor);
602
gconf_peditor_new_integer (GConfChangeSet *changeset,
605
const gchar *first_property_name,
611
g_return_val_if_fail (key != NULL, NULL);
612
g_return_val_if_fail (entry != NULL, NULL);
613
g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
615
va_start (var_args, first_property_name);
617
peditor = gconf_peditor_new_integer_valist
618
(changeset, key, entry,
619
first_property_name, var_args);
627
peditor_string_value_changed (GConfClient *client,
630
GConfPropertyEditor *peditor)
632
GConfValue *value, *value_wid;
634
if (peditor->p->changeset != NULL)
635
gconf_change_set_remove (peditor->p->changeset, peditor->p->key);
637
if (entry && (value = gconf_entry_get_value (entry))) {
638
const char *entry_current_text;
639
const char *gconf_text;
641
value_wid = peditor->p->conv_to_widget_cb (peditor, value);
642
gconf_text = gconf_value_get_string (value_wid);
643
entry_current_text = gtk_entry_get_text (GTK_ENTRY (peditor->p->ui_control));
645
if (gconf_text && strcmp (entry_current_text, gconf_text) != 0) {
646
gtk_entry_set_text (GTK_ENTRY (peditor->p->ui_control), gconf_value_get_string (value_wid));
648
gconf_value_free (value_wid);
653
peditor_string_widget_changed (GConfPropertyEditor *peditor,
656
GConfValue *value, *value_wid;
658
if (!peditor->p->inited) return;
660
value_wid = gconf_value_new (GCONF_VALUE_STRING);
662
gconf_value_set_string (value_wid, gtk_entry_get_text (entry));
663
value = peditor->p->conv_from_widget_cb (peditor, value_wid);
665
peditor_set_gconf_value (peditor, peditor->p->key, value);
667
g_signal_emit (peditor, peditor_signals[VALUE_CHANGED], 0, peditor->p->key, value);
668
gconf_value_free (value_wid);
669
gconf_value_free (value);
673
gconf_peditor_new_string_valist (GConfChangeSet *changeset,
676
const gchar *first_property_name,
681
peditor = gconf_peditor_new
683
(GConfClientNotifyFunc) peditor_string_value_changed,
689
g_signal_connect_swapped (entry, "changed",
690
(GCallback) peditor_string_widget_changed, peditor);
696
gconf_peditor_new_string (GConfChangeSet *changeset,
699
const gchar *first_property_name,
705
g_return_val_if_fail (key != NULL, NULL);
706
g_return_val_if_fail (entry != NULL, NULL);
707
g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
709
va_start (var_args, first_property_name);
711
peditor = gconf_peditor_new_string_valist
712
(changeset, key, entry,
713
first_property_name, var_args);
721
peditor_color_value_changed (GConfClient *client,
724
GConfPropertyEditor *peditor)
726
GConfValue *value, *value_wid;
728
if (peditor->p->changeset != NULL)
729
gconf_change_set_remove (peditor->p->changeset, peditor->p->key);
731
if (entry && (value = gconf_entry_get_value (entry))) {
734
value_wid = peditor->p->conv_to_widget_cb (peditor, value);
735
spec = gconf_value_get_string (value_wid);
738
gdk_color_parse (gconf_value_get_string (value_wid), &color);
739
gtk_color_button_set_color (
740
GTK_COLOR_BUTTON (peditor->p->ui_control), &color);
742
gconf_value_free (value_wid);
747
peditor_color_widget_changed (GConfPropertyEditor *peditor,
751
GConfValue *value, *value_wid;
754
if (!peditor->p->inited) return;
756
value_wid = gconf_value_new (GCONF_VALUE_STRING);
757
gtk_color_button_get_color (cb, &color);
758
str = g_strdup_printf ("#%02x%02x%02x", color.red >> 8,
759
color.green >> 8, color.blue >> 8);
760
gconf_value_set_string (value_wid, str);
763
value = peditor->p->conv_from_widget_cb (peditor, value_wid);
765
peditor_set_gconf_value (peditor, peditor->p->key, value);
766
g_signal_emit (peditor, peditor_signals[VALUE_CHANGED], 0, peditor->p->key, value);
768
gconf_value_free (value_wid);
769
gconf_value_free (value);
773
gconf_peditor_new_color (GConfChangeSet *changeset,
776
const gchar *first_property_name,
782
g_return_val_if_fail (key != NULL, NULL);
783
g_return_val_if_fail (cb != NULL, NULL);
784
g_return_val_if_fail (GTK_IS_COLOR_BUTTON (cb), NULL);
786
va_start (var_args, first_property_name);
788
peditor = gconf_peditor_new
790
(GConfClientNotifyFunc) peditor_color_value_changed,
798
g_signal_connect_swapped (cb, "color_set",
799
(GCallback) peditor_color_widget_changed, peditor);
805
peditor_enum_int_from_string (GType type, const gchar *str, gboolean use_nick)
811
klass = g_type_class_ref (type);
813
val = g_enum_get_value_by_nick (klass, str);
815
val = g_enum_get_value_by_name (klass, str);
817
g_type_class_unref (klass);
826
peditor_enum_string_from_int (GType type, const int index, gboolean use_nick)
832
klass = g_type_class_ref (type);
833
val = g_enum_get_value (klass, index);
836
if (val->value_nick && use_nick)
837
ret = g_strdup (val->value_nick);
839
ret = g_strdup (val->value_name);
842
g_type_class_unref (klass);
848
peditor_enum_conv_to_widget (GConfPropertyEditor *peditor,
849
const GConfValue *value)
852
GConfPropertyEditorEnumData *data = peditor->p->data;
855
if (value->type == GCONF_VALUE_INT)
856
return gconf_value_copy (value);
858
ret = gconf_value_new (GCONF_VALUE_INT);
860
index = peditor_enum_int_from_string (data->enum_type,
861
gconf_value_get_string (value),
864
gconf_value_set_int (ret, index);
870
peditor_enum_conv_from_widget (GConfPropertyEditor *peditor,
871
const GConfValue *value)
874
GConfPropertyEditorEnumData *data = peditor->p->data;
877
if (value->type == GCONF_VALUE_STRING)
878
return gconf_value_copy (value);
880
ret = gconf_value_new (GCONF_VALUE_STRING);
881
str = peditor_enum_string_from_int (data->enum_type,
882
gconf_value_get_int (value),
884
gconf_value_set_string (ret, str);
891
peditor_combo_box_value_changed (GConfClient *client,
894
GConfPropertyEditor *peditor)
896
GConfValue *value, *value_wid;
898
if (peditor->p->changeset != NULL)
899
gconf_change_set_remove (peditor->p->changeset, peditor->p->key);
901
if (entry && (value = gconf_entry_get_value (entry))) {
902
value_wid = peditor->p->conv_to_widget_cb (peditor, value);
903
gtk_combo_box_set_active (GTK_COMBO_BOX (peditor->p->ui_control), gconf_value_get_int (value_wid));
904
gconf_value_free (value_wid);
909
peditor_combo_box_widget_changed (GConfPropertyEditor *peditor,
910
GtkComboBox *combo_box)
912
GConfValue *value, *value_wid;
914
if (!peditor->p->inited) return;
915
value_wid = gconf_value_new (GCONF_VALUE_INT);
916
gconf_value_set_int (value_wid, gtk_combo_box_get_active (combo_box));
917
value = peditor->p->conv_from_widget_cb (peditor, value_wid);
918
peditor_set_gconf_value (peditor, peditor->p->key, value);
919
g_signal_emit (peditor, peditor_signals[VALUE_CHANGED], 0, peditor->p->key, value);
920
gconf_value_free (value_wid);
922
gconf_value_free (value);
926
gconf_peditor_new_combo_box (GConfChangeSet *changeset,
928
GtkWidget *combo_box,
929
const gchar *first_property_name,
935
g_return_val_if_fail (key != NULL, NULL);
936
g_return_val_if_fail (combo_box != NULL, NULL);
937
g_return_val_if_fail (GTK_IS_COMBO_BOX (combo_box), NULL);
939
va_start (var_args, first_property_name);
941
peditor = gconf_peditor_new
943
(GConfClientNotifyFunc) peditor_combo_box_value_changed,
945
G_OBJECT (combo_box),
951
g_signal_connect_swapped (combo_box, "changed",
952
(GCallback) peditor_combo_box_widget_changed, peditor);
958
gconf_peditor_new_combo_box_with_enum (GConfChangeSet *changeset,
960
GtkWidget *combo_box,
963
const gchar *first_property_name,
967
GConfPropertyEditorEnumData *data;
970
g_return_val_if_fail (key != NULL, NULL);
971
g_return_val_if_fail (combo_box != NULL, NULL);
972
g_return_val_if_fail (GTK_IS_COMBO_BOX (combo_box), NULL);
973
g_return_val_if_fail (enum_type != G_TYPE_NONE, NULL);
975
data = g_new0 (GConfPropertyEditorEnumData, 1);
976
data->enum_type = enum_type;
977
data->use_nick = use_nick;
979
va_start (var_args, first_property_name);
981
peditor = gconf_peditor_new
983
(GConfClientNotifyFunc) peditor_combo_box_value_changed,
985
G_OBJECT (combo_box),
989
peditor_enum_conv_to_widget,
990
"conv-from-widget-cb",
991
peditor_enum_conv_from_widget,
1001
g_signal_connect_swapped (combo_box, "changed",
1002
(GCallback) peditor_combo_box_widget_changed, peditor);
1008
peditor_select_radio_value_changed (GConfClient *client,
1011
GConfPropertyEditor *peditor)
1013
GSList *group, *link;
1014
GConfValue *value, *value_wid;
1016
if (peditor->p->changeset != NULL)
1017
gconf_change_set_remove (peditor->p->changeset, peditor->p->key);
1019
if (entry && (value = gconf_entry_get_value (entry))) {
1020
value_wid = peditor->p->conv_to_widget_cb (peditor, value);
1021
group = g_slist_copy (gtk_radio_button_get_group (GTK_RADIO_BUTTON (peditor->p->ui_control)));
1022
group = g_slist_reverse (group);
1023
link = g_slist_nth (group, gconf_value_get_int (value_wid));
1024
if (link && link->data)
1025
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (link->data), TRUE);
1026
gconf_value_free (value_wid);
1027
g_slist_free (group);
1032
peditor_select_radio_widget_changed (GConfPropertyEditor *peditor,
1033
GtkToggleButton *tb)
1036
GConfValue *value, *value_wid;
1038
if (!peditor->p->inited) return;
1039
if (!gtk_toggle_button_get_active (tb)) return;
1041
value_wid = gconf_value_new (GCONF_VALUE_INT);
1042
group = g_slist_copy (gtk_radio_button_get_group (GTK_RADIO_BUTTON (peditor->p->ui_control)));
1043
group = g_slist_reverse (group);
1045
gconf_value_set_int (value_wid, g_slist_index (group, tb));
1046
value = peditor->p->conv_from_widget_cb (peditor, value_wid);
1048
peditor_set_gconf_value (peditor, peditor->p->key, value);
1049
g_signal_emit (peditor, peditor_signals[VALUE_CHANGED], 0, peditor->p->key, value);
1051
gconf_value_free (value_wid);
1052
gconf_value_free (value);
1053
g_slist_free (group);
1057
gconf_peditor_new_select_radio (GConfChangeSet *changeset,
1059
GSList *radio_group,
1060
const gchar *first_property_name,
1064
GtkRadioButton *first_button;
1068
g_return_val_if_fail (key != NULL, NULL);
1069
g_return_val_if_fail (radio_group != NULL, NULL);
1070
g_return_val_if_fail (radio_group->data != NULL, NULL);
1071
g_return_val_if_fail (GTK_IS_RADIO_BUTTON (radio_group->data), NULL);
1073
first_button = GTK_RADIO_BUTTON (radio_group->data);
1075
va_start (var_args, first_property_name);
1077
peditor = gconf_peditor_new
1079
(GConfClientNotifyFunc) peditor_select_radio_value_changed,
1081
G_OBJECT (first_button),
1082
first_property_name,
1087
for (item = radio_group; item != NULL; item = item->next)
1088
g_signal_connect_swapped (item->data, "toggled",
1089
(GCallback) peditor_select_radio_widget_changed, peditor);
1095
peditor_numeric_range_value_changed (GConfClient *client,
1098
GConfPropertyEditor *peditor)
1100
GConfValue *value, *value_wid;
1102
if (peditor->p->changeset != NULL)
1103
gconf_change_set_remove (peditor->p->changeset, peditor->p->key);
1105
if (entry && (value = gconf_entry_get_value (entry))) {
1106
value_wid = peditor->p->conv_to_widget_cb (peditor, value);
1108
switch (value_wid->type) {
1109
case GCONF_VALUE_FLOAT:
1110
gtk_adjustment_set_value (GTK_ADJUSTMENT (peditor->p->ui_control), gconf_value_get_float (value_wid));
1112
case GCONF_VALUE_INT:
1113
gtk_adjustment_set_value (GTK_ADJUSTMENT (peditor->p->ui_control), gconf_value_get_int (value_wid));
1116
g_warning ("Unknown type in range peditor: %d\n", value_wid->type);
1118
gconf_value_free (value_wid);
1123
peditor_numeric_range_widget_changed (GConfPropertyEditor *peditor,
1124
GtkAdjustment *adjustment)
1126
GConfValue *value, *value_wid, *default_value;
1127
GConfClient *client;
1129
if (!peditor->p->inited) return;
1131
/* We try to get the default type from the schemas. if not, we default
1134
client = gconf_client_get_default();
1136
default_value = gconf_client_get_default_from_schema (client,
1139
g_object_unref (client);
1141
if (default_value) {
1142
value_wid = gconf_value_new (default_value->type);
1143
gconf_value_free (default_value);
1145
g_warning ("Unable to find a default value for key for %s.\n"
1146
"I'll assume it is an integer, but that may break things.\n"
1147
"Please be sure that the associated schema is installed",
1149
value_wid = gconf_value_new (GCONF_VALUE_INT);
1152
g_assert (value_wid);
1154
if (value_wid->type == GCONF_VALUE_INT)
1155
gconf_value_set_int (value_wid, gtk_adjustment_get_value (adjustment));
1156
else if (value_wid->type == GCONF_VALUE_FLOAT)
1157
gconf_value_set_float (value_wid, gtk_adjustment_get_value (adjustment));
1159
g_warning ("unable to set a gconf key for %s of type %d",
1162
gconf_value_free (value_wid);
1165
value = peditor->p->conv_from_widget_cb (peditor, value_wid);
1166
peditor_set_gconf_value (peditor, peditor->p->key, value);
1167
g_signal_emit (peditor, peditor_signals[VALUE_CHANGED], 0, peditor->p->key, value);
1168
gconf_value_free (value_wid);
1169
gconf_value_free (value);
1173
gconf_peditor_new_numeric_range (GConfChangeSet *changeset,
1176
const gchar *first_property_name,
1180
GObject *adjustment = NULL;
1183
g_return_val_if_fail (key != NULL, NULL);
1184
g_return_val_if_fail (range != NULL, NULL);
1185
g_return_val_if_fail (GTK_IS_RANGE (range)||GTK_IS_SPIN_BUTTON (range), NULL);
1187
if (GTK_IS_RANGE (range))
1188
adjustment = G_OBJECT (gtk_range_get_adjustment (GTK_RANGE (range)));
1189
else if (GTK_IS_SPIN_BUTTON (range))
1190
adjustment = G_OBJECT (gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (range)));
1192
g_assert_not_reached ();
1194
va_start (var_args, first_property_name);
1196
peditor = gconf_peditor_new
1198
(GConfClientNotifyFunc) peditor_numeric_range_value_changed,
1201
first_property_name,
1206
g_signal_connect_swapped (adjustment, "value_changed",
1207
(GCallback) peditor_numeric_range_widget_changed, peditor);
1213
guard_get_bool (GConfPropertyEditor *peditor, const GConfValue *value)
1215
if (value->type == GCONF_VALUE_BOOL)
1216
return gconf_value_get_bool (value);
1219
GConfPropertyEditorEnumData *data = peditor->p->data;
1220
int index = peditor_enum_int_from_string (data->enum_type, gconf_value_get_string (value), data->use_nick);
1221
return (index != data->enum_val_false);
1226
guard_value_changed (GConfPropertyEditor *peditor,
1228
const GConfValue *value,
1231
gtk_widget_set_sensitive (widget, guard_get_bool (peditor, value));
1235
gconf_peditor_widget_set_guard (GConfPropertyEditor *peditor,
1238
GConfClient *client;
1241
g_return_if_fail (peditor != NULL);
1242
g_return_if_fail (IS_GCONF_PROPERTY_EDITOR (peditor));
1243
g_return_if_fail (widget != NULL);
1244
g_return_if_fail (GTK_IS_WIDGET (widget));
1246
client = gconf_client_get_default ();
1247
value = gconf_client_get (client, peditor->p->key, NULL);
1248
g_object_unref (client);
1251
gtk_widget_set_sensitive (widget, guard_get_bool (peditor, value));
1252
gconf_value_free (value);
1254
g_warning ("NULL GConf value: %s: possibly incomplete setup", peditor->p->key);
1257
g_signal_connect (peditor, "value-changed", (GCallback) guard_value_changed, widget);
1261
gconf_value_int_to_float (GConfPropertyEditor *ignored, const GConfValue *value)
1263
GConfValue *new_value;
1265
new_value = gconf_value_new (GCONF_VALUE_FLOAT);
1266
gconf_value_set_float (new_value, gconf_value_get_int (value));
1271
gconf_value_float_to_int (GConfPropertyEditor *ignored, const GConfValue *value)
1273
GConfValue *new_value;
1275
new_value = gconf_value_new (GCONF_VALUE_INT);
1276
gconf_value_set_int (new_value, gconf_value_get_float (value));
1281
peditor_font_value_changed (GConfClient *client,
1284
GConfPropertyEditor *peditor)
1286
GConfValue *value, *value_wid;
1288
if (peditor->p->changeset != NULL)
1289
gconf_change_set_remove (peditor->p->changeset, peditor->p->key);
1291
if (entry && (value = gconf_entry_get_value (entry))) {
1294
value_wid = peditor->p->conv_to_widget_cb (peditor, value);
1295
font = gconf_value_get_string (value_wid);
1296
gtk_font_button_set_font_name (GTK_FONT_BUTTON (peditor->p->ui_control),
1298
gconf_value_free (value_wid);
1303
peditor_font_widget_changed (GConfPropertyEditor *peditor,
1304
GtkFontButton *font_button)
1306
const gchar *font_name;
1307
GConfValue *value, *value_wid = NULL;
1309
if (!peditor->p->inited)
1312
font_name = gtk_font_button_get_font_name (font_button);
1314
value_wid = gconf_value_new (GCONF_VALUE_STRING);
1315
gconf_value_set_string (value_wid, font_name);
1317
value = peditor->p->conv_from_widget_cb (peditor, value_wid);
1319
peditor_set_gconf_value (peditor, peditor->p->key, value);
1320
g_signal_emit (peditor, peditor_signals[VALUE_CHANGED], 0, peditor->p->key, value);
1322
gconf_value_free (value_wid);
1323
gconf_value_free (value);
1327
gconf_peditor_new_font (GConfChangeSet *changeset,
1329
GtkWidget *font_button,
1330
const gchar *first_property_name,
1336
g_return_val_if_fail (key != NULL, NULL);
1337
g_return_val_if_fail (GTK_IS_FONT_BUTTON (font_button), NULL);
1339
va_start (var_args, first_property_name);
1341
peditor = gconf_peditor_new (key,
1342
(GConfClientNotifyFunc) peditor_font_value_changed,
1344
G_OBJECT (font_button),
1345
first_property_name,
1351
g_signal_connect_swapped (font_button, "font_set",
1352
(GCallback) peditor_font_widget_changed, peditor);
1358
peditor_enum_toggle_conv_to_widget (GConfPropertyEditor *peditor,
1359
const GConfValue *value)
1362
GConfPropertyEditorEnumData *data = peditor->p->data;
1365
if (value->type == GCONF_VALUE_BOOL)
1366
return gconf_value_copy (value);
1368
ret = gconf_value_new (GCONF_VALUE_BOOL);
1370
index = peditor_enum_int_from_string (data->enum_type,
1371
gconf_value_get_string (value),
1373
gconf_value_set_bool (ret, (index != data->enum_val_false));
1379
peditor_enum_toggle_conv_from_widget (GConfPropertyEditor *peditor,
1380
const GConfValue *value)
1383
GConfPropertyEditorEnumData *data = peditor->p->data;
1387
if (value->type == GCONF_VALUE_STRING)
1388
return gconf_value_copy (value);
1390
ret = gconf_value_new (GCONF_VALUE_STRING);
1391
if (gconf_value_get_bool (value))
1392
index = data->enum_val_true_fn (peditor, data->enum_val_true_fn_data);
1394
index = data->enum_val_false;
1396
str = peditor_enum_string_from_int (data->enum_type, index, data->use_nick);
1397
gconf_value_set_string (ret, str);
1404
gconf_peditor_new_enum_toggle (GConfChangeSet *changeset,
1406
GtkWidget *checkbox,
1408
GConfPEditorGetValueFn val_true_fn,
1412
const gchar *first_property_name,
1416
GConfPropertyEditorEnumData *enum_data;
1419
g_return_val_if_fail (key != NULL, NULL);
1420
g_return_val_if_fail (checkbox != NULL, NULL);
1421
g_return_val_if_fail (GTK_IS_TOGGLE_BUTTON (checkbox), NULL);
1423
enum_data = g_new0 (GConfPropertyEditorEnumData, 1);
1424
enum_data->enum_type = enum_type;
1425
enum_data->enum_val_true_fn = val_true_fn;
1426
enum_data->enum_val_true_fn_data = data;
1427
enum_data->enum_val_false = val_false;
1428
enum_data->use_nick = use_nick;
1430
va_start (var_args, first_property_name);
1432
peditor = gconf_peditor_new
1434
(GConfClientNotifyFunc) peditor_boolean_value_changed,
1436
G_OBJECT (checkbox),
1437
first_property_name,
1439
"conv-to-widget-cb",
1440
peditor_enum_toggle_conv_to_widget,
1441
"conv-from-widget-cb",
1442
peditor_enum_toggle_conv_from_widget,
1451
g_signal_connect_swapped (checkbox, "toggled",
1452
(GCallback) peditor_boolean_widget_changed, peditor);
1458
peditor_image_set_filename (GConfPropertyEditor *peditor, const gchar *filename)
1460
GdkPixbuf *pixbuf = NULL;
1461
GtkImage *image = NULL;
1462
const int scale = 100;
1463
gchar *message = NULL;
1464
GtkWidget *ui_control_child;
1467
/* NULL is not valid, however "" is, but not an error (it's
1469
g_return_val_if_fail (filename != NULL, FALSE);
1472
if (!g_file_test (filename, G_FILE_TEST_EXISTS))
1474
message = g_strdup_printf (_("Couldn't find the file '%s'.\n\nPlease make "
1475
"sure it exists and try again, "
1476
"or choose a different background picture."),
1480
else if (!(pixbuf = gdk_pixbuf_new_from_file_at_size (filename, scale, scale, NULL)))
1482
message = g_strdup_printf (_("I don't know how to open the file '%s'.\n"
1484
"a kind of picture that is not yet supported.\n\n"
1485
"Please select a different picture instead."),
1489
ui_control_child = gtk_bin_get_child (GTK_BIN (peditor->p->ui_control));
1491
if (GTK_IS_IMAGE (ui_control_child))
1492
image = GTK_IMAGE (ui_control_child);
1495
for (l = gtk_container_get_children (GTK_CONTAINER (ui_control_child)); l != NULL; l = l->next)
1497
if (GTK_IS_IMAGE (l->data))
1498
image = GTK_IMAGE (l->data);
1499
else if (GTK_IS_LABEL (l->data) && message == NULL)
1501
gchar *base = g_path_get_basename (filename);
1502
gtk_label_set_text (GTK_LABEL (l->data), base);
1510
if (peditor->p->inited)
1514
box = gtk_message_dialog_new (NULL,
1520
gtk_dialog_run (GTK_DIALOG (box));
1521
gtk_widget_destroy (box);
1523
gtk_image_set_from_stock (image, GTK_STOCK_MISSING_IMAGE,
1524
GTK_ICON_SIZE_BUTTON);
1531
gtk_image_set_from_pixbuf (image, pixbuf);
1532
g_object_unref (pixbuf);
1538
peditor_image_chooser_response_cb (GtkWidget *chooser,
1540
GConfPropertyEditor *peditor)
1542
GConfValue *value, *value_wid;
1545
if (response == GTK_RESPONSE_CANCEL ||
1546
response == GTK_RESPONSE_DELETE_EVENT)
1548
gtk_widget_destroy (chooser);
1552
if (!peditor->p->inited)
1555
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser));
1556
if (!(filename && peditor_image_set_filename (peditor, filename)))
1562
value_wid = gconf_value_new (GCONF_VALUE_STRING);
1563
gconf_value_set_string (value_wid, filename);
1564
value = peditor->p->conv_from_widget_cb (peditor, value_wid);
1566
peditor_set_gconf_value (peditor, peditor->p->key, value);
1567
g_signal_emit (peditor, peditor_signals[VALUE_CHANGED], 0, peditor->p->key, value);
1569
gconf_value_free (value_wid);
1570
gconf_value_free (value);
1572
gtk_widget_destroy (chooser);
1576
peditor_image_chooser_update_preview_cb (GtkFileChooser *chooser,
1580
GdkPixbuf *pixbuf = NULL;
1581
const int scale = 100;
1583
filename = gtk_file_chooser_get_preview_filename (chooser);
1585
if (filename != NULL && g_file_test (filename, G_FILE_TEST_IS_REGULAR))
1586
pixbuf = gdk_pixbuf_new_from_file_at_size (filename, scale, scale, NULL);
1588
gtk_image_set_from_pixbuf (preview, pixbuf);
1593
g_object_unref (pixbuf);
1597
peditor_image_clicked_cb (GConfPropertyEditor *peditor, GtkButton *button)
1599
GConfValue *value = NULL, *value_wid;
1600
const gchar *filename;
1601
GtkWidget *chooser, *toplevel, *preview, *preview_box;
1603
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (button));
1604
chooser = gtk_file_chooser_dialog_new (_("Please select an image."),
1605
GTK_IS_WINDOW (toplevel) ? GTK_WINDOW (toplevel)
1607
GTK_FILE_CHOOSER_ACTION_OPEN,
1608
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
1609
_("_Select"), GTK_RESPONSE_OK,
1612
preview = gtk_image_new ();
1614
preview_box = gtk_hbox_new (FALSE, 6);
1615
gtk_box_pack_start (GTK_BOX (preview_box), preview, FALSE, TRUE, 0);
1616
gtk_container_set_border_width (GTK_CONTAINER (preview_box), 6);
1618
gtk_widget_show_all (preview_box);
1619
gtk_file_chooser_set_preview_widget (GTK_FILE_CHOOSER (chooser),
1621
gtk_file_chooser_set_preview_widget_active (GTK_FILE_CHOOSER (chooser),
1624
gtk_dialog_set_default_response (GTK_DIALOG (chooser), GTK_RESPONSE_OK);
1625
gtk_window_set_destroy_with_parent (GTK_WINDOW (chooser), TRUE);
1626
gtk_window_set_modal (GTK_WINDOW (chooser), TRUE);
1628
/* need the current filename */
1629
if (peditor->p->changeset)
1630
gconf_change_set_check_value (peditor->p->changeset, peditor->p->key, &value);
1634
/* the one we got is not a copy */
1635
value = gconf_value_copy (value);
1639
GConfClient *client = gconf_client_get_default ();
1640
value = gconf_client_get (client, peditor->p->key, NULL);
1641
g_object_unref (client);
1644
value_wid = peditor->p->conv_to_widget_cb (peditor, value);
1645
filename = gconf_value_get_string (value_wid);
1647
if (filename && strcmp (filename, ""))
1648
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (chooser), filename);
1650
g_signal_connect (chooser, "update-preview",
1651
G_CALLBACK (peditor_image_chooser_update_preview_cb),
1653
g_signal_connect (chooser, "response",
1654
G_CALLBACK (peditor_image_chooser_response_cb),
1657
if (gtk_grab_get_current ())
1658
gtk_grab_add (chooser);
1660
gtk_widget_show (chooser);
1662
gconf_value_free (value);
1663
gconf_value_free (value_wid);
1667
peditor_image_value_changed (GConfClient *client,
1670
GConfPropertyEditor *peditor)
1672
GConfValue *value, *value_wid;
1674
if (peditor->p->changeset != NULL)
1675
gconf_change_set_remove (peditor->p->changeset, peditor->p->key);
1677
if (entry && (value = gconf_entry_get_value (entry))) {
1678
const gchar *filename;
1680
value_wid = peditor->p->conv_to_widget_cb (peditor, value);
1681
filename = gconf_value_get_string (value_wid);
1682
peditor_image_set_filename (peditor, filename);
1683
gconf_value_free (value_wid);
1688
gconf_peditor_new_image (GConfChangeSet *changeset,
1691
const gchar *first_property_name,
1697
g_return_val_if_fail (key != NULL, NULL);
1698
g_return_val_if_fail (button != NULL, NULL);
1699
g_return_val_if_fail (GTK_IS_BUTTON (button), NULL);
1701
va_start (var_args, first_property_name);
1703
peditor = gconf_peditor_new
1705
(GConfClientNotifyFunc) peditor_image_value_changed,
1708
first_property_name,
1713
g_signal_connect_swapped (button, "clicked",
1714
(GCallback) peditor_image_clicked_cb, peditor);
1720
gconf_peditor_new_select_radio_with_enum (GConfChangeSet *changeset,
1722
GSList *radio_group,
1725
const gchar *first_property_name,
1729
GConfPropertyEditorEnumData *enum_data;
1730
GtkRadioButton *first_button;
1734
g_return_val_if_fail (key != NULL, NULL);
1735
g_return_val_if_fail (radio_group != NULL, NULL);
1736
g_return_val_if_fail (radio_group->data != NULL, NULL);
1737
g_return_val_if_fail (GTK_IS_RADIO_BUTTON (radio_group->data), NULL);
1739
enum_data = g_new0 (GConfPropertyEditorEnumData, 1);
1740
enum_data->enum_type = enum_type;
1741
enum_data->use_nick = use_nick;
1743
first_button = GTK_RADIO_BUTTON (radio_group->data);
1745
va_start (var_args, first_property_name);
1747
peditor = gconf_peditor_new
1749
(GConfClientNotifyFunc) peditor_select_radio_value_changed,
1751
G_OBJECT (first_button),
1752
first_property_name,
1754
"conv-to-widget-cb",
1755
peditor_enum_conv_to_widget,
1756
"conv-from-widget-cb",
1757
peditor_enum_conv_from_widget,
1766
for (item = radio_group; item != NULL; item = item->next)
1767
g_signal_connect_swapped (item->data, "toggled",
1768
(GCallback) peditor_select_radio_widget_changed, peditor);
1774
peditor_tree_view_value_changed (GConfClient *client,
1777
GConfPropertyEditor *peditor)
1781
if (peditor->p->changeset != NULL)
1782
gconf_change_set_remove (peditor->p->changeset, peditor->p->key);
1784
if (entry && (value = gconf_entry_get_value (entry))) {
1785
GtkTreeView *treeview;
1786
GtkTreeSelection *selection;
1787
GConfValue *value_wid;
1789
treeview = GTK_TREE_VIEW (peditor->p->ui_control);
1790
selection = gtk_tree_view_get_selection (treeview);
1792
value_wid = peditor->p->conv_to_widget_cb (peditor, value);
1794
if (value_wid != NULL) {
1795
GtkTreePath *path = gtk_tree_path_new_from_string (
1796
gconf_value_get_string (value_wid));
1797
gtk_tree_selection_select_path (selection, path);
1798
gtk_tree_view_scroll_to_cell (treeview, path, NULL, FALSE, 0, 0);
1799
gtk_tree_path_free (path);
1800
gconf_value_free (value_wid);
1802
gtk_tree_selection_unselect_all (selection);
1808
peditor_tree_view_widget_changed (GConfPropertyEditor *peditor,
1809
GtkTreeSelection *selection)
1811
GtkTreeModel *model;
1813
GConfValue *value, *value_wid;
1815
if (!peditor->p->inited) return;
1817
/* we don't support GTK_SELECTION_MULTIPLE */
1818
if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
1821
path = gtk_tree_model_get_string_from_iter (model, &iter);
1822
value_wid = gconf_value_new (GCONF_VALUE_STRING);
1823
gconf_value_set_string (value_wid, path);
1828
value = peditor->p->conv_from_widget_cb (peditor, value_wid);
1829
peditor_set_gconf_value (peditor, peditor->p->key, value);
1830
g_signal_emit (peditor, peditor_signals[VALUE_CHANGED], 0, peditor->p->key, value);
1833
gconf_value_free (value_wid);
1835
gconf_value_free (value);
1839
gconf_peditor_new_tree_view (GConfChangeSet *changeset,
1841
GtkWidget *tree_view,
1842
const gchar *first_property_name,
1848
g_return_val_if_fail (key != NULL, NULL);
1849
g_return_val_if_fail (tree_view != NULL, NULL);
1850
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), NULL);
1852
va_start (var_args, first_property_name);
1854
peditor = gconf_peditor_new
1856
(GConfClientNotifyFunc) peditor_tree_view_value_changed,
1858
G_OBJECT (tree_view),
1859
first_property_name,
1864
g_signal_connect_swapped (gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)),
1866
(GCallback) peditor_tree_view_widget_changed, peditor);