diff options
author | Tristan Van Berkom <tvb@src.gnome.org> | 2008-04-03 19:52:40 +0000 |
---|---|---|
committer | Tristan Van Berkom <tvb@src.gnome.org> | 2008-04-03 19:52:40 +0000 |
commit | 64bb8141c669ab3f36a713885472045c6c2ba035 (patch) | |
tree | e612211b16213e3ca79cfa3aac10ebbeed50ae79 /gladeui | |
parent | 1b84fad310e3f98deb960fc09bc6ad6ba9169671 (diff) | |
download | glade-64bb8141c669ab3f36a713885472045c6c2ba035.tar.gz |
merging builder branch into trunk
A plugins/gtk+/glade-keysyms.c
M plugins/gtk+/glade-gtk.c
M plugins/gtk+/gtk+.xml.in
A plugins/gtk+/glade-accels.c
M plugins/gtk+/Makefile.am
A plugins/gtk+/glade-accels.h
M ChangeLog
M gladeui/glade-editor.c
M gladeui/glade-editor-property.c
M gladeui/glade-editor-property.h
M gladeui/glade-widget.c
M gladeui/glade-widget.h
M gladeui/glade-widget-adaptor.c
M gladeui/glade-command.c
M gladeui/glade-widget-adaptor.h
M gladeui/glade-parser.c
M gladeui/glade-xml-utils.c
M gladeui/glade-base-editor.c
M gladeui/glade-utils.c
D gladeui/glade-parser.h
M gladeui/glade-signal-editor.c
M gladeui/glade-xml-utils.h
D gladeui/glade-keysyms.c
M gladeui/glade-property.c
M gladeui/glade-property-class.c
M gladeui/glade-property.h
M gladeui/glade-builtins.c
M gladeui/glade-property-class.h
M gladeui/glade-builtins.h
M gladeui/glade-project.c
M gladeui/glade-signal.c
M gladeui/Makefile.am
M gladeui/glade-signal.h
svn path=/trunk/; revision=1764
Diffstat (limited to 'gladeui')
-rw-r--r-- | gladeui/Makefile.am | 5 | ||||
-rw-r--r-- | gladeui/glade-base-editor.c | 2 | ||||
-rw-r--r-- | gladeui/glade-builtins.c | 221 | ||||
-rw-r--r-- | gladeui/glade-builtins.h | 39 | ||||
-rw-r--r-- | gladeui/glade-command.c | 11 | ||||
-rw-r--r-- | gladeui/glade-editor-property.c | 919 | ||||
-rw-r--r-- | gladeui/glade-editor-property.h | 104 | ||||
-rw-r--r-- | gladeui/glade-editor.c | 16 | ||||
-rw-r--r-- | gladeui/glade-keysyms.c | 1360 | ||||
-rw-r--r-- | gladeui/glade-parser.c | 96 | ||||
-rw-r--r-- | gladeui/glade-parser.h | 152 | ||||
-rw-r--r-- | gladeui/glade-project.c | 218 | ||||
-rw-r--r-- | gladeui/glade-property-class.c | 297 | ||||
-rw-r--r-- | gladeui/glade-property-class.h | 39 | ||||
-rw-r--r-- | gladeui/glade-property.c | 661 | ||||
-rw-r--r-- | gladeui/glade-property.h | 13 | ||||
-rw-r--r-- | gladeui/glade-signal-editor.c | 20 | ||||
-rw-r--r-- | gladeui/glade-signal.c | 96 | ||||
-rw-r--r-- | gladeui/glade-signal.h | 15 | ||||
-rw-r--r-- | gladeui/glade-utils.c | 9 | ||||
-rw-r--r-- | gladeui/glade-widget-adaptor.c | 317 | ||||
-rw-r--r-- | gladeui/glade-widget-adaptor.h | 93 | ||||
-rw-r--r-- | gladeui/glade-widget.c | 916 | ||||
-rw-r--r-- | gladeui/glade-widget.h | 23 | ||||
-rw-r--r-- | gladeui/glade-xml-utils.c | 62 | ||||
-rw-r--r-- | gladeui/glade-xml-utils.h | 25 |
26 files changed, 1409 insertions, 4320 deletions
diff --git a/gladeui/Makefile.am b/gladeui/Makefile.am index 0367529d..efa884cb 100644 --- a/gladeui/Makefile.am +++ b/gladeui/Makefile.am @@ -51,10 +51,8 @@ libgladeui_1_la_SOURCES = \ glade-id-allocator.h \ glade-marshallers.c \ glade-accumulators.c \ - glade-parser.c \ glade-builtins.c \ glade-app.c \ - glade-keysyms.c \ glade-fixed.c \ glade-base-editor.c \ glade-palette-item.h \ @@ -110,11 +108,10 @@ libgladeuiinclude_HEADERS = \ glade-fixed.h \ glade-base-editor.h \ glade-xml-utils.h \ - glade-parser.h \ glade-signal.h \ glade-cursor.h \ glade-widget-action.h - + if PLATFORM_WIN32 libgladeui_1_la_LDFLAGS += -no-undefined diff --git a/gladeui/glade-base-editor.c b/gladeui/glade-base-editor.c index 224cbd91..9b70be04 100644 --- a/gladeui/glade-base-editor.c +++ b/gladeui/glade-base-editor.c @@ -1675,7 +1675,7 @@ glade_base_editor_add_properties (GladeBaseEditor *editor, while (property) { - eprop = glade_editor_property_new_from_widget (gchild, property, packing, TRUE); + eprop = glade_widget_create_editor_property (gchild, property, packing, TRUE); if (eprop) glade_base_editor_table_attach (editor, GLADE_EDITOR_PROPERTY (eprop)->item_label, diff --git a/gladeui/glade-builtins.c b/gladeui/glade-builtins.c index 51ce5355..cff51d34 100644 --- a/gladeui/glade-builtins.c +++ b/gladeui/glade-builtins.c @@ -41,15 +41,6 @@ struct _GladeParamSpecObjects { */ }; -struct _GladeParamSpecAccel { - GParamSpec parent_instance; - - GType type; /* The type this accel key is for; this allows - * us to verify the validity of any signals for - * this type. - */ -}; - typedef struct _GladeStockItem { gchar *value_name; gchar *value_nick; @@ -277,10 +268,9 @@ glade_standard_stock_image_spec (void) 0, G_PARAM_READWRITE); } - /**************************************************************** * A GList boxed type used by GladeParamSpecObjects and * - * GladeParamSpecAccel * + * GladeParamSpecAccel (which is now in the glade-gtk backend) * ****************************************************************/ GType glade_glist_get_type (void) @@ -295,180 +285,6 @@ glade_glist_get_type (void) return type_id; } -GList * -glade_accel_list_copy (GList *accels) -{ - GList *ret = NULL, *list; - GladeAccelInfo *info, *dup_info; - - for (list = accels; list; list = list->next) - { - info = list->data; - - dup_info = g_new0 (GladeAccelInfo, 1); - dup_info->signal = g_strdup (info->signal); - dup_info->key = info->key; - dup_info->modifiers = info->modifiers; - - ret = g_list_prepend (ret, dup_info); - } - - return g_list_reverse (ret); -} - -void -glade_accel_list_free (GList *accels) -{ - GList *list; - GladeAccelInfo *info; - - for (list = accels; list; list = list->next) - { - info = list->data; - - g_free (info->signal); - g_free (info); - } - g_list_free (accels); -} - -GType -glade_accel_glist_get_type (void) -{ - static GType type_id = 0; - - if (!type_id) - type_id = g_boxed_type_register_static - ("GladeAccelGList", - (GBoxedCopyFunc) glade_accel_list_copy, - (GBoxedFreeFunc) glade_accel_list_free); - return type_id; -} - - -/**************************************************************** - * Built-in GladeParamSpecAccel for accelerator properties * - ****************************************************************/ -gboolean -glade_keyval_valid (guint val) -{ - gint i; - - for (i = 0; GladeKeys[i].name != NULL; i++) - { - if (GladeKeys[i].value == val) - return TRUE; - } - return FALSE; -} - - -static void -param_accel_init (GParamSpec *pspec) -{ - GladeParamSpecAccel *ospec = GLADE_PARAM_SPEC_ACCEL (pspec); - ospec->type = G_TYPE_OBJECT; -} - -static void -param_accel_set_default (GParamSpec *pspec, - GValue *value) -{ - if (value->data[0].v_pointer != NULL) - { - g_free (value->data[0].v_pointer); - } - value->data[0].v_pointer = NULL; -} - -static gboolean -param_accel_validate (GParamSpec *pspec, - GValue *value) -{ - /* GladeParamSpecAccel *aspec = GLADE_PARAM_SPEC_ACCEL (pspec); */ - GList *accels, *list, *toremove = NULL; - GladeAccelInfo *info; - - accels = value->data[0].v_pointer; - - for (list = accels; list; list = list->next) - { - info = list->data; - - /* Is it an invalid key ? */ - if (glade_keyval_valid (info->key) == FALSE || - /* Does the modifier contain any unwanted bits ? */ - info->modifiers & GDK_MODIFIER_MASK || - /* Do we have a signal ? */ - /* FIXME: Check if the signal is valid for 'type' */ - info->signal == NULL) - toremove = g_list_prepend (toremove, info); - } - - for (list = toremove; list; list = list->next) - accels = g_list_remove (accels, list->data); - - if (toremove) g_list_free (toremove); - - value->data[0].v_pointer = accels; - - return toremove != NULL; -} - -static gint -param_accel_values_cmp (GParamSpec *pspec, - const GValue *value1, - const GValue *value2) -{ - guint8 *p1 = value1->data[0].v_pointer; - guint8 *p2 = value2->data[0].v_pointer; - - /* not much to compare here, try to at least provide stable lesser/greater result */ - - return p1 < p2 ? -1 : p1 > p2; -} - -GType -glade_param_accel_get_type (void) -{ - static GType accel_type = 0; - - if (accel_type == 0) - { - static /* const */ GParamSpecTypeInfo pspec_info = { - sizeof (GladeParamSpecAccel), /* instance_size */ - 16, /* n_preallocs */ - param_accel_init, /* instance_init */ - 0xdeadbeef, /* value_type, assigned further down */ - NULL, /* finalize */ - param_accel_set_default, /* value_set_default */ - param_accel_validate, /* value_validate */ - param_accel_values_cmp, /* values_cmp */ - }; - pspec_info.value_type = GLADE_TYPE_ACCEL_GLIST; - - accel_type = g_param_type_register_static - ("GladeParamAccel", &pspec_info); - } - return accel_type; -} - -GParamSpec * -glade_param_spec_accel (const gchar *name, - const gchar *nick, - const gchar *blurb, - GType widget_type, - GParamFlags flags) -{ - GladeParamSpecAccel *pspec; - - pspec = g_param_spec_internal (GLADE_TYPE_PARAM_ACCEL, - name, nick, blurb, flags); - - pspec->type = widget_type; - return G_PARAM_SPEC (pspec); -} - /**************************************************************** * Built-in GladeParamSpecObjects for object list properties * * (Used as a pspec to desctibe an AtkRelationSet, but can * @@ -628,16 +444,6 @@ glade_standard_gdkcolor_spec (void) G_PARAM_READWRITE); } -/* Accelerator spec */ -GParamSpec * -glade_standard_accel_spec (void) -{ - return glade_param_spec_accel ("accelerators", _("Accelerators"), - _("A list of accelerator keys"), - GTK_TYPE_WIDGET, - G_PARAM_READWRITE); -} - /**************************************************************** * Basic types follow * ****************************************************************/ @@ -692,31 +498,6 @@ glade_standard_boolean_spec (void) G_PARAM_READWRITE); } -guint -glade_builtin_key_from_string (const gchar *string) -{ - gint i; - - g_return_val_if_fail (string != NULL, 0); - - for (i = 0; GladeKeys[i].name != NULL; i++) - if (!strcmp (string, GladeKeys[i].name)) - return GladeKeys[i].value; - - return 0; -} - -const gchar * -glade_builtin_string_from_key (guint key) -{ - gint i; - - for (i = 0; GladeKeys[i].name != NULL; i++) - if (GladeKeys[i].value == key) - return GladeKeys[i].name; - return NULL; -} - GType glade_item_appearance_get_type (void) { diff --git a/gladeui/glade-builtins.h b/gladeui/glade-builtins.h index 378824d8..178bb51f 100644 --- a/gladeui/glade-builtins.h +++ b/gladeui/glade-builtins.h @@ -8,28 +8,12 @@ G_BEGIN_DECLS typedef struct _GladeParamSpecObjects GladeParamSpecObjects; -typedef struct _GladeParamSpecAccel GladeParamSpecAccel; -typedef struct _GladeKey GladeKey; -struct _GladeKey { - guint value; - gchar *name; -}; - -extern const GladeKey GladeKeys[]; - -#define GLADE_KEYS_LAST_ALPHANUM "9" -#define GLADE_KEYS_LAST_EXTRA "questiondown" -#define GLADE_KEYS_LAST_KP "KP_9" -#define GLADE_KEYS_LAST_FKEY "F35" - #define GLADE_TYPE_STOCK (glade_standard_stock_get_type()) #define GLADE_TYPE_STOCK_IMAGE (glade_standard_stock_image_get_type()) #define GLADE_TYPE_GLIST (glade_glist_get_type()) -#define GLADE_TYPE_ACCEL_GLIST (glade_accel_glist_get_type()) #define GLADE_TYPE_PARAM_OBJECTS (glade_param_objects_get_type()) -#define GLADE_TYPE_PARAM_ACCEL (glade_param_accel_get_type()) #define GLADE_TYPE_ITEM_APPEARANCE (glade_item_appearance_get_type()) #define GLADE_IS_STOCK(pspec) \ @@ -45,42 +29,22 @@ extern const GladeKey GladeKeys[]; (G_TYPE_CHECK_INSTANCE_CAST ((pspec), \ GLADE_TYPE_PARAM_OBJECTS, GladeParamSpecObjects)) -#define GLADE_IS_PARAM_SPEC_ACCEL(pspec) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), \ - GLADE_TYPE_PARAM_ACCEL)) -#define GLADE_PARAM_SPEC_ACCEL(pspec) \ - (G_TYPE_CHECK_INSTANCE_CAST ((pspec), \ - GLADE_TYPE_PARAM_ACCEL, GladeParamSpecAccel)) - GType glade_standard_stock_get_type (void) G_GNUC_CONST; GType glade_standard_stock_image_get_type (void) G_GNUC_CONST; GType glade_glist_get_type (void) G_GNUC_CONST; -GType glade_accel_glist_get_type (void) G_GNUC_CONST; GType glade_param_objects_get_type (void) G_GNUC_CONST; -GType glade_param_accel_get_type (void) G_GNUC_CONST; GType glade_item_appearance_get_type (void) G_GNUC_CONST; guint glade_builtin_key_from_string (const gchar *string); const gchar *glade_builtin_string_from_key (guint key); -GList *glade_accel_list_copy (GList *accels); -void glade_accel_list_free (GList *accels); - - - GParamSpec *glade_param_spec_objects (const gchar *name, const gchar *nick, const gchar *blurb, GType accepted_type, GParamFlags flags); -GParamSpec *glade_param_spec_accel (const gchar *name, - const gchar *nick, - const gchar *blurb, - GType widget_type, - GParamFlags flags); - void glade_param_spec_objects_set_type (GladeParamSpecObjects *pspec, GType type); GType glade_param_spec_objects_get_type (GladeParamSpecObjects *pspec); @@ -90,7 +54,6 @@ GParamSpec *glade_standard_gdkcolor_spec (void); GParamSpec *glade_standard_objects_spec (void); GParamSpec *glade_standard_stock_spec (void); GParamSpec *glade_standard_stock_image_spec (void); -GParamSpec *glade_standard_accel_spec (void); GParamSpec *glade_standard_int_spec (void); GParamSpec *glade_standard_uint_spec (void); GParamSpec *glade_standard_string_spec (void); @@ -100,8 +63,6 @@ GParamSpec *glade_standard_boolean_spec (void); void glade_standard_stock_append_prefix (const gchar *prefix); -gboolean glade_keyval_valid (guint val); - G_END_DECLS #endif /* __GLADE_BUILTINS_H__ */ diff --git a/gladeui/glade-command.c b/gladeui/glade-command.c index 9bf91f65..1a1e42b1 100644 --- a/gladeui/glade-command.c +++ b/gladeui/glade-command.c @@ -364,8 +364,9 @@ glade_command_set_property_execute (GladeCommand *cmd) #if 0 { gchar *str = - glade_property_class_make_string_from_gvalue - (sdata->property->klass, &new_value); + glade_widget_adaptor_string_from_value + (GLADE_WIDGET_ADAPTOR (sdata->property->klass->handle), + sdata->property->klass, &new_value); g_print ("Setting %s property of %s to %s (sumode: %d)\n", sdata->property->klass->id, @@ -550,8 +551,10 @@ glade_command_set_property_description (GladeCommandSetProperty *me) else { sdata = me->sdata->data; - value_name = glade_property_class_make_string_from_gvalue (sdata->property->klass, - sdata->new_value); + value_name = glade_widget_adaptor_string_from_value + (GLADE_WIDGET_ADAPTOR (sdata->property->klass->handle), + sdata->property->klass, sdata->new_value); + if (!value_name || strlen (value_name) > MAX_UNDO_MENU_ITEM_VALUE_LEN || strchr (value_name, '_')) { description = g_strdup_printf (_("Setting %s of %s"), diff --git a/gladeui/glade-editor-property.c b/gladeui/glade-editor-property.c index 27e6e410..24ab7dc4 100644 --- a/gladeui/glade-editor-property.c +++ b/gladeui/glade-editor-property.c @@ -70,61 +70,6 @@ static guint glade_editor_property_signals[LAST_SIGNAL] = { #define FLAGS_COLUMN_SETTING 0 #define FLAGS_COLUMN_SYMBOL 1 -/******************************************************************************* - Boiler plate macros (inspired from glade-command.c) - *******************************************************************************/ -#define MAKE_TYPE(func, type, parent) \ -GType \ -func ## _get_type (void) \ -{ \ - static GType cmd_type = 0; \ - \ - if (!cmd_type) \ - { \ - static const GTypeInfo info = \ - { \ - sizeof (type ## Class), \ - (GBaseInitFunc) NULL, \ - (GBaseFinalizeFunc) NULL, \ - (GClassInitFunc) func ## _class_init, \ - (GClassFinalizeFunc) NULL, \ - NULL, \ - sizeof (type), \ - 0, \ - (GInstanceInitFunc) NULL \ - }; \ - \ - cmd_type = g_type_register_static (parent, #type, &info, 0); \ - } \ - \ - return cmd_type; \ -} \ - - -#define GLADE_MAKE_EPROP(type, func) \ -static void \ -func ## _finalize (GObject *object); \ -static void \ -func ## _load (GladeEditorProperty *me, GladeProperty *property); \ -static GtkWidget * \ -func ## _create_input (GladeEditorProperty *me); \ -static void \ -func ## _class_init (gpointer parent_tmp, gpointer notused) \ -{ \ - GladeEditorPropertyClass *parent = parent_tmp; \ - GObjectClass* object_class; \ - object_class = G_OBJECT_CLASS (parent); \ - parent->load = func ## _load; \ - parent->create_input = func ## _create_input; \ - object_class->finalize = func ## _finalize; \ -} \ -typedef struct { \ - GladeEditorPropertyClass cmd; \ -} type ## Class; \ -static MAKE_TYPE(func, type, GLADE_TYPE_EDITOR_PROPERTY) - - - /******************************************************************************* GladeEditorPropertyClass @@ -134,9 +79,15 @@ static MAKE_TYPE(func, type, GLADE_TYPE_EDITOR_PROPERTY) static void glade_editor_property_load_common (GladeEditorProperty *eprop, GladeProperty *property); -/* For use in editor implementations +/** + * glade_editor_property_commit: + * @eprop: A #GladeEditorProperty + * @value: The #GValue + * + * Commits the value onto the widget and glade-command interface + * (for use in GladeEditorProperty implementations) */ -static void +void glade_editor_property_commit (GladeEditorProperty *eprop, GValue *value) { @@ -596,7 +547,6 @@ typedef struct { } GladeEPropNumeric; GLADE_MAKE_EPROP (GladeEPropNumeric, glade_eprop_numeric) -#define GLADE_TYPE_EPROP_NUMERIC (glade_eprop_numeric_get_type()) #define GLADE_EPROP_NUMERIC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_EPROP_NUMERIC, GladeEPropNumeric)) #define GLADE_EPROP_NUMERIC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_EPROP_NUMERIC, GladeEPropNumericClass)) #define GLADE_IS_EPROP_NUMERIC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_EPROP_NUMERIC)) @@ -717,7 +667,6 @@ typedef struct { } GladeEPropEnum; GLADE_MAKE_EPROP (GladeEPropEnum, glade_eprop_enum) -#define GLADE_TYPE_EPROP_ENUM (glade_eprop_enum_get_type()) #define GLADE_EPROP_ENUM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_EPROP_ENUM, GladeEPropEnum)) #define GLADE_EPROP_ENUM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_EPROP_ENUM, GladeEPropEnumClass)) #define GLADE_IS_EPROP_ENUM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_EPROP_ENUM)) @@ -871,7 +820,6 @@ typedef struct { } GladeEPropFlags; GLADE_MAKE_EPROP (GladeEPropFlags, glade_eprop_flags) -#define GLADE_TYPE_EPROP_FLAGS (glade_eprop_flags_get_type()) #define GLADE_EPROP_FLAGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_EPROP_FLAGS, GladeEPropFlags)) #define GLADE_EPROP_FLAGS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_EPROP_FLAGS, GladeEPropFlagsClass)) #define GLADE_IS_EPROP_FLAGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_EPROP_FLAGS)) @@ -1160,7 +1108,6 @@ typedef struct { } GladeEPropColor; GLADE_MAKE_EPROP (GladeEPropColor, glade_eprop_color) -#define GLADE_TYPE_EPROP_COLOR (glade_eprop_color_get_type()) #define GLADE_EPROP_COLOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_EPROP_COLOR, GladeEPropColor)) #define GLADE_EPROP_COLOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_EPROP_COLOR, GladeEPropColorClass)) #define GLADE_IS_EPROP_COLOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_EPROP_COLOR)) @@ -1187,8 +1134,9 @@ glade_eprop_color_load (GladeEditorProperty *eprop, GladeProperty *property) if (property) { - if ((text = glade_property_class_make_string_from_gvalue - (eprop->klass, property->value)) != NULL) + if ((text = glade_widget_adaptor_string_from_value + (GLADE_WIDGET_ADAPTOR (eprop->klass->handle), + eprop->klass, property->value)) != NULL) { gtk_entry_set_text (GTK_ENTRY (eprop_color->entry), text); g_free (text); @@ -1268,7 +1216,6 @@ typedef struct { } GladeEPropNamedIcon; GLADE_MAKE_EPROP (GladeEPropNamedIcon, glade_eprop_named_icon) -#define GLADE_TYPE_EPROP_NAMED_ICON (glade_eprop_named_icon_get_type()) #define GLADE_EPROP_NAMED_ICON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_EPROP_NAMED_ICON, GladeEPropNamedIcon)) #define GLADE_EPROP_NAMED_ICON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_EPROP_NAMED_ICON, GladeEPropNamedIconClass)) #define GLADE_IS_EPROP_NAMED_ICON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_EPROP_NAMED_ICON)) @@ -1478,7 +1425,6 @@ typedef struct { } GladeEPropText; GLADE_MAKE_EPROP (GladeEPropText, glade_eprop_text) -#define GLADE_TYPE_EPROP_TEXT (glade_eprop_text_get_type()) #define GLADE_EPROP_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_EPROP_TEXT, GladeEPropText)) #define GLADE_EPROP_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_EPROP_TEXT, GladeEPropTextClass)) #define GLADE_IS_EPROP_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_EPROP_TEXT)) @@ -1519,8 +1465,9 @@ glade_eprop_text_load (GladeEditorProperty *eprop, GladeProperty *property) if (G_VALUE_HOLDS (property->value, G_TYPE_STRV) || G_VALUE_HOLDS (property->value, G_TYPE_VALUE_ARRAY)) { - gchar *text = glade_property_class_make_string_from_gvalue ( - property->klass, property->value); + gchar *text = glade_widget_adaptor_string_from_value + (GLADE_WIDGET_ADAPTOR (property->klass->handle), + property->klass, property->value); gtk_text_buffer_set_text (buffer, text ? text : "", -1); g_free (text); } @@ -1684,7 +1631,7 @@ glade_eprop_text_show_i18n_dialog (GtkWidget *entry, text, -1); } - + /* Translatable and context prefix. */ hbox = gtk_hbox_new (FALSE, 12); gtk_widget_show (hbox); @@ -1757,7 +1704,8 @@ glade_eprop_text_show_i18n_dialog (GtkWidget *entry, if (res == GTK_RESPONSE_OK) { GtkTextIter start, end; gboolean translatable, has_context; - + + /* get the new values for translatable, has_context, and comment */ translatable = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (translatable_button)); has_context = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (context_button)); @@ -1777,11 +1725,6 @@ glade_eprop_text_show_i18n_dialog (GtkWidget *entry, /* Text */ gtk_text_buffer_get_bounds (text_buffer, &start, &end); str = gtk_text_buffer_get_text (text_buffer, &start, &end, TRUE); - if (str[0] == '\0') - { - g_free (str); - str = NULL; - } /* set the new text */ glade_eprop_text_changed_common (eprop, str, eprop->use_command); @@ -1860,7 +1803,6 @@ typedef struct { } GladeEPropBool; GLADE_MAKE_EPROP (GladeEPropBool, glade_eprop_bool) -#define GLADE_TYPE_EPROP_BOOL (glade_eprop_bool_get_type()) #define GLADE_EPROP_BOOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_EPROP_BOOL, GladeEPropBool)) #define GLADE_EPROP_BOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_EPROP_BOOL, GladeEPropBoolClass)) #define GLADE_IS_EPROP_BOOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_EPROP_BOOL)) @@ -1942,7 +1884,6 @@ typedef struct { } GladeEPropUnichar; GLADE_MAKE_EPROP (GladeEPropUnichar, glade_eprop_unichar) -#define GLADE_TYPE_EPROP_UNICHAR (glade_eprop_unichar_get_type()) #define GLADE_EPROP_UNICHAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_EPROP_UNICHAR, GladeEPropUnichar)) #define GLADE_EPROP_UNICHAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_EPROP_UNICHAR, GladeEPropUnicharClass)) #define GLADE_IS_EPROP_UNICHAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_EPROP_UNICHAR)) @@ -2072,7 +2013,6 @@ typedef struct { } GladeEPropResource; GLADE_MAKE_EPROP (GladeEPropResource, glade_eprop_resource) -#define GLADE_TYPE_EPROP_RESOURCE (glade_eprop_resource_get_type()) #define GLADE_EPROP_RESOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_EPROP_RESOURCE, GladeEPropResource)) #define GLADE_EPROP_RESOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_EPROP_RESOURCE, GladeEPropResourceClass)) #define GLADE_IS_EPROP_RESOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_EPROP_RESOURCE)) @@ -2173,8 +2113,9 @@ glade_eprop_resource_load (GladeEditorProperty *eprop, GladeProperty *property) if (property == NULL) return; - file = glade_property_class_make_string_from_gvalue - (eprop->klass, property->value); + file = glade_widget_adaptor_string_from_value + (GLADE_WIDGET_ADAPTOR (eprop->klass->handle), + eprop->klass, property->value); if (file) { gtk_entry_set_text (GTK_ENTRY (eprop_resource->entry), file); @@ -2238,7 +2179,6 @@ typedef struct { } GladeEPropObject; GLADE_MAKE_EPROP (GladeEPropObject, glade_eprop_object) -#define GLADE_TYPE_EPROP_OBJECT (glade_eprop_object_get_type()) #define GLADE_EPROP_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_EPROP_OBJECT, GladeEPropObject)) #define GLADE_EPROP_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_EPROP_OBJECT, GladeEPropObjectClass)) #define GLADE_IS_EPROP_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_EPROP_OBJECT)) @@ -2682,8 +2622,9 @@ glade_eprop_object_load (GladeEditorProperty *eprop, GladeProperty *property) if (property == NULL) return; - if ((obj_name = glade_property_class_make_string_from_gvalue - (eprop->klass, property->value)) != NULL) + if ((obj_name = glade_widget_adaptor_string_from_value + (GLADE_WIDGET_ADAPTOR (eprop->klass->handle), + eprop->klass, property->value)) != NULL) { gtk_entry_set_text (GTK_ENTRY (eprop_object->entry), obj_name); g_free (obj_name); @@ -2728,7 +2669,6 @@ typedef struct { } GladeEPropObjects; GLADE_MAKE_EPROP (GladeEPropObjects, glade_eprop_objects) -#define GLADE_TYPE_EPROP_OBJECTS (glade_eprop_objects_get_type()) #define GLADE_EPROP_OBJECTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_EPROP_OBJECTS, GladeEPropObjects)) #define GLADE_EPROP_OBJECTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_EPROP_OBJECTS, GladeEPropObjectsClass)) #define GLADE_IS_EPROP_OBJECTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_EPROP_OBJECTS)) @@ -2753,8 +2693,9 @@ glade_eprop_objects_load (GladeEditorProperty *eprop, GladeProperty *property) if (property == NULL) return; - if ((obj_name = glade_property_class_make_string_from_gvalue - (eprop->klass, property->value)) != NULL) + if ((obj_name = glade_widget_adaptor_string_from_value + (GLADE_WIDGET_ADAPTOR (eprop->klass->handle), + eprop->klass, property->value)) != NULL) { gtk_entry_set_text (GTK_ENTRY (eprop_objects->entry), obj_name); g_free (obj_name); @@ -2913,7 +2854,6 @@ typedef struct { } GladeEPropAdjustment; GLADE_MAKE_EPROP (GladeEPropAdjustment, glade_eprop_adjustment) -#define GLADE_TYPE_EPROP_ADJUSTMENT (glade_eprop_adjustment_get_type()) #define GLADE_EPROP_ADJUSTMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_EPROP_ADJUSTMENT, GladeEPropAdjustment)) #define GLADE_EPROP_ADJUSTMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_EPROP_ADJUSTMENT, GladeEPropAdjustmentClass)) #define GLADE_IS_EPROP_ADJUSTMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_EPROP_ADJUSTMENT)) @@ -3165,813 +3105,10 @@ glade_eprop_adjustment_create_input (GladeEditorProperty *eprop) /******************************************************************************* - GladeEditorPropertyAccelClass - *******************************************************************************/ -enum { - ACCEL_COLUMN_SIGNAL = 0, - ACCEL_COLUMN_REAL_SIGNAL, - ACCEL_COLUMN_KEY, - ACCEL_COLUMN_MOD_SHIFT, - ACCEL_COLUMN_MOD_CNTL, - ACCEL_COLUMN_MOD_ALT, - ACCEL_COLUMN_IS_CLASS, - ACCEL_COLUMN_IS_SIGNAL, - ACCEL_COLUMN_KEY_ENTERED, - ACCEL_COLUMN_KEY_SLOT, - ACCEL_NUM_COLUMNS -}; - -enum { - ACCEL_COMBO_COLUMN_TEXT = 0, - ACCEL_COMBO_NUM_COLUMNS, -}; - -typedef struct { - GladeEditorProperty parent_instance; - - GtkWidget *entry; - GList *parent_iters; - GtkTreeModel *model; -} GladeEPropAccel; - -typedef struct { - GtkTreeIter *iter; - gchar *name; /* <-- dont free */ -} GladeEpropIterTab; - - -static GtkTreeModel *keysyms_model = NULL; - -GLADE_MAKE_EPROP (GladeEPropAccel, glade_eprop_accel) -#define GLADE_TYPE_EPROP_ACCEL (glade_eprop_accel_get_type()) -#define GLADE_EPROP_ACCEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_EPROP_ACCEL, GladeEPropAccel)) -#define GLADE_EPROP_ACCEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_EPROP_ACCEL, GladeEPropAccelClass)) -#define GLADE_IS_EPROP_ACCEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_EPROP_ACCEL)) -#define GLADE_IS_EPROP_ACCEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GLADE_TYPE_EPROP_ACCEL)) -#define GLADE_EPROP_ACCEL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GLADE_EPROP_ACCEL, GladeEPropAccelClass)) - - -static GtkTreeModel * -create_keysyms_model (void) -{ - GtkTreeModel *model; - GtkTreeIter iter, alphanum, fkey, keypad, other, extra; - GtkTreeIter *parent; - gint i; - - model = (GtkTreeModel *)gtk_tree_store_new - (ACCEL_COMBO_NUM_COLUMNS, - G_TYPE_STRING); /* The Key charachter name */ - - gtk_tree_store_append (GTK_TREE_STORE (model), &alphanum, NULL); - gtk_tree_store_set - (GTK_TREE_STORE (model), &alphanum, - ACCEL_COMBO_COLUMN_TEXT, _("Alphanumerical"), -1); - - gtk_tree_store_append (GTK_TREE_STORE (model), &extra, NULL); - gtk_tree_store_set - (GTK_TREE_STORE (model), &extra, - ACCEL_COMBO_COLUMN_TEXT, _("Extra"), -1); - - gtk_tree_store_append (GTK_TREE_STORE (model), &keypad, NULL); - gtk_tree_store_set - (GTK_TREE_STORE (model), &keypad, - ACCEL_COMBO_COLUMN_TEXT, _("Keypad"), -1); - - gtk_tree_store_append (GTK_TREE_STORE (model), &fkey, NULL); - gtk_tree_store_set - (GTK_TREE_STORE (model), &fkey, - ACCEL_COMBO_COLUMN_TEXT, _("Functions"), -1); - - gtk_tree_store_append (GTK_TREE_STORE (model), &other, NULL); - gtk_tree_store_set - (GTK_TREE_STORE (model), &other, - ACCEL_COMBO_COLUMN_TEXT, _("Other"), -1); - - parent = &alphanum; - - for (i = 0; GladeKeys[i].name != NULL; i++) - { - gtk_tree_store_append (GTK_TREE_STORE (model), &iter, parent); - gtk_tree_store_set - (GTK_TREE_STORE (model), &iter, - ACCEL_COMBO_COLUMN_TEXT, GladeKeys[i].name, -1); - - if (!strcmp (GladeKeys[i].name, GLADE_KEYS_LAST_ALPHANUM)) - parent = &extra; - else if (!strcmp (GladeKeys[i].name, GLADE_KEYS_LAST_EXTRA)) - parent = &keypad; - else if (!strcmp (GladeKeys[i].name, GLADE_KEYS_LAST_KP)) - parent = &fkey; - else if (!strcmp (GladeKeys[i].name, GLADE_KEYS_LAST_FKEY)) - parent = &other; - } - return model; -} - -static void -glade_eprop_accel_finalize (GObject *object) -{ - /* Chain up */ - G_OBJECT_CLASS (editor_property_class)->finalize (object); -} - -static void -glade_eprop_accel_load (GladeEditorProperty *eprop, - GladeProperty *property) -{ - GladeEPropAccel *eprop_accel = GLADE_EPROP_ACCEL (eprop); - gchar *accels; - - /* Chain up first */ - editor_property_class->load (eprop, property); - - if (property == NULL) return; - - if ((accels = glade_property_class_make_string_from_gvalue - (eprop->klass, property->value)) != NULL) - { - gtk_entry_set_text (GTK_ENTRY (eprop_accel->entry), accels); - g_free (accels); - } - else - gtk_entry_set_text (GTK_ENTRY (eprop_accel->entry), ""); - -} - -static gint -eprop_find_iter (GladeEpropIterTab *iter_tab, - gchar *name) -{ - return strcmp (iter_tab->name, name); -} - -static void -iter_tab_free (GladeEpropIterTab *iter_tab) -{ - gtk_tree_iter_free (iter_tab->iter); - g_free (iter_tab); -} - -static void -glade_eprop_accel_populate_view (GladeEditorProperty *eprop, - GtkTreeView *view) -{ - GladeEPropAccel *eprop_accel = GLADE_EPROP_ACCEL (eprop); - GladeSignalClass *sclass; - GladeWidgetAdaptor *adaptor = glade_widget_adaptor_from_pclass (eprop->klass); - GtkTreeStore *model = (GtkTreeStore *)gtk_tree_view_get_model (view); - GtkTreeIter iter; - GladeEpropIterTab *parent_tab; - GladeAccelInfo *info; - GList *list, *l, *found, *accelerators; - gchar *name; - - accelerators = g_value_get_boxed (eprop->property->value); - - /* First make parent iters... - */ - for (list = adaptor->signals; list; list = list->next) - { - sclass = list->data; - - /* Only action signals have accelerators. */ - if ((sclass->query.signal_flags & G_SIGNAL_ACTION) == 0) - continue; - - if (g_list_find_custom (eprop_accel->parent_iters, - sclass->type, - (GCompareFunc)eprop_find_iter) == NULL) - { - gtk_tree_store_append (model, &iter, NULL); - gtk_tree_store_set (model, &iter, - ACCEL_COLUMN_SIGNAL, sclass->type, - ACCEL_COLUMN_IS_CLASS, TRUE, - ACCEL_COLUMN_IS_SIGNAL, FALSE, - -1); - - parent_tab = g_new0 (GladeEpropIterTab, 1); - parent_tab->name = sclass->type; - parent_tab->iter = gtk_tree_iter_copy (&iter); - - eprop_accel->parent_iters = - g_list_prepend (eprop_accel->parent_iters, - parent_tab); - } - } - - /* Now we populate... - */ - for (list = adaptor->signals; list; list = list->next) - { - sclass = list->data; - - /* Only action signals have accelerators. */ - if ((sclass->query.signal_flags & G_SIGNAL_ACTION) == 0) - continue; - - if ((found = g_list_find_custom (eprop_accel->parent_iters, - sclass->type, - (GCompareFunc)eprop_find_iter)) != NULL) - { - parent_tab = found->data; - name = g_strdup_printf (" %s", sclass->name); - - /* Populate from accelerator list - */ - for (l = accelerators; l; l = l->next) - { - info = l->data; - - if (strcmp (info->signal, sclass->name)) - continue; - - gtk_tree_store_append (model, &iter, parent_tab->iter); - gtk_tree_store_set - (model, &iter, - ACCEL_COLUMN_SIGNAL, name, - ACCEL_COLUMN_REAL_SIGNAL, sclass->name, - ACCEL_COLUMN_IS_CLASS, FALSE, - ACCEL_COLUMN_IS_SIGNAL, TRUE, - ACCEL_COLUMN_MOD_SHIFT, - (info->modifiers & GDK_SHIFT_MASK) != 0, - ACCEL_COLUMN_MOD_CNTL, - (info->modifiers & GDK_CONTROL_MASK) != 0, - ACCEL_COLUMN_MOD_ALT, - (info->modifiers & GDK_MOD1_MASK) != 0, - ACCEL_COLUMN_KEY, - glade_builtin_string_from_key (info->key), - ACCEL_COLUMN_KEY_ENTERED, TRUE, - ACCEL_COLUMN_KEY_SLOT, FALSE, - -1); - } - - /* Append a new empty slot at the end */ - gtk_tree_store_append (model, &iter, parent_tab->iter); - gtk_tree_store_set - (model, &iter, - ACCEL_COLUMN_SIGNAL, name, - ACCEL_COLUMN_REAL_SIGNAL, sclass->name, - ACCEL_COLUMN_IS_CLASS, FALSE, - ACCEL_COLUMN_IS_SIGNAL, TRUE, - ACCEL_COLUMN_MOD_SHIFT, FALSE, - ACCEL_COLUMN_MOD_CNTL, FALSE, - ACCEL_COLUMN_MOD_ALT, FALSE, - ACCEL_COLUMN_KEY, _("<choose a key>"), - ACCEL_COLUMN_KEY_ENTERED, FALSE, - ACCEL_COLUMN_KEY_SLOT, TRUE, - -1); - - g_free (name); - } - } -} - -static void -key_edited (GtkCellRendererText *cell, - const gchar *path_string, - const gchar *new_text, - GladeEditorProperty *eprop) -{ - GladeEPropAccel *eprop_accel = GLADE_EPROP_ACCEL (eprop); - gboolean key_was_set; - const gchar *text; - GtkTreeIter iter, parent_iter, new_iter; - - if (!gtk_tree_model_get_iter_from_string (eprop_accel->model, - &iter, path_string)) - return; - - gtk_tree_model_get (eprop_accel->model, &iter, - ACCEL_COLUMN_KEY_ENTERED, &key_was_set, - -1); - - /* If user selects "none"; remove old entry or ignore new one. - */ - if (!new_text || new_text[0] == '\0' || - glade_builtin_string_from_key ((guint)new_text[0]) == NULL || - g_utf8_collate (new_text, _("None")) == 0 || - g_utf8_collate (new_text, _("<choose a key>")) == 0) - { - if (key_was_set) - gtk_tree_store_remove - (GTK_TREE_STORE (eprop_accel->model), &iter); - - return; - } - - if (glade_builtin_key_from_string (new_text) != 0) - text = new_text; - else - text = glade_builtin_string_from_key ((guint)new_text[0]); - - gtk_tree_store_set - (GTK_TREE_STORE (eprop_accel->model), &iter, - ACCEL_COLUMN_KEY, text, - ACCEL_COLUMN_KEY_ENTERED, TRUE, - ACCEL_COLUMN_KEY_SLOT, FALSE, - -1); - - /* Append a new one if needed - */ - if (key_was_set == FALSE && - gtk_tree_model_iter_parent (eprop_accel->model, - &parent_iter, &iter)) - { - gchar *signal, *real_signal; - - gtk_tree_model_get (eprop_accel->model, &iter, - ACCEL_COLUMN_SIGNAL, &signal, - ACCEL_COLUMN_REAL_SIGNAL, &real_signal, - -1); - - /* Append a new empty slot at the end */ - gtk_tree_store_insert_after (GTK_TREE_STORE (eprop_accel->model), - &new_iter, &parent_iter, &iter); - gtk_tree_store_set (GTK_TREE_STORE (eprop_accel->model), &new_iter, - ACCEL_COLUMN_SIGNAL, signal, - ACCEL_COLUMN_REAL_SIGNAL, real_signal, - ACCEL_COLUMN_IS_CLASS, FALSE, - ACCEL_COLUMN_IS_SIGNAL, TRUE, - ACCEL_COLUMN_MOD_SHIFT, FALSE, - ACCEL_COLUMN_MOD_CNTL, FALSE, - ACCEL_COLUMN_MOD_ALT, FALSE, - ACCEL_COLUMN_KEY, _("<choose a key>"), - ACCEL_COLUMN_KEY_ENTERED, FALSE, - ACCEL_COLUMN_KEY_SLOT, TRUE, - -1); - g_free (signal); - g_free (real_signal); - } -} - -static void -modifier_toggled (GtkCellRendererToggle *cell, - gchar *path_string, - GladeEditorProperty *eprop) -{ - GladeEPropAccel *eprop_accel = GLADE_EPROP_ACCEL (eprop); - GtkTreeIter iter; - gint column; - gboolean active, key_entered; - - if (!gtk_tree_model_get_iter_from_string (eprop_accel->model, - &iter, path_string)) - return; - - column = GPOINTER_TO_INT (g_object_get_data - (G_OBJECT (cell), "model-column")); - - gtk_tree_model_get - (eprop_accel->model, &iter, - ACCEL_COLUMN_KEY_ENTERED, &key_entered, - column, &active, -1); - - if (key_entered) - gtk_tree_store_set - (GTK_TREE_STORE (eprop_accel->model), &iter, - column, !active, -1); -} - - -static GtkWidget * -glade_eprop_accel_view (GladeEditorProperty *eprop) -{ - GladeEPropAccel *eprop_accel = GLADE_EPROP_ACCEL (eprop); - GtkWidget *view_widget; - GtkCellRenderer *renderer; - GtkTreeViewColumn *column; - - eprop_accel->model = (GtkTreeModel *)gtk_tree_store_new - (ACCEL_NUM_COLUMNS, - G_TYPE_STRING, /* The GSignal name formatted for display */ - G_TYPE_STRING, /* The GSignal name */ - G_TYPE_STRING, /* The Gdk keycode */ - G_TYPE_BOOLEAN, /* The shift modifier */ - G_TYPE_BOOLEAN, /* The cntl modifier */ - G_TYPE_BOOLEAN, /* The alt modifier */ - G_TYPE_BOOLEAN, /* Whether this is a class entry */ - G_TYPE_BOOLEAN, /* Whether this is a signal entry (oposite of above) */ - G_TYPE_BOOLEAN, /* Whether the key has been entered for this row */ - G_TYPE_BOOLEAN); /* Oposite of above */ - - view_widget = gtk_tree_view_new_with_model (eprop_accel->model); - g_object_set (G_OBJECT (view_widget), "enable-search", FALSE, NULL); - - /********************* fake invisible column *********************/ - renderer = gtk_cell_renderer_text_new (); - g_object_set (G_OBJECT (renderer), "editable", FALSE, "visible", FALSE, NULL); - - column = gtk_tree_view_column_new_with_attributes (NULL, renderer, NULL); - gtk_tree_view_append_column (GTK_TREE_VIEW (view_widget), column); - - gtk_tree_view_column_set_visible (column, FALSE); - gtk_tree_view_set_expander_column (GTK_TREE_VIEW (view_widget), column); - - /********************* signal name column *********************/ - renderer = gtk_cell_renderer_text_new (); - g_object_set (G_OBJECT (renderer), - "editable", FALSE, - "weight", PANGO_WEIGHT_BOLD, - NULL); - - column = gtk_tree_view_column_new_with_attributes - (_("Signal"), renderer, - "text", ACCEL_COLUMN_SIGNAL, - "weight-set", ACCEL_COLUMN_IS_CLASS, - NULL); - - g_object_set (G_OBJECT (column), "expand", TRUE, NULL); - - gtk_tree_view_append_column (GTK_TREE_VIEW (view_widget), column); - - /********************* key name column *********************/ - if (keysyms_model == NULL) - keysyms_model = create_keysyms_model (); - - renderer = gtk_cell_renderer_combo_new (); - g_object_set (G_OBJECT (renderer), - "editable", TRUE, - "model", keysyms_model, - "text-column", ACCEL_COMBO_COLUMN_TEXT, - "has-entry", TRUE, - "style", PANGO_STYLE_ITALIC, - "foreground", "Gray", - NULL); - - g_signal_connect (renderer, "edited", - G_CALLBACK (key_edited), eprop); - - column = gtk_tree_view_column_new_with_attributes - (_("Key"), renderer, - "text", ACCEL_COLUMN_KEY, - "style-set", ACCEL_COLUMN_KEY_SLOT, - "foreground-set", ACCEL_COLUMN_KEY_SLOT, - "visible", ACCEL_COLUMN_IS_SIGNAL, - NULL); - - g_object_set (G_OBJECT (column), "expand", TRUE, NULL); - - gtk_tree_view_append_column (GTK_TREE_VIEW (view_widget), column); - - /********************* shift modifier column *********************/ - renderer = gtk_cell_renderer_toggle_new (); - column = gtk_tree_view_column_new_with_attributes - (_("Shift"), renderer, - "visible", ACCEL_COLUMN_IS_SIGNAL, - "sensitive", ACCEL_COLUMN_KEY_ENTERED, - "active", ACCEL_COLUMN_MOD_SHIFT, - NULL); - - g_object_set_data (G_OBJECT (renderer), "model-column", - GINT_TO_POINTER (ACCEL_COLUMN_MOD_SHIFT)); - g_signal_connect (G_OBJECT (renderer), "toggled", - G_CALLBACK (modifier_toggled), eprop); - - gtk_tree_view_append_column (GTK_TREE_VIEW (view_widget), column); - - /********************* control modifier column *********************/ - renderer = gtk_cell_renderer_toggle_new (); - column = gtk_tree_view_column_new_with_attributes - (_("Control"), renderer, - "visible", ACCEL_COLUMN_IS_SIGNAL, - "sensitive", ACCEL_COLUMN_KEY_ENTERED, - "active", ACCEL_COLUMN_MOD_CNTL, - NULL); - - g_object_set_data (G_OBJECT (renderer), "model-column", - GINT_TO_POINTER (ACCEL_COLUMN_MOD_CNTL)); - g_signal_connect (G_OBJECT (renderer), "toggled", - G_CALLBACK (modifier_toggled), eprop); - - gtk_tree_view_append_column (GTK_TREE_VIEW (view_widget), column); - - /********************* alt modifier column *********************/ - renderer = gtk_cell_renderer_toggle_new (); - column = gtk_tree_view_column_new_with_attributes - (_("Alt"), renderer, - "visible", ACCEL_COLUMN_IS_SIGNAL, - "sensitive", ACCEL_COLUMN_KEY_ENTERED, - "active", ACCEL_COLUMN_MOD_ALT, - NULL); - - g_object_set_data (G_OBJECT (renderer), "model-column", - GINT_TO_POINTER (ACCEL_COLUMN_MOD_ALT)); - g_signal_connect (G_OBJECT (renderer), "toggled", - G_CALLBACK (modifier_toggled), eprop); - - gtk_tree_view_append_column (GTK_TREE_VIEW (view_widget), column); - - return view_widget; -} - -static gboolean -glade_eprop_accel_accum_accelerators (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, - GList **ret) -{ - GladeAccelInfo *info; - gchar *signal, *key_str; - gboolean shift, cntl, alt, entered; - - gtk_tree_model_get (model, iter, ACCEL_COLUMN_KEY_ENTERED, &entered, -1); - if (entered == FALSE) return FALSE; - - gtk_tree_model_get (model, iter, - ACCEL_COLUMN_REAL_SIGNAL, &signal, - ACCEL_COLUMN_KEY, &key_str, - ACCEL_COLUMN_MOD_SHIFT, &shift, - ACCEL_COLUMN_MOD_CNTL, &cntl, - ACCEL_COLUMN_MOD_ALT, &alt, - -1); - - info = g_new0 (GladeAccelInfo, 1); - info->signal = signal; - info->key = glade_builtin_key_from_string (key_str); - info->modifiers = (shift ? GDK_SHIFT_MASK : 0) | - (cntl ? GDK_CONTROL_MASK : 0) | - (alt ? GDK_MOD1_MASK : 0); - - *ret = g_list_prepend (*ret, info); - - g_free (key_str); - - return FALSE; -} - - -static void -glade_eprop_accel_show_dialog (GtkWidget *dialog_button, - GladeEditorProperty *eprop) -{ - GladeEPropAccel *eprop_accel = GLADE_EPROP_ACCEL (eprop); - GtkWidget *dialog, *parent, *vbox, *sw, *tree_view; - GladeProject *project; - GValue *value; - GList *accelerators = NULL; - gint res; - - project = glade_widget_get_project (eprop->property->widget); - parent = gtk_widget_get_toplevel (GTK_WIDGET (eprop)); - - dialog = gtk_dialog_new_with_buttons (_("Choose accelerator keys..."), - GTK_WINDOW (parent), - GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_STOCK_CLEAR, GLADE_RESPONSE_CLEAR, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, GTK_RESPONSE_OK, - NULL); - - gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE); - - vbox = gtk_vbox_new (FALSE, 6); - gtk_widget_show (vbox); - - gtk_container_set_border_width (GTK_CONTAINER (vbox), 6); - - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), vbox, TRUE, TRUE, 0); - - sw = gtk_scrolled_window_new (NULL, NULL); - gtk_widget_show (sw); - gtk_box_pack_start (GTK_BOX (vbox), sw, TRUE, TRUE, 0); - gtk_widget_set_size_request (sw, 400, 200); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), - GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN); - - tree_view = glade_eprop_accel_view (eprop); - glade_eprop_accel_populate_view (eprop, GTK_TREE_VIEW (tree_view)); - - gtk_tree_view_expand_all (GTK_TREE_VIEW (tree_view)); - - gtk_widget_show (tree_view); - gtk_container_add (GTK_CONTAINER (sw), tree_view); - - /* Run the dialog */ - res = gtk_dialog_run (GTK_DIALOG (dialog)); - if (res == GTK_RESPONSE_OK) - { - gtk_tree_model_foreach - (gtk_tree_view_get_model (GTK_TREE_VIEW (tree_view)), - (GtkTreeModelForeachFunc) - glade_eprop_accel_accum_accelerators, &accelerators); - - value = g_new0 (GValue, 1); - g_value_init (value, GLADE_TYPE_ACCEL_GLIST); - g_value_take_boxed (value, accelerators); - - glade_editor_property_commit (eprop, value); - - g_value_unset (value); - g_free (value); - } - else if (res == GLADE_RESPONSE_CLEAR) - { - value = g_new0 (GValue, 1); - g_value_init (value, GLADE_TYPE_ACCEL_GLIST); - g_value_set_boxed (value, NULL); - - glade_editor_property_commit (eprop, value); - - g_value_unset (value); - g_free (value); - } - - /* Clean up ... - */ - gtk_widget_destroy (dialog); - - g_object_unref (G_OBJECT (eprop_accel->model)); - eprop_accel->model = NULL; - - if (eprop_accel->parent_iters) - { - g_list_foreach (eprop_accel->parent_iters, (GFunc)iter_tab_free, NULL); - g_list_free (eprop_accel->parent_iters); - eprop_accel->parent_iters = NULL; - } - -} - -static GtkWidget * -glade_eprop_accel_create_input (GladeEditorProperty *eprop) -{ - GladeEPropAccel *eprop_accel = GLADE_EPROP_ACCEL (eprop); - GtkWidget *hbox; - GtkWidget *button; - - hbox = gtk_hbox_new (FALSE, 0); - eprop_accel->entry = gtk_entry_new (); - gtk_entry_set_editable (GTK_ENTRY (eprop_accel->entry), FALSE); - gtk_widget_show (eprop_accel->entry); - gtk_box_pack_start (GTK_BOX (hbox), eprop_accel->entry, TRUE, TRUE, 0); - - button = gtk_button_new_with_label ("..."); - gtk_widget_show (button); - gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); - - g_signal_connect (G_OBJECT (button), "clicked", - G_CALLBACK (glade_eprop_accel_show_dialog), - eprop); - - return hbox; -} - - - -/******************************************************************************* - Misc static stuff - *******************************************************************************/ -static GType -glade_editor_property_type (GParamSpec *pspec) -{ - GType type = 0; - - if (pspec->value_type == GLADE_TYPE_STOCK || - G_IS_PARAM_SPEC_ENUM(pspec)) - type = GLADE_TYPE_EPROP_ENUM; - else if (G_IS_PARAM_SPEC_FLAGS(pspec)) - type = GLADE_TYPE_EPROP_FLAGS; - else if (G_IS_PARAM_SPEC_VALUE_ARRAY (pspec)) - { - if (pspec->value_type == G_TYPE_VALUE_ARRAY) - type = GLADE_TYPE_EPROP_TEXT; - } - else if (G_IS_PARAM_SPEC_BOXED(pspec)) - { - if (pspec->value_type == GDK_TYPE_COLOR) - type = GLADE_TYPE_EPROP_COLOR; - else if (pspec->value_type == G_TYPE_STRV) - type = GLADE_TYPE_EPROP_TEXT; - } - else if (G_IS_PARAM_SPEC_STRING(pspec)) - type = GLADE_TYPE_EPROP_TEXT; - else if (G_IS_PARAM_SPEC_BOOLEAN(pspec)) - type = GLADE_TYPE_EPROP_BOOL; - else if (G_IS_PARAM_SPEC_FLOAT(pspec) || - G_IS_PARAM_SPEC_DOUBLE(pspec) || - G_IS_PARAM_SPEC_INT(pspec) || - G_IS_PARAM_SPEC_UINT(pspec) || - G_IS_PARAM_SPEC_LONG(pspec) || - G_IS_PARAM_SPEC_ULONG(pspec) || - G_IS_PARAM_SPEC_INT64(pspec) || - G_IS_PARAM_SPEC_UINT64(pspec)) - type = GLADE_TYPE_EPROP_NUMERIC; - else if (G_IS_PARAM_SPEC_UNICHAR(pspec)) - type = GLADE_TYPE_EPROP_UNICHAR; - else if (G_IS_PARAM_SPEC_OBJECT(pspec)) - { - if (pspec->value_type == GDK_TYPE_PIXBUF) - type = GLADE_TYPE_EPROP_RESOURCE; - else if (pspec->value_type == GTK_TYPE_ADJUSTMENT) - type = GLADE_TYPE_EPROP_ADJUSTMENT; - else - type = GLADE_TYPE_EPROP_OBJECT; - } - else if (GLADE_IS_PARAM_SPEC_OBJECTS(pspec)) - type = GLADE_TYPE_EPROP_OBJECTS; - else if (GLADE_IS_PARAM_SPEC_ACCEL(pspec)) - type = GLADE_TYPE_EPROP_ACCEL; - - return type; -} - -/******************************************************************************* API *******************************************************************************/ /** - * glade_editor_property_new: - * @klass: A #GladePropertyClass - * @use_command: Whether the undo/redo stack applies here. - * - * This is a factory function to create the correct type of - * editor property that can edit the said type of #GladePropertyClass - * - * Returns: A newly created GladeEditorProperty of the correct type - */ -GladeEditorProperty * -glade_editor_property_new (GladePropertyClass *klass, - gboolean use_command) -{ - GladeEditorProperty *eprop; - GType type = 0; - - /* Find the right type of GladeEditorProperty for this - * GladePropertyClass. - */ - if ((type = glade_editor_property_type (klass->pspec)) == 0) - g_error ("%s : pspec '%s' type '%s' not implemented (%s)\n", - G_GNUC_PRETTY_FUNCTION, - klass->name, - g_type_name (G_PARAM_SPEC_TYPE (klass->pspec)), - g_type_name (klass->pspec->value_type)); - - /* special case for resource specs which are hand specified in the catalog. */ - if (klass->resource) - type = GLADE_TYPE_EPROP_RESOURCE; - - /* special case for string specs that denote themed application icons. */ - if (klass->themed_icon) - type = GLADE_TYPE_EPROP_NAMED_ICON; - - /* Create and return the correct type of GladeEditorProperty */ - eprop = g_object_new (type, - "property-class", klass, - "use-command", use_command, - NULL); - - return eprop; -} - -/** - * glade_editor_property_new_from_widget: - * @widget: A #GladeWidget - * @property: The widget's property - * @packing: whether @property indicates a packing property or not. - * @use_command: Whether the undo/redo stack applies here. - * - * This is a convenience function to create a GladeEditorProperty corresponding - * to @property - * - * Returns: A newly created and connected GladeEditorProperty - */ -GladeEditorProperty * -glade_editor_property_new_from_widget (GladeWidget *widget, - const gchar *property, - gboolean packing, - gboolean use_command) -{ - GladeEditorProperty *eprop; - GladeProperty *p; - - if (packing) - p = glade_widget_get_pack_property (widget, property); - else - p = glade_widget_get_property (widget, property); - g_return_val_if_fail (GLADE_IS_PROPERTY (p), NULL); - - eprop = glade_editor_property_new (p->klass, use_command); - glade_editor_property_load (eprop, p); - - return eprop; -} - -/** - * glade_editor_property_supported: - * @pspec: A #GParamSpec - * - * Returns: whether this pspec is supported by GladeEditorProperties. - */ -gboolean -glade_editor_property_supported (GParamSpec *pspec) -{ - return glade_editor_property_type (pspec) != 0; -} - - -/** * glade_editor_property_load: * @eprop: A #GladeEditorProperty * @property: A #GladeProperty @@ -4009,10 +3146,12 @@ glade_editor_property_load_by_widget (GladeEditorProperty *eprop, g_return_if_fail (widget == NULL || GLADE_IS_WIDGET (widget)); if (widget) + { /* properties are allowed to be missing on some internal widgets */ property = glade_widget_get_property (widget, eprop->klass->id); - glade_editor_property_load (eprop, property); + glade_editor_property_load (eprop, property); + } } /** diff --git a/gladeui/glade-editor-property.h b/gladeui/glade-editor-property.h index c9fce8b6..b8edfe6a 100644 --- a/gladeui/glade-editor-property.h +++ b/gladeui/glade-editor-property.h @@ -2,8 +2,69 @@ #ifndef __GLADE_EDITOR_PROPERTY_H__ #define __GLADE_EDITOR_PROPERTY_H__ +#include <gtk/gtk.h> + G_BEGIN_DECLS + + +/******************************************************************************* + Boiler plate macros (inspired from glade-command.c) + *******************************************************************************/ +/* XXX document me ! */ + +#define GLADE_MAKE_EPROP_TYPE(func, type, parent) \ +GType \ +func ## _get_type (void) \ +{ \ + static GType cmd_type = 0; \ + \ + if (!cmd_type) \ + { \ + static const GTypeInfo info = \ + { \ + sizeof (type ## Class), \ + (GBaseInitFunc) NULL, \ + (GBaseFinalizeFunc) NULL, \ + (GClassInitFunc) func ## _class_init, \ + (GClassFinalizeFunc) NULL, \ + NULL, \ + sizeof (type), \ + 0, \ + (GInstanceInitFunc) NULL \ + }; \ + \ + cmd_type = g_type_register_static (parent, #type, &info, 0); \ + } \ + \ + return cmd_type; \ +} \ + + +#define GLADE_MAKE_EPROP(type, func) \ +static void \ +func ## _finalize (GObject *object); \ +static void \ +func ## _load (GladeEditorProperty *me, GladeProperty *property); \ +static GtkWidget * \ +func ## _create_input (GladeEditorProperty *me); \ +static void \ +func ## _class_init (gpointer parent_tmp, gpointer notused) \ +{ \ + GladeEditorPropertyClass *parent = parent_tmp; \ + GObjectClass* object_class; \ + object_class = G_OBJECT_CLASS (parent); \ + parent->load = func ## _load; \ + parent->create_input = func ## _create_input; \ + object_class->finalize = func ## _finalize; \ +} \ +typedef struct { \ + GladeEditorPropertyClass cmd; \ +} type ## Class; \ +GLADE_MAKE_EPROP_TYPE(func, type, GLADE_TYPE_EDITOR_PROPERTY) + + + #define GLADE_TYPE_EDITOR_PROPERTY (glade_editor_property_get_type()) #define GLADE_EDITOR_PROPERTY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_EDITOR_PROPERTY, GladeEditorProperty)) #define GLADE_EDITOR_PROPERTY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_EDITOR_PROPERTY, GladeEditorPropertyClass)) @@ -59,7 +120,6 @@ struct _GladeEditorPropertyClass { void (* load) (GladeEditorProperty *, GladeProperty *); - /* private */ GtkWidget *(* create_input) (GladeEditorProperty *); void (* gtk_doc_search)(GladeEditorProperty *, @@ -71,15 +131,7 @@ struct _GladeEditorPropertyClass { -GType glade_editor_property_get_type (void); - -GladeEditorProperty *glade_editor_property_new (GladePropertyClass *klass, - gboolean use_command); - -GladeEditorProperty *glade_editor_property_new_from_widget (GladeWidget *widget, - const gchar *property, - gboolean packing, - gboolean use_command); +GType glade_editor_property_get_type (void) G_GNUC_CONST; void glade_editor_property_load (GladeEditorProperty *eprop, GladeProperty *property); @@ -87,12 +139,40 @@ void glade_editor_property_load (GladeEditorProperty * void glade_editor_property_load_by_widget (GladeEditorProperty *eprop, GladeWidget *widget); -gboolean glade_editor_property_supported (GParamSpec *pspec); - void glade_editor_property_show_info (GladeEditorProperty *eprop); void glade_editor_property_hide_info (GladeEditorProperty *eprop); +void glade_editor_property_commit (GladeEditorProperty *eprop, + GValue *value); + + +/* Generic eprops */ +#define GLADE_TYPE_EPROP_NUMERIC (glade_eprop_numeric_get_type()) +#define GLADE_TYPE_EPROP_ENUM (glade_eprop_enum_get_type()) +#define GLADE_TYPE_EPROP_FLAGS (glade_eprop_flags_get_type()) +#define GLADE_TYPE_EPROP_COLOR (glade_eprop_color_get_type()) +#define GLADE_TYPE_EPROP_NAMED_ICON (glade_eprop_named_icon_get_type()) +#define GLADE_TYPE_EPROP_TEXT (glade_eprop_text_get_type()) +#define GLADE_TYPE_EPROP_BOOL (glade_eprop_bool_get_type()) +#define GLADE_TYPE_EPROP_UNICHAR (glade_eprop_unichar_get_type()) +#define GLADE_TYPE_EPROP_RESOURCE (glade_eprop_resource_get_type()) +#define GLADE_TYPE_EPROP_OBJECT (glade_eprop_object_get_type()) +#define GLADE_TYPE_EPROP_OBJECTS (glade_eprop_objects_get_type()) +#define GLADE_TYPE_EPROP_ADJUSTMENT (glade_eprop_adjustment_get_type()) +GType glade_eprop_numeric_get_type (void) G_GNUC_CONST; +GType glade_eprop_enum_get_type (void) G_GNUC_CONST; +GType glade_eprop_flags_get_type (void) G_GNUC_CONST; +GType glade_eprop_color_get_type (void) G_GNUC_CONST; +GType glade_eprop_named_icon_get_type (void) G_GNUC_CONST; +GType glade_eprop_text_get_type (void) G_GNUC_CONST; +GType glade_eprop_bool_get_type (void) G_GNUC_CONST; +GType glade_eprop_unichar_get_type (void) G_GNUC_CONST; +GType glade_eprop_resource_get_type (void) G_GNUC_CONST; +GType glade_eprop_object_get_type (void) G_GNUC_CONST; +GType glade_eprop_objects_get_type (void) G_GNUC_CONST; +GType glade_eprop_adjustment_get_type (void) G_GNUC_CONST; + G_END_DECLS diff --git a/gladeui/glade-editor.c b/gladeui/glade-editor.c index 535f69a2..03501372 100644 --- a/gladeui/glade-editor.c +++ b/gladeui/glade-editor.c @@ -434,7 +434,10 @@ glade_editor_table_append_item (GladeEditorTable *table, { GladeEditorProperty *property; - property = glade_editor_property_new (klass, from_query_dialog == FALSE); + property = glade_widget_adaptor_create_eprop + (GLADE_WIDGET_ADAPTOR (klass->handle), + klass, from_query_dialog == FALSE); + gtk_widget_show (GTK_WIDGET (property)); gtk_widget_show_all (property->item_label); @@ -570,13 +573,9 @@ glade_editor_table_append_items (GladeEditorTable *table, continue; else if (type == TABLE_TYPE_GENERAL && property_class->common) continue; - else if (type == TABLE_TYPE_ATK && - (property_class->type == GPC_NORMAL || - property_class->type == GPC_ACCEL_PROPERTY)) + else if (type == TABLE_TYPE_ATK && !property_class->atk) continue; - else if (type != TABLE_TYPE_ATK && - (property_class->type != GPC_NORMAL && - property_class->type != GPC_ACCEL_PROPERTY)) + else if (type != TABLE_TYPE_ATK && property_class->atk) continue; property = glade_editor_table_append_item (table, property_class, @@ -1197,8 +1196,7 @@ glade_editor_populate_reset_view (GladeEditor *editor, if (glade_property_class_is_visible (property->klass) == FALSE) continue; - if (property->klass->type != GPC_NORMAL && - property->klass->type != GPC_ACCEL_PROPERTY) + if (property->klass->atk) iter = &atk_iter; else if (property->klass->common) iter = &common_iter; diff --git a/gladeui/glade-keysyms.c b/gladeui/glade-keysyms.c deleted file mode 100644 index 2b028981..00000000 --- a/gladeui/glade-keysyms.c +++ /dev/null @@ -1,1360 +0,0 @@ -#include <gdk/gdkkeysyms.h> - -#include "glade-builtins.h" - -/* - * This is automatically generated by ${glade-2 cvs}/tools/getkeys.pl - */ -const GladeKey GladeKeys[] = -{ - { GDK_A, "A" }, - { GDK_B, "B" }, - { GDK_C, "C" }, - { GDK_D, "D" }, - { GDK_E, "E" }, - { GDK_F, "F" }, - { GDK_G, "G" }, - { GDK_H, "H" }, - { GDK_I, "I" }, - { GDK_J, "J" }, - { GDK_K, "K" }, - { GDK_L, "L" }, - { GDK_M, "M" }, - { GDK_N, "N" }, - { GDK_O, "O" }, - { GDK_P, "P" }, - { GDK_Q, "Q" }, - { GDK_R, "R" }, - { GDK_S, "S" }, - { GDK_T, "T" }, - { GDK_U, "U" }, - { GDK_V, "V" }, - { GDK_W, "W" }, - { GDK_X, "X" }, - { GDK_Y, "Y" }, - { GDK_Z, "Z" }, - { GDK_a, "a" }, - { GDK_b, "b" }, - { GDK_c, "c" }, - { GDK_d, "d" }, - { GDK_e, "e" }, - { GDK_f, "f" }, - { GDK_g, "g" }, - { GDK_h, "h" }, - { GDK_i, "i" }, - { GDK_j, "j" }, - { GDK_k, "k" }, - { GDK_l, "l" }, - { GDK_m, "m" }, - { GDK_n, "n" }, - { GDK_o, "o" }, - { GDK_p, "p" }, - { GDK_q, "q" }, - { GDK_r, "r" }, - { GDK_s, "s" }, - { GDK_t, "t" }, - { GDK_u, "u" }, - { GDK_v, "v" }, - { GDK_w, "w" }, - { GDK_x, "x" }, - { GDK_y, "y" }, - { GDK_z, "z" }, - - { GDK_0, "0" }, - { GDK_1, "1" }, - { GDK_2, "2" }, - { GDK_3, "3" }, - { GDK_4, "4" }, - { GDK_5, "5" }, - { GDK_6, "6" }, - { GDK_7, "7" }, - { GDK_8, "8" }, - { GDK_9, "9" }, - - { GDK_BackSpace, "BackSpace" }, - { GDK_Tab, "Tab" }, - { GDK_Return, "Return" }, - { GDK_Escape, "Escape" }, - { GDK_Delete, "Delete" }, - { GDK_Insert, "Insert" }, - { GDK_space, "space" }, - - { GDK_Home, "Home" }, - { GDK_Left, "Left" }, - { GDK_Up, "Up" }, - { GDK_Right, "Right" }, - { GDK_Down, "Down" }, - { GDK_Page_Up, "Page_Up" }, - { GDK_Page_Down, "Page_Down" }, - { GDK_End, "End" }, - - { GDK_exclam, "exclam" }, - { GDK_quotedbl, "quotedbl" }, - { GDK_numbersign, "numbersign" }, - { GDK_dollar, "dollar" }, - { GDK_percent, "percent" }, - { GDK_ampersand, "ampersand" }, - { GDK_apostrophe, "apostrophe" }, - { GDK_quoteright, "quoteright" }, - { GDK_parenleft, "parenleft" }, - { GDK_parenright, "parenright" }, - { GDK_asterisk, "asterisk" }, - { GDK_plus, "plus" }, - { GDK_comma, "comma" }, - { GDK_minus, "minus" }, - { GDK_period, "period" }, - { GDK_slash, "slash" }, - { GDK_colon, "colon" }, - { GDK_semicolon, "semicolon" }, - { GDK_less, "less" }, - { GDK_equal, "equal" }, - { GDK_greater, "greater" }, - { GDK_question, "question" }, - { GDK_at, "at" }, - { GDK_bracketleft, "bracketleft" }, - { GDK_backslash, "backslash" }, - { GDK_bracketright, "bracketright" }, - { GDK_asciicircum, "asciicircum" }, - { GDK_underscore, "underscore" }, - { GDK_grave, "grave" }, - { GDK_quoteleft, "quoteleft" }, - { GDK_braceleft, "braceleft" }, - { GDK_bar, "bar" }, - { GDK_braceright, "braceright" }, - { GDK_asciitilde, "asciitilde" }, - { GDK_nobreakspace, "nobreakspace" }, - { GDK_exclamdown, "exclamdown" }, - { GDK_cent, "cent" }, - { GDK_sterling, "sterling" }, - { GDK_currency, "currency" }, - { GDK_yen, "yen" }, - { GDK_brokenbar, "brokenbar" }, - { GDK_section, "section" }, - { GDK_diaeresis, "diaeresis" }, - { GDK_copyright, "copyright" }, - { GDK_ordfeminine, "ordfeminine" }, - { GDK_guillemotleft, "guillemotleft" }, - { GDK_notsign, "notsign" }, - { GDK_hyphen, "hyphen" }, - { GDK_registered, "registered" }, - { GDK_macron, "macron" }, - { GDK_degree, "degree" }, - { GDK_plusminus, "plusminus" }, - { GDK_twosuperior, "twosuperior" }, - { GDK_threesuperior, "threesuperior" }, - { GDK_acute, "acute" }, - { GDK_mu, "mu" }, - { GDK_paragraph, "paragraph" }, - { GDK_periodcentered, "periodcentered" }, - { GDK_cedilla, "cedilla" }, - { GDK_onesuperior, "onesuperior" }, - { GDK_masculine, "masculine" }, - { GDK_guillemotright, "guillemotright" }, - { GDK_onequarter, "onequarter" }, - { GDK_onehalf, "onehalf" }, - { GDK_threequarters, "threequarters" }, - { GDK_questiondown, "questiondown" }, - - { GDK_KP_Space, "KP_Space" }, - { GDK_KP_Tab, "KP_Tab" }, - { GDK_KP_Enter, "KP_Enter" }, - { GDK_KP_F1, "KP_F1" }, - { GDK_KP_F2, "KP_F2" }, - { GDK_KP_F3, "KP_F3" }, - { GDK_KP_F4, "KP_F4" }, - { GDK_KP_Home, "KP_Home" }, - { GDK_KP_Left, "KP_Left" }, - { GDK_KP_Up, "KP_Up" }, - { GDK_KP_Right, "KP_Right" }, - { GDK_KP_Down, "KP_Down" }, - { GDK_KP_Prior, "KP_Prior" }, - { GDK_KP_Page_Up, "KP_Page_Up" }, - { GDK_KP_Next, "KP_Next" }, - { GDK_KP_Page_Down, "KP_Page_Down" }, - { GDK_KP_End, "KP_End" }, - { GDK_KP_Begin, "KP_Begin" }, - { GDK_KP_Insert, "KP_Insert" }, - { GDK_KP_Delete, "KP_Delete" }, - { GDK_KP_Equal, "KP_Equal" }, - { GDK_KP_Multiply, "KP_Multiply" }, - { GDK_KP_Add, "KP_Add" }, - { GDK_KP_Separator, "KP_Separator" }, - { GDK_KP_Subtract, "KP_Subtract" }, - { GDK_KP_Decimal, "KP_Decimal" }, - { GDK_KP_Divide, "KP_Divide" }, - { GDK_KP_0, "KP_0" }, - { GDK_KP_1, "KP_1" }, - { GDK_KP_2, "KP_2" }, - { GDK_KP_3, "KP_3" }, - { GDK_KP_4, "KP_4" }, - { GDK_KP_5, "KP_5" }, - { GDK_KP_6, "KP_6" }, - { GDK_KP_7, "KP_7" }, - { GDK_KP_8, "KP_8" }, - { GDK_KP_9, "KP_9" }, - - { GDK_F1, "F1" }, - { GDK_F2, "F2" }, - { GDK_F3, "F3" }, - { GDK_F4, "F4" }, - { GDK_F5, "F5" }, - { GDK_F6, "F6" }, - { GDK_F7, "F7" }, - { GDK_F8, "F8" }, - { GDK_F9, "F9" }, - { GDK_F10, "F10" }, - { GDK_F11, "F11" }, - { GDK_F12, "F12" }, - { GDK_F13, "F13" }, - { GDK_F14, "F14" }, - { GDK_F15, "F15" }, - { GDK_F16, "F16" }, - { GDK_F17, "F17" }, - { GDK_F18, "F18" }, - { GDK_F19, "F19" }, - { GDK_F20, "F20" }, - { GDK_F21, "F21" }, - { GDK_F22, "F22" }, - { GDK_F23, "F23" }, - { GDK_F24, "F24" }, - { GDK_F25, "F25" }, - { GDK_F26, "F26" }, - { GDK_F27, "F27" }, - { GDK_F28, "F28" }, - { GDK_F29, "F29" }, - { GDK_F30, "F30" }, - { GDK_F31, "F31" }, - { GDK_F32, "F32" }, - { GDK_F33, "F33" }, - { GDK_F34, "F34" }, - { GDK_F35, "F35" }, - - { GDK_VoidSymbol, "VoidSymbol" }, - { GDK_Linefeed, "Linefeed" }, - { GDK_Clear, "Clear" }, - { GDK_Pause, "Pause" }, - { GDK_Scroll_Lock, "Scroll_Lock" }, - { GDK_Sys_Req, "Sys_Req" }, - { GDK_Multi_key, "Multi_key" }, - { GDK_Codeinput, "Codeinput" }, - { GDK_SingleCandidate, "SingleCandidate" }, - { GDK_MultipleCandidate, "MultipleCandidate" }, - { GDK_PreviousCandidate, "PreviousCandidate" }, - { GDK_Kanji, "Kanji" }, - { GDK_Muhenkan, "Muhenkan" }, - { GDK_Henkan_Mode, "Henkan_Mode" }, - { GDK_Henkan, "Henkan" }, - { GDK_Romaji, "Romaji" }, - { GDK_Hiragana, "Hiragana" }, - { GDK_Katakana, "Katakana" }, - { GDK_Hiragana_Katakana, "Hiragana_Katakana" }, - { GDK_Zenkaku, "Zenkaku" }, - { GDK_Hankaku, "Hankaku" }, - { GDK_Zenkaku_Hankaku, "Zenkaku_Hankaku" }, - { GDK_Touroku, "Touroku" }, - { GDK_Massyo, "Massyo" }, - { GDK_Kana_Lock, "Kana_Lock" }, - { GDK_Kana_Shift, "Kana_Shift" }, - { GDK_Eisu_Shift, "Eisu_Shift" }, - { GDK_Eisu_toggle, "Eisu_toggle" }, - { GDK_Kanji_Bangou, "Kanji_Bangou" }, - { GDK_Zen_Koho, "Zen_Koho" }, - { GDK_Mae_Koho, "Mae_Koho" }, - { GDK_Prior, "Prior" }, - { GDK_Next, "Next" }, - { GDK_Begin, "Begin" }, - { GDK_Select, "Select" }, - { GDK_Print, "Print" }, - { GDK_Execute, "Execute" }, - { GDK_Undo, "Undo" }, - { GDK_Redo, "Redo" }, - { GDK_Menu, "Menu" }, - { GDK_Find, "Find" }, - { GDK_Cancel, "Cancel" }, - { GDK_Help, "Help" }, - { GDK_Break, "Break" }, - { GDK_Mode_switch, "Mode_switch" }, - { GDK_script_switch, "script_switch" }, - { GDK_Num_Lock, "Num_Lock" }, - { GDK_L1, "L1" }, - { GDK_L2, "L2" }, - { GDK_L3, "L3" }, - { GDK_L4, "L4" }, - { GDK_L5, "L5" }, - { GDK_L6, "L6" }, - { GDK_L7, "L7" }, - { GDK_L8, "L8" }, - { GDK_L9, "L9" }, - { GDK_L10, "L10" }, - { GDK_R1, "R1" }, - { GDK_R2, "R2" }, - { GDK_R3, "R3" }, - { GDK_R4, "R4" }, - { GDK_R5, "R5" }, - { GDK_R6, "R6" }, - { GDK_R7, "R7" }, - { GDK_R8, "R8" }, - { GDK_R9, "R9" }, - { GDK_R10, "R10" }, - { GDK_R11, "R11" }, - { GDK_R12, "R12" }, - { GDK_R13, "R13" }, - { GDK_R14, "R14" }, - { GDK_R15, "R15" }, - { GDK_Shift_L, "Shift_L" }, - { GDK_Shift_R, "Shift_R" }, - { GDK_Control_L, "Control_L" }, - { GDK_Control_R, "Control_R" }, - { GDK_Caps_Lock, "Caps_Lock" }, - { GDK_Shift_Lock, "Shift_Lock" }, - { GDK_Meta_L, "Meta_L" }, - { GDK_Meta_R, "Meta_R" }, - { GDK_Alt_L, "Alt_L" }, - { GDK_Alt_R, "Alt_R" }, - { GDK_Super_L, "Super_L" }, - { GDK_Super_R, "Super_R" }, - { GDK_Hyper_L, "Hyper_L" }, - { GDK_Hyper_R, "Hyper_R" }, - { GDK_ISO_Lock, "ISO_Lock" }, - { GDK_ISO_Level2_Latch, "ISO_Level2_Latch" }, - { GDK_ISO_Level3_Shift, "ISO_Level3_Shift" }, - { GDK_ISO_Level3_Latch, "ISO_Level3_Latch" }, - { GDK_ISO_Level3_Lock, "ISO_Level3_Lock" }, - { GDK_ISO_Group_Shift, "ISO_Group_Shift" }, - { GDK_ISO_Group_Latch, "ISO_Group_Latch" }, - { GDK_ISO_Group_Lock, "ISO_Group_Lock" }, - { GDK_ISO_Next_Group, "ISO_Next_Group" }, - { GDK_ISO_Next_Group_Lock, "ISO_Next_Group_Lock" }, - { GDK_ISO_Prev_Group, "ISO_Prev_Group" }, - { GDK_ISO_Prev_Group_Lock, "ISO_Prev_Group_Lock" }, - { GDK_ISO_First_Group, "ISO_First_Group" }, - { GDK_ISO_First_Group_Lock, "ISO_First_Group_Lock" }, - { GDK_ISO_Last_Group, "ISO_Last_Group" }, - { GDK_ISO_Last_Group_Lock, "ISO_Last_Group_Lock" }, - { GDK_ISO_Left_Tab, "ISO_Left_Tab" }, - { GDK_ISO_Move_Line_Up, "ISO_Move_Line_Up" }, - { GDK_ISO_Move_Line_Down, "ISO_Move_Line_Down" }, - { GDK_ISO_Partial_Line_Up, "ISO_Partial_Line_Up" }, - { GDK_ISO_Partial_Line_Down, "ISO_Partial_Line_Down" }, - { GDK_ISO_Partial_Space_Left, "ISO_Partial_Space_Left" }, - { GDK_ISO_Partial_Space_Right, "ISO_Partial_Space_Right" }, - { GDK_ISO_Set_Margin_Left, "ISO_Set_Margin_Left" }, - { GDK_ISO_Set_Margin_Right, "ISO_Set_Margin_Right" }, - { GDK_ISO_Release_Margin_Left, "ISO_Release_Margin_Left" }, - { GDK_ISO_Release_Margin_Right, "ISO_Release_Margin_Right" }, - { GDK_ISO_Release_Both_Margins, "ISO_Release_Both_Margins" }, - { GDK_ISO_Fast_Cursor_Left, "ISO_Fast_Cursor_Left" }, - { GDK_ISO_Fast_Cursor_Right, "ISO_Fast_Cursor_Right" }, - { GDK_ISO_Fast_Cursor_Up, "ISO_Fast_Cursor_Up" }, - { GDK_ISO_Fast_Cursor_Down, "ISO_Fast_Cursor_Down" }, - { GDK_ISO_Continuous_Underline, "ISO_Continuous_Underline" }, - { GDK_ISO_Discontinuous_Underline, "ISO_Discontinuous_Underline" }, - { GDK_ISO_Emphasize, "ISO_Emphasize" }, - { GDK_ISO_Center_Object, "ISO_Center_Object" }, - { GDK_ISO_Enter, "ISO_Enter" }, - { GDK_dead_grave, "dead_grave" }, - { GDK_dead_acute, "dead_acute" }, - { GDK_dead_circumflex, "dead_circumflex" }, - { GDK_dead_tilde, "dead_tilde" }, - { GDK_dead_macron, "dead_macron" }, - { GDK_dead_breve, "dead_breve" }, - { GDK_dead_abovedot, "dead_abovedot" }, - { GDK_dead_diaeresis, "dead_diaeresis" }, - { GDK_dead_abovering, "dead_abovering" }, - { GDK_dead_doubleacute, "dead_doubleacute" }, - { GDK_dead_caron, "dead_caron" }, - { GDK_dead_cedilla, "dead_cedilla" }, - { GDK_dead_ogonek, "dead_ogonek" }, - { GDK_dead_iota, "dead_iota" }, - { GDK_dead_voiced_sound, "dead_voiced_sound" }, - { GDK_dead_semivoiced_sound, "dead_semivoiced_sound" }, - { GDK_dead_belowdot, "dead_belowdot" }, - { GDK_dead_hook, "dead_hook" }, - { GDK_dead_horn, "dead_horn" }, - { GDK_First_Virtual_Screen, "First_Virtual_Screen" }, - { GDK_Prev_Virtual_Screen, "Prev_Virtual_Screen" }, - { GDK_Next_Virtual_Screen, "Next_Virtual_Screen" }, - { GDK_Last_Virtual_Screen, "Last_Virtual_Screen" }, - { GDK_Terminate_Server, "Terminate_Server" }, - { GDK_AccessX_Enable, "AccessX_Enable" }, - { GDK_AccessX_Feedback_Enable, "AccessX_Feedback_Enable" }, - { GDK_RepeatKeys_Enable, "RepeatKeys_Enable" }, - { GDK_SlowKeys_Enable, "SlowKeys_Enable" }, - { GDK_BounceKeys_Enable, "BounceKeys_Enable" }, - { GDK_StickyKeys_Enable, "StickyKeys_Enable" }, - { GDK_MouseKeys_Enable, "MouseKeys_Enable" }, - { GDK_MouseKeys_Accel_Enable, "MouseKeys_Accel_Enable" }, - { GDK_Overlay1_Enable, "Overlay1_Enable" }, - { GDK_Overlay2_Enable, "Overlay2_Enable" }, - { GDK_AudibleBell_Enable, "AudibleBell_Enable" }, - { GDK_Pointer_Left, "Pointer_Left" }, - { GDK_Pointer_Right, "Pointer_Right" }, - { GDK_Pointer_Up, "Pointer_Up" }, - { GDK_Pointer_Down, "Pointer_Down" }, - { GDK_Pointer_UpLeft, "Pointer_UpLeft" }, - { GDK_Pointer_UpRight, "Pointer_UpRight" }, - { GDK_Pointer_DownLeft, "Pointer_DownLeft" }, - { GDK_Pointer_DownRight, "Pointer_DownRight" }, - { GDK_Pointer_Button_Dflt, "Pointer_Button_Dflt" }, - { GDK_Pointer_Button1, "Pointer_Button1" }, - { GDK_Pointer_Button2, "Pointer_Button2" }, - { GDK_Pointer_Button3, "Pointer_Button3" }, - { GDK_Pointer_Button4, "Pointer_Button4" }, - { GDK_Pointer_Button5, "Pointer_Button5" }, - { GDK_Pointer_DblClick_Dflt, "Pointer_DblClick_Dflt" }, - { GDK_Pointer_DblClick1, "Pointer_DblClick1" }, - { GDK_Pointer_DblClick2, "Pointer_DblClick2" }, - { GDK_Pointer_DblClick3, "Pointer_DblClick3" }, - { GDK_Pointer_DblClick4, "Pointer_DblClick4" }, - { GDK_Pointer_DblClick5, "Pointer_DblClick5" }, - { GDK_Pointer_Drag_Dflt, "Pointer_Drag_Dflt" }, - { GDK_Pointer_Drag1, "Pointer_Drag1" }, - { GDK_Pointer_Drag2, "Pointer_Drag2" }, - { GDK_Pointer_Drag3, "Pointer_Drag3" }, - { GDK_Pointer_Drag4, "Pointer_Drag4" }, - { GDK_Pointer_Drag5, "Pointer_Drag5" }, - { GDK_Pointer_EnableKeys, "Pointer_EnableKeys" }, - { GDK_Pointer_Accelerate, "Pointer_Accelerate" }, - { GDK_Pointer_DfltBtnNext, "Pointer_DfltBtnNext" }, - { GDK_Pointer_DfltBtnPrev, "Pointer_DfltBtnPrev" }, - { GDK_3270_Duplicate, "3270_Duplicate" }, - { GDK_3270_FieldMark, "3270_FieldMark" }, - { GDK_3270_Right2, "3270_Right2" }, - { GDK_3270_Left2, "3270_Left2" }, - { GDK_3270_BackTab, "3270_BackTab" }, - { GDK_3270_EraseEOF, "3270_EraseEOF" }, - { GDK_3270_EraseInput, "3270_EraseInput" }, - { GDK_3270_Reset, "3270_Reset" }, - { GDK_3270_Quit, "3270_Quit" }, - { GDK_3270_PA1, "3270_PA1" }, - { GDK_3270_PA2, "3270_PA2" }, - { GDK_3270_PA3, "3270_PA3" }, - { GDK_3270_Test, "3270_Test" }, - { GDK_3270_Attn, "3270_Attn" }, - { GDK_3270_CursorBlink, "3270_CursorBlink" }, - { GDK_3270_AltCursor, "3270_AltCursor" }, - { GDK_3270_KeyClick, "3270_KeyClick" }, - { GDK_3270_Jump, "3270_Jump" }, - { GDK_3270_Ident, "3270_Ident" }, - { GDK_3270_Rule, "3270_Rule" }, - { GDK_3270_Copy, "3270_Copy" }, - { GDK_3270_Play, "3270_Play" }, - { GDK_3270_Setup, "3270_Setup" }, - { GDK_3270_Record, "3270_Record" }, - { GDK_3270_ChangeScreen, "3270_ChangeScreen" }, - { GDK_3270_DeleteWord, "3270_DeleteWord" }, - { GDK_3270_ExSelect, "3270_ExSelect" }, - { GDK_3270_CursorSelect, "3270_CursorSelect" }, - { GDK_3270_PrintScreen, "3270_PrintScreen" }, - { GDK_3270_Enter, "3270_Enter" }, - - { GDK_Agrave, "Agrave" }, - { GDK_Aacute, "Aacute" }, - { GDK_Acircumflex, "Acircumflex" }, - { GDK_Atilde, "Atilde" }, - { GDK_Adiaeresis, "Adiaeresis" }, - { GDK_Aring, "Aring" }, - { GDK_AE, "AE" }, - { GDK_Ccedilla, "Ccedilla" }, - { GDK_Egrave, "Egrave" }, - { GDK_Eacute, "Eacute" }, - { GDK_Ecircumflex, "Ecircumflex" }, - { GDK_Ediaeresis, "Ediaeresis" }, - { GDK_Igrave, "Igrave" }, - { GDK_Iacute, "Iacute" }, - { GDK_Icircumflex, "Icircumflex" }, - { GDK_Idiaeresis, "Idiaeresis" }, - { GDK_ETH, "ETH" }, - { GDK_Eth, "Eth" }, - { GDK_Ntilde, "Ntilde" }, - { GDK_Ograve, "Ograve" }, - { GDK_Oacute, "Oacute" }, - { GDK_Ocircumflex, "Ocircumflex" }, - { GDK_Otilde, "Otilde" }, - { GDK_Odiaeresis, "Odiaeresis" }, - { GDK_multiply, "multiply" }, - { GDK_Ooblique, "Ooblique" }, - { GDK_Ugrave, "Ugrave" }, - { GDK_Uacute, "Uacute" }, - { GDK_Ucircumflex, "Ucircumflex" }, - { GDK_Udiaeresis, "Udiaeresis" }, - { GDK_Yacute, "Yacute" }, - { GDK_THORN, "THORN" }, - { GDK_Thorn, "Thorn" }, - { GDK_ssharp, "ssharp" }, - { GDK_agrave, "agrave" }, - { GDK_aacute, "aacute" }, - { GDK_acircumflex, "acircumflex" }, - { GDK_atilde, "atilde" }, - { GDK_adiaeresis, "adiaeresis" }, - { GDK_aring, "aring" }, - { GDK_ae, "ae" }, - { GDK_ccedilla, "ccedilla" }, - { GDK_egrave, "egrave" }, - { GDK_eacute, "eacute" }, - { GDK_ecircumflex, "ecircumflex" }, - { GDK_ediaeresis, "ediaeresis" }, - { GDK_igrave, "igrave" }, - { GDK_iacute, "iacute" }, - { GDK_icircumflex, "icircumflex" }, - { GDK_idiaeresis, "idiaeresis" }, - { GDK_eth, "eth" }, - { GDK_ntilde, "ntilde" }, - { GDK_ograve, "ograve" }, - { GDK_oacute, "oacute" }, - { GDK_ocircumflex, "ocircumflex" }, - { GDK_otilde, "otilde" }, - { GDK_odiaeresis, "odiaeresis" }, - { GDK_division, "division" }, - { GDK_oslash, "oslash" }, - { GDK_ugrave, "ugrave" }, - { GDK_uacute, "uacute" }, - { GDK_ucircumflex, "ucircumflex" }, - { GDK_udiaeresis, "udiaeresis" }, - { GDK_yacute, "yacute" }, - { GDK_thorn, "thorn" }, - { GDK_ydiaeresis, "ydiaeresis" }, - { GDK_Aogonek, "Aogonek" }, - { GDK_breve, "breve" }, - { GDK_Lstroke, "Lstroke" }, - { GDK_Lcaron, "Lcaron" }, - { GDK_Sacute, "Sacute" }, - { GDK_Scaron, "Scaron" }, - { GDK_Scedilla, "Scedilla" }, - { GDK_Tcaron, "Tcaron" }, - { GDK_Zacute, "Zacute" }, - { GDK_Zcaron, "Zcaron" }, - { GDK_Zabovedot, "Zabovedot" }, - { GDK_aogonek, "aogonek" }, - { GDK_ogonek, "ogonek" }, - { GDK_lstroke, "lstroke" }, - { GDK_lcaron, "lcaron" }, - { GDK_sacute, "sacute" }, - { GDK_caron, "caron" }, - { GDK_scaron, "scaron" }, - { GDK_scedilla, "scedilla" }, - { GDK_tcaron, "tcaron" }, - { GDK_zacute, "zacute" }, - { GDK_doubleacute, "doubleacute" }, - { GDK_zcaron, "zcaron" }, - { GDK_zabovedot, "zabovedot" }, - { GDK_Racute, "Racute" }, - { GDK_Abreve, "Abreve" }, - { GDK_Lacute, "Lacute" }, - { GDK_Cacute, "Cacute" }, - { GDK_Ccaron, "Ccaron" }, - { GDK_Eogonek, "Eogonek" }, - { GDK_Ecaron, "Ecaron" }, - { GDK_Dcaron, "Dcaron" }, - { GDK_Dstroke, "Dstroke" }, - { GDK_Nacute, "Nacute" }, - { GDK_Ncaron, "Ncaron" }, - { GDK_Odoubleacute, "Odoubleacute" }, - { GDK_Rcaron, "Rcaron" }, - { GDK_Uring, "Uring" }, - { GDK_Udoubleacute, "Udoubleacute" }, - { GDK_Tcedilla, "Tcedilla" }, - { GDK_racute, "racute" }, - { GDK_abreve, "abreve" }, - { GDK_lacute, "lacute" }, - { GDK_cacute, "cacute" }, - { GDK_ccaron, "ccaron" }, - { GDK_eogonek, "eogonek" }, - { GDK_ecaron, "ecaron" }, - { GDK_dcaron, "dcaron" }, - { GDK_dstroke, "dstroke" }, - { GDK_nacute, "nacute" }, - { GDK_ncaron, "ncaron" }, - { GDK_odoubleacute, "odoubleacute" }, - { GDK_udoubleacute, "udoubleacute" }, - { GDK_rcaron, "rcaron" }, - { GDK_uring, "uring" }, - { GDK_tcedilla, "tcedilla" }, - { GDK_abovedot, "abovedot" }, - { GDK_Hstroke, "Hstroke" }, - { GDK_Hcircumflex, "Hcircumflex" }, - { GDK_Iabovedot, "Iabovedot" }, - { GDK_Gbreve, "Gbreve" }, - { GDK_Jcircumflex, "Jcircumflex" }, - { GDK_hstroke, "hstroke" }, - { GDK_hcircumflex, "hcircumflex" }, - { GDK_idotless, "idotless" }, - { GDK_gbreve, "gbreve" }, - { GDK_jcircumflex, "jcircumflex" }, - { GDK_Cabovedot, "Cabovedot" }, - { GDK_Ccircumflex, "Ccircumflex" }, - { GDK_Gabovedot, "Gabovedot" }, - { GDK_Gcircumflex, "Gcircumflex" }, - { GDK_Ubreve, "Ubreve" }, - { GDK_Scircumflex, "Scircumflex" }, - { GDK_cabovedot, "cabovedot" }, - { GDK_ccircumflex, "ccircumflex" }, - { GDK_gabovedot, "gabovedot" }, - { GDK_gcircumflex, "gcircumflex" }, - { GDK_ubreve, "ubreve" }, - { GDK_scircumflex, "scircumflex" }, - { GDK_kra, "kra" }, - { GDK_kappa, "kappa" }, - { GDK_Rcedilla, "Rcedilla" }, - { GDK_Itilde, "Itilde" }, - { GDK_Lcedilla, "Lcedilla" }, - { GDK_Emacron, "Emacron" }, - { GDK_Gcedilla, "Gcedilla" }, - { GDK_Tslash, "Tslash" }, - { GDK_rcedilla, "rcedilla" }, - { GDK_itilde, "itilde" }, - { GDK_lcedilla, "lcedilla" }, - { GDK_emacron, "emacron" }, - { GDK_gcedilla, "gcedilla" }, - { GDK_tslash, "tslash" }, - { GDK_ENG, "ENG" }, - { GDK_eng, "eng" }, - { GDK_Amacron, "Amacron" }, - { GDK_Iogonek, "Iogonek" }, - { GDK_Eabovedot, "Eabovedot" }, - { GDK_Imacron, "Imacron" }, - { GDK_Ncedilla, "Ncedilla" }, - { GDK_Omacron, "Omacron" }, - { GDK_Kcedilla, "Kcedilla" }, - { GDK_Uogonek, "Uogonek" }, - { GDK_Utilde, "Utilde" }, - { GDK_Umacron, "Umacron" }, - { GDK_amacron, "amacron" }, - { GDK_iogonek, "iogonek" }, - { GDK_eabovedot, "eabovedot" }, - { GDK_imacron, "imacron" }, - { GDK_ncedilla, "ncedilla" }, - { GDK_omacron, "omacron" }, - { GDK_kcedilla, "kcedilla" }, - { GDK_uogonek, "uogonek" }, - { GDK_utilde, "utilde" }, - { GDK_umacron, "umacron" }, - { GDK_OE, "OE" }, - { GDK_oe, "oe" }, - { GDK_Ydiaeresis, "Ydiaeresis" }, - { GDK_overline, "overline" }, - { GDK_kana_fullstop, "kana_fullstop" }, - { GDK_kana_openingbracket, "kana_openingbracket" }, - { GDK_kana_closingbracket, "kana_closingbracket" }, - { GDK_kana_comma, "kana_comma" }, - { GDK_kana_conjunctive, "kana_conjunctive" }, - { GDK_kana_middledot, "kana_middledot" }, - { GDK_kana_WO, "kana_WO" }, - { GDK_kana_a, "kana_a" }, - { GDK_kana_i, "kana_i" }, - { GDK_kana_u, "kana_u" }, - { GDK_kana_e, "kana_e" }, - { GDK_kana_o, "kana_o" }, - { GDK_kana_ya, "kana_ya" }, - { GDK_kana_yu, "kana_yu" }, - { GDK_kana_yo, "kana_yo" }, - { GDK_kana_tsu, "kana_tsu" }, - { GDK_kana_tu, "kana_tu" }, - { GDK_prolongedsound, "prolongedsound" }, - { GDK_kana_A, "kana_A" }, - { GDK_kana_I, "kana_I" }, - { GDK_kana_U, "kana_U" }, - { GDK_kana_E, "kana_E" }, - { GDK_kana_O, "kana_O" }, - { GDK_kana_KA, "kana_KA" }, - { GDK_kana_KI, "kana_KI" }, - { GDK_kana_KU, "kana_KU" }, - { GDK_kana_KE, "kana_KE" }, - { GDK_kana_KO, "kana_KO" }, - { GDK_kana_SA, "kana_SA" }, - { GDK_kana_SHI, "kana_SHI" }, - { GDK_kana_SU, "kana_SU" }, - { GDK_kana_SE, "kana_SE" }, - { GDK_kana_SO, "kana_SO" }, - { GDK_kana_TA, "kana_TA" }, - { GDK_kana_CHI, "kana_CHI" }, - { GDK_kana_TI, "kana_TI" }, - { GDK_kana_TSU, "kana_TSU" }, - { GDK_kana_TU, "kana_TU" }, - { GDK_kana_TE, "kana_TE" }, - { GDK_kana_TO, "kana_TO" }, - { GDK_kana_NA, "kana_NA" }, - { GDK_kana_NI, "kana_NI" }, - { GDK_kana_NU, "kana_NU" }, - { GDK_kana_NE, "kana_NE" }, - { GDK_kana_NO, "kana_NO" }, - { GDK_kana_HA, "kana_HA" }, - { GDK_kana_HI, "kana_HI" }, - { GDK_kana_FU, "kana_FU" }, - { GDK_kana_HU, "kana_HU" }, - { GDK_kana_HE, "kana_HE" }, - { GDK_kana_HO, "kana_HO" }, - { GDK_kana_MA, "kana_MA" }, - { GDK_kana_MI, "kana_MI" }, - { GDK_kana_MU, "kana_MU" }, - { GDK_kana_ME, "kana_ME" }, - { GDK_kana_MO, "kana_MO" }, - { GDK_kana_YA, "kana_YA" }, - { GDK_kana_YU, "kana_YU" }, - { GDK_kana_YO, "kana_YO" }, - { GDK_kana_RA, "kana_RA" }, - { GDK_kana_RI, "kana_RI" }, - { GDK_kana_RU, "kana_RU" }, - { GDK_kana_RE, "kana_RE" }, - { GDK_kana_RO, "kana_RO" }, - { GDK_kana_WA, "kana_WA" }, - { GDK_kana_N, "kana_N" }, - { GDK_voicedsound, "voicedsound" }, - { GDK_semivoicedsound, "semivoicedsound" }, - { GDK_kana_switch, "kana_switch" }, - { GDK_Arabic_comma, "Arabic_comma" }, - { GDK_Arabic_semicolon, "Arabic_semicolon" }, - { GDK_Arabic_question_mark, "Arabic_question_mark" }, - { GDK_Arabic_hamza, "Arabic_hamza" }, - { GDK_Arabic_maddaonalef, "Arabic_maddaonalef" }, - { GDK_Arabic_hamzaonalef, "Arabic_hamzaonalef" }, - { GDK_Arabic_hamzaonwaw, "Arabic_hamzaonwaw" }, - { GDK_Arabic_hamzaunderalef, "Arabic_hamzaunderalef" }, - { GDK_Arabic_hamzaonyeh, "Arabic_hamzaonyeh" }, - { GDK_Arabic_alef, "Arabic_alef" }, - { GDK_Arabic_beh, "Arabic_beh" }, - { GDK_Arabic_tehmarbuta, "Arabic_tehmarbuta" }, - { GDK_Arabic_teh, "Arabic_teh" }, - { GDK_Arabic_theh, "Arabic_theh" }, - { GDK_Arabic_jeem, "Arabic_jeem" }, - { GDK_Arabic_hah, "Arabic_hah" }, - { GDK_Arabic_khah, "Arabic_khah" }, - { GDK_Arabic_dal, "Arabic_dal" }, - { GDK_Arabic_thal, "Arabic_thal" }, - { GDK_Arabic_ra, "Arabic_ra" }, - { GDK_Arabic_zain, "Arabic_zain" }, - { GDK_Arabic_seen, "Arabic_seen" }, - { GDK_Arabic_sheen, "Arabic_sheen" }, - { GDK_Arabic_sad, "Arabic_sad" }, - { GDK_Arabic_dad, "Arabic_dad" }, - { GDK_Arabic_tah, "Arabic_tah" }, - { GDK_Arabic_zah, "Arabic_zah" }, - { GDK_Arabic_ain, "Arabic_ain" }, - { GDK_Arabic_ghain, "Arabic_ghain" }, - { GDK_Arabic_tatweel, "Arabic_tatweel" }, - { GDK_Arabic_feh, "Arabic_feh" }, - { GDK_Arabic_qaf, "Arabic_qaf" }, - { GDK_Arabic_kaf, "Arabic_kaf" }, - { GDK_Arabic_lam, "Arabic_lam" }, - { GDK_Arabic_meem, "Arabic_meem" }, - { GDK_Arabic_noon, "Arabic_noon" }, - { GDK_Arabic_ha, "Arabic_ha" }, - { GDK_Arabic_heh, "Arabic_heh" }, - { GDK_Arabic_waw, "Arabic_waw" }, - { GDK_Arabic_alefmaksura, "Arabic_alefmaksura" }, - { GDK_Arabic_yeh, "Arabic_yeh" }, - { GDK_Arabic_fathatan, "Arabic_fathatan" }, - { GDK_Arabic_dammatan, "Arabic_dammatan" }, - { GDK_Arabic_kasratan, "Arabic_kasratan" }, - { GDK_Arabic_fatha, "Arabic_fatha" }, - { GDK_Arabic_damma, "Arabic_damma" }, - { GDK_Arabic_kasra, "Arabic_kasra" }, - { GDK_Arabic_shadda, "Arabic_shadda" }, - { GDK_Arabic_sukun, "Arabic_sukun" }, - { GDK_Arabic_switch, "Arabic_switch" }, - { GDK_Serbian_dje, "Serbian_dje" }, - { GDK_Macedonia_gje, "Macedonia_gje" }, - { GDK_Cyrillic_io, "Cyrillic_io" }, - { GDK_Ukrainian_ie, "Ukrainian_ie" }, - { GDK_Ukranian_je, "Ukranian_je" }, - { GDK_Macedonia_dse, "Macedonia_dse" }, - { GDK_Ukrainian_i, "Ukrainian_i" }, - { GDK_Ukranian_i, "Ukranian_i" }, - { GDK_Ukrainian_yi, "Ukrainian_yi" }, - { GDK_Ukranian_yi, "Ukranian_yi" }, - { GDK_Cyrillic_je, "Cyrillic_je" }, - { GDK_Serbian_je, "Serbian_je" }, - { GDK_Cyrillic_lje, "Cyrillic_lje" }, - { GDK_Serbian_lje, "Serbian_lje" }, - { GDK_Cyrillic_nje, "Cyrillic_nje" }, - { GDK_Serbian_nje, "Serbian_nje" }, - { GDK_Serbian_tshe, "Serbian_tshe" }, - { GDK_Macedonia_kje, "Macedonia_kje" }, - { GDK_Ukrainian_ghe_with_upturn, "Ukrainian_ghe_with_upturn" }, - { GDK_Byelorussian_shortu, "Byelorussian_shortu" }, - { GDK_Cyrillic_dzhe, "Cyrillic_dzhe" }, - { GDK_Serbian_dze, "Serbian_dze" }, - { GDK_numerosign, "numerosign" }, - { GDK_Serbian_DJE, "Serbian_DJE" }, - { GDK_Macedonia_GJE, "Macedonia_GJE" }, - { GDK_Cyrillic_IO, "Cyrillic_IO" }, - { GDK_Ukrainian_IE, "Ukrainian_IE" }, - { GDK_Ukranian_JE, "Ukranian_JE" }, - { GDK_Macedonia_DSE, "Macedonia_DSE" }, - { GDK_Ukrainian_I, "Ukrainian_I" }, - { GDK_Ukranian_I, "Ukranian_I" }, - { GDK_Ukrainian_YI, "Ukrainian_YI" }, - { GDK_Ukranian_YI, "Ukranian_YI" }, - { GDK_Cyrillic_JE, "Cyrillic_JE" }, - { GDK_Serbian_JE, "Serbian_JE" }, - { GDK_Cyrillic_LJE, "Cyrillic_LJE" }, - { GDK_Serbian_LJE, "Serbian_LJE" }, - { GDK_Cyrillic_NJE, "Cyrillic_NJE" }, - { GDK_Serbian_NJE, "Serbian_NJE" }, - { GDK_Serbian_TSHE, "Serbian_TSHE" }, - { GDK_Macedonia_KJE, "Macedonia_KJE" }, - { GDK_Ukrainian_GHE_WITH_UPTURN, "Ukrainian_GHE_WITH_UPTURN" }, - { GDK_Byelorussian_SHORTU, "Byelorussian_SHORTU" }, - { GDK_Cyrillic_DZHE, "Cyrillic_DZHE" }, - { GDK_Serbian_DZE, "Serbian_DZE" }, - { GDK_Cyrillic_yu, "Cyrillic_yu" }, - { GDK_Cyrillic_a, "Cyrillic_a" }, - { GDK_Cyrillic_be, "Cyrillic_be" }, - { GDK_Cyrillic_tse, "Cyrillic_tse" }, - { GDK_Cyrillic_de, "Cyrillic_de" }, - { GDK_Cyrillic_ie, "Cyrillic_ie" }, - { GDK_Cyrillic_ef, "Cyrillic_ef" }, - { GDK_Cyrillic_ghe, "Cyrillic_ghe" }, - { GDK_Cyrillic_ha, "Cyrillic_ha" }, - { GDK_Cyrillic_i, "Cyrillic_i" }, - { GDK_Cyrillic_shorti, "Cyrillic_shorti" }, - { GDK_Cyrillic_ka, "Cyrillic_ka" }, - { GDK_Cyrillic_el, "Cyrillic_el" }, - { GDK_Cyrillic_em, "Cyrillic_em" }, - { GDK_Cyrillic_en, "Cyrillic_en" }, - { GDK_Cyrillic_o, "Cyrillic_o" }, - { GDK_Cyrillic_pe, "Cyrillic_pe" }, - { GDK_Cyrillic_ya, "Cyrillic_ya" }, - { GDK_Cyrillic_er, "Cyrillic_er" }, - { GDK_Cyrillic_es, "Cyrillic_es" }, - { GDK_Cyrillic_te, "Cyrillic_te" }, - { GDK_Cyrillic_u, "Cyrillic_u" }, - { GDK_Cyrillic_zhe, "Cyrillic_zhe" }, - { GDK_Cyrillic_ve, "Cyrillic_ve" }, - { GDK_Cyrillic_softsign, "Cyrillic_softsign" }, - { GDK_Cyrillic_yeru, "Cyrillic_yeru" }, - { GDK_Cyrillic_ze, "Cyrillic_ze" }, - { GDK_Cyrillic_sha, "Cyrillic_sha" }, - { GDK_Cyrillic_e, "Cyrillic_e" }, - { GDK_Cyrillic_shcha, "Cyrillic_shcha" }, - { GDK_Cyrillic_che, "Cyrillic_che" }, - { GDK_Cyrillic_hardsign, "Cyrillic_hardsign" }, - { GDK_Cyrillic_YU, "Cyrillic_YU" }, - { GDK_Cyrillic_A, "Cyrillic_A" }, - { GDK_Cyrillic_BE, "Cyrillic_BE" }, - { GDK_Cyrillic_TSE, "Cyrillic_TSE" }, - { GDK_Cyrillic_DE, "Cyrillic_DE" }, - { GDK_Cyrillic_IE, "Cyrillic_IE" }, - { GDK_Cyrillic_EF, "Cyrillic_EF" }, - { GDK_Cyrillic_GHE, "Cyrillic_GHE" }, - { GDK_Cyrillic_HA, "Cyrillic_HA" }, - { GDK_Cyrillic_I, "Cyrillic_I" }, - { GDK_Cyrillic_SHORTI, "Cyrillic_SHORTI" }, - { GDK_Cyrillic_KA, "Cyrillic_KA" }, - { GDK_Cyrillic_EL, "Cyrillic_EL" }, - { GDK_Cyrillic_EM, "Cyrillic_EM" }, - { GDK_Cyrillic_EN, "Cyrillic_EN" }, - { GDK_Cyrillic_O, "Cyrillic_O" }, - { GDK_Cyrillic_PE, "Cyrillic_PE" }, - { GDK_Cyrillic_YA, "Cyrillic_YA" }, - { GDK_Cyrillic_ER, "Cyrillic_ER" }, - { GDK_Cyrillic_ES, "Cyrillic_ES" }, - { GDK_Cyrillic_TE, "Cyrillic_TE" }, - { GDK_Cyrillic_U, "Cyrillic_U" }, - { GDK_Cyrillic_ZHE, "Cyrillic_ZHE" }, - { GDK_Cyrillic_VE, "Cyrillic_VE" }, - { GDK_Cyrillic_SOFTSIGN, "Cyrillic_SOFTSIGN" }, - { GDK_Cyrillic_YERU, "Cyrillic_YERU" }, - { GDK_Cyrillic_ZE, "Cyrillic_ZE" }, - { GDK_Cyrillic_SHA, "Cyrillic_SHA" }, - { GDK_Cyrillic_E, "Cyrillic_E" }, - { GDK_Cyrillic_SHCHA, "Cyrillic_SHCHA" }, - { GDK_Cyrillic_CHE, "Cyrillic_CHE" }, - { GDK_Cyrillic_HARDSIGN, "Cyrillic_HARDSIGN" }, - { GDK_Greek_ALPHAaccent, "Greek_ALPHAaccent" }, - { GDK_Greek_EPSILONaccent, "Greek_EPSILONaccent" }, - { GDK_Greek_ETAaccent, "Greek_ETAaccent" }, - { GDK_Greek_IOTAaccent, "Greek_IOTAaccent" }, - { GDK_Greek_IOTAdieresis, "Greek_IOTAdieresis" }, - { GDK_Greek_IOTAdiaeresis, "Greek_IOTAdiaeresis" }, - { GDK_Greek_OMICRONaccent, "Greek_OMICRONaccent" }, - { GDK_Greek_UPSILONaccent, "Greek_UPSILONaccent" }, - { GDK_Greek_UPSILONdieresis, "Greek_UPSILONdieresis" }, - { GDK_Greek_OMEGAaccent, "Greek_OMEGAaccent" }, - { GDK_Greek_accentdieresis, "Greek_accentdieresis" }, - { GDK_Greek_horizbar, "Greek_horizbar" }, - { GDK_Greek_alphaaccent, "Greek_alphaaccent" }, - { GDK_Greek_epsilonaccent, "Greek_epsilonaccent" }, - { GDK_Greek_etaaccent, "Greek_etaaccent" }, - { GDK_Greek_iotaaccent, "Greek_iotaaccent" }, - { GDK_Greek_iotadieresis, "Greek_iotadieresis" }, - { GDK_Greek_iotaaccentdieresis, "Greek_iotaaccentdieresis" }, - { GDK_Greek_omicronaccent, "Greek_omicronaccent" }, - { GDK_Greek_upsilonaccent, "Greek_upsilonaccent" }, - { GDK_Greek_upsilondieresis, "Greek_upsilondieresis" }, - { GDK_Greek_upsilonaccentdieresis, "Greek_upsilonaccentdieresis" }, - { GDK_Greek_omegaaccent, "Greek_omegaaccent" }, - { GDK_Greek_ALPHA, "Greek_ALPHA" }, - { GDK_Greek_BETA, "Greek_BETA" }, - { GDK_Greek_GAMMA, "Greek_GAMMA" }, - { GDK_Greek_DELTA, "Greek_DELTA" }, - { GDK_Greek_EPSILON, "Greek_EPSILON" }, - { GDK_Greek_ZETA, "Greek_ZETA" }, - { GDK_Greek_ETA, "Greek_ETA" }, - { GDK_Greek_THETA, "Greek_THETA" }, - { GDK_Greek_IOTA, "Greek_IOTA" }, - { GDK_Greek_KAPPA, "Greek_KAPPA" }, - { GDK_Greek_LAMDA, "Greek_LAMDA" }, - { GDK_Greek_LAMBDA, "Greek_LAMBDA" }, - { GDK_Greek_MU, "Greek_MU" }, - { GDK_Greek_NU, "Greek_NU" }, - { GDK_Greek_XI, "Greek_XI" }, - { GDK_Greek_OMICRON, "Greek_OMICRON" }, - { GDK_Greek_PI, "Greek_PI" }, - { GDK_Greek_RHO, "Greek_RHO" }, - { GDK_Greek_SIGMA, "Greek_SIGMA" }, - { GDK_Greek_TAU, "Greek_TAU" }, - { GDK_Greek_UPSILON, "Greek_UPSILON" }, - { GDK_Greek_PHI, "Greek_PHI" }, - { GDK_Greek_CHI, "Greek_CHI" }, - { GDK_Greek_PSI, "Greek_PSI" }, - { GDK_Greek_OMEGA, "Greek_OMEGA" }, - { GDK_Greek_alpha, "Greek_alpha" }, - { GDK_Greek_beta, "Greek_beta" }, - { GDK_Greek_gamma, "Greek_gamma" }, - { GDK_Greek_delta, "Greek_delta" }, - { GDK_Greek_epsilon, "Greek_epsilon" }, - { GDK_Greek_zeta, "Greek_zeta" }, - { GDK_Greek_eta, "Greek_eta" }, - { GDK_Greek_theta, "Greek_theta" }, - { GDK_Greek_iota, "Greek_iota" }, - { GDK_Greek_kappa, "Greek_kappa" }, - { GDK_Greek_lamda, "Greek_lamda" }, - { GDK_Greek_lambda, "Greek_lambda" }, - { GDK_Greek_mu, "Greek_mu" }, - { GDK_Greek_nu, "Greek_nu" }, - { GDK_Greek_xi, "Greek_xi" }, - { GDK_Greek_omicron, "Greek_omicron" }, - { GDK_Greek_pi, "Greek_pi" }, - { GDK_Greek_rho, "Greek_rho" }, - { GDK_Greek_sigma, "Greek_sigma" }, - { GDK_Greek_finalsmallsigma, "Greek_finalsmallsigma" }, - { GDK_Greek_tau, "Greek_tau" }, - { GDK_Greek_upsilon, "Greek_upsilon" }, - { GDK_Greek_phi, "Greek_phi" }, - { GDK_Greek_chi, "Greek_chi" }, - { GDK_Greek_psi, "Greek_psi" }, - { GDK_Greek_omega, "Greek_omega" }, - { GDK_Greek_switch, "Greek_switch" }, - { GDK_leftradical, "leftradical" }, - { GDK_topleftradical, "topleftradical" }, - { GDK_horizconnector, "horizconnector" }, - { GDK_topintegral, "topintegral" }, - { GDK_botintegral, "botintegral" }, - { GDK_vertconnector, "vertconnector" }, - { GDK_topleftsqbracket, "topleftsqbracket" }, - { GDK_botleftsqbracket, "botleftsqbracket" }, - { GDK_toprightsqbracket, "toprightsqbracket" }, - { GDK_botrightsqbracket, "botrightsqbracket" }, - { GDK_topleftparens, "topleftparens" }, - { GDK_botleftparens, "botleftparens" }, - { GDK_toprightparens, "toprightparens" }, - { GDK_botrightparens, "botrightparens" }, - { GDK_leftmiddlecurlybrace, "leftmiddlecurlybrace" }, - { GDK_rightmiddlecurlybrace, "rightmiddlecurlybrace" }, - { GDK_topleftsummation, "topleftsummation" }, - { GDK_botleftsummation, "botleftsummation" }, - { GDK_topvertsummationconnector, "topvertsummationconnector" }, - { GDK_botvertsummationconnector, "botvertsummationconnector" }, - { GDK_toprightsummation, "toprightsummation" }, - { GDK_botrightsummation, "botrightsummation" }, - { GDK_rightmiddlesummation, "rightmiddlesummation" }, - { GDK_lessthanequal, "lessthanequal" }, - { GDK_notequal, "notequal" }, - { GDK_greaterthanequal, "greaterthanequal" }, - { GDK_integral, "integral" }, - { GDK_therefore, "therefore" }, - { GDK_variation, "variation" }, - { GDK_infinity, "infinity" }, - { GDK_nabla, "nabla" }, - { GDK_approximate, "approximate" }, - { GDK_similarequal, "similarequal" }, - { GDK_ifonlyif, "ifonlyif" }, - { GDK_implies, "implies" }, - { GDK_identical, "identical" }, - { GDK_radical, "radical" }, - { GDK_includedin, "includedin" }, - { GDK_includes, "includes" }, - { GDK_intersection, "intersection" }, - { GDK_union, "union" }, - { GDK_logicaland, "logicaland" }, - { GDK_logicalor, "logicalor" }, - { GDK_partialderivative, "partialderivative" }, - { GDK_function, "function" }, - { GDK_leftarrow, "leftarrow" }, - { GDK_uparrow, "uparrow" }, - { GDK_rightarrow, "rightarrow" }, - { GDK_downarrow, "downarrow" }, - { GDK_blank, "blank" }, - { GDK_soliddiamond, "soliddiamond" }, - { GDK_checkerboard, "checkerboard" }, - { GDK_ht, "ht" }, - { GDK_ff, "ff" }, - { GDK_cr, "cr" }, - { GDK_lf, "lf" }, - { GDK_nl, "nl" }, - { GDK_vt, "vt" }, - { GDK_lowrightcorner, "lowrightcorner" }, - { GDK_uprightcorner, "uprightcorner" }, - { GDK_upleftcorner, "upleftcorner" }, - { GDK_lowleftcorner, "lowleftcorner" }, - { GDK_crossinglines, "crossinglines" }, - { GDK_horizlinescan1, "horizlinescan1" }, - { GDK_horizlinescan3, "horizlinescan3" }, - { GDK_horizlinescan5, "horizlinescan5" }, - { GDK_horizlinescan7, "horizlinescan7" }, - { GDK_horizlinescan9, "horizlinescan9" }, - { GDK_leftt, "leftt" }, - { GDK_rightt, "rightt" }, - { GDK_bott, "bott" }, - { GDK_topt, "topt" }, - { GDK_vertbar, "vertbar" }, - { GDK_emspace, "emspace" }, - { GDK_enspace, "enspace" }, - { GDK_em3space, "em3space" }, - { GDK_em4space, "em4space" }, - { GDK_digitspace, "digitspace" }, - { GDK_punctspace, "punctspace" }, - { GDK_thinspace, "thinspace" }, - { GDK_hairspace, "hairspace" }, - { GDK_emdash, "emdash" }, - { GDK_endash, "endash" }, - { GDK_signifblank, "signifblank" }, - { GDK_ellipsis, "ellipsis" }, - { GDK_doubbaselinedot, "doubbaselinedot" }, - { GDK_onethird, "onethird" }, - { GDK_twothirds, "twothirds" }, - { GDK_onefifth, "onefifth" }, - { GDK_twofifths, "twofifths" }, - { GDK_threefifths, "threefifths" }, - { GDK_fourfifths, "fourfifths" }, - { GDK_onesixth, "onesixth" }, - { GDK_fivesixths, "fivesixths" }, - { GDK_careof, "careof" }, - { GDK_figdash, "figdash" }, - { GDK_leftanglebracket, "leftanglebracket" }, - { GDK_decimalpoint, "decimalpoint" }, - { GDK_rightanglebracket, "rightanglebracket" }, - { GDK_marker, "marker" }, - { GDK_oneeighth, "oneeighth" }, - { GDK_threeeighths, "threeeighths" }, - { GDK_fiveeighths, "fiveeighths" }, - { GDK_seveneighths, "seveneighths" }, - { GDK_trademark, "trademark" }, - { GDK_signaturemark, "signaturemark" }, - { GDK_trademarkincircle, "trademarkincircle" }, - { GDK_leftopentriangle, "leftopentriangle" }, - { GDK_rightopentriangle, "rightopentriangle" }, - { GDK_emopencircle, "emopencircle" }, - { GDK_emopenrectangle, "emopenrectangle" }, - { GDK_leftsinglequotemark, "leftsinglequotemark" }, - { GDK_rightsinglequotemark, "rightsinglequotemark" }, - { GDK_leftdoublequotemark, "leftdoublequotemark" }, - { GDK_rightdoublequotemark, "rightdoublequotemark" }, - { GDK_prescription, "prescription" }, - { GDK_minutes, "minutes" }, - { GDK_seconds, "seconds" }, - { GDK_latincross, "latincross" }, - { GDK_hexagram, "hexagram" }, - { GDK_filledrectbullet, "filledrectbullet" }, - { GDK_filledlefttribullet, "filledlefttribullet" }, - { GDK_filledrighttribullet, "filledrighttribullet" }, - { GDK_emfilledcircle, "emfilledcircle" }, - { GDK_emfilledrect, "emfilledrect" }, - { GDK_enopencircbullet, "enopencircbullet" }, - { GDK_enopensquarebullet, "enopensquarebullet" }, - { GDK_openrectbullet, "openrectbullet" }, - { GDK_opentribulletup, "opentribulletup" }, - { GDK_opentribulletdown, "opentribulletdown" }, - { GDK_openstar, "openstar" }, - { GDK_enfilledcircbullet, "enfilledcircbullet" }, - { GDK_enfilledsqbullet, "enfilledsqbullet" }, - { GDK_filledtribulletup, "filledtribulletup" }, - { GDK_filledtribulletdown, "filledtribulletdown" }, - { GDK_leftpointer, "leftpointer" }, - { GDK_rightpointer, "rightpointer" }, - { GDK_club, "club" }, - { GDK_diamond, "diamond" }, - { GDK_heart, "heart" }, - { GDK_maltesecross, "maltesecross" }, - { GDK_dagger, "dagger" }, - { GDK_doubledagger, "doubledagger" }, - { GDK_checkmark, "checkmark" }, - { GDK_ballotcross, "ballotcross" }, - { GDK_musicalsharp, "musicalsharp" }, - { GDK_musicalflat, "musicalflat" }, - { GDK_malesymbol, "malesymbol" }, - { GDK_femalesymbol, "femalesymbol" }, - { GDK_telephone, "telephone" }, - { GDK_telephonerecorder, "telephonerecorder" }, - { GDK_phonographcopyright, "phonographcopyright" }, - { GDK_caret, "caret" }, - { GDK_singlelowquotemark, "singlelowquotemark" }, - { GDK_doublelowquotemark, "doublelowquotemark" }, - { GDK_cursor, "cursor" }, - { GDK_leftcaret, "leftcaret" }, - { GDK_rightcaret, "rightcaret" }, - { GDK_downcaret, "downcaret" }, - { GDK_upcaret, "upcaret" }, - { GDK_overbar, "overbar" }, - { GDK_downtack, "downtack" }, - { GDK_upshoe, "upshoe" }, - { GDK_downstile, "downstile" }, - { GDK_underbar, "underbar" }, - { GDK_jot, "jot" }, - { GDK_quad, "quad" }, - { GDK_uptack, "uptack" }, - { GDK_circle, "circle" }, - { GDK_upstile, "upstile" }, - { GDK_downshoe, "downshoe" }, - { GDK_rightshoe, "rightshoe" }, - { GDK_leftshoe, "leftshoe" }, - { GDK_lefttack, "lefttack" }, - { GDK_righttack, "righttack" }, - { GDK_hebrew_doublelowline, "hebrew_doublelowline" }, - { GDK_hebrew_aleph, "hebrew_aleph" }, - { GDK_hebrew_bet, "hebrew_bet" }, - { GDK_hebrew_beth, "hebrew_beth" }, - { GDK_hebrew_gimel, "hebrew_gimel" }, - { GDK_hebrew_gimmel, "hebrew_gimmel" }, - { GDK_hebrew_dalet, "hebrew_dalet" }, - { GDK_hebrew_daleth, "hebrew_daleth" }, - { GDK_hebrew_he, "hebrew_he" }, - { GDK_hebrew_waw, "hebrew_waw" }, - { GDK_hebrew_zain, "hebrew_zain" }, - { GDK_hebrew_zayin, "hebrew_zayin" }, - { GDK_hebrew_chet, "hebrew_chet" }, - { GDK_hebrew_het, "hebrew_het" }, - { GDK_hebrew_tet, "hebrew_tet" }, - { GDK_hebrew_teth, "hebrew_teth" }, - { GDK_hebrew_yod, "hebrew_yod" }, - { GDK_hebrew_finalkaph, "hebrew_finalkaph" }, - { GDK_hebrew_kaph, "hebrew_kaph" }, - { GDK_hebrew_lamed, "hebrew_lamed" }, - { GDK_hebrew_finalmem, "hebrew_finalmem" }, - { GDK_hebrew_mem, "hebrew_mem" }, - { GDK_hebrew_finalnun, "hebrew_finalnun" }, - { GDK_hebrew_nun, "hebrew_nun" }, - { GDK_hebrew_samech, "hebrew_samech" }, - { GDK_hebrew_samekh, "hebrew_samekh" }, - { GDK_hebrew_ayin, "hebrew_ayin" }, - { GDK_hebrew_finalpe, "hebrew_finalpe" }, - { GDK_hebrew_pe, "hebrew_pe" }, - { GDK_hebrew_finalzade, "hebrew_finalzade" }, - { GDK_hebrew_finalzadi, "hebrew_finalzadi" }, - { GDK_hebrew_zade, "hebrew_zade" }, - { GDK_hebrew_zadi, "hebrew_zadi" }, - { GDK_hebrew_qoph, "hebrew_qoph" }, - { GDK_hebrew_kuf, "hebrew_kuf" }, - { GDK_hebrew_resh, "hebrew_resh" }, - { GDK_hebrew_shin, "hebrew_shin" }, - { GDK_hebrew_taw, "hebrew_taw" }, - { GDK_hebrew_taf, "hebrew_taf" }, - { GDK_Hebrew_switch, "Hebrew_switch" }, - { GDK_Thai_kokai, "Thai_kokai" }, - { GDK_Thai_khokhai, "Thai_khokhai" }, - { GDK_Thai_khokhuat, "Thai_khokhuat" }, - { GDK_Thai_khokhwai, "Thai_khokhwai" }, - { GDK_Thai_khokhon, "Thai_khokhon" }, - { GDK_Thai_khorakhang, "Thai_khorakhang" }, - { GDK_Thai_ngongu, "Thai_ngongu" }, - { GDK_Thai_chochan, "Thai_chochan" }, - { GDK_Thai_choching, "Thai_choching" }, - { GDK_Thai_chochang, "Thai_chochang" }, - { GDK_Thai_soso, "Thai_soso" }, - { GDK_Thai_chochoe, "Thai_chochoe" }, - { GDK_Thai_yoying, "Thai_yoying" }, - { GDK_Thai_dochada, "Thai_dochada" }, - { GDK_Thai_topatak, "Thai_topatak" }, - { GDK_Thai_thothan, "Thai_thothan" }, - { GDK_Thai_thonangmontho, "Thai_thonangmontho" }, - { GDK_Thai_thophuthao, "Thai_thophuthao" }, - { GDK_Thai_nonen, "Thai_nonen" }, - { GDK_Thai_dodek, "Thai_dodek" }, - { GDK_Thai_totao, "Thai_totao" }, - { GDK_Thai_thothung, "Thai_thothung" }, - { GDK_Thai_thothahan, "Thai_thothahan" }, - { GDK_Thai_thothong, "Thai_thothong" }, - { GDK_Thai_nonu, "Thai_nonu" }, - { GDK_Thai_bobaimai, "Thai_bobaimai" }, - { GDK_Thai_popla, "Thai_popla" }, - { GDK_Thai_phophung, "Thai_phophung" }, - { GDK_Thai_fofa, "Thai_fofa" }, - { GDK_Thai_phophan, "Thai_phophan" }, - { GDK_Thai_fofan, "Thai_fofan" }, - { GDK_Thai_phosamphao, "Thai_phosamphao" }, - { GDK_Thai_moma, "Thai_moma" }, - { GDK_Thai_yoyak, "Thai_yoyak" }, - { GDK_Thai_rorua, "Thai_rorua" }, - { GDK_Thai_ru, "Thai_ru" }, - { GDK_Thai_loling, "Thai_loling" }, - { GDK_Thai_lu, "Thai_lu" }, - { GDK_Thai_wowaen, "Thai_wowaen" }, - { GDK_Thai_sosala, "Thai_sosala" }, - { GDK_Thai_sorusi, "Thai_sorusi" }, - { GDK_Thai_sosua, "Thai_sosua" }, - { GDK_Thai_hohip, "Thai_hohip" }, - { GDK_Thai_lochula, "Thai_lochula" }, - { GDK_Thai_oang, "Thai_oang" }, - { GDK_Thai_honokhuk, "Thai_honokhuk" }, - { GDK_Thai_paiyannoi, "Thai_paiyannoi" }, - { GDK_Thai_saraa, "Thai_saraa" }, - { GDK_Thai_maihanakat, "Thai_maihanakat" }, - { GDK_Thai_saraaa, "Thai_saraaa" }, - { GDK_Thai_saraam, "Thai_saraam" }, - { GDK_Thai_sarai, "Thai_sarai" }, - { GDK_Thai_saraii, "Thai_saraii" }, - { GDK_Thai_saraue, "Thai_saraue" }, - { GDK_Thai_sarauee, "Thai_sarauee" }, - { GDK_Thai_sarau, "Thai_sarau" }, - { GDK_Thai_sarauu, "Thai_sarauu" }, - { GDK_Thai_phinthu, "Thai_phinthu" }, - { GDK_Thai_maihanakat_maitho, "Thai_maihanakat_maitho" }, - { GDK_Thai_baht, "Thai_baht" }, - { GDK_Thai_sarae, "Thai_sarae" }, - { GDK_Thai_saraae, "Thai_saraae" }, - { GDK_Thai_sarao, "Thai_sarao" }, - { GDK_Thai_saraaimaimuan, "Thai_saraaimaimuan" }, - { GDK_Thai_saraaimaimalai, "Thai_saraaimaimalai" }, - { GDK_Thai_lakkhangyao, "Thai_lakkhangyao" }, - { GDK_Thai_maiyamok, "Thai_maiyamok" }, - { GDK_Thai_maitaikhu, "Thai_maitaikhu" }, - { GDK_Thai_maiek, "Thai_maiek" }, - { GDK_Thai_maitho, "Thai_maitho" }, - { GDK_Thai_maitri, "Thai_maitri" }, - { GDK_Thai_maichattawa, "Thai_maichattawa" }, - { GDK_Thai_thanthakhat, "Thai_thanthakhat" }, - { GDK_Thai_nikhahit, "Thai_nikhahit" }, - { GDK_Thai_leksun, "Thai_leksun" }, - { GDK_Thai_leknung, "Thai_leknung" }, - { GDK_Thai_leksong, "Thai_leksong" }, - { GDK_Thai_leksam, "Thai_leksam" }, - { GDK_Thai_leksi, "Thai_leksi" }, - { GDK_Thai_lekha, "Thai_lekha" }, - { GDK_Thai_lekhok, "Thai_lekhok" }, - { GDK_Thai_lekchet, "Thai_lekchet" }, - { GDK_Thai_lekpaet, "Thai_lekpaet" }, - { GDK_Thai_lekkao, "Thai_lekkao" }, - { GDK_Hangul, "Hangul" }, - { GDK_Hangul_Start, "Hangul_Start" }, - { GDK_Hangul_End, "Hangul_End" }, - { GDK_Hangul_Hanja, "Hangul_Hanja" }, - { GDK_Hangul_Jamo, "Hangul_Jamo" }, - { GDK_Hangul_Romaja, "Hangul_Romaja" }, - { GDK_Hangul_Codeinput, "Hangul_Codeinput" }, - { GDK_Hangul_Jeonja, "Hangul_Jeonja" }, - { GDK_Hangul_Banja, "Hangul_Banja" }, - { GDK_Hangul_PreHanja, "Hangul_PreHanja" }, - { GDK_Hangul_PostHanja, "Hangul_PostHanja" }, - { GDK_Hangul_SingleCandidate, "Hangul_SingleCandidate" }, - { GDK_Hangul_MultipleCandidate, "Hangul_MultipleCandidate" }, - { GDK_Hangul_PreviousCandidate, "Hangul_PreviousCandidate" }, - { GDK_Hangul_Special, "Hangul_Special" }, - { GDK_Hangul_switch, "Hangul_switch" }, - { GDK_Hangul_Kiyeog, "Hangul_Kiyeog" }, - { GDK_Hangul_SsangKiyeog, "Hangul_SsangKiyeog" }, - { GDK_Hangul_KiyeogSios, "Hangul_KiyeogSios" }, - { GDK_Hangul_Nieun, "Hangul_Nieun" }, - { GDK_Hangul_NieunJieuj, "Hangul_NieunJieuj" }, - { GDK_Hangul_NieunHieuh, "Hangul_NieunHieuh" }, - { GDK_Hangul_Dikeud, "Hangul_Dikeud" }, - { GDK_Hangul_SsangDikeud, "Hangul_SsangDikeud" }, - { GDK_Hangul_Rieul, "Hangul_Rieul" }, - { GDK_Hangul_RieulKiyeog, "Hangul_RieulKiyeog" }, - { GDK_Hangul_RieulMieum, "Hangul_RieulMieum" }, - { GDK_Hangul_RieulPieub, "Hangul_RieulPieub" }, - { GDK_Hangul_RieulSios, "Hangul_RieulSios" }, - { GDK_Hangul_RieulTieut, "Hangul_RieulTieut" }, - { GDK_Hangul_RieulPhieuf, "Hangul_RieulPhieuf" }, - { GDK_Hangul_RieulHieuh, "Hangul_RieulHieuh" }, - { GDK_Hangul_Mieum, "Hangul_Mieum" }, - { GDK_Hangul_Pieub, "Hangul_Pieub" }, - { GDK_Hangul_SsangPieub, "Hangul_SsangPieub" }, - { GDK_Hangul_PieubSios, "Hangul_PieubSios" }, - { GDK_Hangul_Sios, "Hangul_Sios" }, - { GDK_Hangul_SsangSios, "Hangul_SsangSios" }, - { GDK_Hangul_Ieung, "Hangul_Ieung" }, - { GDK_Hangul_Jieuj, "Hangul_Jieuj" }, - { GDK_Hangul_SsangJieuj, "Hangul_SsangJieuj" }, - { GDK_Hangul_Cieuc, "Hangul_Cieuc" }, - { GDK_Hangul_Khieuq, "Hangul_Khieuq" }, - { GDK_Hangul_Tieut, "Hangul_Tieut" }, - { GDK_Hangul_Phieuf, "Hangul_Phieuf" }, - { GDK_Hangul_Hieuh, "Hangul_Hieuh" }, - { GDK_Hangul_A, "Hangul_A" }, - { GDK_Hangul_AE, "Hangul_AE" }, - { GDK_Hangul_YA, "Hangul_YA" }, - { GDK_Hangul_YAE, "Hangul_YAE" }, - { GDK_Hangul_EO, "Hangul_EO" }, - { GDK_Hangul_E, "Hangul_E" }, - { GDK_Hangul_YEO, "Hangul_YEO" }, - { GDK_Hangul_YE, "Hangul_YE" }, - { GDK_Hangul_O, "Hangul_O" }, - { GDK_Hangul_WA, "Hangul_WA" }, - { GDK_Hangul_WAE, "Hangul_WAE" }, - { GDK_Hangul_OE, "Hangul_OE" }, - { GDK_Hangul_YO, "Hangul_YO" }, - { GDK_Hangul_U, "Hangul_U" }, - { GDK_Hangul_WEO, "Hangul_WEO" }, - { GDK_Hangul_WE, "Hangul_WE" }, - { GDK_Hangul_WI, "Hangul_WI" }, - { GDK_Hangul_YU, "Hangul_YU" }, - { GDK_Hangul_EU, "Hangul_EU" }, - { GDK_Hangul_YI, "Hangul_YI" }, - { GDK_Hangul_I, "Hangul_I" }, - { GDK_Hangul_J_Kiyeog, "Hangul_J_Kiyeog" }, - { GDK_Hangul_J_SsangKiyeog, "Hangul_J_SsangKiyeog" }, - { GDK_Hangul_J_KiyeogSios, "Hangul_J_KiyeogSios" }, - { GDK_Hangul_J_Nieun, "Hangul_J_Nieun" }, - { GDK_Hangul_J_NieunJieuj, "Hangul_J_NieunJieuj" }, - { GDK_Hangul_J_NieunHieuh, "Hangul_J_NieunHieuh" }, - { GDK_Hangul_J_Dikeud, "Hangul_J_Dikeud" }, - { GDK_Hangul_J_Rieul, "Hangul_J_Rieul" }, - { GDK_Hangul_J_RieulKiyeog, "Hangul_J_RieulKiyeog" }, - { GDK_Hangul_J_RieulMieum, "Hangul_J_RieulMieum" }, - { GDK_Hangul_J_RieulPieub, "Hangul_J_RieulPieub" }, - { GDK_Hangul_J_RieulSios, "Hangul_J_RieulSios" }, - { GDK_Hangul_J_RieulTieut, "Hangul_J_RieulTieut" }, - { GDK_Hangul_J_RieulPhieuf, "Hangul_J_RieulPhieuf" }, - { GDK_Hangul_J_RieulHieuh, "Hangul_J_RieulHieuh" }, - { GDK_Hangul_J_Mieum, "Hangul_J_Mieum" }, - { GDK_Hangul_J_Pieub, "Hangul_J_Pieub" }, - { GDK_Hangul_J_PieubSios, "Hangul_J_PieubSios" }, - { GDK_Hangul_J_Sios, "Hangul_J_Sios" }, - { GDK_Hangul_J_SsangSios, "Hangul_J_SsangSios" }, - { GDK_Hangul_J_Ieung, "Hangul_J_Ieung" }, - { GDK_Hangul_J_Jieuj, "Hangul_J_Jieuj" }, - { GDK_Hangul_J_Cieuc, "Hangul_J_Cieuc" }, - { GDK_Hangul_J_Khieuq, "Hangul_J_Khieuq" }, - { GDK_Hangul_J_Tieut, "Hangul_J_Tieut" }, - { GDK_Hangul_J_Phieuf, "Hangul_J_Phieuf" }, - { GDK_Hangul_J_Hieuh, "Hangul_J_Hieuh" }, - { GDK_Hangul_RieulYeorinHieuh, "Hangul_RieulYeorinHieuh" }, - { GDK_Hangul_SunkyeongeumMieum, "Hangul_SunkyeongeumMieum" }, - { GDK_Hangul_SunkyeongeumPieub, "Hangul_SunkyeongeumPieub" }, - { GDK_Hangul_PanSios, "Hangul_PanSios" }, - { GDK_Hangul_KkogjiDalrinIeung, "Hangul_KkogjiDalrinIeung" }, - { GDK_Hangul_SunkyeongeumPhieuf, "Hangul_SunkyeongeumPhieuf" }, - { GDK_Hangul_YeorinHieuh, "Hangul_YeorinHieuh" }, - { GDK_Hangul_AraeA, "Hangul_AraeA" }, - { GDK_Hangul_AraeAE, "Hangul_AraeAE" }, - { GDK_Hangul_J_PanSios, "Hangul_J_PanSios" }, - { GDK_Hangul_J_KkogjiDalrinIeung, "Hangul_J_KkogjiDalrinIeung" }, - { GDK_Hangul_J_YeorinHieuh, "Hangul_J_YeorinHieuh" }, - { GDK_Korean_Won, "Korean_Won" }, - { GDK_EcuSign, "EcuSign" }, - { GDK_ColonSign, "ColonSign" }, - { GDK_CruzeiroSign, "CruzeiroSign" }, - { GDK_FFrancSign, "FFrancSign" }, - { GDK_LiraSign, "LiraSign" }, - { GDK_MillSign, "MillSign" }, - { GDK_NairaSign, "NairaSign" }, - { GDK_PesetaSign, "PesetaSign" }, - { GDK_RupeeSign, "RupeeSign" }, - { GDK_WonSign, "WonSign" }, - { GDK_NewSheqelSign, "NewSheqelSign" }, - { GDK_DongSign, "DongSign" }, - { GDK_EuroSign, "EuroSign" }, - - { 0, NULL } -}; diff --git a/gladeui/glade-parser.c b/gladeui/glade-parser.c index 2e32068a..109fb854 100644 --- a/gladeui/glade-parser.c +++ b/gladeui/glade-parser.c @@ -1276,102 +1276,6 @@ glade_parser_interface_new_from_buffer (const gchar *buffer, return state.interface; } -static gchar * -modifier_string_from_bits (GdkModifierType modifiers) -{ - GString *string = g_string_new (""); - - if (modifiers & GDK_SHIFT_MASK) { - if (string->len > 0) - g_string_append (string, " | "); - g_string_append (string, "GDK_SHIFT_MASK"); - } - - if (modifiers & GDK_LOCK_MASK) { - if (string->len > 0) - g_string_append (string, " | "); - g_string_append (string, "GDK_LOCK_MASK"); - } - - if (modifiers & GDK_CONTROL_MASK) { - if (string->len > 0) - g_string_append (string, " | "); - g_string_append (string, "GDK_CONTROL_MASK"); - } - - if (modifiers & GDK_MOD1_MASK) { - if (string->len > 0) - g_string_append (string, " | "); - g_string_append (string, "GDK_MOD1_MASK"); - } - - if (modifiers & GDK_MOD2_MASK) { - if (string->len > 0) - g_string_append (string, " | "); - g_string_append (string, "GDK_MOD2_MASK"); - } - - if (modifiers & GDK_MOD3_MASK) { - if (string->len > 0) - g_string_append (string, " | "); - g_string_append (string, "GDK_MOD3_MASK"); - } - - if (modifiers & GDK_MOD4_MASK) { - if (string->len > 0) - g_string_append (string, " | "); - g_string_append (string, "GDK_MOD4_MASK"); - } - - if (modifiers & GDK_MOD5_MASK) { - if (string->len > 0) - g_string_append (string, " | "); - g_string_append (string, "GDK_MOD5_MASK"); - } - - if (modifiers & GDK_BUTTON1_MASK) { - if (string->len > 0) - g_string_append (string, " | "); - g_string_append (string, "GDK_BUTTON1_MASK"); - } - - if (modifiers & GDK_BUTTON2_MASK) { - if (string->len > 0) - g_string_append (string, " | "); - g_string_append (string, "GDK_BUTTON2_MASK"); - } - - if (modifiers & GDK_BUTTON3_MASK) { - if (string->len > 0) - g_string_append (string, " | "); - g_string_append (string, "GDK_BUTTON3_MASK"); - } - - if (modifiers & GDK_BUTTON4_MASK) { - if (string->len > 0) - g_string_append (string, " | "); - g_string_append (string, "GDK_BUTTON4_MASK"); - } - - if (modifiers & GDK_BUTTON5_MASK) { - if (string->len > 0) - g_string_append (string, " | "); - g_string_append (string, "GDK_BUTTON5_MASK"); - } - - if (modifiers & GDK_RELEASE_MASK) { - if (string->len > 0) - g_string_append (string, " | "); - g_string_append (string, "GDK_RELEASE_MASK"); - } - - if (string->len > 0) - return g_string_free (string, FALSE); - - g_string_free (string, TRUE); - return NULL; -} - static void dump_widget(xmlNode *parent, GladeWidgetInfo *info, gint indent) { diff --git a/gladeui/glade-parser.h b/gladeui/glade-parser.h deleted file mode 100644 index d849161f..00000000 --- a/gladeui/glade-parser.h +++ /dev/null @@ -1,152 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- - * libglade - a library for building interfaces from XML files at runtime - * Copyright (C) 1998-2002 James Henstridge <james@daa.com.au> - * - * glade-parser.h: functions for parsing glade-2.0 files - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __GLADE_PARSER_H__ -#define __GLADE_PARSER_H__ - -#include <glib.h> -#include <gdk/gdk.h> - -G_BEGIN_DECLS - -#define CAST_BAD (gchar *) - -typedef struct _GladePropInfo GladePropInfo; -typedef struct _GladeSignalInfo GladeSignalInfo; -typedef struct _GladeAtkActionInfo GladeAtkActionInfo; -typedef struct _GladeAccelInfo GladeAccelInfo; -typedef struct _GladeWidgetInfo GladeWidgetInfo; -typedef struct _GladeChildInfo GladeChildInfo; -typedef struct _GladeInterface GladeInterface; -typedef struct _GladeAtkRelationInfo GladeAtkRelationInfo; -typedef struct _GladePackingDefault GladePackingDefault; - -struct _GladePropInfo { - gchar *name; - gchar *value; - gchar *comment; - guint translatable : 1; - guint has_context : 1; -}; - -struct _GladeSignalInfo { - gchar *name; - gchar *handler; - gchar *object; /* represents userdata, if lookup is FALSE, then do connect_object with a - * widget looked up by name, otherwise g_module_lookup() */ - guint after : 1; - guint lookup : 1; -}; - -struct _GladePackingDefault { - gchar *id; - gchar *value; -}; - -struct _GladeAtkActionInfo { - gchar *action_name; - gchar *description; -}; - -struct _GladeAtkRelationInfo { - gchar *target; - gchar *type; -}; - -struct _GladeAccelInfo { - guint key; - GdkModifierType modifiers; - gchar *signal; -}; - -struct _GladeWidgetInfo { - GladeWidgetInfo *parent; - - gchar *classname; - gchar *name; - - GladePropInfo *properties; - guint n_properties; - - GladePropInfo *atk_props; - guint n_atk_props; - - GladeSignalInfo *signals; - guint n_signals; - - GladeAtkActionInfo *atk_actions; - guint n_atk_actions; - - GladeAtkRelationInfo *relations; - guint n_relations; - - GladeAccelInfo *accels; - guint n_accels; - - GladeChildInfo *children; - guint n_children; -}; - -struct _GladeChildInfo { - GladePropInfo *properties; - guint n_properties; - - GladeWidgetInfo *child; - gchar *internal_child; -}; - -struct _GladeInterface { - gchar **requires; - guint n_requires; - - GladeWidgetInfo **toplevels; - guint n_toplevels; - - GHashTable *names; - - GHashTable *strings; - - gchar *comment; -}; - -/* the actual functions ... */ -GladeInterface *glade_parser_interface_new (void); - -GladeInterface *glade_parser_interface_new_from_file (const gchar *file, - const gchar *domain); - -GladeInterface *glade_parser_interface_new_from_buffer (const gchar *buffer, - gint len, - const gchar *domain); - -void glade_parser_interface_destroy (GladeInterface *interface); - -gboolean glade_parser_interface_dump (GladeInterface *interface, - const gchar *filename, - GError **error); - -G_CONST_RETURN gchar *glade_parser_pvalue_from_winfo (GladeWidgetInfo *winfo, - const gchar *pname); - -G_END_DECLS - -#endif diff --git a/gladeui/glade-project.c b/gladeui/glade-project.c index e32c2260..cd262403 100644 --- a/gladeui/glade-project.c +++ b/gladeui/glade-project.c @@ -128,9 +128,9 @@ static guint glade_project_signals[LAST_SIGNAL] = {0}; static GladeIDAllocator *unsaved_number_allocator = NULL; -static gboolean glade_project_load_from_interface (GladeProject *project, - GladeInterface *interface, - const gchar *path); +/* XXX static gboolean glade_project_load_from_interface (GladeProject *project, */ +/* GladeInterface *interface, */ +/* const gchar *path); */ G_DEFINE_TYPE (GladeProject, glade_project, G_TYPE_OBJECT) @@ -764,9 +764,114 @@ glade_project_new (void) return g_object_new (GLADE_TYPE_PROJECT, NULL); } + +static void +glade_project_fix_object_props (GladeProject *project) +{ + GList *l, *ll; + GValue *value; + GladeWidget *gwidget; + GladeProperty *property; + gchar *txt; + + for (l = project->priv->objects; l; l = l->next) + { + gwidget = glade_widget_get_from_gobject (l->data); + + for (ll = gwidget->properties; ll; ll = ll->next) + { + property = GLADE_PROPERTY (ll->data); + + if (glade_property_class_is_object (property->klass) && + (txt = g_object_get_data (G_OBJECT (property), + "glade-loaded-object")) != NULL) + { + /* Parse the object list and set the property to it + * (this magicly works for both objects & object lists) + */ + value = glade_property_class_make_gvalue_from_string + (property->klass, txt, project); + + glade_property_set_value (property, value); + + g_value_unset (value); + g_free (value); + + g_object_set_data (G_OBJECT (property), + "glade-loaded-object", NULL); + } + } + } +} + gboolean glade_project_load_from_file (GladeProject *project, const gchar *path) { + GladeXmlContext *context; + GladeXmlDoc *doc; + GladeXmlNode *root; + GladeXmlNode *node; + GladeWidget *widget; + + project->priv->path = glade_util_canonical_path (path); + + project->priv->selection = NULL; + project->priv->objects = NULL; + project->priv->loading = TRUE; + + + /* get the context & root node of the catalog file */ + if (!(context = + glade_xml_context_new_from_path (path, + NULL, + GLADE_XML_TAG_PROJECT))) + { + g_warning ("Couldn't open glade file [%s].", path); + return FALSE; + } + + doc = glade_xml_context_get_doc (context); + root = glade_xml_doc_get_root (doc); + + if (!glade_xml_node_verify (root, GLADE_XML_TAG_PROJECT)) + { + g_warning ("Glade file root node is not '%s', skipping %s", + GLADE_XML_TAG_PROJECT, path); + glade_xml_context_free (context); + return FALSE; + } + + for (node = glade_xml_node_get_children (root); + node; node = glade_xml_node_next (node)) + { + if ((widget = glade_widget_read (project, NULL, node, NULL)) != NULL) + glade_project_add_object (project, NULL, widget->object); + } + + if (glade_util_file_is_writeable (project->priv->path) == FALSE) + glade_project_set_readonly (project, TRUE); + + + project->priv->mtime = glade_util_get_file_mtime (project->priv->path, NULL); + + /* Reset project status here too so that you get a clean + * slate after calling glade_project_open(). + */ + project->priv->modified = FALSE; + project->priv->loading = FALSE; + + /* Emit "parse-finished" signal */ + g_signal_emit (project, glade_project_signals [PARSE_FINISHED], 0); + + /* Now we have to loop over all the object properties + * and fix'em all ('cause they probably weren't found) + */ + glade_project_fix_object_props (project); + + return TRUE; + +#if LOADING_WAS_IMPLEMENTED + GladeInterface *interface; g_return_val_if_fail (GLADE_IS_PROJECT (project), FALSE); @@ -795,7 +900,8 @@ glade_project_load_from_file (GladeProject *project, const gchar *path) project->priv->mtime = glade_util_get_file_mtime (project->priv->path, NULL); - return TRUE; +#endif // LOADING_WAS_IMPLEMENTED + } @@ -866,8 +972,9 @@ gp_sync_resources (GladeProject *project, glade_property_get_value (property, &value); - if ((resource = glade_property_class_make_string_from_gvalue - (property->klass, &value)) != NULL) + if ((resource = glade_widget_adaptor_string_from_value + (GLADE_WIDGET_ADAPTOR (property->klass->handle), + property->klass, &value)) != NULL) { full_resource = glade_project_resource_fullpath (prev_project ? prev_project : project, resource); @@ -1517,6 +1624,39 @@ glade_project_update_comment (GladeProject *project) g_strfreev (lines); } + +static GladeXmlContext * +glade_project_write (GladeProject *project) +{ + GladeXmlContext *context; + GladeXmlDoc *doc; + GladeXmlNode *root; + GList *list; + + doc = glade_xml_doc_new (); + context = glade_xml_context_new (doc, NULL); + root = glade_xml_node_new (context, GLADE_XML_TAG_PROJECT); + glade_xml_doc_set_root (doc, root); + + + for (list = project->priv->objects; list; list = list->next) + { + GladeWidget *widget; + + widget = glade_widget_get_from_gobject (list->data); + + /* + * Append toplevel widgets. Each widget then takes + * care of appending its children. + */ + if (widget->parent == NULL) + glade_widget_write (widget, context, root); + } + + return context; +} +#if LOADING_WAS_IMPLEMENTED + /** * glade_project_write: * @project: a #GladeProject @@ -1606,44 +1746,10 @@ loadable_interface (GladeInterface *interface, const gchar *path) return loadable; } -static void -glade_project_fix_object_props (GladeProject *project) -{ - GList *l, *ll; - GValue *value; - GladeWidget *gwidget; - GladeProperty *property; - gchar *txt; - - for (l = project->priv->objects; l; l = l->next) - { - gwidget = glade_widget_get_from_gobject (l->data); +#endif // LOADING_WAS_IMPLEMENTED - for (ll = gwidget->properties; ll; ll = ll->next) - { - property = GLADE_PROPERTY (ll->data); - if (glade_property_class_is_object (property->klass) && - (txt = g_object_get_data (G_OBJECT (property), - "glade-loaded-object")) != NULL) - { - /* Parse the object list and set the property to it - * (this magicly works for both objects & object lists) - */ - value = glade_property_class_make_gvalue_from_string - (property->klass, txt, project); - - glade_property_set_value (property, value); - - g_value_unset (value); - g_free (value); - - g_object_set_data (G_OBJECT (property), - "glade-loaded-object", NULL); - } - } - } -} +#if LOADING_WAS_IMPLEMENTED static gboolean glade_project_load_from_interface (GladeProject *project, @@ -1700,6 +1806,9 @@ glade_project_load_from_interface (GladeProject *project, return TRUE; } +#endif // LOADING_WAS_IMPLEMENTED + + /** * glade_project_load: * @path: @@ -1774,22 +1883,15 @@ glade_project_move_resources (GladeProject *project, gboolean glade_project_save (GladeProject *project, const gchar *path, GError **error) { - GladeInterface *interface; - gboolean ret; - gchar *canonical_path; - - g_return_val_if_fail (GLADE_IS_PROJECT (project), FALSE); - g_return_val_if_fail (path != NULL, FALSE); - - interface = glade_project_write (project); - if (!interface) - { - g_warning ("Could not write glade document\n"); - return FALSE; - } + GladeXmlContext *context; + GladeXmlDoc *doc; + gchar *canonical_path; + gint ret; - ret = glade_parser_interface_dump (interface, path, error); - glade_parser_interface_destroy (interface); + context = glade_project_write (project); + doc = glade_xml_context_get_doc (context); + ret = glade_xml_doc_save (doc, path); + glade_xml_context_destroy (context); canonical_path = glade_util_canonical_path (path); g_assert (canonical_path); @@ -1829,7 +1931,7 @@ glade_project_save (GladeProject *project, const gchar *path, GError **error) g_free (canonical_path); - return ret; + return ret > 0; } diff --git a/gladeui/glade-property-class.c b/gladeui/glade-property-class.c index bc8e262a..4ed8c3ce 100644 --- a/gladeui/glade-property-class.c +++ b/gladeui/glade-property-class.c @@ -53,102 +53,6 @@ #define NUMERICAL_PAGE_INCREMENT 10 #define NUMERICAL_PAGE_SIZE 1 - -/* Hardcoded recognized atk actions - */ -typedef struct { - gchar *prop_name; - gchar *id; - gchar *name; - gchar *tooltip; -} GPCAtkPropertyTab; - -static const GPCAtkPropertyTab action_names_table[] = { - { "click", "atk-click", N_("Click"), - N_("Set the description of the Click atk action") }, - { "press", "atk-press", N_("Press"), - N_("Set the description of the Press atk action") }, - { "release", "atk-release", N_("Release"), - N_("Set the description of the Release atk action") }, - { "activate", "atk-activate", N_("Activate"), - N_("Set the description of the Activate atk action") } -}; - -static const GPCAtkPropertyTab relation_names_table[] = { - { "controlled-by", "atk-controlled-by", N_("Controlled By"), - N_("Indicates an object controlled by one or more target objects") }, - - { "controlled-for", "atk-controlled-for", N_("Controller For"), - N_("Indicates an object is a controller for one or more target objects") }, - - { "labelled-by", "atk-labelled-by", N_("Labelled By"), - N_("Indicates an object is labelled by one or more target objects") }, - - { "label-for", "atk-label-for", N_("Label For"), - N_("Indicates an object is a label for one or more target objects") }, - - { "member-of", "atk-member-of", N_("Member Of"), - N_("Indicates an object is a member of a group of one or more target objects") }, - - { "child-node-of", "atk-child-node-of", N_("Child Node Of"), - N_("Indicates an object is a cell in a treetable which is displayed " - "because a cell in the same column is expanded and identifies that cell") }, - - { "flows-to", "atk-flows-to", N_("Flows To"), - N_("Indicates that the object has content that flows logically to another " - "AtkObject in a sequential way (text-flow, for instance).") }, - - { "flows-from", "atk-flows-from", N_("Flows From"), - N_("Indicates that the object has content that flows logically from another " - "AtkObject in a sequential way, (for instance text-flow)") }, - - { "subwindow-of", "atk-subwindow-of", N_("Subwindow Of"), - N_("Indicates a subwindow attached to a component but otherwise has no " - "connection in the UI hierarchy to that component") }, - - { "embeds", "atk-embeds", N_("Embeds"), - N_("Indicates that the object visually embeds another object's content, " - "i.e. this object's content flows around another's content") }, - - { "embedded-by", "atk-embedded-by", N_("Embedded By"), - N_("Inverse of 'Embeds', indicates that this object's content " - "is visually embedded in another object") }, - - { "popup-for", "atk-popup-for", N_("Popup For"), - N_("Indicates that an object is a popup for another object") }, - - { "parent-window-of", "atk-parent-window-of", N_("Parent Window Of"), - N_("Indicates that an object is a parent window of another object") } -}; - - -/** - * glade_property_class_atk_realname: - * @atk_name: The id of the atk property - * - * Translates a GladePropertyClass->id to the name that should be - * saved into the glade file. - * - * Returns: a pointer to a constant string. - */ -G_CONST_RETURN gchar * -glade_property_class_atk_realname (const gchar *atk_name) -{ - gint i; - - g_return_val_if_fail (atk_name != NULL, NULL); - - for (i = 0; i < G_N_ELEMENTS (action_names_table); i++) - if (!strcmp (action_names_table[i].id, atk_name)) - return action_names_table[i].prop_name; - - for (i = 0; i < G_N_ELEMENTS (relation_names_table); i++) - if (!strcmp (relation_names_table[i].id, atk_name)) - return relation_names_table[i].prop_name; - - return atk_name; -} - /** * glade_property_class_new: * @handle: A generic pointer (i.e. a #GladeWidgetClass) @@ -183,7 +87,7 @@ glade_property_class_new (gpointer handle) property_class->resource = FALSE; property_class->themed_icon = FALSE; property_class->translatable = FALSE; - property_class->type = GPC_NORMAL; + property_class->atk = FALSE; property_class->virt = TRUE; property_class->transfer_on_paste = FALSE; property_class->weight = -1.0; @@ -474,41 +378,6 @@ glade_property_class_make_string_from_objects (GladePropertyClass *property_clas return string; } -/* This is not used to save in the glade file... and its a one-way conversion. - * its only usefull to show the values in the UI. - */ -static gchar * -glade_property_class_make_string_from_accels (GladePropertyClass *property_class, - GList *accels) -{ - GladeAccelInfo *info; - GString *string; - GList *list; - - string = g_string_new (""); - - for (list = accels; list; list = list->next) - { - info = list->data; - - if (info->modifiers & GDK_SHIFT_MASK) - g_string_append (string, "SHIFT-"); - - if (info->modifiers & GDK_CONTROL_MASK) - g_string_append (string, "CNTL-"); - - if (info->modifiers & GDK_MOD1_MASK) - g_string_append (string, "ALT-"); - - g_string_append (string, glade_builtin_string_from_key (info->key)); - - if (list->next) - g_string_append (string, ", "); - } - - return g_string_free (string, FALSE); -} - /** * glade_property_class_make_string_from_gvalue: * @property_class: A #GladePropertyClass @@ -523,7 +392,7 @@ glade_property_class_make_string_from_gvalue (GladePropertyClass *property_class gchar *string = NULL, **strv, str[G_ASCII_DTOSTR_BUF_SIZE]; GObject *object; GdkColor *color; - GList *objects, *accels; + GList *objects; if (G_IS_PARAM_SPEC_ENUM(property_class->pspec)) { @@ -629,14 +498,8 @@ glade_property_class_make_string_from_gvalue (GladePropertyClass *property_class string = glade_property_class_make_string_from_objects (property_class, objects); } - else if (GLADE_IS_PARAM_SPEC_ACCEL (property_class->pspec)) - { - accels = g_value_get_boxed (value); - string = glade_property_class_make_string_from_accels - (property_class, accels); - } else - g_critical ("Unsupported pspec type %s", + g_critical ("Unsupported pspec type %s (value -> string)", g_type_name(G_PARAM_SPEC_TYPE (property_class->pspec))); return string; @@ -961,7 +824,7 @@ glade_property_class_make_gvalue_from_string (GladePropertyClass *property_class g_value_set_boxed (value, objects); } else - g_critical ("Unsupported pspec type %s", + g_critical ("Unsupported pspec type %s (string -> value)", g_type_name(G_PARAM_SPEC_TYPE (property_class->pspec))); return value; @@ -1024,7 +887,7 @@ glade_property_class_make_gvalue_from_vl (GladePropertyClass *klass, else if (GLADE_IS_PARAM_SPEC_OBJECTS(klass->pspec)) g_value_set_boxed (value, va_arg (vl, gpointer)); else - g_critical ("Unsupported pspec type %s", + g_critical ("Unsupported pspec type %s (vl -> string)", g_type_name(G_PARAM_SPEC_TYPE (klass->pspec))); return value; @@ -1113,7 +976,7 @@ glade_property_class_set_vl_from_gvalue (GladePropertyClass *klass, else if (GLADE_IS_PARAM_SPEC_OBJECTS(klass->pspec)) *(gpointer *)(va_arg (vl, gpointer *)) = g_value_get_boxed (value); else - g_critical ("Unsupported pspec type %s", + g_critical ("Unsupported pspec type %s (string -> vl)", g_type_name(G_PARAM_SPEC_TYPE (klass->pspec))); } @@ -1141,108 +1004,6 @@ glade_property_class_get_from_gvalue (GladePropertyClass *klass, } /** - * glade_property_class_list_atk_relations: - * @handle: A generic pointer (i.e. a #GladeWidgetClass) - * @owner_type: The #GType of the owning widget class. - * - * Returns: a #GList of newly created atk relation #GladePropertyClass. - */ -GList * -glade_property_class_list_atk_relations (gpointer handle, - GType owner_type) -{ - const GPCAtkPropertyTab *relation_tab = NULL; - GladePropertyClass *property_class; - GList *list = NULL; - gint i; - - /* Loop through our hard-coded table enties */ - for (i = 0; i < G_N_ELEMENTS (relation_names_table); i++) - { - relation_tab = &relation_names_table[i]; - - property_class = glade_property_class_new (handle); - property_class->pspec = - glade_param_spec_objects (relation_tab->id, - _(relation_tab->name), - _(relation_tab->tooltip), - ATK_TYPE_IMPLEMENTOR, - G_PARAM_READWRITE); - - property_class->pspec->owner_type = owner_type; - property_class->id = g_strdup (relation_tab->id); - property_class->name = g_strdup (_(relation_tab->name)); - property_class->tooltip = g_strdup (_(relation_tab->tooltip)); - property_class->type = GPC_ATK_RELATION; - property_class->visible_lines = 2; - property_class->ignore = TRUE; - - property_class->def = - glade_property_class_make_gvalue_from_string - (property_class, "", NULL); - - property_class->orig_def = - glade_property_class_make_gvalue_from_string - (property_class, "", NULL); - - list = g_list_prepend (list, property_class); - } - - return g_list_reverse (list); -} - -/** - * glade_property_class_accel_property: - * @handle: A generic pointer (i.e. a #GladeWidgetClass) - * @owner_type: The #GType of the owning widget class. - * - * Returns: a newly created #GladePropertyClass for accelerators - * of the prescribed @owner_type. - */ -GladePropertyClass * -glade_property_class_accel_property (gpointer handle, - GType owner_type) -{ - GladePropertyClass *property_class; - GValue *def_value; - - property_class = glade_property_class_new (handle); - property_class->pspec = - glade_param_spec_accel ("accelerators", _("Accelerators"), - _("A list of accelerator keys"), - owner_type, - G_PARAM_READWRITE); - - - property_class->pspec->owner_type = owner_type; - property_class->id = g_strdup (g_param_spec_get_name - (property_class->pspec)); - property_class->name = g_strdup (g_param_spec_get_nick - (property_class->pspec)); - property_class->tooltip = g_strdup (g_param_spec_get_blurb - (property_class->pspec)); - - property_class->type = GPC_ACCEL_PROPERTY; - property_class->ignore = TRUE; - property_class->common = TRUE; - - /* Setup default */ - def_value = g_new0 (GValue, 1); - g_value_init (def_value, GLADE_TYPE_ACCEL_GLIST); - g_value_set_boxed (def_value, NULL); - property_class->def = def_value; - - /* Setup original default */ - def_value = g_new0 (GValue, 1); - g_value_init (def_value, GLADE_TYPE_ACCEL_GLIST); - g_value_set_boxed (def_value, NULL); - property_class->orig_def = def_value; - - return property_class; -} - - -/** * glade_property_class_new_from_spec: * @handle: A generic pointer (i.e. a #GladeWidgetClass) * @spec: A #GParamSpec @@ -1254,8 +1015,9 @@ GladePropertyClass * glade_property_class_new_from_spec (gpointer handle, GParamSpec *spec) { - GObjectClass *gtk_widget_class; - GladePropertyClass *property_class; + GObjectClass *gtk_widget_class; + GladePropertyClass *property_class; + GladeEditorProperty *eprop; g_return_val_if_fail (spec != NULL, NULL); gtk_widget_class = g_type_class_ref (GTK_TYPE_WIDGET); @@ -1271,13 +1033,17 @@ glade_property_class_new_from_spec (gpointer handle, if ((spec->flags & G_PARAM_WRITABLE) == 0) goto failed; + property_class->id = g_strdup (spec->name); + property_class->name = g_strdup (g_param_spec_get_nick (spec)); + /* Register only editable properties. */ - if (!glade_editor_property_supported (property_class->pspec)) + if (!(eprop = glade_widget_adaptor_create_eprop + (GLADE_WIDGET_ADAPTOR (handle), property_class, FALSE))) goto failed; - - property_class->id = g_strdup (spec->name); - property_class->name = g_strdup (g_param_spec_get_nick (spec)); + + /* Just created it to see if it was supported.... destroy now... */ + gtk_widget_destroy (GTK_WIDGET (eprop)); /* If its on the GtkWidgetClass, it goes in "common" * (unless stipulated otherwise in the xml file) @@ -1290,17 +1056,6 @@ glade_property_class_new_from_spec (gpointer handle, if (spec->flags & G_PARAM_CONSTRUCT_ONLY) property_class->construct_only = TRUE; - if (g_type_is_a (spec->owner_type, ATK_TYPE_OBJECT)) - { - property_class->type = GPC_ATK_PROPERTY; - property_class->ignore = TRUE; - - /* We only use the name and desctription props, - * they are both translatable. - */ - property_class->translatable = TRUE; - } - if (!property_class->id || !property_class->name) { g_critical ("No name or id for " @@ -1735,22 +1490,10 @@ glade_property_class_update_from_node (GladeXmlNode *node, klass->displayable_values = gpc_get_displayable_values_from_node (child, klass, domain); - /* A sprinkle of hard-code to get atk properties working right - */ - if (glade_xml_get_property_boolean (node, GLADE_TAG_ATK_ACTION, FALSE)) - klass->type = GPC_ATK_ACTION; - else if (glade_xml_get_property_boolean (node, GLADE_TAG_ATK_PROPERTY, FALSE)) - { - if (GLADE_IS_PARAM_SPEC_OBJECTS (klass->pspec)) - klass->type = GPC_ATK_RELATION; - else - klass->type = GPC_ATK_PROPERTY; - } - - /* Special case accelerators here. + /* Right now allowing the backend to specify that some properties + * go in the atk tab, ideally this shouldnt be needed. */ - if (GLADE_IS_PARAM_SPEC_ACCEL (klass->pspec)) - klass->type = GPC_ACCEL_PROPERTY; + klass->atk = glade_xml_get_property_boolean (node, GLADE_TAG_ATK_PROPERTY, klass->atk); /* Special case pixbuf here. */ diff --git a/gladeui/glade-property-class.h b/gladeui/glade-property-class.h index 88c500b2..4040ae45 100644 --- a/gladeui/glade-property-class.h +++ b/gladeui/glade-property-class.h @@ -20,28 +20,10 @@ G_BEGIN_DECLS typedef struct _GladePropertyClass GladePropertyClass; -/** - * GPCType: - * @GPC_NORMAL: is not an atk property - * @GPC_ATK_PROPERTY: is a property of an #AtkImplementor object - * @GPC_ATK_RELATION: is an atk relation set property - * @GPC_ATK_ACTION: is an atk action property - * @GPC_ACCEL_PROPERTY: is an accelerator key property - */ -typedef enum { - GPC_NORMAL, - GPC_ATK_PROPERTY, - GPC_ATK_RELATION, - GPC_ATK_ACTION, - GPC_ACCEL_PROPERTY -} GPCType; - struct _GladePropertyClass { - GPCType type; /* A symbolic type used to load/save properties differently - */ - gpointer handle; /* The GladeWidgetClass that this property class + gpointer handle; /* The GladeWidgetAdaptor that this property class * was created for. */ @@ -103,7 +85,8 @@ struct _GladePropertyClass gboolean construct_only; /* Whether this property is G_PARAM_CONSTRUCT_ONLY or not */ - gboolean common; /* Common properties go in the common tab */ + gboolean common; /* Common properties go in the common tab */ + gboolean atk; /* Atk properties go in the atk tab */ gboolean packing; /* Packing properties go in the packing tab */ @@ -120,7 +103,9 @@ struct _GladePropertyClass * property editor availability & live object updates in the glade environment. */ gboolean save; /* Whether we should save to the glade file or not - * (mostly just for custom glade properties) + * (mostly just for virtual internal glade properties, + * also used for properties with generic pspecs that + * are saved in custom ways by the plugin) */ gboolean save_always; /* Used to make a special case exception and always * save this property regardless of what the default @@ -131,10 +116,9 @@ struct _GladePropertyClass gboolean visible; /* Whether or not to show this property in the editor */ gboolean ignore; /* When true, we will not sync the object when the property - * changes. + * changes, or load values from the object. */ - gboolean is_modified; /* If true, this property_class has been "modified" from the * the standard property by a xml file. */ @@ -166,13 +150,6 @@ GladePropertyClass *glade_property_class_new (gpointer GladePropertyClass *glade_property_class_new_from_spec (gpointer handle, GParamSpec *spec); - -GList *glade_property_class_list_atk_relations (gpointer handle, - GType owner_type); - -GladePropertyClass *glade_property_class_accel_property (gpointer handle, - GType owner_type); - GladePropertyClass *glade_property_class_clone (GladePropertyClass *property_class); @@ -220,8 +197,6 @@ gboolean glade_property_class_match (GladePropertyC gboolean glade_property_class_void_value (GladePropertyClass *klass, GValue *value); -G_CONST_RETURN gchar *glade_property_class_atk_realname (const gchar *atk_name); - G_END_DECLS #endif /* __GLADE_PROPERTY_CLASS_H__ */ diff --git a/gladeui/glade-property.c b/gladeui/glade-property.c index 3b0632a0..ea285c5f 100644 --- a/gladeui/glade-property.c +++ b/gladeui/glade-property.c @@ -220,8 +220,9 @@ glade_property_set_value_impl (GladeProperty *property, const GValue *value) #if 0 { - gchar *str = glade_property_class_make_string_from_gvalue - (property->klass, value); + gchar *str = glade_widget_adaptor_string_from_value + (GLADE_WIDGET_ADAPTOR (property->klass->handle), + property->klass, value); g_print ("Setting property %s on %s to %s\n", property->klass->id, property->widget ? property->widget->name : "unknown", str); @@ -343,9 +344,10 @@ glade_property_load_impl (GladeProperty *property) if (property->widget == NULL || property->klass->packing || - property->klass->type != GPC_NORMAL || + property->klass->ignore || !(property->klass->pspec->flags & G_PARAM_READABLE)) return; + object = glade_widget_get_object (property->widget); oclass = G_OBJECT_GET_CLASS (object); @@ -353,122 +355,6 @@ glade_property_load_impl (GladeProperty *property) g_object_get_property (object, property->klass->id, property->value); } -static gboolean -glade_property_write_impl (GladeProperty *property, - GladeInterface *interface, - GArray *props) -{ - GladePropInfo info = { 0, }; - GladeAtkActionInfo ainfo = { 0, }; - GList *list; - gchar *name, *value, **split, *tmp; - gint i; - - if (!property->klass->save || !property->enabled) - return FALSE; - - g_assert (property->klass->orig_def); - g_assert (property->klass->def); - - /* Skip properties that are default by original pspec default - * (excepting those that specified otherwise). - */ - if (!(property->klass->save_always || property->save_always) && - glade_property_equals_value (property, property->klass->orig_def)) - return FALSE; - - /* we should change each '-' by '_' on the name of the property - * (<property name="...">) */ - if (property->klass->type != GPC_NORMAL) - { - - tmp = (gchar *)glade_property_class_atk_realname (property->klass->id); - name = g_strdup (tmp); - } - else - { - name = g_strdup (property->klass->id); - } - - /* convert the value of this property to a string */ - if (property->klass->type == GPC_ACCEL_PROPERTY || - (value = glade_property_class_make_string_from_gvalue - (property->klass, property->value)) == NULL) - /* make sure we keep the empty string, also... upcomming - * funcs that may not like NULL. - */ - value = g_strdup (""); - else - { - /* Escape the string so that it will be parsed as it should. */ - tmp = value; - value = g_markup_escape_text (value, -1); - g_free (tmp); - } - - switch (property->klass->type) - { - case GPC_ATK_PROPERTY: - tmp = g_strdup_printf ("AtkObject::%s", name); - g_free (name); - name = tmp; - /* Dont break here ... */ - case GPC_NORMAL: - info.name = glade_xml_alloc_propname(interface, name); - info.value = glade_xml_alloc_string(interface, value); - - if (property->klass->translatable) - { - info.translatable = property->i18n_translatable; - info.has_context = property->i18n_has_context; - if (property->i18n_comment) - info.comment = glade_xml_alloc_string - (interface, property->i18n_comment); - } - g_array_append_val (props, info); - break; - case GPC_ATK_RELATION: - if ((split = g_strsplit (value, GPC_OBJECT_DELIMITER, 0)) != NULL) - { - for (i = 0; split[i] != NULL; i++) - { - GladeAtkRelationInfo rinfo = { 0, }; - rinfo.type = glade_xml_alloc_string(interface, name); - rinfo.target = glade_xml_alloc_string(interface, split[i]); - g_array_append_val (props, rinfo); - } - g_strfreev (split); - } - break; - case GPC_ATK_ACTION: - ainfo.action_name = glade_xml_alloc_string(interface, name); - ainfo.description = glade_xml_alloc_string(interface, value); - g_array_append_val (props, ainfo); - break; - case GPC_ACCEL_PROPERTY: - for (list = g_value_get_boxed (property->value); - list; list = list->next) - { - GladeAccelInfo *accel = list->data; - GladeAccelInfo accel_info = { 0, }; - - accel_info.signal = glade_xml_alloc_string(interface, accel->signal); - accel_info.key = accel->key; - accel_info.modifiers = accel->modifiers; - - g_array_append_val (props, accel_info); - } - break; - default: - break; - } - - g_free (name); - g_free (value); - - return TRUE; -} - static G_CONST_RETURN gchar * glade_property_get_tooltip_impl (GladeProperty *property) { @@ -593,7 +479,6 @@ glade_property_klass_init (GladePropertyKlass *prop_class) prop_class->get_default = glade_property_get_default_impl; prop_class->sync = glade_property_sync_impl; prop_class->load = glade_property_load_impl; - prop_class->write = glade_property_write_impl; prop_class->get_tooltip = glade_property_get_tooltip_impl; prop_class->value_changed = NULL; prop_class->tooltip_changed = NULL; @@ -658,7 +543,6 @@ glade_property_klass_init (GladePropertyKlass *prop_class) } - GType glade_property_get_type (void) { @@ -687,308 +571,6 @@ glade_property_get_type (void) } /******************************************************************************* - GladeInterface Parsing code - *******************************************************************************/ -static GValue * -glade_property_read_packing (GladeProperty *property, - GladePropertyClass *pclass, - GladeProject *project, - GladeChildInfo *info, - gboolean free_value) -{ - GValue *gvalue = NULL; - gint i; - gchar *id; - - for (i = 0; i < info->n_properties; ++i) - { - GladePropInfo *pinfo = info->properties + i; - - id = glade_util_read_prop_name (pinfo->name); - - if (!strcmp (id, pclass->id)) - { - gvalue = glade_property_class_make_gvalue_from_string - (pclass, pinfo->value, project); - - if (property) - { - glade_property_i18n_set_translatable - (property, pinfo->translatable); - glade_property_i18n_set_has_context - (property, pinfo->has_context); - glade_property_i18n_set_comment - (property, pinfo->comment); - - property->enabled = TRUE; - - GLADE_PROPERTY_GET_KLASS (property)->set_value - (property, gvalue); - } - - if (free_value) - { - g_value_unset (gvalue); - g_free (gvalue); - } - - g_free (id); - break; - } - g_free (id); - } - return gvalue; -} - -static GValue * -glade_property_read_normal (GladeProperty *property, - GladePropertyClass *pclass, - GladeProject *project, - GladeWidgetInfo *info, - gboolean free_value) -{ - GValue *gvalue = NULL; - gint i; - gchar *id; - - for (i = 0; i < info->n_properties; ++i) - { - GladePropInfo *pinfo = info->properties + i; - - id = glade_util_read_prop_name (pinfo->name); - - if (!strcmp (id, pclass->id)) - { - if (property && glade_property_class_is_object (pclass)) - { - /* we must synchronize this directly after loading this project - * (i.e. lookup the actual objects after they've been parsed and - * are present). - */ - g_object_set_data_full (G_OBJECT (property), - "glade-loaded-object", - g_strdup (pinfo->value), g_free); - } - else - { - gvalue = glade_property_class_make_gvalue_from_string - (pclass, pinfo->value, project); - - if (property) - GLADE_PROPERTY_GET_KLASS - (property)->set_value (property, gvalue); - - if (free_value) - { - g_value_unset (gvalue); - g_free (gvalue); - } - } - - if (property) - { - glade_property_i18n_set_translatable - (property, pinfo->translatable); - glade_property_i18n_set_has_context - (property, pinfo->has_context); - glade_property_i18n_set_comment - (property, pinfo->comment); - - property->enabled = TRUE; - } - - g_free (id); - break; - } - g_free (id); - } - return gvalue; -} - -static GValue * -glade_property_read_atk_prop (GladeProperty *property, - GladePropertyClass *pclass, - GladeProject *project, - GladeWidgetInfo *info, - gboolean free_value) -{ - GValue *gvalue = NULL; - gint i; - gchar *id; - - for (i = 0; i < info->n_atk_props; ++i) - { - GladePropInfo *pinfo = info->atk_props + i; - - id = glade_util_read_prop_name (pinfo->name); - - if (!strcmp (id, pclass->id)) - { - gvalue = glade_property_class_make_gvalue_from_string - (pclass, pinfo->value, project); - - if (property) - { - glade_property_i18n_set_translatable - (property, pinfo->translatable); - glade_property_i18n_set_has_context - (property, pinfo->has_context); - glade_property_i18n_set_comment - (property, pinfo->comment); - - property->enabled = TRUE; - - GLADE_PROPERTY_GET_KLASS (property)->set_value - (property, gvalue); - } - - if (free_value) - { - g_value_unset (gvalue); - g_free (gvalue); - } - - g_free (id); - break; - } - g_free (id); - } - return gvalue; -} - -static GValue * -glade_property_read_atk_relation (GladeProperty *property, - GladePropertyClass *pclass, - GladeProject *project, - GladeWidgetInfo *info) -{ - const gchar *class_id; - gchar *id, *string = NULL, *tmp; - gint i; - - for (i = 0; i < info->n_relations; ++i) - { - GladeAtkRelationInfo *rinfo = info->relations + i; - - id = glade_util_read_prop_name (rinfo->type); - class_id = glade_property_class_atk_realname (pclass->id); - - if (!strcmp (id, class_id)) - { - if (string == NULL) - string = g_strdup (rinfo->target); - else - { - tmp = g_strdup_printf ("%s%s%s", string, - GPC_OBJECT_DELIMITER, rinfo->target); - string = (g_free (string), tmp); - } - } - g_free (id); - } - - /* we must synchronize this directly after loading this project - * (i.e. lookup the actual objects after they've been parsed and - * are present). - */ - if (property) - { - g_object_set_data_full (G_OBJECT (property), "glade-loaded-object", - g_strdup (string), g_free); - } - - return NULL; -} - -static GValue * -glade_property_read_atk_action (GladeProperty *property, - GladePropertyClass *pclass, - GladeProject *project, - GladeWidgetInfo *info, - gboolean free_value) -{ - GValue *gvalue = NULL; - const gchar *class_id; - gchar *id; - gint i; - - for (i = 0; i < info->n_atk_actions; ++i) - { - GladeAtkActionInfo *ainfo = info->atk_actions + i; - - id = glade_util_read_prop_name (ainfo->action_name); - class_id = glade_property_class_atk_realname (pclass->id); - - if (!strcmp (id, class_id)) - { - /* Need special case for NULL values here ??? */ - - gvalue = glade_property_class_make_gvalue_from_string - (pclass, ainfo->description, project); - - if (property) - GLADE_PROPERTY_GET_KLASS - (property)->set_value (property, gvalue); - - if (free_value) - { - g_value_unset (gvalue); - g_free (gvalue); - } - g_free (id); - break; - } - g_free (id); - } - return gvalue; -} - -static GValue * -glade_property_read_accel_prop (GladeProperty *property, - GladePropertyClass *pclass, - GladeProject *project, - GladeWidgetInfo *info, - gboolean free_value) -{ - GValue *gvalue = NULL; - GList *accels = NULL; - gint i; - - for (i = 0; i < info->n_accels; ++i) - { - GladeAccelInfo *ainfo = info->accels + i; - - GladeAccelInfo *ainfo_dup = g_new0 (GladeAccelInfo, 1); - - ainfo_dup = g_new0 (GladeAccelInfo, 1); - ainfo_dup->signal = g_strdup (ainfo->signal); - ainfo_dup->key = ainfo->key; - ainfo_dup->modifiers = ainfo->modifiers; - - accels = g_list_prepend (accels, ainfo_dup); - } - - gvalue = g_new0 (GValue, 1); - g_value_init (gvalue, GLADE_TYPE_ACCEL_GLIST); - g_value_take_boxed (gvalue, accels); - - - if (property) - GLADE_PROPERTY_GET_KLASS - (property)->set_value (property, gvalue); - - - if (free_value) - { - g_value_unset (gvalue); - g_free (gvalue); - } - - return gvalue; -} - - -/******************************************************************************* API *******************************************************************************/ /** @@ -1321,83 +903,208 @@ glade_property_load (GladeProperty *property) /** * glade_property_read: * @property: a #GladeProperty or #NULL - * @pclass: the #GladePropertyClass * @project: the #GladeProject - * @info: a #GladeWidgetInfo struct or a #GladeChildInfo struct if - * a packing property is passed. - * @free_value: Whether the return value should be freed after applying - * it to the property or if it should be returned in tact. + * @node: the #GladeXmlNode to read, will either be a <widget> + * node or a <child> node for packing properties. * - * Read the value and any attributes for @property from @info, assumes + * Read the value and any attributes for @property from @node, assumes * @property is being loaded for @project * - * Returns: The newly created #GValue if successfull (and if @free_value == FALSE) - * * Note that object values will only be resolved after the project is * completely loaded */ -GValue * +void glade_property_read (GladeProperty *property, - GladePropertyClass *pclass, GladeProject *project, - gpointer info, - gboolean free_value) + GladeXmlNode *node) { - GValue *ret = NULL; + GladeXmlNode *prop; + GValue *gvalue = NULL; + gchar *id, *name, *value; - g_return_val_if_fail (pclass != NULL, FALSE); - g_return_val_if_fail (info != NULL, FALSE); + g_return_if_fail (GLADE_IS_PROPERTY (property)); + g_return_if_fail (GLADE_IS_PROJECT (project)); + g_return_if_fail (node != NULL); - if (pclass->packing) - { - ret = glade_property_read_packing - (property, pclass, project, (GladeChildInfo *)info, free_value); - } - else switch (pclass->type) + /* This code should work the same for <packing> and <widget> */ + if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_PACKING) || + glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET))) + return; + + for (prop = glade_xml_node_get_children (node); + prop; prop = glade_xml_node_next (prop)) { - case GPC_NORMAL: - ret = glade_property_read_normal - (property, pclass, project, (GladeWidgetInfo *)info, free_value); - break; - case GPC_ATK_PROPERTY: - ret = glade_property_read_atk_prop - (property, pclass, project, (GladeWidgetInfo *)info, free_value); - break; - case GPC_ATK_RELATION: - ret = glade_property_read_atk_relation - (property, pclass, project, (GladeWidgetInfo *)info); - break; - case GPC_ATK_ACTION: - ret = glade_property_read_atk_action - (property, pclass, project, (GladeWidgetInfo *)info, free_value); - break; - case GPC_ACCEL_PROPERTY: - ret = glade_property_read_accel_prop - (property, pclass, project, (GladeWidgetInfo *)info, free_value); - break; - default: - break; - } - return ret; + if (!glade_xml_node_verify_silent (prop, GLADE_XML_TAG_PROPERTY)) + continue; + + if (!(name = glade_xml_get_property_string_required + (prop, GLADE_XML_TAG_NAME, NULL))) + continue; + + /* Make sure we are working with dashes and + * not underscores ... + */ + id = glade_util_read_prop_name (name); + g_free (name); + + if (!strcmp (id, property->klass->id)) + { + if (!(value = glade_xml_get_content (prop))) + { + /* XXX should be glade_xml_get_content_required()... */ + g_free (id); + break; + } + + if (property && glade_property_class_is_object (property->klass)) + { + /* we must synchronize this directly after loading this project + * (i.e. lookup the actual objects after they've been parsed and + * are present). + */ + g_object_set_data_full (G_OBJECT (property), + "glade-loaded-object", + g_strdup (value), g_free); + } + else + { + gvalue = glade_property_class_make_gvalue_from_string + (property->klass, value, project); + + if (property) + { + GLADE_PROPERTY_GET_KLASS + (property)->set_value (property, gvalue); + } + + g_value_unset (gvalue); + g_free (gvalue); + + /* If an optional property is specified in the + * glade file, its enabled + */ + property->enabled = TRUE; + } + + if (property) + { + gint translatable, has_context; + gchar *comment; + + translatable = glade_xml_get_property_boolean + (prop, GLADE_TAG_TRANSLATABLE, FALSE); + has_context = glade_xml_get_property_boolean + (prop, GLADE_TAG_HAS_CONTEXT, FALSE); + comment = glade_xml_get_property_string + (prop, GLADE_TAG_COMMENT); + + glade_property_i18n_set_translatable + (property, translatable); + glade_property_i18n_set_has_context + (property, has_context); + glade_property_i18n_set_comment + (property, comment); + + g_free (comment); + } + + g_free (value); + g_free (id); + break; + } + g_free (id); + } } /** * glade_property_write: * @property: a #GladeProperty - * @interface: a #GladeInterface - * @props: a GArray of #GladePropInfo + * @context: A #GladeXmlContext + * @node: A #GladeXmlNode * - * Write this property to the GladeInterface metadata + * Write @property to @node */ -gboolean -glade_property_write (GladeProperty *property, GladeInterface *interface, GArray *props) +void +glade_property_write (GladeProperty *property, + GladeXmlContext *context, + GladeXmlNode *node) { - g_return_val_if_fail (GLADE_IS_PROPERTY (property), FALSE); - g_return_val_if_fail (interface != NULL, FALSE); - g_return_val_if_fail (props != NULL, FALSE); - return GLADE_PROPERTY_GET_KLASS (property)->write (property, interface, props); + GladeXmlNode *prop_node; + gchar *name, *value, *tmp; + + g_return_if_fail (GLADE_IS_PROPERTY (property)); + g_return_if_fail (node != NULL); + + /* This code should work the same for <packing> and <widget> */ + if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_PACKING) || + glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET))) + return; + + if (!property->klass->save || !property->enabled) + return; + + g_assert (property->klass->orig_def); + g_assert (property->klass->def); + + /* Skip properties that are default by original pspec default + * (excepting those that specified otherwise). + */ + if (!(property->klass->save_always || property->save_always) && + glade_property_equals_value (property, property->klass->orig_def)) + return; + + /* Escape our string and save with underscores */ + name = g_strdup (property->klass->id); + glade_util_replace (name, '-', '_'); + + /* convert the value of this property to a string */ + if (!(value = glade_widget_adaptor_string_from_value + (GLADE_WIDGET_ADAPTOR (property->klass->handle), + property->klass, property->value))) + /* make sure we keep the empty string, also... upcomming + * funcs that may not like NULL. + */ + value = g_strdup (""); + else + { + /* Escape the string so that it will be parsed as it should. */ + tmp = value; + value = g_markup_escape_text (value, -1); + g_free (tmp); + } + + /* Now dump the node values... */ + prop_node = glade_xml_node_new (context, GLADE_XML_TAG_PROPERTY); + glade_xml_node_append_child (node, prop_node); + + /* Name and value */ + glade_xml_node_set_property_string (prop_node, GLADE_XML_TAG_NAME, name); + glade_xml_set_content (prop_node, value); + + /* i18n stuff */ + if (property->klass->translatable) + { + if (property->i18n_translatable) + glade_xml_node_set_property_string (prop_node, + GLADE_TAG_TRANSLATABLE, + GLADE_XML_TAG_I18N_TRUE); + + if (property->i18n_has_context) + glade_xml_node_set_property_string (prop_node, + GLADE_TAG_HAS_CONTEXT, + GLADE_XML_TAG_I18N_TRUE); + + + if (property->i18n_comment) + glade_xml_node_set_property_string (prop_node, + GLADE_TAG_COMMENT, + property->i18n_comment); + } + + g_free (name); + g_free (value); } /** diff --git a/gladeui/glade-property.h b/gladeui/glade-property.h index a0c0c4a1..569cbabc 100644 --- a/gladeui/glade-property.h +++ b/gladeui/glade-property.h @@ -78,7 +78,6 @@ struct _GladePropertyKlass void (* get_default) (GladeProperty *, GValue *); void (* sync) (GladeProperty *); void (* load) (GladeProperty *); - gboolean (* write) (GladeProperty *, GladeInterface *, GArray *); G_CONST_RETURN gchar * (* get_tooltip) (GladeProperty *); /* Signals */ @@ -141,15 +140,13 @@ void glade_property_sync (GladeProperty void glade_property_load (GladeProperty *property); -GValue *glade_property_read (GladeProperty *property, - GladePropertyClass *pclass, +void glade_property_read (GladeProperty *property, GladeProject *project, - gpointer info, - gboolean free_value); + GladeXmlNode *node); -gboolean glade_property_write (GladeProperty *property, - GladeInterface *interface, - GArray *props); +void glade_property_write (GladeProperty *property, + GladeXmlContext *context, + GladeXmlNode *node); G_CONST_RETURN gchar *glade_property_get_tooltip (GladeProperty *property); diff --git a/gladeui/glade-signal-editor.c b/gladeui/glade-signal-editor.c index d62e0e94..06fac409 100644 --- a/gladeui/glade-signal-editor.c +++ b/gladeui/glade-signal-editor.c @@ -102,8 +102,8 @@ glade_signal_editor_after_toggled (GtkCellRendererToggle *cell, g_assert (signal_name != NULL); } - old_signal = glade_signal_new (signal_name, handler, userdata, lookup, after); - new_signal = glade_signal_new (signal_name, handler, userdata, lookup, !after); + old_signal = glade_signal_new (signal_name, handler, userdata, after); + new_signal = glade_signal_new (signal_name, handler, userdata, !after); glade_command_change_signal (editor->widget, old_signal, new_signal); gtk_tree_store_set (GTK_TREE_STORE (model), &iter, COLUMN_AFTER, !after, -1); @@ -348,7 +348,7 @@ glade_signal_editor_handler_cell_edited (GtkCellRendererText *cell, if (slot && !is_void_signal_handler(new_handler)) { GladeSignal *new_signal = glade_signal_new (signal_name, new_handler, - NULL, FALSE, FALSE); + NULL, FALSE); glade_command_add_signal (glade_widget, new_signal); glade_signal_free (new_signal); gtk_tree_store_set (GTK_TREE_STORE (model), &iter, @@ -368,7 +368,7 @@ glade_signal_editor_handler_cell_edited (GtkCellRendererText *cell, glade_signal_new (signal_name, old_handler, is_void_user_data (userdata) ? NULL : userdata, - lookup, after); + after); glade_command_remove_signal (glade_widget, old_signal); glade_signal_free (old_signal); @@ -397,14 +397,12 @@ glade_signal_editor_handler_cell_edited (GtkCellRendererText *cell, (signal_name, old_handler, is_void_user_data(userdata) ? NULL : userdata, - lookup, after); GladeSignal *new_signal = glade_signal_new (signal_name, new_handler, is_void_user_data(userdata) ? NULL : userdata, - lookup, after); glade_command_change_signal (glade_widget, old_signal, new_signal); @@ -619,14 +617,12 @@ glade_signal_editor_userdata_cell_edited (GtkCellRendererText *cell, old_signal = glade_signal_new (signal_name, handler, - is_void_user_data(old_userdata) ? NULL : old_userdata, - lookup, after); + is_void_user_data(old_userdata) ? NULL : old_userdata, after); new_signal = glade_signal_new (signal_name, handler, - is_void_user_data(new_userdata) ? NULL : new_userdata, - lookup, after); + is_void_user_data(new_userdata) ? NULL : new_userdata, after); if (glade_signal_equal (old_signal, new_signal) == FALSE) glade_command_change_signal (glade_widget, old_signal, new_signal); @@ -921,7 +917,7 @@ glade_signal_editor_load_widget (GladeSignalEditor *editor, COLUMN_USERDATA, widget_signal->userdata ? widget_signal->userdata : _(USERDATA_DEFAULT), - COLUMN_LOOKUP, widget_signal->lookup, + COLUMN_LOOKUP, FALSE/* widget_signal->lookup */, COLUMN_LOOKUP_VISIBLE, widget_signal->userdata ? TRUE : FALSE, COLUMN_AFTER_VISIBLE, TRUE, @@ -944,7 +940,7 @@ glade_signal_editor_load_widget (GladeSignalEditor *editor, COLUMN_USERDATA, widget_signal->userdata ? widget_signal->userdata : _(USERDATA_DEFAULT), - COLUMN_LOOKUP, widget_signal->lookup, + COLUMN_LOOKUP, FALSE/* widget_signal->lookup */, COLUMN_LOOKUP_VISIBLE, widget_signal->userdata ? TRUE : FALSE, COLUMN_AFTER_VISIBLE, TRUE, diff --git a/gladeui/glade-signal.c b/gladeui/glade-signal.c index 1bf5dd9c..3e5e522c 100644 --- a/gladeui/glade-signal.c +++ b/gladeui/glade-signal.c @@ -45,7 +45,6 @@ GladeSignal *glade_signal_new (const gchar *name, const gchar *handler, const gchar *userdata, - gboolean lookup, gboolean after) { GladeSignal *signal = g_new0 (GladeSignal, 1); @@ -53,7 +52,6 @@ GladeSignal *glade_signal_new (const gchar *name, signal->name = g_strdup (name); signal->handler = g_strdup (handler); signal->userdata = userdata ? g_strdup (userdata) : NULL; - signal->lookup = lookup; signal->after = after; return signal; @@ -92,8 +90,7 @@ glade_signal_equal (GladeSignal *sig1, GladeSignal *sig2) if (!strcmp (sig1->name, sig2->name) && !strcmp (sig1->handler, sig2->handler) && - sig1->after == sig2->after && - sig1->lookup == sig2->lookup) + sig1->after == sig2->after) { if ((sig1->userdata == NULL && sig2->userdata == NULL) || (sig1->userdata != NULL && sig2->userdata != NULL && @@ -116,51 +113,88 @@ glade_signal_clone (const GladeSignal *signal) return glade_signal_new (signal->name, signal->handler, signal->userdata, - signal->lookup, signal->after); + } /** * glade_signal_write: - * @info: - * @signal: - * @interface: + * @signal: The #GladeSignal + * @context: A #GladeXmlContext + * @node: A #GladeXmlNode * - * Returns: TRUE if succeed + * Writes @signal to @node */ -gboolean -glade_signal_write (GladeSignalInfo *info, GladeSignal *signal, - GladeInterface *interface) +void +glade_signal_write (GladeSignal *signal, + GladeXmlContext *context, + GladeXmlNode *node) { - info->name = glade_xml_alloc_string(interface, signal->name); - glade_util_replace (info->name, '-', '_'); - info->handler = glade_xml_alloc_string(interface, signal->handler); - info->object = - signal->userdata ? - glade_xml_alloc_string(interface, signal->userdata) : NULL; - info->after = signal->after; - info->lookup = signal->lookup; + GladeXmlNode *signal_node; + gchar *name; + + if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET)) + return; + + name = g_strdup (signal->name); + glade_util_replace (name, '-', '_'); + + /* Now dump the node values... */ + signal_node = glade_xml_node_new (context, GLADE_XML_TAG_SIGNAL); + glade_xml_node_append_child (node, signal_node); + + glade_xml_node_set_property_string (signal_node, GLADE_XML_TAG_NAME, name); + glade_xml_node_set_property_string (signal_node, GLADE_XML_TAG_HANDLER, signal->handler); + + if (signal->userdata) + glade_xml_node_set_property_string (signal_node, + GLADE_XML_TAG_OBJECT, + signal->userdata); + + if (signal->after) + glade_xml_node_set_property_string (signal_node, + GLADE_XML_TAG_AFTER, + GLADE_XML_TAG_SIGNAL_TRUE); + + g_free (name); return TRUE; } -/* - * Returns a new GladeSignal with the attributes defined in node + +/** + * glade_signal_read: + * @node: The #GladeXmlNode to read + * + * Reads and creates a ner #GladeSignal based on @node + * + * Returns: A newly created #GladeSignal */ -GladeSignal *glade_signal_new_from_signal_info (GladeSignalInfo *info) +GladeSignal * +glade_signal_read (GladeXmlNode *node) { GladeSignal *signal; + gchar *name, *handler; - g_return_val_if_fail (info != NULL, NULL); + g_return_val_if_fail (glade_xml_node_verify_silent + (node, GLADE_XML_TAG_SIGNAL), NULL); - signal = g_new0 (GladeSignal, 1); - signal->name = g_strdup (info->name); - glade_util_replace (signal->name, '_', '-'); - signal->handler = g_strdup (info->handler); - signal->after = info->after; - signal->userdata = g_strdup (info->object); + if (!(name = + glade_xml_get_property_string_required (node, GLADE_XML_TAG_NAME, NULL))) + return NULL; + glade_util_replace (name, '_', '-'); - if (!signal->name) + if (!(handler = + glade_xml_get_property_string_required (node, GLADE_XML_TAG_HANDLER, NULL))) + { + g_free (name); return NULL; + } + + signal = g_new0 (GladeSignal, 1); + signal->name = name; + signal->handler = handler; + signal->after = glade_xml_get_property_boolean (node, GLADE_XML_TAG_AFTER, FALSE); + signal->userdata = glade_xml_get_property_string (node, GLADE_XML_TAG_OBJECT); return signal; } diff --git a/gladeui/glade-signal.h b/gladeui/glade-signal.h index 0c2ff3ac..1bb8871c 100644 --- a/gladeui/glade-signal.h +++ b/gladeui/glade-signal.h @@ -2,7 +2,7 @@ #ifndef __GLADE_SIGNAL_H__ #define __GLADE_SIGNAL_H__ -#include "glade-parser.h" +#include <glib.h> G_BEGIN_DECLS @@ -17,9 +17,6 @@ struct _GladeSignal gchar *name; /* Signal name eg "clicked" */ gchar *handler; /* Handler function eg "gtk_main_quit" */ gchar *userdata; /* User data signal handler argument */ - gboolean lookup; /* Whether user_data should be looked up - * with the GModule interface by libglade. - */ gboolean after; /* Connect after TRUE or FALSE */ }; @@ -27,18 +24,16 @@ struct _GladeSignal GladeSignal *glade_signal_new (const gchar *name, const gchar *handler, const gchar *userdata, - gboolean lookup, gboolean after); GladeSignal *glade_signal_clone (const GladeSignal *signal); void glade_signal_free (GladeSignal *signal); gboolean glade_signal_equal (GladeSignal *sig1, GladeSignal *sig2); -gboolean glade_signal_write (GladeSignalInfo *info, GladeSignal *signal, - GladeInterface *interface); - -GladeSignal *glade_signal_new_from_signal_info (GladeSignalInfo *info); - +GladeSignal *glade_signal_read (GladeXmlNode *node); +void glade_signal_write (GladeSignal *signal, + GladeXmlContext *context, + GladeXmlNode *node); G_END_DECLS diff --git a/gladeui/glade-utils.c b/gladeui/glade-utils.c index 69d40b53..0a2eec68 100644 --- a/gladeui/glade-utils.c +++ b/gladeui/glade-utils.c @@ -569,15 +569,6 @@ glade_util_read_prop_name (const gchar *str) glade_util_replace (id, '_', '-'); - if (strstr (id, "::")) - { - /* Extract the second half of "AtkObject::accessible_name" - */ - gchar **split = g_strsplit (id, "::", 0); - g_free (id); - id = g_strdup (split[1]); - g_strfreev (split); - } return id; } diff --git a/gladeui/glade-widget-adaptor.c b/gladeui/glade-widget-adaptor.c index a4035df3..51dff531 100644 --- a/gladeui/glade-widget-adaptor.c +++ b/gladeui/glade-widget-adaptor.c @@ -73,6 +73,13 @@ struct _GladeChildPacking { GList *packing_defaults; }; + +struct _GladePackingDefault { + gchar *id; + gchar *value; +}; + + enum { PROP_0, PROP_NAME, @@ -86,7 +93,8 @@ enum { PROP_CURSOR }; -typedef struct _GladeChildPacking GladeChildPacking; +typedef struct _GladeChildPacking GladeChildPacking; +typedef struct _GladePackingDefault GladePackingDefault; static GObjectClass *parent_class = NULL; static GHashTable *adaptor_hash = NULL; @@ -126,11 +134,10 @@ gwa_properties_set_weight (GList **properties, GType parent) for (l = *properties; l && l->data; l = g_list_next (l)) { GladePropertyClass *klass = l->data; - GPCType type = klass->type; if (klass->visible && (parent) ? parent == klass->pspec->owner_type : TRUE && - (type == GPC_NORMAL || type == GPC_ACCEL_PROPERTY)) + !klass->atk) { /* Use a different counter for each tab (common, packing and normal) */ if (klass->common) common++; @@ -395,9 +402,6 @@ gwa_setup_introspected_props_from_pspecs (GladeWidgetAdaptor *adaptor, g_list_reverse (list)); } -/* XXX Atk relations and accel props disregarded - they should - * be implemented from the gtk+ catalog instead I think. - */ static void gwa_setup_properties (GladeWidgetAdaptor *adaptor, GObjectClass *object_class, @@ -750,6 +754,175 @@ glade_widget_adaptor_object_child_action_activate (GladeWidgetAdaptor *adaptor, adaptor->name, action_id); } +static void +glade_widget_adaptor_object_read_widget (GladeWidgetAdaptor *adaptor, + GladeWidget *widget, + GladeXmlNode *node) +{ + GladeXmlNode *sig_node; + GList *props; + GladeSignal *signal; + + /* Read in the properties */ + for (props = widget->properties; + props; props = props->next) + { + GladeProperty *property = props->data; + glade_property_read + (property, widget->project, node); + } + + /* Read in the signals */ + for (sig_node = glade_xml_node_get_children (node); + sig_node; sig_node = glade_xml_node_next (sig_node)) + { + if (!glade_xml_node_verify_silent (sig_node, GLADE_XML_TAG_SIGNAL)) + continue; + + if (!(signal = glade_signal_read (sig_node))) + continue; + + glade_widget_add_signal_handler (widget, signal); + } +} + +typedef struct { + GladeXmlContext *context; + GladeXmlNode *node; +} WriteSignalsInfo; + + +static void +glade_widget_adaptor_write_signals (gpointer key, + gpointer value, + gpointer user_data) +{ + WriteSignalsInfo *info; + GPtrArray *signals; + guint i; + + info = (WriteSignalsInfo *) user_data; + signals = (GPtrArray *) value; + for (i = 0; i < signals->len; i++) + { + GladeSignal *signal = g_ptr_array_index (signals, i); + glade_signal_write (signal, + info->context, + info->node); + } +} + +static void +glade_widget_adaptor_object_write_widget (GladeWidgetAdaptor *adaptor, + GladeWidget *widget, + GladeXmlContext *context, + GladeXmlNode *node) +{ + GList *props; + WriteSignalsInfo info = { context, node }; + + /* Write the properties */ + for (props = widget->properties; + props; props = props->next) + glade_property_write (GLADE_PROPERTY (props->data), context, node); + + /* Write the signals */ + g_hash_table_foreach (widget->signals, + glade_widget_adaptor_write_signals, + &info); +} + +static GType +glade_widget_adaptor_get_eprop_type (GParamSpec *pspec) +{ + GType type = 0; + + if (pspec->value_type == GLADE_TYPE_STOCK || + G_IS_PARAM_SPEC_ENUM(pspec)) + type = GLADE_TYPE_EPROP_ENUM; + else if (G_IS_PARAM_SPEC_FLAGS(pspec)) + type = GLADE_TYPE_EPROP_FLAGS; + else if (G_IS_PARAM_SPEC_VALUE_ARRAY (pspec)) + { + if (pspec->value_type == G_TYPE_VALUE_ARRAY) + type = GLADE_TYPE_EPROP_TEXT; + } + else if (G_IS_PARAM_SPEC_BOXED(pspec)) + { + if (pspec->value_type == GDK_TYPE_COLOR) + type = GLADE_TYPE_EPROP_COLOR; + else if (pspec->value_type == G_TYPE_STRV) + type = GLADE_TYPE_EPROP_TEXT; + } + else if (G_IS_PARAM_SPEC_STRING(pspec)) + type = GLADE_TYPE_EPROP_TEXT; + else if (G_IS_PARAM_SPEC_BOOLEAN(pspec)) + type = GLADE_TYPE_EPROP_BOOL; + else if (G_IS_PARAM_SPEC_FLOAT(pspec) || + G_IS_PARAM_SPEC_DOUBLE(pspec) || + G_IS_PARAM_SPEC_INT(pspec) || + G_IS_PARAM_SPEC_UINT(pspec) || + G_IS_PARAM_SPEC_LONG(pspec) || + G_IS_PARAM_SPEC_ULONG(pspec) || + G_IS_PARAM_SPEC_INT64(pspec) || + G_IS_PARAM_SPEC_UINT64(pspec)) + type = GLADE_TYPE_EPROP_NUMERIC; + else if (G_IS_PARAM_SPEC_UNICHAR(pspec)) + type = GLADE_TYPE_EPROP_UNICHAR; + else if (G_IS_PARAM_SPEC_OBJECT(pspec)) + { + if (pspec->value_type == GDK_TYPE_PIXBUF) + type = GLADE_TYPE_EPROP_RESOURCE; + else if (pspec->value_type == GTK_TYPE_ADJUSTMENT) + type = GLADE_TYPE_EPROP_ADJUSTMENT; + else + type = GLADE_TYPE_EPROP_OBJECT; + } + else if (GLADE_IS_PARAM_SPEC_OBJECTS(pspec)) + type = GLADE_TYPE_EPROP_OBJECTS; + + return type; +} + +static GladeEditorProperty * +glade_widget_adaptor_object_create_eprop (GladeWidgetAdaptor *adaptor, + GladePropertyClass *klass, + gboolean use_command) +{ + GladeEditorProperty *eprop; + GType type = 0; + + /* Find the right type of GladeEditorProperty for this + * GladePropertyClass. + */ + if ((type = glade_widget_adaptor_get_eprop_type (klass->pspec)) == 0) + return NULL; + + /* special case for resource specs which are hand specified in the catalog. */ + if (klass->resource) + type = GLADE_TYPE_EPROP_RESOURCE; + + /* special case for string specs that denote themed application icons. */ + if (klass->themed_icon) + type = GLADE_TYPE_EPROP_NAMED_ICON; + + /* Create and return the correct type of GladeEditorProperty */ + eprop = g_object_new (type, + "property-class", klass, + "use-command", use_command, + NULL); + + return eprop; +} + +static gchar * +glade_widget_adaptor_object_string_from_value (GladeWidgetAdaptor *adaptor, + GladePropertyClass *klass, + const GValue *value) +{ + return glade_property_class_make_string_from_gvalue (klass, value); +} + /******************************************************************************* GladeWidgetAdaptor type registration and class initializer *******************************************************************************/ @@ -789,6 +962,12 @@ glade_widget_adaptor_class_init (GladeWidgetAdaptorClass *adaptor_class) adaptor_class->child_get_property = NULL; adaptor_class->action_activate = glade_widget_adaptor_object_action_activate; adaptor_class->child_action_activate= glade_widget_adaptor_object_child_action_activate; + adaptor_class->read_widget = glade_widget_adaptor_object_read_widget; + adaptor_class->write_widget = glade_widget_adaptor_object_write_widget; + adaptor_class->create_eprop = glade_widget_adaptor_object_create_eprop; + adaptor_class->string_from_value = glade_widget_adaptor_object_string_from_value; + + /* Base defaults here */ adaptor_class->fixed = FALSE; @@ -1029,6 +1208,27 @@ gwa_extend_with_node_load_sym (GladeWidgetAdaptorClass *klass, GLADE_TAG_CHILD_ACTION_ACTIVATE_FUNCTION, &symbol)) klass->child_action_activate = symbol; + + if (glade_xml_load_sym_from_node (node, module, + GLADE_TAG_READ_WIDGET_FUNCTION, + &symbol)) + klass->read_widget = symbol; + + if (glade_xml_load_sym_from_node (node, module, + GLADE_TAG_WRITE_WIDGET_FUNCTION, + &symbol)) + klass->write_widget = symbol; + + if (glade_xml_load_sym_from_node (node, module, + GLADE_TAG_CREATE_EPROP_FUNCTION, + &symbol)) + klass->create_eprop = symbol; + + if (glade_xml_load_sym_from_node (node, module, + GLADE_TAG_STRING_FROM_VALUE_FUNCTION, + &symbol)) + klass->string_from_value = symbol; + } static void @@ -2777,3 +2977,108 @@ glade_widget_adaptor_child_action_activate (GladeWidgetAdaptor *adaptor, GLADE_WIDGET_ADAPTOR_GET_CLASS (adaptor)->child_action_activate (adaptor, container, object, action_path); } + + + +/** + * glade_widget_adaptor_read_widget: + * @adaptor: A #GladeWidgetAdaptor + * @widget: The #GladeWidget + * @node: The #GladeXmlNode + * + * This function is called to update @widget from @node + * when loading xml files. + */ +void +glade_widget_adaptor_read_widget (GladeWidgetAdaptor *adaptor, + GladeWidget *widget, + GladeXmlNode *node) +{ + g_return_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor)); + g_return_if_fail (GLADE_IS_WIDGET (widget)); + g_return_if_fail (node != NULL); + + GLADE_WIDGET_ADAPTOR_GET_CLASS (adaptor)->read_widget (adaptor, widget, node); +} + + +/** + * glade_widget_adaptor_write_widget: + * @adaptor: A #GladeWidgetAdaptor + * @widget: The #GladeWidget + * @context: The #GladeXmlContext + * @node: The #GladeXmlNode + * + * This function is called to update @widget from @node + * when loading xml files. + */ +void +glade_widget_adaptor_write_widget (GladeWidgetAdaptor *adaptor, + GladeWidget *widget, + GladeXmlContext *context, + GladeXmlNode *node) +{ + g_return_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor)); + g_return_if_fail (GLADE_IS_WIDGET (widget)); + g_return_if_fail (node != NULL); + + GLADE_WIDGET_ADAPTOR_GET_CLASS (adaptor)->write_widget (adaptor, widget, + context, node); +} + + +/** + * glade_widget_adaptor_create_eprop: + * @adaptor: A #GladeWidgetAdaptor + * @klass: The #GladePropertyClass to be edited + * @use_command: whether to use the GladeCommand interface + * to commit property changes + * + * Creates a GladeEditorProperty to edit @klass + * + * Returns: A newly created #GladeEditorProperty + */ +GladeEditorProperty * +glade_widget_adaptor_create_eprop (GladeWidgetAdaptor *adaptor, + GladePropertyClass *klass, + gboolean use_command) +{ + GladeEditorProperty *eprop; + g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL); + g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (klass), NULL); + + eprop = GLADE_WIDGET_ADAPTOR_GET_CLASS + (adaptor)->create_eprop (adaptor, klass, use_command); + + /* XXX we really need to print a g_error() here, exept we are + * now using this func to test for unsupported properties + * at init time from glade-property-class */ + + return eprop; +} + + +/** + * glade_widget_adaptor_string_from_value: + * @adaptor: A #GladeWidgetAdaptor + * @klass: The #GladePropertyClass + * @value: The #GValue to convert to a string + * + * For normal properties this is used to serialize + * property values, for custom properties its still + * needed to update the UI for undo/redo items etc. + * + * Returns: A newly allocated string representation of @value + */ +gchar * +glade_widget_adaptor_string_from_value (GladeWidgetAdaptor *adaptor, + GladePropertyClass *klass, + const GValue *value) +{ + g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL); + g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (klass), NULL); + g_return_val_if_fail (value != NULL, NULL); + + return GLADE_WIDGET_ADAPTOR_GET_CLASS + (adaptor)->string_from_value (adaptor, klass, value); +} diff --git a/gladeui/glade-widget-adaptor.h b/gladeui/glade-widget-adaptor.h index c1701cec..0bfdfee2 100644 --- a/gladeui/glade-widget-adaptor.h +++ b/gladeui/glade-widget-adaptor.h @@ -4,6 +4,7 @@ #include <gladeui/glade-xml-utils.h> #include <gladeui/glade-property-class.h> +#include <gladeui/glade-editor-property.h> #include <glib-object.h> #include <gmodule.h> #include <gtk/gtk.h> @@ -237,9 +238,10 @@ typedef gboolean (* GladeChildVerifyPropertyFunc) (GladeWidgetAdaptor *adaptor, /** * GladeGetChildrenFunc: * @container: A #GObject container - * @Returns: A #GList of #GObject children. * * A function called to get @containers children. + * + * Returns: A #GList of #GObject children. */ typedef GList *(* GladeGetChildrenFunc) (GladeWidgetAdaptor *adaptor, GObject *container); @@ -297,6 +299,8 @@ typedef void (* GladePostCreateFunc) (GladeWidgetAdaptor *adaptor, * @name: A string identifier * * Called to lookup @child in composite object @parent by @name. + * + * Returns: The specified internal widget. */ typedef GObject *(* GladeGetInternalFunc) (GladeWidgetAdaptor *adaptor, GObject *parent, @@ -330,6 +334,66 @@ typedef void (* GladeChildActionActivateFunc) (GladeWidgetAdaptor *adaptor, GObject *object, const gchar *action_path); +/** + * GladeReadWidgetFunc: + * @adaptor: A #GladeWidgetAdaptor + * @widget: The #GladeWidget + * @node: The #GladeXmlNode + * + * This function is called to update @widget from @node. + * + */ +typedef void (* GladeReadWidgetFunc) (GladeWidgetAdaptor *adaptor, + GladeWidget *widget, + GladeXmlNode *node); + +/** + * GladeWriteWidgetFunc: + * @adaptor: A #GladeWidgetAdaptor + * @widget: The #GladeWidget + * @node: The #GladeXmlNode + * + * This function is called to fill in @node from @widget. + * + */ +typedef void (* GladeWriteWidgetFunc) (GladeWidgetAdaptor *adaptor, + GladeWidget *widget, + GladeXmlContext *context, + GladeXmlNode *node); + + +/** + * GladeCreateEPropFunc: + * @adaptor: A #GladeWidgetAdaptor + * @klass: The #GladePropertyClass to be edited + * @use_command: whether to use the GladeCommand interface + * to commit property changes + * + * Creates a GladeEditorProperty to edit @klass + * + * Returns: A newly created #GladeEditorProperty + */ +typedef GladeEditorProperty *(* GladeCreateEPropFunc) (GladeWidgetAdaptor *adaptor, + GladePropertyClass *klass, + gboolean use_command); + +/** + * GladeStringFromValueFunc: + * @adaptor: A #GladeWidgetAdaptor + * @klass: The #GladePropertyClass + * @value: The #GValue to convert to a string + * + * For normal properties this is used to serialize + * property values, for custom properties its still + * needed to update the UI for undo/redo items etc. + * + * Returns: A newly allocated string representation of @value + */ +typedef gchar *(* GladeStringFromValueFunc) (GladeWidgetAdaptor *adaptor, + GladePropertyClass *klass, + const GValue *value); + + /* GladeSignalClass contains all the info we need for a given signal, such as * the signal name, and maybe more in the future */ @@ -472,6 +536,15 @@ struct _GladeWidgetAdaptorClass GladeActionActivateFunc action_activate; /* This method is used to catch actions */ GladeChildActionActivateFunc child_action_activate; /* This method is used to catch packing actions */ + + + GladeReadWidgetFunc read_widget; /* Reads widget attributes from xml */ + + GladeWriteWidgetFunc write_widget; /* Writes widget attributes to the xml */ + + GladeCreateEPropFunc create_eprop; /* Creates a GladeEditorProperty */ + + GladeStringFromValueFunc string_from_value; /* Creates a string for a value */ }; #define glade_widget_adaptor_create_widget(adaptor, query, ...) \ @@ -622,6 +695,24 @@ void glade_widget_adaptor_child_action_activate (GladeWidgetAdap GObject *container, GObject *object, const gchar *action_path); + +void glade_widget_adaptor_read_widget (GladeWidgetAdaptor *adaptor, + GladeWidget *widget, + GladeXmlNode *node); + +void glade_widget_adaptor_write_widget (GladeWidgetAdaptor *adaptor, + GladeWidget *widget, + GladeXmlContext *context, + GladeXmlNode *node); + +GladeEditorProperty *glade_widget_adaptor_create_eprop (GladeWidgetAdaptor *adaptor, + GladePropertyClass *klass, + gboolean use_command); + +gchar *glade_widget_adaptor_string_from_value (GladeWidgetAdaptor *adaptor, + GladePropertyClass *klass, + const GValue *value); + G_END_DECLS #endif /* __GLADE_WIDGET_ADAPTOR_H__ */ diff --git a/gladeui/glade-widget.c b/gladeui/glade-widget.c index bddbb7f6..7f9b2c6e 100644 --- a/gladeui/glade-widget.c +++ b/gladeui/glade-widget.c @@ -62,17 +62,6 @@ static void glade_widget_set_adaptor (GladeWidget *w GladeWidgetAdaptor *adaptor); static void glade_widget_set_properties (GladeWidget *widget, GList *properties); -static GParameter *glade_widget_info_params (GladeWidgetAdaptor *adaptor, - GladeWidgetInfo *info, - gboolean construct, - guint *n_params); -static void glade_widget_fill_from_widget_info (GladeWidgetInfo *info, - GladeWidget *widget, - gboolean apply_props); -static GladeWidget *glade_widget_new_from_widget_info (GladeWidgetInfo *info, - GladeProject *project, - GladeWidget *parent); - static gboolean glade_window_is_embedded (GtkWindow *window); static gboolean glade_widget_embed (GladeWidget *widget); @@ -100,18 +89,12 @@ enum PROP_PARENT, PROP_INTERNAL_NAME, PROP_TEMPLATE, - PROP_INFO, PROP_REASON, PROP_TOPLEVEL_WIDTH, PROP_TOPLEVEL_HEIGHT }; static guint glade_widget_signals[LAST_SIGNAL] = {0}; - -/* Sometimes we need to use the project deep in the loading code, - * this is just a shortcut way to get the project. - */ -static GladeProject *loading_project = NULL; static GQuark glade_widget_name_quark = 0; @@ -300,7 +283,6 @@ glade_widget_change_signal_handler_impl (GladeWidget *widget, g_strdup (new_signal_handler->userdata); tmp_signal_handler->after = new_signal_handler->after; - tmp_signal_handler->lookup = new_signal_handler->lookup; break; } } @@ -519,7 +501,7 @@ free_params (GParameter *params, guint n_params) } static GObject * -glade_widget_build_object (GladeWidgetAdaptor *adaptor, GladeWidget *widget, GladeWidgetInfo *info) +glade_widget_build_object (GladeWidgetAdaptor *adaptor, GladeWidget *widget, void /* GladeWidgetInfo */ *info) { GParameter *params; GObject *object; @@ -527,8 +509,8 @@ glade_widget_build_object (GladeWidgetAdaptor *adaptor, GladeWidget *widget, Gla if (widget) params = glade_widget_template_params (widget, TRUE, &n_params); - else if (info) - params = glade_widget_info_params (adaptor, info, TRUE, &n_params); +/* else if (info) */ +/* params = glade_widget_info_params (adaptor, info, TRUE, &n_params); */ else params = glade_widget_adaptor_default_params (adaptor, TRUE, &n_params); @@ -540,8 +522,8 @@ glade_widget_build_object (GladeWidgetAdaptor *adaptor, GladeWidget *widget, Gla if (widget) params = glade_widget_template_params (widget, FALSE, &n_params); - else if (info) - params = glade_widget_info_params (adaptor, info, FALSE, &n_params); +/* else if (info) */ +/* params = glade_widget_info_params (adaptor, info, FALSE, &n_params); */ else params = glade_widget_adaptor_default_params (adaptor, FALSE, &n_params); @@ -715,7 +697,7 @@ glade_widget_constructor (GType type, { object = glade_widget_build_object(gwidget->adaptor, gwidget->construct_template, - gwidget->construct_info); + NULL/* gwidget->construct_info */); glade_widget_set_object (gwidget, object); } @@ -863,9 +845,6 @@ glade_widget_set_real_property (GObject *object, case PROP_TEMPLATE: widget->construct_template = g_value_get_object (value); break; - case PROP_INFO: - widget->construct_info = g_value_get_pointer (value); - break; case PROP_REASON: widget->construct_reason = g_value_get_int (value); break; @@ -1077,12 +1056,6 @@ glade_widget_class_init (GladeWidgetClass *klass) G_PARAM_CONSTRUCT_ONLY|G_PARAM_WRITABLE)); g_object_class_install_property - (object_class, PROP_INFO, - g_param_spec_pointer ("info", _("Info"), - _("A GladeWidgetInfo struct to base a new widget on"), - G_PARAM_CONSTRUCT_ONLY|G_PARAM_WRITABLE)); - - g_object_class_install_property (object_class, PROP_REASON, g_param_spec_int ("reason", _("Reason"), _("A GladeCreateReason for this creation"), @@ -1786,301 +1759,6 @@ glade_widget_create_packing_properties (GladeWidget *container, GladeWidget *wid } /******************************************************************************* - GladeInterface Parsing code - *******************************************************************************/ -static gint -glade_widget_set_child_type_from_child_info (GladeChildInfo *child_info, - GladeWidgetAdaptor *parent_adaptor, - GObject *child) -{ - guint i; - GladePropInfo *prop_info; - gchar *special_child_type; - - g_object_get (parent_adaptor, "special-child-type", &special_child_type, NULL); - - if (!special_child_type) - return -1; - - for (i = 0; i < child_info->n_properties; ++i) - { - prop_info = child_info->properties + i; - if (!strcmp (prop_info->name, special_child_type)) - { - g_free (special_child_type); - - g_object_set_data_full (child, - "special-child-type", - g_strdup (prop_info->value), - g_free); - return i; - } - } - g_free (special_child_type); - return -1; -} - -static gboolean -glade_widget_new_child_from_child_info (GladeChildInfo *info, - GladeProject *project, - GladeWidget *parent) -{ - GladeWidget *child; - GList *list; - - g_return_val_if_fail (info != NULL, FALSE); - g_return_val_if_fail (project != NULL, FALSE); - - /* is it a placeholder? */ - if (!info->child) - { - GObject *palaceholder = G_OBJECT (glade_placeholder_new ()); - glade_widget_set_child_type_from_child_info - (info, parent->adaptor, palaceholder); - glade_widget_adaptor_add (parent->adaptor, - parent->object, - palaceholder); - return TRUE; - } - - /* is it an internal child? */ - if (info->internal_child) - { - GObject *child_object = - glade_widget_get_internal_child (parent, info->internal_child); - - if (!child_object) - { - g_warning ("Failed to locate internal child %s of %s", - info->internal_child, glade_widget_get_name (parent)); - return FALSE; - } - - if ((child = glade_widget_get_from_gobject (child_object)) == NULL) - g_error ("Unable to get GladeWidget for internal child %s\n", - info->internal_child); - - /* Apply internal widget name from here */ - glade_widget_set_name (child, info->child->name); - glade_widget_fill_from_widget_info (info->child, child, TRUE); - glade_widget_sync_custom_props (child); - } - else - { - child = glade_widget_new_from_widget_info (info->child, project, parent); - if (!child) - return FALSE; - - child->parent = parent; - - glade_widget_set_child_type_from_child_info - (info, parent->adaptor, child->object); - - glade_widget_add_child (parent, child, FALSE); - - glade_widget_sync_packing_props (child); - } - - /* Get the packing properties */ - for (list = child->packing_properties; list; list = list->next) - { - GladeProperty *property = list->data; - glade_property_read (property, property->klass, - loading_project, info, TRUE); - } - return TRUE; -} - -static void -glade_widget_fill_from_widget_info (GladeWidgetInfo *info, - GladeWidget *widget, - gboolean apply_props) -{ - GladeProperty *property; - GList *list; - guint i; - - g_return_if_fail (GLADE_IS_WIDGET (widget)); - g_return_if_fail (info != NULL); - - g_assert (strcmp (info->classname, widget->adaptor->name) == 0); - - /* Children */ - for (i = 0; i < info->n_children; ++i) - { - if (!glade_widget_new_child_from_child_info (info->children + i, - widget->project, widget)) - { - g_warning ("Failed to read child of %s", - glade_widget_get_name (widget)); - continue; - } - } - - /* Signals */ - for (i = 0; i < info->n_signals; ++i) - { - GladeSignal *signal; - - signal = glade_signal_new_from_signal_info (info->signals + i); - if (!signal) - { - g_warning ("Failed to read signal"); - continue; - } - glade_widget_add_signal_handler (widget, signal); - } - - /* Properties */ - if (apply_props) - { - for (list = widget->properties; list; list = list->next) - { - property = list->data; - glade_property_read (property, property->klass, - loading_project, info, TRUE); - } - } -} - - - -static GList * -glade_widget_properties_from_widget_info (GladeWidgetAdaptor *klass, - GladeWidgetInfo *info) -{ - GList *properties = NULL, *list; - - for (list = klass->properties; list && list->data; list = list->next) - { - GladePropertyClass *pclass = list->data; - GladeProperty *property; - - /* If there is a value in the XML, initialize property with it, - * otherwise initialize property to default. - */ - property = glade_property_new (pclass, NULL, NULL); - - glade_property_original_reset (property); - - glade_property_read (property, property->klass, - loading_project, info, TRUE); - - properties = g_list_prepend (properties, property); - } - - return g_list_reverse (properties); -} - -static GladeWidget * -glade_widget_new_from_widget_info (GladeWidgetInfo *info, - GladeProject *project, - GladeWidget *parent) -{ - GladeWidgetAdaptor *adaptor; - GladeWidget *widget; - GList *properties; - - g_return_val_if_fail (info != NULL, NULL); - g_return_val_if_fail (project != NULL, NULL); - - if ((adaptor = - glade_widget_adaptor_get_by_name (info->classname)) == NULL) - { - g_warning ("Widget class %s unknown.", info->classname); - return NULL; - } - - properties = glade_widget_properties_from_widget_info (adaptor, info); - widget = glade_widget_adaptor_create_widget - (adaptor, FALSE, - "name", info->name, - "parent", parent, - "project", project, - "info", info, - "properties", properties, - "reason", GLADE_CREATE_LOAD, NULL); - - /* create the packing_properties list, without setting them */ - if (parent) - widget->packing_properties = - glade_widget_create_packing_properties (parent, widget); - - /* Load children first */ - glade_widget_fill_from_widget_info (info, widget, FALSE); - - /* Now sync custom props, things like "size" on GtkBox need - * this to be done afterwards. - */ - glade_widget_sync_custom_props (widget); - - return widget; -} - -static GParameter * -glade_widget_info_params (GladeWidgetAdaptor *adaptor, - GladeWidgetInfo *info, - gboolean construct, - guint *n_params) -{ - GladePropertyClass *glade_property_class; - GObjectClass *oclass; - GParamSpec **pspec; - GArray *params; - guint i, n_props; - - oclass = g_type_class_ref (adaptor->type); - pspec = g_object_class_list_properties (oclass, &n_props); - params = g_array_new (FALSE, FALSE, sizeof (GParameter)); - - /* prepare parameters that have glade_property_class->def */ - for (i = 0; i < n_props; i++) - { - GParameter parameter = { 0, }; - GValue *value; - - glade_property_class = - glade_widget_adaptor_get_property_class (adaptor, - pspec[i]->name); - if (glade_property_class == NULL || - glade_property_class->virt || - glade_property_class->ignore) - continue; - - if (construct && - (pspec[i]->flags & - (G_PARAM_CONSTRUCT|G_PARAM_CONSTRUCT_ONLY)) == 0) - continue; - else if (!construct && - (pspec[i]->flags & - (G_PARAM_CONSTRUCT|G_PARAM_CONSTRUCT_ONLY)) != 0) - continue; - - - /* Try filling parameter with value from widget info. - */ - if ((value = glade_property_read (NULL, glade_property_class, - loading_project, info, FALSE)) != NULL) - { - parameter.name = pspec[i]->name; - g_value_init (¶meter.value, pspec[i]->value_type); - - g_value_copy (value, ¶meter.value); - g_value_unset (value); - g_free (value); - - g_array_append_val (params, parameter); - } - } - g_free(pspec); - - g_type_class_unref (oclass); - - *n_params = params->len; - return (GParameter *)g_array_free (params, FALSE); -} - -/******************************************************************************* API *******************************************************************************/ GladeWidget * @@ -2176,7 +1854,7 @@ glade_widget_show (GladeWidget *widget) if (layout && !GTK_WIDGET_REALIZED (layout)) { /* XXX Dangerous !!! give her a little kick */ - g_idle_add (glade_widget_show_idle, widget); + g_idle_add ((GSourceFunc)glade_widget_show_idle, widget); return; } else if (!layout) @@ -3103,9 +2781,9 @@ glade_widget_property_string (GladeWidget *widget, g_return_val_if_fail (id_property != NULL, NULL); if ((property = glade_widget_get_property (widget, id_property)) != NULL) - ret_string = - glade_property_class_make_string_from_gvalue (property->klass, - value ? value : property->value); + ret_string = glade_widget_adaptor_string_from_value + (GLADE_WIDGET_ADAPTOR (property->klass->handle), + property->klass, value ? value : property->value); return ret_string; } @@ -3133,9 +2811,9 @@ glade_widget_pack_property_string (GladeWidget *widget, g_return_val_if_fail (id_property != NULL, NULL); if ((property = glade_widget_get_pack_property (widget, id_property)) != NULL) - ret_string = - glade_property_class_make_string_from_gvalue (property->klass, - value ? value : property->value); + ret_string = glade_widget_adaptor_string_from_value + (GLADE_WIDGET_ADAPTOR (property->klass->handle), + property->klass, value ? value : property->value); return ret_string; } @@ -3608,288 +3286,379 @@ glade_widget_replace (GladeWidget *parent, GObject *old_object, GObject *new_obj GLADE_WIDGET_GET_CLASS (parent)->replace_child (parent, old_object, new_object); } -/* XML Serialization */ -static gboolean -glade_widget_write_child (GArray *children, GladeWidget *parent, GObject *object, GladeInterface *interface); - -typedef struct _WriteSignalsContext -{ - GladeInterface *interface; - GArray *signals; -} WriteSignalsContext; - +/******************************************************************************* + * Xml Parsing code * + *******************************************************************************/ static void -glade_widget_write_signals (gpointer key, gpointer value, gpointer user_data) +glade_widget_set_child_type_from_node (GladeWidgetAdaptor *parent_adaptor, + GObject *child, + GladeXmlNode *node) { - WriteSignalsContext *write_signals_context; - GPtrArray *signals; - guint i; + GladeXmlNode *packing_node, *prop; + gchar *special_child_type, *name, *value; - write_signals_context = (WriteSignalsContext *) user_data; - signals = (GPtrArray *) value; - for (i = 0; i < signals->len; i++) + if (!glade_xml_node_verify (node, GLADE_XML_TAG_CHILD)) + return; + + g_object_get (parent_adaptor, "special-child-type", &special_child_type, NULL); + if (!special_child_type) + return; + + if ((packing_node = + glade_xml_search_child (node, GLADE_XML_TAG_PACKING)) != NULL) + { + for (prop = glade_xml_node_get_children (packing_node); + prop; prop = glade_xml_node_next (prop)) + { + if (!(name = + glade_xml_get_property_string_required (prop, + GLADE_XML_TAG_NAME, + NULL))) + continue; + + if (!(value = glade_xml_get_content (prop))) + { + /* XXX should be glade_xml_get_content_required()... */ + g_free (name); + continue; + } + + if (!strcmp (name, special_child_type)) + { + g_object_set_data_full (child, + "special-child-type", + g_strdup (value), + g_free); + g_free (name); + g_free (value); + break; + } + g_free (name); + g_free (value); + } + } + g_free (special_child_type); +} + +static void +glade_widget_read_children (GladeWidget *widget, + GladeXmlNode *node) +{ + GladeXmlNode *child, *widget_node, *packing_node; + GladeWidget *child_widget; + GList *packing; + /* + * Deal with children... + */ + for (child = glade_xml_node_get_children (node); + child; child = glade_xml_node_next (child)) { - GladeSignal *signal = g_ptr_array_index (signals, i); - GladeSignalInfo signalinfo; + const gchar *node_name = glade_xml_node_get_name (child); + gchar *internal_name; + + if (strcmp (node_name, GLADE_XML_TAG_CHILD) != 0) + continue; + + internal_name = + glade_xml_get_property_string + (child, GLADE_XML_TAG_INTERNAL_CHILD); + + if ((widget_node = + glade_xml_search_child + (child, GLADE_XML_TAG_WIDGET)) != NULL) + { + child_widget = + glade_widget_read (widget->project, + widget, + widget_node, + internal_name); - glade_signal_write (&signalinfo, signal, - write_signals_context->interface); - g_array_append_val (write_signals_context->signals, - signalinfo); + if (child_widget) + { + if (!internal_name) { + glade_widget_set_child_type_from_node + (widget->adaptor, + child_widget->object, child); + glade_widget_add_child (widget, child_widget, FALSE); + } + + if ((packing_node = + glade_xml_search_child + (child, GLADE_XML_TAG_PACKING)) != NULL) + { + + /* Get the packing properties */ + for (packing = child_widget->packing_properties; + packing; packing = packing->next) + { + GladeProperty *property = packing->data; + glade_property_read (property, + child_widget->project, + packing_node); + } + } + } + + } else { + GObject *palaceholder = + G_OBJECT (glade_placeholder_new ()); + + glade_widget_set_child_type_from_node (widget->adaptor, + palaceholder, + child); + + glade_widget_adaptor_add (widget->adaptor, + widget->object, + palaceholder); + + } + g_free (internal_name); } } + /** - * glade_widget_write: - * @widget: a #GladeWidget - * @interface: a #GladeInterface - * - * TODO: write me + * glade_widget_read: + * @project: a #GladeProject + * @parent: The parent #GladeWidget or %NULL + * @node: a #GladeXmlNode * - * Returns: + * Returns: a new #GladeWidget for @project, based on @node */ -GladeWidgetInfo* -glade_widget_write (GladeWidget *widget, GladeInterface *interface) +GladeWidget * +glade_widget_read (GladeProject *project, + GladeWidget *parent, + GladeXmlNode *node, + const gchar *internal) { - WriteSignalsContext write_signals_context; - GladeWidgetInfo *info; - GArray *props, *atk_props, *atk_actions, *atk_relations, *accels, *children; - GList *list; + GladeWidgetAdaptor *adaptor; + GladeWidget *widget = NULL; + gchar *klass, *id; - g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL); + glade_widget_push_superuser (); - info = g_new0 (GladeWidgetInfo, 1); + if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET)) + return NULL; - info->classname = glade_xml_alloc_string (interface, widget->adaptor->name); - info->name = glade_xml_alloc_string (interface, widget->name); + if ((klass = + glade_xml_get_property_string_required + (node, GLADE_XML_TAG_CLASS, NULL)) != NULL) + { + if ((id = + glade_xml_get_property_string_required + (node, GLADE_XML_TAG_ID, NULL)) != NULL) + { + /* + * Create GladeWidget instance based on type. + */ + if ((adaptor = + glade_widget_adaptor_get_by_name (klass)) != NULL) + { - /* Write the properties */ - props = g_array_new (FALSE, FALSE, sizeof (GladePropInfo)); - atk_props = g_array_new (FALSE, FALSE, sizeof (GladePropInfo)); - atk_relations = g_array_new (FALSE, FALSE, sizeof (GladeAtkRelationInfo)); - atk_actions = g_array_new (FALSE, FALSE, sizeof (GladeAtkActionInfo)); - accels = g_array_new (FALSE, FALSE, sizeof (GladeAccelInfo)); + // Internal children !!! + if (internal) + { + GObject *child_object = + glade_widget_get_internal_child + (parent, internal); + + if (!child_object) + { + g_warning ("Failed to locate " + "internal child %s of %s", + internal, + glade_widget_get_name (parent)); + return FALSE; + } + + if (!(widget = + glade_widget_get_from_gobject (child_object))) + g_error ("Unable to get GladeWidget " + "for internal child %s\n", + internal); + + /* Apply internal widget name from here */ + glade_widget_set_name (widget, id); + } else { + widget = glade_widget_adaptor_create_widget + (adaptor, FALSE, + "name", id, + "parent", parent, + "project", project, + "reason", GLADE_CREATE_LOAD, NULL); + } - for (list = widget->properties; list; list = list->next) - { - GladeProperty *property = list->data; + glade_widget_adaptor_read_widget (adaptor, + widget, + node); - /* This should never happen */ - if (property->klass->packing) - continue; + glade_widget_read_children (widget, node); - switch (property->klass->type) - { - case GPC_NORMAL: - glade_property_write (property, interface, props); - break; - case GPC_ATK_PROPERTY: - glade_property_write (property, interface, atk_props); - break; - case GPC_ATK_RELATION: - glade_property_write (property, interface, atk_relations); - break; - case GPC_ATK_ACTION: - glade_property_write (property, interface, atk_actions); - break; - case GPC_ACCEL_PROPERTY: - glade_property_write (property, interface, accels); - break; - default: - break; + } + g_free (id); } + g_free (klass); } - /* Properties */ - info->properties = (GladePropInfo *) props->data; - info->n_properties = props->len; - g_array_free(props, FALSE); - - /* Atk Properties */ - info->atk_props = (GladePropInfo *) atk_props->data; - info->n_atk_props = atk_props->len; - g_array_free(atk_props, FALSE); - - /* Atk Relations */ - info->relations = (GladeAtkRelationInfo *) atk_relations->data; - info->n_relations = atk_relations->len; - g_array_free(atk_relations, FALSE); - - /* Atk Actions */ - info->atk_actions = (GladeAtkActionInfo *) atk_actions->data; - info->n_atk_actions = atk_actions->len; - g_array_free(atk_actions, FALSE); - - /* Accels */ - info->accels = (GladeAccelInfo *) accels->data; - info->n_accels = accels->len; - g_array_free(accels, FALSE); - - /* Signals */ - write_signals_context.interface = interface; - write_signals_context.signals = g_array_new (FALSE, FALSE, - sizeof (GladeSignalInfo)); - g_hash_table_foreach (widget->signals, - glade_widget_write_signals, - &write_signals_context); - info->signals = (GladeSignalInfo *) - write_signals_context.signals->data; - info->n_signals = write_signals_context.signals->len; - g_array_free (write_signals_context.signals, FALSE); - - /* Children */ - if ((list = - glade_widget_adaptor_get_children (widget->adaptor, - widget->object)) != NULL) - { - children = g_array_new (FALSE, FALSE, sizeof (GladeChildInfo)); - while (list && list->data) - { - GObject *child = list->data; - glade_widget_write_child (children, widget, child, interface); - list = list->next; - } - info->children = (GladeChildInfo *) children->data; - info->n_children = children->len; - - g_array_free (children, FALSE); - g_list_free (list); - } - g_hash_table_insert(interface->names, info->name, info); + glade_widget_pop_superuser (); - return info; + return widget; } - -static gboolean -glade_widget_write_special_child_prop (GArray *props, - GladeWidget *parent, - GObject *object, - GladeInterface *interface) +static void +glade_widget_write_special_child_prop (GladeWidget *parent, + GObject *object, + GladeXmlContext *context, + GladeXmlNode *node) { - GladePropInfo info = { 0 }; - gchar *buff, *special_child_type; + GladeXmlNode *prop_node; + gchar *buff, *special_child_type; buff = g_object_get_data (object, "special-child-type"); - g_object_get (parent->adaptor, "special-child-type", &special_child_type, NULL); if (special_child_type && buff) { - info.name = glade_xml_alloc_propname (interface, - special_child_type); - info.value = glade_xml_alloc_string (interface, buff); - g_array_append_val (props, info); - g_free (special_child_type); - return TRUE; + prop_node = glade_xml_node_new (context, GLADE_XML_TAG_PROPERTY); + glade_xml_node_append_child (node, prop_node); + + /* Name and value */ + glade_xml_node_set_property_string (prop_node, + GLADE_XML_TAG_NAME, + special_child_type); + glade_xml_set_content (prop_node, buff); + } g_free (special_child_type); - return FALSE; } -gboolean -glade_widget_write_child (GArray *children, - GladeWidget *parent, - GObject *object, - GladeInterface *interface) +static void +glade_widget_write_child (GladeWidget *widget, + GladeXmlContext *context, + GladeXmlNode *node) { - GladeChildInfo info = { 0 }; - GladeWidget *child_widget; - GList *list; - GArray *props; + GladeXmlNode *child_node, *packing_node; + GList *props; - if (GLADE_IS_PLACEHOLDER (object)) - { - props = g_array_new (FALSE, FALSE, - sizeof (GladePropInfo)); - /* Here we have to add the "special-child-type" packing property */ - glade_widget_write_special_child_prop (props, parent, - object, interface); + child_node = glade_xml_node_new (context, GLADE_XML_TAG_CHILD); + glade_xml_node_append_child (node, child_node); - info.properties = (GladePropInfo *) props->data; - info.n_properties = props->len; - g_array_free(props, FALSE); + /* Set internal child */ + if (widget->internal) + glade_xml_node_set_property_string (child_node, + GLADE_XML_TAG_INTERNAL_CHILD, + widget->internal); - g_array_append_val (children, info); + /* Write out the widget */ + glade_widget_write (widget, context, child_node); - return TRUE; - } + /* Write out packing properties and special-child-type */ + packing_node = glade_xml_node_new (context, GLADE_XML_TAG_PACKING); + glade_xml_node_append_child (child_node, packing_node); - child_widget = glade_widget_get_from_gobject (object); - if (!child_widget) - return FALSE; - - if (child_widget->internal) - info.internal_child = glade_xml_alloc_string(interface, child_widget->internal); + for (props = widget->packing_properties; + props; props = props->next) + glade_property_write (GLADE_PROPERTY (props->data), + context, packing_node); + + glade_widget_write_special_child_prop (widget->parent, + widget->object, + context, packing_node); - info.child = glade_widget_write (child_widget, interface); - if (!info.child) + + /* Default packing properties and such are not saved, + * so lets check afterwords if there was anything saved + * and then just remove the node. + */ + if (!glade_xml_node_get_children (packing_node)) { - g_warning ("Failed to write child widget"); - return FALSE; + glade_xml_node_remove (packing_node); + glade_xml_node_delete (packing_node); } +} - /* Append the packing properties */ - props = g_array_new (FALSE, FALSE, sizeof (GladePropInfo)); - - /* Here we have to add the "special-child-type" packing property */ - glade_widget_write_special_child_prop (props, parent, - child_widget->object, - interface); +static void +glade_widget_write_placeholder (GladeWidget *parent, + GObject *object, + GladeXmlContext *context, + GladeXmlNode *node) +{ + GladeXmlNode *child_node, *packing_node, *placeholder_node; - if (child_widget->packing_properties != NULL) - { - for (list = child_widget->packing_properties; - list; list = list->next) - { - GladeProperty *property; + child_node = glade_xml_node_new (context, GLADE_XML_TAG_CHILD); + glade_xml_node_append_child (node, child_node); - property = list->data; - g_assert (property->klass->packing != FALSE); - glade_property_write (property, interface, props); - } - } + placeholder_node = glade_xml_node_new (context, GLADE_XML_TAG_PLACEHOLDER); + glade_xml_node_append_child (child_node, placeholder_node); - info.properties = (GladePropInfo *) props->data; - info.n_properties = props->len; - g_array_free(props, FALSE); - - g_array_append_val (children, info); + /* maybe write out special-child-type here */ + packing_node = glade_xml_node_new (context, GLADE_XML_TAG_PACKING); + glade_xml_node_append_child (child_node, packing_node); - return TRUE; + glade_widget_write_special_child_prop (parent, object, + context, packing_node); + + if (!glade_xml_node_get_children (packing_node)) + { + glade_xml_node_remove (packing_node); + glade_xml_node_delete (packing_node); + } } /** - * glade_widget_read: - * @project: a #GladeProject - * @info: a #GladeWidgetInfo + * glade_widget_write: + * @widget: The #GladeWidget + * @context: A #GladeXmlContext + * @node: A #GladeXmlNode * - * Returns: a new #GladeWidget for @project, based on @info + * Recursively writes out @widget and its children + * and appends the created #GladeXmlNode to @node. */ -GladeWidget * -glade_widget_read (GladeProject *project, GladeWidgetInfo *info) +void +glade_widget_write (GladeWidget *widget, + GladeXmlContext *context, + GladeXmlNode *node) { - GladeWidget *widget; + GladeXmlNode *widget_node; + GList *list, *l; - glade_widget_push_superuser (); - loading_project = project; - - if ((widget = glade_widget_new_from_widget_info - (info, project, NULL)) != NULL) - { -#if 0 - if (glade_verbose) - glade_widget_debug (widget); -#endif - } + widget_node = glade_xml_node_new (context, GLADE_XML_TAG_WIDGET); + glade_xml_node_append_child (node, widget_node); - loading_project = NULL; - glade_widget_pop_superuser (); + /* Set class and id */ + glade_xml_node_set_property_string (widget_node, + GLADE_XML_TAG_CLASS, + widget->adaptor->name); + glade_xml_node_set_property_string (widget_node, + GLADE_XML_TAG_ID, + widget->name); + + /* Write out widget content (properties and signals) */ + glade_widget_adaptor_write_widget (widget->adaptor, widget, context, widget_node); + + /* Write out children */ + if ((list = + glade_widget_adaptor_get_children (widget->adaptor, + widget->object)) != NULL) + { + for (l = list; l; l = l->next) + { + GladeWidget *child = glade_widget_get_from_gobject (l->data); + + if (child) + glade_widget_write_child (child, context, widget_node); + else if (GLADE_IS_PLACEHOLDER (l->data)) + glade_widget_write_placeholder (widget, + G_OBJECT (l->data), + context, widget_node); + } + g_list_free (list); + } - return widget; } + static gint glade_widget_su_stack = 0; /** @@ -4282,3 +4051,40 @@ glade_widget_embed (GladeWidget *gwidget) return TRUE; } + + +/** + * glade_widget_create_editor_property: + * @widget: A #GladeWidget + * @property: The widget's property + * @packing: whether @property indicates a packing property or not. + * @use_command: Whether the undo/redo stack applies here. + * + * This is a convenience function to create a GladeEditorProperty corresponding + * to @property + * + * Returns: A newly created and connected GladeEditorProperty + */ +GladeEditorProperty * +glade_widget_create_editor_property (GladeWidget *widget, + const gchar *property, + gboolean packing, + gboolean use_command) +{ + GladeEditorProperty *eprop; + GladeProperty *p; + + if (packing) + p = glade_widget_get_pack_property (widget, property); + else + p = glade_widget_get_property (widget, property); + + g_return_val_if_fail (GLADE_IS_PROPERTY (p), NULL); + + eprop = glade_widget_adaptor_create_eprop (widget->adaptor, + p->klass, + use_command); + glade_editor_property_load (eprop, p); + + return eprop; +} diff --git a/gladeui/glade-widget.h b/gladeui/glade-widget.h index 57b206b4..b872e330 100644 --- a/gladeui/glade-widget.h +++ b/gladeui/glade-widget.h @@ -97,7 +97,6 @@ struct _GladeWidget /* Construct parameters: */ GladeWidget *construct_template; - GladeWidgetInfo *construct_info; GladeCreateReason construct_reason; gchar *construct_internal; }; @@ -135,13 +134,7 @@ void glade_widget_add_child (GladeWidget *p void glade_widget_remove_child (GladeWidget *parent, GladeWidget *child); - -GladeWidgetInfo *glade_widget_write (GladeWidget *widget, - GladeInterface *interface); - -GladeWidget *glade_widget_read (GladeProject *project, - GladeWidgetInfo *info); - + void glade_widget_replace (GladeWidget *parent, GObject *old_object, GObject *new_object); @@ -219,6 +212,20 @@ void glade_widget_remove_pack_action (GladeWidget *widget GtkWidget * glade_widget_create_action_menu (GladeWidget *widget, const gchar *action_path); +void glade_widget_write (GladeWidget *widget, + GladeXmlContext *context, + GladeXmlNode *node); + +GladeWidget *glade_widget_read (GladeProject *project, + GladeWidget *parent, + GladeXmlNode *node, + const gchar *internal); + +GladeEditorProperty *glade_widget_create_editor_property (GladeWidget *widget, + const gchar *property, + gboolean packing, + gboolean use_command); + /******************************************************************************* Project, object property references *******************************************************************************/ diff --git a/gladeui/glade-xml-utils.c b/gladeui/glade-xml-utils.c index cc2f841f..daca97be 100644 --- a/gladeui/glade-xml-utils.c +++ b/gladeui/glade-xml-utils.c @@ -232,7 +232,7 @@ glade_xml_get_value_int_required (GladeXmlNode *node, const gchar *name, gint * ret = glade_xml_get_value_int (node, name, val); if (ret == FALSE) - g_warning ("The file did not contained the required value \"%s\"\n" + g_warning ("The file did not contain the required value \"%s\"\n" "Under the \"%s\" tag.", name, glade_xml_node_get_name (node)); return ret; @@ -425,10 +425,10 @@ glade_xml_get_value_string_required (GladeXmlNode *node_in, if (value == NULL) { if (xtra == NULL) - g_warning ("The file did not contained the required value \"%s\"\n" + g_warning ("The file did not contain the required value \"%s\"\n" "Under the \"%s\" tag.", name, node->name); else - g_warning ("The file did not contained the required value \"%s\"\n" + g_warning ("The file did not contain the required value \"%s\"\n" "Under the \"%s\" tag (%s).", name, node->name, xtra); } @@ -464,10 +464,10 @@ glade_xml_get_property_string_required (GladeXmlNode *node_in, if (value == NULL) { if (xtra == NULL) - g_warning ("The file did not contained the required property \"%s\"\n" + g_warning ("The file did not contain the required property \"%s\"\n" "Under the \"%s\" tag.", name, node->name); else - g_warning ("The file did not contained the required property \"%s\"\n" + g_warning ("The file did not contain the required property \"%s\"\n" "Under the \"%s\" tag (%s).", name, node->name, xtra); } return value; @@ -514,7 +514,7 @@ glade_xml_search_child_required (GladeXmlNode *node, const gchar* name) child = glade_xml_search_child (node, name); if (child == NULL) - g_warning ("The file did not contained the required tag \"%s\"\n" + g_warning ("The file did not contain the required tag \"%s\"\n" "Under the \"%s\" node.", name, glade_xml_node_get_name (node)); return child; @@ -538,7 +538,7 @@ GladeXmlContext * glade_xml_context_new (GladeXmlDoc *doc, const gchar *name_space) { /* We are not using the namespace now */ - return glade_xml_context_new_real (doc, FALSE, NULL); + return glade_xml_context_new_real (doc, TRUE, NULL); } void @@ -579,7 +579,7 @@ glade_xml_context_new_from_path (const gchar *full_path, name_space = xmlSearchNsByHref (doc, doc->children, BAD_CAST(nspace)); if (name_space == NULL && nspace != NULL) { - g_warning ("The file did not contained the expected name space\n" + g_warning ("The file did not contain the expected name space\n" "Expected \"%s\" [%s]", nspace, full_path); xmlFreeDoc (doc); @@ -589,7 +589,7 @@ glade_xml_context_new_from_path (const gchar *full_path, root = xmlDocGetRootElement(doc); if ((root->name == NULL) || (xmlStrcmp (root->name, BAD_CAST(root_name)) !=0 )) { - g_warning ("The file did not contained the expected root name\n" + g_warning ("The file did not contain the expected root name\n" "Expected \"%s\", actual : \"%s\" [%s]", root_name, root->name, full_path); xmlFreeDoc (doc); @@ -630,6 +630,17 @@ glade_xml_node_append_child (GladeXmlNode *node_in, GladeXmlNode *child_in) xmlAddChild (node, child); } +void +glade_xml_node_remove (GladeXmlNode *node_in) +{ + xmlNodePtr node = (xmlNodePtr) node_in; + + g_return_if_fail (node != NULL); + + xmlReplaceNode (node, NULL); +} + + GladeXmlNode * glade_xml_node_new (GladeXmlContext *context, const gchar *name) { @@ -744,39 +755,6 @@ glade_xml_doc_get_root (GladeXmlDoc *doc) return (GladeXmlNode *)node; } -gchar * -glade_xml_alloc_string(GladeInterface *interface, const gchar *string) -{ - gchar *s; - - s = g_hash_table_lookup(interface->strings, string); - if (!s) { - s = g_strdup(string); - g_hash_table_insert(interface->strings, s, s); - } - - return s; -} - -gchar * -glade_xml_alloc_propname(GladeInterface *interface, const gchar *string) -{ - static GString *norm_str; - guint i; - - if (!norm_str) - norm_str = g_string_new_len(NULL, 64); - - /* assign the string to norm_str */ - g_string_assign(norm_str, string); - /* convert all dashes to underscores */ - for (i = 0; i < norm_str->len; i++) - if (norm_str->str[i] == '-') - norm_str->str[i] = '_'; - - return glade_xml_alloc_string(interface, norm_str->str); -} - gboolean glade_xml_load_sym_from_node (GladeXmlNode *node_in, GModule *module, diff --git a/gladeui/glade-xml-utils.h b/gladeui/glade-xml-utils.h index 2ec3b838..92e7eb99 100644 --- a/gladeui/glade-xml-utils.h +++ b/gladeui/glade-xml-utils.h @@ -3,13 +3,18 @@ #ifndef __GLADE_XML_UTILS_H__ #define __GLADE_XML_UTILS_H__ -#include <gladeui/glade-parser.h> +#include <glib.h> +#include <gmodule.h> + G_BEGIN_DECLS #define GLADE_XML_CONTEXT(c) ((GladeXmlContext *)c) #define GLADE_XML_IS_CONTEXT(c) (c != NULL) +#define CAST_BAD (gchar *) + + typedef struct _GladeXmlContext GladeXmlContext; typedef struct _GladeXmlNode GladeXmlNode; typedef struct _GladeXmlDoc GladeXmlDoc; @@ -23,13 +28,15 @@ typedef struct _GladeXmlDoc GladeXmlDoc; #define GLADE_XML_TAG_ID "id" #define GLADE_XML_TAG_SIGNAL "signal" #define GLADE_XML_TAG_HANDLER "handler" +#define GLADE_XML_TAG_AFTER "after" +#define GLADE_XML_TAG_OBJECT "object" #define GLADE_XML_TAG_NAME "name" #define GLADE_XML_TAG_CHILD "child" -#define GLADE_XML_TAG_SIGNAL "signal" -#define GLADE_XML_TAG_AFTER "after" #define GLADE_XML_TAG_PACKING "packing" #define GLADE_XML_TAG_PLACEHOLDER "placeholder" #define GLADE_XML_TAG_INTERNAL_CHILD "internal-child" +#define GLADE_XML_TAG_I18N_TRUE "yes" +#define GLADE_XML_TAG_SIGNAL_TRUE "yes" #define GLADE_TAG_GLADE_CATALOG "glade-catalog" #define GLADE_TAG_GLADE_WIDGET_CLASSES "glade-widget-classes" @@ -58,6 +65,10 @@ typedef struct _GladeXmlDoc GladeXmlDoc; #define GLADE_TAG_CONSTRUCTOR_FUNCTION "constructor-function" #define GLADE_TAG_ACTION_ACTIVATE_FUNCTION "action-activate-function" #define GLADE_TAG_CHILD_ACTION_ACTIVATE_FUNCTION "child-action-activate-function" +#define GLADE_TAG_READ_WIDGET_FUNCTION "read-widget-function" +#define GLADE_TAG_WRITE_WIDGET_FUNCTION "write-widget-function" +#define GLADE_TAG_CREATE_EPROP_FUNCTION "create-editor-property-function" +#define GLADE_TAG_STRING_FROM_VALUE_FUNCTION "string-from-value-function" #define GLADE_TAG_PROPERTIES "properties" #define GLADE_TAG_PACKING_PROPERTIES "packing-properties" #define GLADE_TAG_PROPERTY "property" @@ -86,6 +97,8 @@ typedef struct _GladeXmlDoc GladeXmlDoc; #define GLADE_TAG_KEY "key" #define GLADE_TAG_VALUE "value" #define GLADE_TAG_TRANSLATABLE "translatable" +#define GLADE_TAG_HAS_CONTEXT "context" +#define GLADE_TAG_COMMENT "comments" #define GLADE_TAG_PACKING_DEFAULTS "packing-defaults" #define GLADE_TAG_PARENT_CLASS "parent-class" #define GLADE_TAG_CHILD_PROPERTY "child-property" @@ -100,7 +113,6 @@ typedef struct _GladeXmlDoc GladeXmlDoc; #define GLADE_TAG_RESOURCE "resource" #define GLADE_TAG_THEMED_ICON "themed-icon" #define GLADE_TAG_INIT_FUNCTION "init-function" -#define GLADE_TAG_ATK_ACTION "atk-action" #define GLADE_TAG_ATK_PROPERTY "atk-property" #define GLADE_TAG_FIXED "fixed" #define GLADE_TAG_TRANSFER_ON_PASTE "transfer-on-paste" @@ -162,6 +174,8 @@ gboolean glade_xml_node_verify (GladeXmlNode * node_in, const gchar *name) gboolean glade_xml_node_verify_silent (GladeXmlNode *node_in, const gchar *name); const gchar * glade_xml_node_get_name (GladeXmlNode *node_in); void glade_xml_node_append_child (GladeXmlNode * node, GladeXmlNode * child); +void glade_xml_node_remove (GladeXmlNode *node_in); + /* Document Operatons */ GladeXmlNode * glade_xml_doc_get_root (GladeXmlDoc *doc); @@ -179,9 +193,6 @@ GladeXmlContext * glade_xml_context_new_from_path (const gchar *full_path, const gchar *root_name); GladeXmlDoc * glade_xml_context_get_doc (GladeXmlContext *context); -gchar * glade_xml_alloc_string (GladeInterface *interface, const gchar *string); -gchar * glade_xml_alloc_propname (GladeInterface *interface, const gchar *string); - gboolean glade_xml_load_sym_from_node (GladeXmlNode *node_in, GModule *module, gchar *tagname, |