[glade3] * Made GladeWidgetAdaptor internalize *everything* into a private data structure, 21 files changed
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade3] * Made GladeWidgetAdaptor internalize *everything* into a private data structure, 21 files changed
- Date: Sun, 2 Jan 2011 16:04:32 +0000 (UTC)
commit cc8dfcfc4b31da255bf7e70af57e812066e968ae
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Mon Jan 3 01:11:01 2011 +0900
* Made GladeWidgetAdaptor internalize *everything* into a private data structure,
21 files changed, 694 insertions(+), 670 deletions(-)
ChangeLog | 3 +
gladeui/glade-catalog.c | 5 +-
gladeui/glade-editor-property.c | 12 +-
gladeui/glade-editor-table.c | 10 +-
gladeui/glade-editor.c | 10 +-
gladeui/glade-palette.c | 11 +-
gladeui/glade-placeholder.c | 4 +-
gladeui/glade-popup.c | 54 +--
gladeui/glade-project.c | 14 +-
gladeui/glade-property-class.c | 2 +-
gladeui/glade-signal-editor.c | 8 +-
gladeui/glade-utils.c | 6 +-
gladeui/glade-widget-adaptor.c | 475 ++++++++++++++--------
gladeui/glade-widget-adaptor.h | 624 +++++++++++++----------------
gladeui/glade-widget.c | 80 ++---
plugins/gtk+/glade-accels.c | 23 +-
plugins/gtk+/glade-cell-renderer-editor.c | 5 +-
plugins/gtk+/glade-column-types.c | 5 +-
plugins/gtk+/glade-gtk.c | 7 +-
plugins/gtk+/glade-image-item-editor.c | 2 +-
plugins/gtk+/glade-store-editor.c | 4 +-
21 files changed, 694 insertions(+), 670 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index bf72253..3222a97 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -19,6 +19,9 @@
project when the appropriate data changes (speeds up editing, with latest changes editing labels
in huge projects is smooth).
+ * Made GladeWidgetAdaptor internalize *everything* into a private data structure,
+ 21 files changed, 694 insertions(+), 670 deletions(-)
+
2011-01-01 Tristan Van Berkom <tristanvb openismus com>
* gladeui/glade-command.[ch], Added GladeProject member to base command structure, now
diff --git a/gladeui/glade-catalog.c b/gladeui/glade-catalog.c
index 83e69e1..ba19b2c 100644
--- a/gladeui/glade-catalog.c
+++ b/gladeui/glade-catalog.c
@@ -547,7 +547,7 @@ glade_catalog_load_all (void)
{
GladeWidgetAdaptor *adaptor = l->data;
- if (adaptor->missing_icon)
+ if (glade_widget_adaptor_get_missing_icon (adaptor))
{
if (!icon_warning)
icon_warning = g_string_new ("Glade needs artwork; "
@@ -556,7 +556,8 @@ glade_catalog_load_all (void)
g_string_append_printf (icon_warning,
"\n\t%s\tneeds an icon named '%s'",
- adaptor->name, adaptor->missing_icon);
+ glade_widget_adaptor_get_name (adaptor),
+ glade_widget_adaptor_get_missing_icon (adaptor));
}
}
diff --git a/gladeui/glade-editor-property.c b/gladeui/glade-editor-property.c
index bdc0ea4..5450b56 100644
--- a/gladeui/glade-editor-property.c
+++ b/gladeui/glade-editor-property.c
@@ -2399,9 +2399,9 @@ glade_eprop_object_populate_view_real (GtkTreeStore * model,
has_decendant = !parentless && glade_widget_has_decendant
(widget, object_type);
- good_type = (adaptor->type == object_type ||
- g_type_is_a (adaptor->type, object_type) ||
- glade_util_class_implements_interface (adaptor->type,
+ good_type = (glade_widget_adaptor_get_object_type (adaptor) == object_type ||
+ g_type_is_a (glade_widget_adaptor_get_object_type (adaptor), object_type) ||
+ glade_util_class_implements_interface (glade_widget_adaptor_get_object_type (adaptor),
object_type));
if (parentless)
@@ -2415,7 +2415,7 @@ glade_eprop_object_populate_view_real (GtkTreeStore * model,
OBJ_COLUMN_WIDGET, widget,
OBJ_COLUMN_WIDGET_NAME,
glade_eprop_object_name (glade_widget_get_name (widget), model, parent_iter),
- OBJ_COLUMN_WIDGET_CLASS, adaptor->title,
+ OBJ_COLUMN_WIDGET_CLASS, glade_widget_adaptor_get_title (adaptor),
/* Selectable if its a compatible type and
* its not itself.
*/
@@ -2618,7 +2618,7 @@ glade_eprop_object_dialog_title (GladeEditorProperty * eprop)
else if ((adaptor =
glade_widget_adaptor_get_by_type
(eprop->klass->pspec->value_type)) != NULL)
- return g_strdup_printf (format, adaptor->title);
+ return g_strdup_printf (format, glade_widget_adaptor_get_title (adaptor));
/* Fallback on type name (which would look like "GtkButton"
* instead of "Button" and maybe not translated).
@@ -2931,7 +2931,7 @@ glade_eprop_object_show_dialog (GtkWidget * dialog_button,
/* translators: Creating 'a widget' for 'a property' of 'a widget' */
glade_command_push_group (_("Creating %s for %s of %s"),
- create_adaptor->name,
+ glade_widget_adaptor_get_name (create_adaptor),
eprop->klass->name,
glade_widget_get_name (widget));
diff --git a/gladeui/glade-editor-table.c b/gladeui/glade-editor-table.c
index ceec20e..c78a2d3 100644
--- a/gladeui/glade-editor-table.c
+++ b/gladeui/glade-editor-table.c
@@ -287,11 +287,13 @@ property_class_comp (gconstpointer a, gconstpointer b)
static GList *
get_sorted_properties (GladeWidgetAdaptor * adaptor, GladeEditorPageType type)
{
- GList *l, *list = NULL, *properties;
+ const GList *l, *properties;
+ GList *list = NULL;
properties =
- (type ==
- GLADE_PAGE_PACKING) ? adaptor->packing_props : adaptor->properties;
+ (type == GLADE_PAGE_PACKING) ?
+ glade_widget_adaptor_get_packing_props (adaptor) :
+ glade_widget_adaptor_get_properties (adaptor);
for (l = properties; l; l = g_list_next (l))
{
@@ -323,7 +325,7 @@ append_item (GladeEditorTable * table,
klass, from_query_dialog == FALSE)))
{
g_critical ("Unable to create editor for property '%s' of class '%s'",
- klass->id, GLADE_WIDGET_ADAPTOR (klass->handle)->name);
+ klass->id, glade_widget_adaptor_get_name (GLADE_WIDGET_ADAPTOR (klass->handle)));
return NULL;
}
diff --git a/gladeui/glade-editor.c b/gladeui/glade-editor.c
index 63e15b5..3b8bff1 100644
--- a/gladeui/glade-editor.c
+++ b/gladeui/glade-editor.c
@@ -255,7 +255,7 @@ glade_editor_on_docs_click (GtkButton * button, GladeEditor * editor)
{
g_object_get (editor->loaded_adaptor, "book", &book, NULL);
glade_editor_search_doc_search (editor, book,
- editor->loaded_adaptor->name,
+ glade_widget_adaptor_get_name (editor->loaded_adaptor),
NULL);
g_free (book);
}
@@ -325,14 +325,14 @@ glade_editor_update_class_field (GladeEditor * editor)
gchar *text;
gtk_image_set_from_icon_name (GTK_IMAGE (editor->class_icon),
- editor->loaded_adaptor->icon_name,
+ glade_widget_adaptor_get_icon_name (editor->loaded_adaptor),
GTK_ICON_SIZE_BUTTON);
gtk_widget_show (editor->class_icon);
/* translators: referring to the properties of a widget named '%s [%s]' */
text = g_strdup_printf (_("%s Properties - %s [%s]"),
- editor->loaded_adaptor->title,
- editor->loaded_adaptor->name,
+ glade_widget_adaptor_get_title (editor->loaded_adaptor),
+ glade_widget_adaptor_get_name (editor->loaded_adaptor),
glade_widget_get_name (widget));
gtk_label_set_text (GTK_LABEL (editor->class_label), text);
g_free (text);
@@ -837,7 +837,7 @@ glade_editor_query_dialog (GladeEditor * editor, GladeWidget * widget)
adaptor = glade_widget_get_adaptor (widget);
- title = g_strdup_printf (_("Create a %s"), adaptor->name);
+ title = g_strdup_printf (_("Create a %s"), glade_widget_adaptor_get_name (adaptor));
dialog = gtk_dialog_new_with_buttons (title, NULL,
GTK_DIALOG_MODAL |
GTK_DIALOG_DESTROY_WITH_PARENT,
diff --git a/gladeui/glade-palette.c b/gladeui/glade-palette.c
index b4ff927..5858baf 100644
--- a/gladeui/glade-palette.c
+++ b/gladeui/glade-palette.c
@@ -527,20 +527,21 @@ glade_palette_item_refresh (GtkWidget * item)
GTK_STOCK_DIALOG_WARNING);
else
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item),
- adaptor->icon_name);
+ glade_widget_adaptor_get_icon_name (adaptor));
/* prepend widget title */
- text = g_strdup_printf ("%s: %s", adaptor->title, warning);
+ text = g_strdup_printf ("%s: %s", glade_widget_adaptor_get_title (adaptor), warning);
gtk_widget_set_tooltip_text (item, text);
g_free (text);
g_free (warning);
}
else
{
- gtk_widget_set_tooltip_text (GTK_WIDGET (item), adaptor->title);
+ gtk_widget_set_tooltip_text (GTK_WIDGET (item),
+ glade_widget_adaptor_get_title (adaptor));
gtk_widget_set_sensitive (GTK_WIDGET (item), TRUE);
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item),
- adaptor->icon_name);
+ glade_widget_adaptor_get_icon_name (adaptor));
}
}
@@ -575,7 +576,7 @@ glade_palette_new_item (GladePalette * palette, GladeWidgetAdaptor * adaptor)
/* Add a box to avoid the ellipsize on the items */
box = gtk_hbox_new (FALSE, 0);
- label = gtk_label_new (adaptor->title);
+ label = gtk_label_new (glade_widget_adaptor_get_title (adaptor));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_widget_show (label);
gtk_widget_show (box);
diff --git a/gladeui/glade-placeholder.c b/gladeui/glade-placeholder.c
index 0a0f221..06d5a68 100644
--- a/gladeui/glade-placeholder.c
+++ b/gladeui/glade-placeholder.c
@@ -137,9 +137,9 @@ glade_placeholder_notify_parent (GObject * gobject,
if (parent)
parent_adaptor = glade_widget_get_adaptor (parent);
- if (parent_adaptor && parent_adaptor->packing_actions)
+ if (parent_adaptor)
placeholder->packing_actions =
- glade_widget_adaptor_pack_actions_new (parent_adaptor);
+ glade_widget_adaptor_pack_actions_new (parent_adaptor);
}
static void
diff --git a/gladeui/glade-popup.c b/gladeui/glade-popup.c
index 8cdf716..b488307 100644
--- a/gladeui/glade-popup.c
+++ b/gladeui/glade-popup.c
@@ -100,19 +100,6 @@ glade_popup_placeholder_add_cb (GtkMenuItem * item,
}
static void
-glade_popup_action_add_cb (GtkMenuItem * item, GladeWidget * group)
-{
- GladeWidgetAdaptor *adaptor;
-
- adaptor = glade_palette_get_current_item (glade_app_get_palette ());
- g_return_if_fail (adaptor != NULL);
-
- glade_command_create (adaptor, group, NULL, glade_widget_get_project (group));
-
- glade_palette_deselect_current_item (glade_app_get_palette (), TRUE);
-}
-
-static void
glade_popup_root_add_cb (GtkMenuItem * item, gpointer * user_data)
{
GladeWidgetAdaptor *adaptor = (GladeWidgetAdaptor *) user_data;
@@ -223,7 +210,8 @@ glade_popup_docs_cb (GtkMenuItem * item, GladeWidgetAdaptor * adaptor)
g_return_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor));
g_object_get (adaptor, "book", &book, NULL);
- glade_editor_search_doc_search (glade_app_get_editor (), book, adaptor->name,
+ glade_editor_search_doc_search (glade_app_get_editor (), book,
+ glade_widget_adaptor_get_name (adaptor),
NULL);
g_free (book);
}
@@ -430,43 +418,25 @@ static GtkWidget *
glade_popup_create_menu (GladeWidget * widget,
GladePlaceholder * placeholder, gboolean packing)
{
- GladeWidgetAdaptor *current_item;
GtkWidget *popup_menu;
GtkWidget *separator;
gboolean sensitive;
GladePlaceholder *tmp_placeholder;
gchar *book;
- sensitive = (current_item =
- glade_palette_get_current_item (glade_app_get_palette ())) !=
- NULL;
-
popup_menu = gtk_menu_new ();
- if (current_item)
+ if (glade_palette_get_current_item (glade_app_get_palette ()))
{
-
- /* Special case for GtkAction accelerators */
- if (widget && GTK_IS_ACTION_GROUP (glade_widget_get_object (widget)) &&
- (current_item->type == GTK_TYPE_ACTION ||
- g_type_is_a (current_item->type, GTK_TYPE_ACTION)))
- {
- glade_popup_append_item (popup_menu, NULL, _("_Add widget here"),
- NULL, TRUE, glade_popup_action_add_cb,
- widget);
- }
- else
- {
- tmp_placeholder = placeholder;
- if (!tmp_placeholder && widget)
- tmp_placeholder =
- find_placeholder (glade_widget_get_object (widget));
-
- glade_popup_append_item (popup_menu, NULL, _("_Add widget here"),
- NULL, tmp_placeholder != NULL,
- glade_popup_placeholder_add_cb,
- tmp_placeholder);
- }
+ tmp_placeholder = placeholder;
+ if (!tmp_placeholder && widget)
+ tmp_placeholder =
+ find_placeholder (glade_widget_get_object (widget));
+
+ glade_popup_append_item (popup_menu, NULL, _("_Add widget here"),
+ NULL, tmp_placeholder != NULL,
+ glade_popup_placeholder_add_cb,
+ tmp_placeholder);
glade_popup_append_item (popup_menu, NULL, _("Add widget as _toplevel"),
NULL, TRUE, glade_popup_root_add_cb, NULL);
diff --git a/gladeui/glade-project.c b/gladeui/glade-project.c
index 0b25608..a864cad 100644
--- a/gladeui/glade-project.c
+++ b/gladeui/glade-project.c
@@ -2088,7 +2088,8 @@ glade_project_verify_property_internal (GladeProject * project,
PROP_VERSION_CONFLICT_FMT,
path_name,
pclass->name,
- adaptor->title, catalog,
+ glade_widget_adaptor_get_title (adaptor),
+ catalog,
pclass->version_since_major,
pclass->version_since_minor);
}
@@ -2167,7 +2168,7 @@ glade_project_verify_signal_internal (GladeWidget * widget,
SIGNAL_VERSION_CONFLICT_FMT,
path_name,
signal->name,
- signal_class->adaptor->title,
+ glade_widget_adaptor_get_title (signal_class->adaptor),
catalog,
signal_class->version_since_major,
signal_class->version_since_minor);
@@ -2368,7 +2369,9 @@ glade_project_verify_adaptor (GladeProject * project,
else
g_string_append_printf (string,
WIDGET_VERSION_CONFLICT_FMT,
- path_name, adaptor_iter->title, catalog,
+ path_name,
+ glade_widget_adaptor_get_title (adaptor_iter),
+ catalog,
GWA_VERSION_SINCE_MAJOR (adaptor_iter),
GWA_VERSION_SINCE_MINOR (adaptor_iter));
@@ -2386,8 +2389,9 @@ glade_project_verify_adaptor (GladeProject * project,
}
else
g_string_append_printf (string, WIDGET_DEPRECATED_FMT,
- path_name, adaptor_iter->title, catalog,
- target_major, target_minor);
+ path_name,
+ glade_widget_adaptor_get_title (adaptor_iter),
+ catalog, target_major, target_minor);
support_mask |= GLADE_SUPPORT_DEPRECATED;
}
diff --git a/gladeui/glade-property-class.c b/gladeui/glade-property-class.c
index 756c2c4..e4c4bc3 100644
--- a/gladeui/glade-property-class.c
+++ b/gladeui/glade-property-class.c
@@ -1109,7 +1109,7 @@ gpc_read_displayable_values_from_node (GladeXmlNode * node,
if (n_values != registered_values)
g_message ("%d missing displayable value for %s::%s",
n_values - registered_values,
- ((GladeWidgetAdaptor *) klass->handle)->name, klass->id);
+ glade_widget_adaptor_get_name ((GladeWidgetAdaptor *) klass->handle), klass->id);
g_type_class_unref (the_class);
diff --git a/gladeui/glade-signal-editor.c b/gladeui/glade-signal-editor.c
index b46117e..8752d00 100644
--- a/gladeui/glade-signal-editor.c
+++ b/gladeui/glade-signal-editor.c
@@ -734,7 +734,9 @@ glade_signal_editor_devhelp_cb (GtkCellRenderer * cell,
g_object_get (signal_class->adaptor, "book", &book, NULL);
glade_editor_search_doc_search (glade_app_get_editor (),
- book, signal_class->adaptor->name, search);
+ book,
+ glade_widget_adaptor_get_name (signal_class->adaptor),
+ search);
g_free (search);
g_free (book);
@@ -1162,7 +1164,7 @@ void
glade_signal_editor_load_widget (GladeSignalEditor * editor,
GladeWidget * widget)
{
- GList *list;
+ const GList *list;
const gchar *last_type = "";
GtkTreeIter iter;
GtkTreeIter parent_class;
@@ -1205,7 +1207,7 @@ glade_signal_editor_load_widget (GladeSignalEditor * editor,
/* Loop over every signal type
*/
- for (list = priv->adaptor->signals; list; list = list->next)
+ for (list = glade_widget_adaptor_get_signals (priv->adaptor); list; list = list->next)
{
GladeSignalClass *signal = (GladeSignalClass *) list->data;
GladeSignal *sig =
diff --git a/gladeui/glade-utils.c b/gladeui/glade-utils.c
index 1a7b8f3..a6f1fe6 100644
--- a/gladeui/glade-utils.c
+++ b/gladeui/glade-utils.c
@@ -288,8 +288,10 @@ glade_util_check_and_warn_scrollable (GladeWidget * parent,
glade_util_ui_message (parent_widget,
GLADE_UI_INFO, NULL,
_("Cannot add non scrollable %s widget to a %s directly.\n"
- "Add a %s first."), child_adaptor->title,
- parent_adaptor->title, vadaptor->title);
+ "Add a %s first."),
+ glade_widget_adaptor_get_title (child_adaptor),
+ glade_widget_adaptor_get_title (parent_adaptor),
+ glade_widget_adaptor_get_title (vadaptor));
return TRUE;
}
return FALSE;
diff --git a/gladeui/glade-widget-adaptor.c b/gladeui/glade-widget-adaptor.c
index 4fdef08..a203d39 100644
--- a/gladeui/glade-widget-adaptor.c
+++ b/gladeui/glade-widget-adaptor.c
@@ -58,20 +58,48 @@
struct _GladeWidgetAdaptorPrivate
{
-
- gchar *catalog; /* The name of the widget catalog this class
- * was declared by.
- */
-
- gchar *book; /* DevHelp search namespace for this widget class
- */
-
- GdkCursor *cursor; /* a cursor for inserting widgets */
-
- gchar *special_child_type; /* Special case code for children that
- * are special children (like notebook tab
- * widgets for example).
- */
+ GType type; /* GType of the widget */
+ GType real_type;
+
+ gchar *name; /* Name of the widget, for example GtkButton */
+ gchar *generic_name; /* Used to generate names of new widgets, for
+ * example "button" so that we generate button1,
+ * button2, buttonX ..
+ */
+ gchar *icon_name; /* icon name to use for widget class */
+ gchar *missing_icon; /* the name of the missing icon if it was not found */
+
+ gchar *title; /* Translated class name used in the UI */
+ GList *properties; /* List of GladePropertyClass objects.
+ * [see glade-property.h] this list contains
+ * properties about the widget that we are going
+ * to modify. Like "title", "label", "rows" .
+ * Each property creates an input in the propety
+ * editor.
+ */
+ GList *packing_props; /* List of GladePropertyClass objects that describe
+ * properties for child objects packing definition -
+ * note there may be more than one type of child supported
+ * by a widget and thus they may have different sets
+ * of properties for each type - this association is
+ * managed on the GladePropertyClass proper.
+ */
+ GList *signals; /* List of GladeSignalClass objects */
+ GList *child_packings; /* Default packing property values */
+ GList *actions; /* A list of GWActionClass */
+ GList *packing_actions; /* A list of GWActionClass for child objects */
+ gchar *catalog; /* The name of the widget catalog this class
+ * was declared by.
+ */
+ gchar *book; /* DevHelp search namespace for this widget class
+ */
+
+ GdkCursor *cursor; /* a cursor for inserting widgets */
+
+ gchar *special_child_type; /* Special case code for children that
+ * are special children (like notebook tab
+ * widgets for example).
+ */
};
struct _GladeChildPacking
@@ -162,9 +190,9 @@ gwa_create_cursor (GladeWidgetAdaptor * adaptor)
GError *error = NULL;
/* only certain widget classes need to have cursors */
- if (G_TYPE_IS_INSTANTIATABLE (adaptor->type) == FALSE ||
- G_TYPE_IS_ABSTRACT (adaptor->type) != FALSE ||
- adaptor->generic_name == NULL)
+ if (G_TYPE_IS_INSTANTIATABLE (adaptor->priv->type) == FALSE ||
+ G_TYPE_IS_ABSTRACT (adaptor->priv->type) != FALSE ||
+ adaptor->priv->generic_name == NULL)
return;
/* cannot continue if 'add widget' cursor pixbuf has not been loaded for any reason */
@@ -178,16 +206,16 @@ gwa_create_cursor (GladeWidgetAdaptor * adaptor)
gdk_pixbuf_fill (tmp_pixbuf, 0x00000000);
if (gtk_icon_theme_has_icon
- (gtk_icon_theme_get_default (), adaptor->icon_name))
+ (gtk_icon_theme_get_default (), adaptor->priv->icon_name))
{
widget_pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
- adaptor->icon_name,
+ adaptor->priv->icon_name,
22, 0, &error);
if (error)
{
g_warning ("Could not load image data for named icon '%s': %s",
- adaptor->icon_name, error->message);
+ adaptor->priv->icon_name, error->message);
g_error_free (error);
return;
}
@@ -234,9 +262,9 @@ glade_widget_adaptor_hash_find (gpointer key, gpointer value,
GladeWidgetAdaptor *adaptor = value;
GType *type = user_data;
- if (g_type_is_a (adaptor->type, *type))
+ if (g_type_is_a (adaptor->priv->type, *type))
{
- *type = adaptor->type;
+ *type = adaptor->priv->type;
return TRUE;
}
@@ -286,7 +314,7 @@ glade_widget_adaptor_get_parent_adaptor (GladeWidgetAdaptor * adaptor)
{
g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL);
- return glade_widget_adaptor_get_parent_adaptor_by_type (adaptor->type);
+ return glade_widget_adaptor_get_parent_adaptor_by_type (adaptor->priv->type);
}
static gint
@@ -384,7 +412,7 @@ gwa_clone_parent_properties (GladeWidgetAdaptor * adaptor, gboolean is_packing)
if ((parent_adaptor = gwa_get_parent_adaptor (adaptor)) != NULL)
{
proplist = is_packing ?
- parent_adaptor->packing_props : parent_adaptor->properties;
+ parent_adaptor->priv->packing_props : parent_adaptor->priv->properties;
for (list = proplist; list; list = list->next)
{
@@ -432,11 +460,11 @@ gwa_setup_introspected_props_from_pspecs (GladeWidgetAdaptor * adaptor,
}
if (is_packing)
- adaptor->packing_props =
- g_list_concat (adaptor->packing_props, g_list_reverse (list));
+ adaptor->priv->packing_props =
+ g_list_concat (adaptor->priv->packing_props, g_list_reverse (list));
else
- adaptor->properties =
- g_list_concat (adaptor->properties, g_list_reverse (list));
+ adaptor->priv->properties =
+ g_list_concat (adaptor->priv->properties, g_list_reverse (list));
}
static void
@@ -448,14 +476,14 @@ gwa_setup_properties (GladeWidgetAdaptor * adaptor,
GList *l;
/* only GtkContainer child propeties can be introspected */
- if (is_packing && !g_type_is_a (adaptor->type, GTK_TYPE_CONTAINER))
+ if (is_packing && !g_type_is_a (adaptor->priv->type, GTK_TYPE_CONTAINER))
return;
/* First clone the parents properties */
if (is_packing)
- adaptor->packing_props = gwa_clone_parent_properties (adaptor, is_packing);
+ adaptor->priv->packing_props = gwa_clone_parent_properties (adaptor, is_packing);
else
- adaptor->properties = gwa_clone_parent_properties (adaptor, is_packing);
+ adaptor->priv->properties = gwa_clone_parent_properties (adaptor, is_packing);
/* Now automaticly introspect new properties added in this class,
* allow the class writer to decide what to override in the resulting
@@ -478,7 +506,7 @@ gwa_setup_properties (GladeWidgetAdaptor * adaptor,
* (which could be used to call gtk_container_class_find_child_property()
* and properly introspect whether or not its a packing property).
*/
- for (l = adaptor->packing_props; l; l = l->next)
+ for (l = adaptor->priv->packing_props; l; l = l->next)
{
GladePropertyClass *property_class = l->data;
property_class->packing = TRUE;
@@ -494,7 +522,7 @@ gwa_inherit_child_packing (GladeWidgetAdaptor * adaptor)
if ((parent_adaptor = gwa_get_parent_adaptor (adaptor)) != NULL)
{
- for (packing_list = parent_adaptor->child_packings;
+ for (packing_list = parent_adaptor->priv->child_packings;
packing_list; packing_list = packing_list->next)
{
GladeChildPacking *packing = packing_list->data;
@@ -530,12 +558,12 @@ gwa_inherit_signals (GladeWidgetAdaptor * adaptor)
if ((parent_adaptor = gwa_get_parent_adaptor (adaptor)) != NULL)
{
- for (list = adaptor->signals; list; list = list->next)
+ for (list = adaptor->priv->signals; list; list = list->next)
{
signal = list->data;
if ((node = g_list_find_custom
- (parent_adaptor->signals, signal->name,
+ (parent_adaptor->priv->signals, signal->name,
(GCompareFunc) gwa_signal_find_comp)) != NULL)
{
parent_signal = node->data;
@@ -573,23 +601,23 @@ glade_widget_adaptor_constructor (GType type,
adaptor = GLADE_WIDGET_ADAPTOR (ret_obj);
parent_adaptor = gwa_get_parent_adaptor (adaptor);
- if (adaptor->type == G_TYPE_NONE)
+ if (adaptor->priv->type == G_TYPE_NONE)
g_warning ("Adaptor created without a type");
- if (adaptor->name == NULL)
+ if (adaptor->priv->name == NULL)
g_warning ("Adaptor created without a name");
/* Build decorations */
- if (!adaptor->icon_name)
+ if (!adaptor->priv->icon_name)
{
- adaptor->icon_name = g_strdup ("gtk-missing-image");
+ adaptor->priv->icon_name = g_strdup ("gtk-missing-image");
}
gwa_create_cursor (adaptor);
/* Let it leek */
- if ((object_class = g_type_class_ref (adaptor->type)))
+ if ((object_class = g_type_class_ref (adaptor->priv->type)))
{
/* Build signals & properties */
- adaptor->signals = gwa_list_signals (adaptor, adaptor->type);
+ adaptor->priv->signals = gwa_list_signals (adaptor, adaptor->priv->type);
gwa_inherit_signals (adaptor);
gwa_setup_properties (adaptor, object_class, FALSE);
@@ -597,7 +625,7 @@ glade_widget_adaptor_constructor (GType type,
}
/* Inherit packing defaults here */
- adaptor->child_packings = gwa_inherit_child_packing (adaptor);
+ adaptor->priv->child_packings = gwa_inherit_child_packing (adaptor);
/* Inherit special-child-type */
if (parent_adaptor)
@@ -619,25 +647,25 @@ glade_widget_adaptor_constructor (GType type,
{
GList *l;
- if (parent_adaptor->actions)
+ if (parent_adaptor->priv->actions)
{
- for (l = parent_adaptor->actions; l; l = g_list_next (l))
+ for (l = parent_adaptor->priv->actions; l; l = g_list_next (l))
{
GWActionClass *child = glade_widget_action_class_clone (l->data);
- adaptor->actions = g_list_prepend (adaptor->actions, child);
+ adaptor->priv->actions = g_list_prepend (adaptor->priv->actions, child);
}
- adaptor->actions = g_list_reverse (adaptor->actions);
+ adaptor->priv->actions = g_list_reverse (adaptor->priv->actions);
}
- if (parent_adaptor->packing_actions)
+ if (parent_adaptor->priv->packing_actions)
{
- for (l = parent_adaptor->packing_actions; l; l = g_list_next (l))
+ for (l = parent_adaptor->priv->packing_actions; l; l = g_list_next (l))
{
GWActionClass *child = glade_widget_action_class_clone (l->data);
- adaptor->packing_actions =
- g_list_prepend (adaptor->packing_actions, child);
+ adaptor->priv->packing_actions =
+ g_list_prepend (adaptor->priv->packing_actions, child);
}
- adaptor->packing_actions = g_list_reverse (adaptor->packing_actions);
+ adaptor->priv->packing_actions = g_list_reverse (adaptor->priv->packing_actions);
}
}
@@ -667,23 +695,23 @@ glade_widget_adaptor_finalize (GObject * object)
GladeWidgetAdaptor *adaptor = GLADE_WIDGET_ADAPTOR (object);
/* Free properties and signals */
- g_list_foreach (adaptor->properties, (GFunc) glade_property_class_free, NULL);
- g_list_free (adaptor->properties);
+ g_list_foreach (adaptor->priv->properties, (GFunc) glade_property_class_free, NULL);
+ g_list_free (adaptor->priv->properties);
- g_list_foreach (adaptor->packing_props, (GFunc) glade_property_class_free,
+ g_list_foreach (adaptor->priv->packing_props, (GFunc) glade_property_class_free,
NULL);
- g_list_free (adaptor->packing_props);
+ g_list_free (adaptor->priv->packing_props);
/* Be careful, this list holds GladeSignalClass* not GladeSignal,
* thus g_free is enough as all members are const */
- g_list_foreach (adaptor->signals, (GFunc) g_free, NULL);
- g_list_free (adaptor->signals);
+ g_list_foreach (adaptor->priv->signals, (GFunc) g_free, NULL);
+ g_list_free (adaptor->priv->signals);
/* Free child packings */
- g_list_foreach (adaptor->child_packings,
+ g_list_foreach (adaptor->priv->child_packings,
(GFunc) gwa_child_packing_free, NULL);
- g_list_free (adaptor->child_packings);
+ g_list_free (adaptor->priv->child_packings);
if (adaptor->priv->book)
g_free (adaptor->priv->book);
@@ -695,29 +723,29 @@ glade_widget_adaptor_finalize (GObject * object)
if (adaptor->priv->cursor != NULL)
gdk_cursor_unref (adaptor->priv->cursor);
- if (adaptor->name)
- g_free (adaptor->name);
- if (adaptor->generic_name)
- g_free (adaptor->generic_name);
- if (adaptor->title)
- g_free (adaptor->title);
- if (adaptor->icon_name)
- g_free (adaptor->icon_name);
- if (adaptor->missing_icon)
- g_free (adaptor->missing_icon);
+ if (adaptor->priv->name)
+ g_free (adaptor->priv->name);
+ if (adaptor->priv->generic_name)
+ g_free (adaptor->priv->generic_name);
+ if (adaptor->priv->title)
+ g_free (adaptor->priv->title);
+ if (adaptor->priv->icon_name)
+ g_free (adaptor->priv->icon_name);
+ if (adaptor->priv->missing_icon)
+ g_free (adaptor->priv->missing_icon);
- if (adaptor->actions)
+ if (adaptor->priv->actions)
{
- g_list_foreach (adaptor->actions,
+ g_list_foreach (adaptor->priv->actions,
(GFunc) glade_widget_action_class_free, NULL);
- g_list_free (adaptor->actions);
+ g_list_free (adaptor->priv->actions);
}
- if (adaptor->packing_actions)
+ if (adaptor->priv->packing_actions)
{
- g_list_foreach (adaptor->packing_actions,
+ g_list_foreach (adaptor->priv->packing_actions,
(GFunc) glade_widget_action_class_free, NULL);
- g_list_free (adaptor->packing_actions);
+ g_list_free (adaptor->priv->packing_actions);
}
G_OBJECT_CLASS (parent_class)->finalize (object);
@@ -737,25 +765,25 @@ glade_widget_adaptor_real_set_property (GObject * object,
{
case PROP_NAME:
/* assume once (construct-only) */
- adaptor->name = g_value_dup_string (value);
- adaptor->real_type = g_type_from_name (adaptor->name);
+ adaptor->priv->name = g_value_dup_string (value);
+ adaptor->priv->real_type = g_type_from_name (adaptor->priv->name);
break;
case PROP_ICON_NAME:
/* assume once (construct-only) */
- adaptor->icon_name = g_value_dup_string (value);
+ adaptor->priv->icon_name = g_value_dup_string (value);
break;
case PROP_TYPE:
- adaptor->type = g_value_get_gtype (value);
+ adaptor->priv->type = g_value_get_gtype (value);
break;
case PROP_TITLE:
- if (adaptor->title)
- g_free (adaptor->title);
- adaptor->title = g_value_dup_string (value);
+ if (adaptor->priv->title)
+ g_free (adaptor->priv->title);
+ adaptor->priv->title = g_value_dup_string (value);
break;
case PROP_GENERIC_NAME:
- if (adaptor->generic_name)
- g_free (adaptor->generic_name);
- adaptor->generic_name = g_value_dup_string (value);
+ if (adaptor->priv->generic_name)
+ g_free (adaptor->priv->generic_name);
+ adaptor->priv->generic_name = g_value_dup_string (value);
break;
case PROP_CATALOG:
/* assume once (construct-only) */
@@ -788,19 +816,19 @@ glade_widget_adaptor_real_get_property (GObject * object,
switch (prop_id)
{
case PROP_NAME:
- g_value_set_string (value, adaptor->name);
+ g_value_set_string (value, adaptor->priv->name);
break;
case PROP_TYPE:
- g_value_set_gtype (value, adaptor->type);
+ g_value_set_gtype (value, adaptor->priv->type);
break;
case PROP_TITLE:
- g_value_set_string (value, adaptor->title);
+ g_value_set_string (value, adaptor->priv->title);
break;
case PROP_GENERIC_NAME:
- g_value_set_string (value, adaptor->generic_name);
+ g_value_set_string (value, adaptor->priv->generic_name);
break;
case PROP_ICON_NAME:
- g_value_set_string (value, adaptor->icon_name);
+ g_value_set_string (value, adaptor->priv->icon_name);
break;
case PROP_CATALOG:
g_value_set_string (value, adaptor->priv->catalog);
@@ -837,7 +865,7 @@ glade_widget_adaptor_object_construct_object (GladeWidgetAdaptor * adaptor,
guint n_parameters,
GParameter * parameters)
{
- return g_object_newv (adaptor->type, n_parameters, parameters);
+ return g_object_newv (adaptor->priv->type, n_parameters, parameters);
}
@@ -865,7 +893,7 @@ glade_widget_adaptor_object_action_activate (GladeWidgetAdaptor * adaptor,
const gchar * action_id)
{
g_message ("No action_activate() support in adaptor %s for action '%s'",
- adaptor->name, action_id);
+ adaptor->priv->name, action_id);
}
static void
@@ -875,7 +903,7 @@ glade_widget_adaptor_object_child_action_activate (GladeWidgetAdaptor * adaptor,
const gchar * action_id)
{
g_message ("No child_action_activate() support in adaptor %s for action '%s'",
- adaptor->name, action_id);
+ adaptor->priv->name, action_id);
}
static gboolean
@@ -1592,6 +1620,78 @@ gwa_derive_adaptor_for_type (GType object_type, GWADerivedClassData * data)
/*******************************************************************************
API
*******************************************************************************/
+GType
+glade_widget_adaptor_get_object_type (GladeWidgetAdaptor *adaptor)
+{
+ g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), G_TYPE_INVALID);
+
+ return adaptor->priv->type;
+}
+
+G_CONST_RETURN gchar *
+glade_widget_adaptor_get_name (GladeWidgetAdaptor *adaptor)
+{
+ g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL);
+
+ return adaptor->priv->name;
+}
+
+G_CONST_RETURN gchar *
+glade_widget_adaptor_get_generic_name (GladeWidgetAdaptor *adaptor)
+{
+ g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL);
+
+ return adaptor->priv->generic_name;
+}
+
+G_CONST_RETURN gchar *
+glade_widget_adaptor_get_title (GladeWidgetAdaptor *adaptor)
+{
+ g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL);
+
+ return adaptor->priv->title;
+}
+
+G_CONST_RETURN gchar *
+glade_widget_adaptor_get_icon_name (GladeWidgetAdaptor *adaptor)
+{
+ g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL);
+
+ return adaptor->priv->icon_name;
+}
+
+G_CONST_RETURN gchar *
+glade_widget_adaptor_get_missing_icon (GladeWidgetAdaptor *adaptor)
+{
+ g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL);
+
+ return adaptor->priv->missing_icon;
+}
+
+G_CONST_RETURN GList *
+glade_widget_adaptor_get_properties (GladeWidgetAdaptor *adaptor)
+{
+ g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL);
+
+ return adaptor->priv->properties;
+}
+
+G_CONST_RETURN GList *
+glade_widget_adaptor_get_packing_props (GladeWidgetAdaptor *adaptor)
+{
+ g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL);
+
+ return adaptor->priv->packing_props;
+}
+
+G_CONST_RETURN GList *
+glade_widget_adaptor_get_signals (GladeWidgetAdaptor *adaptor)
+{
+ g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL);
+
+ return adaptor->priv->signals;
+}
+
static void
accum_adaptor (GType * type, GladeWidgetAdaptor * adaptor, GList ** list)
{
@@ -1628,9 +1728,9 @@ glade_widget_adaptor_register (GladeWidgetAdaptor * adaptor)
g_return_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor));
- if (glade_widget_adaptor_get_by_name (adaptor->name))
+ if (glade_widget_adaptor_get_by_name (adaptor->priv->name))
{
- g_warning ("Adaptor class for '%s' already registered", adaptor->name);
+ g_warning ("Adaptor class for '%s' already registered", adaptor->priv->name);
return;
}
@@ -1639,7 +1739,7 @@ glade_widget_adaptor_register (GladeWidgetAdaptor * adaptor)
g_free, g_object_unref);
g_hash_table_insert (adaptor_hash,
- g_memdup (&adaptor->type, sizeof (GType)), adaptor);
+ g_memdup (&adaptor->priv->type, sizeof (GType)), adaptor);
}
static GladePackingDefault *
@@ -1664,7 +1764,7 @@ glade_widget_adaptor_get_child_packing (GladeWidgetAdaptor * child_adaptor,
{
GList *l;
- for (l = child_adaptor->child_packings; l; l = l->next)
+ for (l = child_adaptor->priv->child_packings; l; l = l->next)
{
GladeChildPacking *packing;
@@ -1694,7 +1794,7 @@ gwa_set_packing_defaults_from_node (GladeWidgetAdaptor * adaptor,
continue;
if ((name = glade_xml_get_property_string_required
- (child, GLADE_TAG_NAME, adaptor->name)) == NULL)
+ (child, GLADE_TAG_NAME, adaptor->priv->name)) == NULL)
continue;
/* If a GladeChildPacking exists for this parent, use it -
@@ -1707,8 +1807,8 @@ gwa_set_packing_defaults_from_node (GladeWidgetAdaptor * adaptor,
packing = g_new0 (GladeChildPacking, 1);
packing->parent_name = name;
- adaptor->child_packings =
- g_list_prepend (adaptor->child_packings, packing);
+ adaptor->priv->child_packings =
+ g_list_prepend (adaptor->priv->child_packings, packing);
}
@@ -1721,12 +1821,12 @@ gwa_set_packing_defaults_from_node (GladeWidgetAdaptor * adaptor,
if ((id =
glade_xml_get_property_string_required
- (prop_node, GLADE_TAG_ID, adaptor->name)) == NULL)
+ (prop_node, GLADE_TAG_ID, adaptor->priv->name)) == NULL)
continue;
if ((value =
glade_xml_get_property_string_required
- (prop_node, GLADE_TAG_DEFAULT, adaptor->name)) == NULL)
+ (prop_node, GLADE_TAG_DEFAULT, adaptor->priv->name)) == NULL)
{
g_free (id);
continue;
@@ -1748,8 +1848,8 @@ gwa_set_packing_defaults_from_node (GladeWidgetAdaptor * adaptor,
def->value = value;
}
- adaptor->child_packings =
- g_list_prepend (adaptor->child_packings, packing);
+ adaptor->priv->child_packings =
+ g_list_prepend (adaptor->priv->child_packings, packing);
}
}
@@ -1776,7 +1876,7 @@ gwa_update_properties_from_node (GladeWidgetAdaptor * adaptor,
continue;
id = glade_xml_get_property_string_required
- (child, GLADE_TAG_ID, adaptor->name);
+ (child, GLADE_TAG_ID, adaptor->priv->name);
if (!id)
continue;
@@ -1812,10 +1912,10 @@ gwa_update_properties_from_node (GladeWidgetAdaptor * adaptor,
}
if ((updated = glade_property_class_update_from_node
- (child, module, adaptor->type, &property_class, domain)) == FALSE)
+ (child, module, adaptor->priv->type, &property_class, domain)) == FALSE)
{
g_warning ("failed to update %s property of %s from xml",
- id, adaptor->name);
+ id, adaptor->priv->name);
g_free (id);
continue;
}
@@ -1965,7 +2065,7 @@ gwa_update_properties_from_type (GladeWidgetAdaptor * adaptor,
guint i, n_specs = 0;
/* only GtkContainer child propeties can be introspected */
- if (is_packing && !g_type_is_a (adaptor->type, GTK_TYPE_CONTAINER))
+ if (is_packing && !g_type_is_a (adaptor->priv->type, GTK_TYPE_CONTAINER))
return;
if (is_packing)
@@ -1997,7 +2097,7 @@ gwa_update_properties_from_type (GladeWidgetAdaptor * adaptor,
/* Make sure we can tell properties apart by there
* owning class.
*/
- property_class->pspec->owner_type = adaptor->type;
+ property_class->pspec->owner_type = adaptor->priv->type;
/* Disable properties by default since the does not really implement them */
property_class->virt = TRUE;
@@ -2042,7 +2142,7 @@ gwa_action_update_from_node (GladeWidgetAdaptor * adaptor,
continue;
id = glade_xml_get_property_string_required
- (child, GLADE_TAG_ID, adaptor->name);
+ (child, GLADE_TAG_ID, adaptor->priv->name);
if (id == NULL)
continue;
@@ -2105,7 +2205,7 @@ gwa_set_signals_from_node (GladeWidgetAdaptor * adaptor, GladeXmlNode * node)
continue;
if ((list =
- g_list_find_custom (adaptor->signals, id,
+ g_list_find_custom (adaptor->priv->signals, id,
(GCompareFunc) gwa_signal_find_comp)) != NULL)
{
signal = list->data;
@@ -2134,12 +2234,12 @@ gwa_extend_with_node (GladeWidgetAdaptor * adaptor,
if ((child = glade_xml_search_child (node, GLADE_TAG_PROPERTIES)) != NULL)
gwa_update_properties_from_node
- (adaptor, child, module, &adaptor->properties, domain, FALSE);
+ (adaptor, child, module, &adaptor->priv->properties, domain, FALSE);
if ((child =
glade_xml_search_child (node, GLADE_TAG_PACKING_PROPERTIES)) != NULL)
gwa_update_properties_from_node
- (adaptor, child, module, &adaptor->packing_props, domain, TRUE);
+ (adaptor, child, module, &adaptor->priv->packing_props, domain, TRUE);
if ((child =
glade_xml_search_child (node, GLADE_TAG_PACKING_DEFAULTS)) != NULL)
@@ -2198,13 +2298,13 @@ create_icon_name_for_object_class (const gchar * class_name,
static void
gwa_displayable_values_check (GladeWidgetAdaptor * adaptor, gboolean packing)
{
- GList *l, *p = (packing) ? adaptor->packing_props : adaptor->properties;
+ GList *l, *p = (packing) ? adaptor->priv->packing_props : adaptor->priv->properties;
for (l = p; l; l = g_list_next (l))
{
GladePropertyClass *klass = l->data;
- if (adaptor->type == klass->pspec->owner_type && klass->visible &&
+ if (adaptor->priv->type == klass->pspec->owner_type && klass->visible &&
(G_IS_PARAM_SPEC_ENUM (klass->pspec) ||
G_IS_PARAM_SPEC_FLAGS (klass->pspec)) &&
!glade_type_has_displayable_values (klass->pspec->value_type) &&
@@ -2213,7 +2313,7 @@ gwa_displayable_values_check (GladeWidgetAdaptor * adaptor, gboolean packing)
{
/* We do not need displayable values if the property is not visible */
g_message ("No displayable values for %sproperty %s::%s",
- (packing) ? "child " : "", adaptor->name, klass->id);
+ (packing) ? "child " : "", adaptor->priv->name, klass->id);
}
}
}
@@ -2331,9 +2431,9 @@ glade_widget_adaptor_from_catalog (GladeCatalog * catalog,
GladeWidgetAdaptor *a =
glade_widget_adaptor_get_by_name (g_type_name (type_iter));
- if (a && a->real_type != a->type)
+ if (a && a->priv->real_type != a->priv->type)
{
- object_type = generate_type (name, g_type_name (a->type));
+ object_type = generate_type (name, g_type_name (a->priv->type));
break;
}
}
@@ -2402,8 +2502,8 @@ glade_widget_adaptor_from_catalog (GladeCatalog * catalog,
/* Save the desired name */
missing_icon = adaptor_icon_name;
- adaptor_icon_name = g_strdup ((parent && parent->icon_name) ?
- parent->icon_name : DEFAULT_ICON_NAME);
+ adaptor_icon_name = g_strdup ((parent && parent->priv->icon_name) ?
+ parent->priv->icon_name : DEFAULT_ICON_NAME);
}
@@ -2414,7 +2514,7 @@ glade_widget_adaptor_from_catalog (GladeCatalog * catalog,
"generic-name", generic_name,
"icon-name", adaptor_icon_name, NULL);
- adaptor->missing_icon = missing_icon;
+ adaptor->priv->missing_icon = missing_icon;
g_free (generic_name);
g_free (icon_name);
@@ -2430,7 +2530,7 @@ glade_widget_adaptor_from_catalog (GladeCatalog * catalog,
{
g_warning ("Class '%s' declared without a '%s' attribute", name,
GLADE_TAG_TITLE);
- adaptor->title = g_strdup (name);
+ adaptor->priv->title = g_strdup (name);
}
else
{
@@ -2439,42 +2539,42 @@ glade_widget_adaptor_from_catalog (GladeCatalog * catalog,
if (translated_title != title)
{
/* gettext owns translated_title */
- adaptor->title = g_strdup (translated_title);
+ adaptor->priv->title = g_strdup (translated_title);
g_free (title);
}
else
{
- adaptor->title = title;
+ adaptor->priv->title = title;
}
}
- if (G_TYPE_IS_INSTANTIATABLE (adaptor->type) &&
- G_TYPE_IS_ABSTRACT (adaptor->type) == FALSE &&
- adaptor->generic_name == NULL)
+ if (G_TYPE_IS_INSTANTIATABLE (adaptor->priv->type) &&
+ G_TYPE_IS_ABSTRACT (adaptor->priv->type) == FALSE &&
+ adaptor->priv->generic_name == NULL)
{
g_warning ("Instantiatable class '%s' built without a '%s'",
name, GLADE_TAG_GENERIC_NAME);
}
- /* if adaptor->type (the runtime used by glade) differs from adaptor->name
+ /* if adaptor->priv->type (the runtime used by glade) differs from adaptor->priv->name
* (the name specified in the catalog) means we are using the type specified in the
* the parent tag as the runtime and the class already exist.
* So we need to add the properties and signals from the real class
* even though they wont be aplied at runtime.
*/
- if (adaptor->type != adaptor->real_type)
+ if (adaptor->priv->type != adaptor->priv->real_type)
{
- adaptor->signals = gwa_list_signals (adaptor, adaptor->real_type);
+ adaptor->priv->signals = gwa_list_signals (adaptor, adaptor->priv->real_type);
- gwa_update_properties_from_type (adaptor, adaptor->real_type,
- &adaptor->properties, FALSE);
- gwa_update_properties_from_type (adaptor, adaptor->real_type,
- &adaptor->packing_props, TRUE);
+ gwa_update_properties_from_type (adaptor, adaptor->priv->real_type,
+ &adaptor->priv->properties, FALSE);
+ gwa_update_properties_from_type (adaptor, adaptor->priv->real_type,
+ &adaptor->priv->packing_props, TRUE);
}
/* Perform a stoopid fallback just incase */
- if (adaptor->generic_name == NULL)
- adaptor->generic_name = g_strdup ("widget");
+ if (adaptor->priv->generic_name == NULL)
+ adaptor->priv->generic_name = g_strdup ("widget");
adaptor->priv->catalog = g_strdup (glade_catalog_get_name (catalog));
@@ -2485,11 +2585,11 @@ glade_widget_adaptor_from_catalog (GladeCatalog * catalog,
glade_catalog_get_domain (catalog));
/* Set default weight on properties */
- for (parent_type = adaptor->type;
+ for (parent_type = adaptor->priv->type;
parent_type != 0; parent_type = g_type_parent (parent_type))
{
- gwa_properties_set_weight (&adaptor->properties, parent_type);
- gwa_properties_set_weight (&adaptor->packing_props, parent_type);
+ gwa_properties_set_weight (&adaptor->priv->properties, parent_type);
+ gwa_properties_set_weight (&adaptor->priv->packing_props, parent_type);
}
gwa_displayable_values_check (adaptor, FALSE);
@@ -2632,7 +2732,7 @@ search_adaptor_by_name (GType * type,
GladeWidgetAdaptor * adaptor,
GladeAdaptorSearchPair * pair)
{
- if (!strcmp (adaptor->name, pair->name))
+ if (!strcmp (adaptor->priv->name, pair->name))
pair->adaptor = adaptor;
}
@@ -2699,9 +2799,9 @@ glade_widget_adaptor_from_pspec (GladeWidgetAdaptor * adaptor,
spec_adaptor = glade_widget_adaptor_get_by_type (spec->owner_type);
- g_return_val_if_fail (g_type_is_a (adaptor->type, spec->owner_type), NULL);
+ g_return_val_if_fail (g_type_is_a (adaptor->priv->type, spec->owner_type), NULL);
- while (spec_type && !spec_adaptor && spec_type != adaptor->type)
+ while (spec_type && !spec_adaptor && spec_type != adaptor->priv->type)
{
spec_type = g_type_parent (spec_type);
spec_adaptor = glade_widget_adaptor_get_by_type (spec_type);
@@ -2729,7 +2829,7 @@ glade_widget_adaptor_get_property_class (GladeWidgetAdaptor * adaptor,
GList *list;
GladePropertyClass *pclass;
- for (list = adaptor->properties; list && list->data; list = list->next)
+ for (list = adaptor->priv->properties; list && list->data; list = list->next)
{
pclass = list->data;
if (strcmp (pclass->id, name) == 0)
@@ -2755,7 +2855,7 @@ glade_widget_adaptor_get_pack_property_class (GladeWidgetAdaptor * adaptor,
GList *list;
GladePropertyClass *pclass;
- for (list = adaptor->packing_props; list && list->data; list = list->next)
+ for (list = adaptor->priv->packing_props; list && list->data; list = list->next)
{
pclass = list->data;
if (strcmp (pclass->id, name) == 0)
@@ -2787,7 +2887,7 @@ glade_widget_adaptor_default_params (GladeWidgetAdaptor * adaptor,
/* As a slight optimization, we never unref the class
*/
- oclass = g_type_class_ref (adaptor->type);
+ oclass = g_type_class_ref (adaptor->priv->type);
pspec = g_object_class_list_properties (oclass, &n_props);
params = g_array_new (FALSE, FALSE, sizeof (GParameter));
@@ -2819,7 +2919,7 @@ glade_widget_adaptor_default_params (GladeWidgetAdaptor * adaptor,
pspec[i]->value_type) == FALSE)
{
g_critical ("Type mismatch on %s property of %s",
- parameter.name, adaptor->name);
+ parameter.name, adaptor->priv->name);
continue;
}
@@ -2877,7 +2977,7 @@ glade_widget_adaptor_post_create (GladeWidgetAdaptor * adaptor,
{
g_return_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor));
g_return_if_fail (G_IS_OBJECT (object));
- g_return_if_fail (g_type_is_a (G_OBJECT_TYPE (object), adaptor->type));
+ g_return_if_fail (g_type_is_a (G_OBJECT_TYPE (object), adaptor->priv->type));
/* Run post_create in 2 stages, one that chains up and all class adaptors
* in the hierarchy get a peek, another that is used to setup placeholders
@@ -2911,14 +3011,14 @@ glade_widget_adaptor_get_internal_child (GladeWidgetAdaptor * adaptor,
g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL);
g_return_val_if_fail (G_IS_OBJECT (object), NULL);
g_return_val_if_fail (internal_name != NULL, NULL);
- g_return_val_if_fail (g_type_is_a (G_OBJECT_TYPE (object), adaptor->type),
+ g_return_val_if_fail (g_type_is_a (G_OBJECT_TYPE (object), adaptor->priv->type),
NULL);
if (GLADE_WIDGET_ADAPTOR_GET_CLASS (adaptor)->get_internal_child)
return GLADE_WIDGET_ADAPTOR_GET_CLASS
(adaptor)->get_internal_child (adaptor, object, internal_name);
else
- g_critical ("No get_internal_child() support in adaptor %s", adaptor->name);
+ g_critical ("No get_internal_child() support in adaptor %s", adaptor->priv->name);
return NULL;
}
@@ -2943,7 +3043,7 @@ glade_widget_adaptor_set_property (GladeWidgetAdaptor * adaptor,
g_return_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor));
g_return_if_fail (G_IS_OBJECT (object));
g_return_if_fail (property_name != NULL && value != NULL);
- g_return_if_fail (g_type_is_a (G_OBJECT_TYPE (object), adaptor->type));
+ g_return_if_fail (g_type_is_a (G_OBJECT_TYPE (object), adaptor->priv->type));
/* The base class provides an implementation */
GLADE_WIDGET_ADAPTOR_GET_CLASS
@@ -2969,7 +3069,7 @@ glade_widget_adaptor_get_property (GladeWidgetAdaptor * adaptor,
g_return_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor));
g_return_if_fail (G_IS_OBJECT (object));
g_return_if_fail (property_name != NULL && value != NULL);
- g_return_if_fail (g_type_is_a (G_OBJECT_TYPE (object), adaptor->type));
+ g_return_if_fail (g_type_is_a (G_OBJECT_TYPE (object), adaptor->priv->type));
/* The base class provides an implementation */
GLADE_WIDGET_ADAPTOR_GET_CLASS
@@ -3002,7 +3102,7 @@ glade_widget_adaptor_verify_property (GladeWidgetAdaptor * adaptor,
g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), FALSE);
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
g_return_val_if_fail (property_name != NULL && value != NULL, FALSE);
- g_return_val_if_fail (g_type_is_a (G_OBJECT_TYPE (object), adaptor->type),
+ g_return_val_if_fail (g_type_is_a (G_OBJECT_TYPE (object), adaptor->priv->type),
FALSE);
if (GLADE_WIDGET_ADAPTOR_GET_CLASS (adaptor)->verify_property)
@@ -3027,12 +3127,12 @@ glade_widget_adaptor_add (GladeWidgetAdaptor * adaptor,
g_return_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor));
g_return_if_fail (G_IS_OBJECT (container));
g_return_if_fail (G_IS_OBJECT (child));
- g_return_if_fail (g_type_is_a (G_OBJECT_TYPE (container), adaptor->type));
+ g_return_if_fail (g_type_is_a (G_OBJECT_TYPE (container), adaptor->priv->type));
if (GLADE_WIDGET_ADAPTOR_GET_CLASS (adaptor)->add)
GLADE_WIDGET_ADAPTOR_GET_CLASS (adaptor)->add (adaptor, container, child);
else
- g_critical ("No add() support in adaptor %s", adaptor->name);
+ g_critical ("No add() support in adaptor %s", adaptor->priv->name);
}
@@ -3051,13 +3151,13 @@ glade_widget_adaptor_remove (GladeWidgetAdaptor * adaptor,
g_return_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor));
g_return_if_fail (G_IS_OBJECT (container));
g_return_if_fail (G_IS_OBJECT (child));
- g_return_if_fail (g_type_is_a (G_OBJECT_TYPE (container), adaptor->type));
+ g_return_if_fail (g_type_is_a (G_OBJECT_TYPE (container), adaptor->priv->type));
if (GLADE_WIDGET_ADAPTOR_GET_CLASS (adaptor)->remove)
GLADE_WIDGET_ADAPTOR_GET_CLASS (adaptor)->remove (adaptor, container,
child);
else
- g_critical ("No remove() support in adaptor %s", adaptor->name);
+ g_critical ("No remove() support in adaptor %s", adaptor->priv->name);
}
/**
@@ -3075,7 +3175,7 @@ glade_widget_adaptor_get_children (GladeWidgetAdaptor * adaptor,
{
g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL);
g_return_val_if_fail (G_IS_OBJECT (container), NULL);
- g_return_val_if_fail (g_type_is_a (G_OBJECT_TYPE (container), adaptor->type),
+ g_return_val_if_fail (g_type_is_a (G_OBJECT_TYPE (container), adaptor->priv->type),
NULL);
if (GLADE_WIDGET_ADAPTOR_GET_CLASS (adaptor)->get_children)
@@ -3138,14 +3238,14 @@ glade_widget_adaptor_child_set_property (GladeWidgetAdaptor * adaptor,
g_return_if_fail (G_IS_OBJECT (container));
g_return_if_fail (G_IS_OBJECT (child));
g_return_if_fail (property_name != NULL && value != NULL);
- g_return_if_fail (g_type_is_a (G_OBJECT_TYPE (container), adaptor->type));
+ g_return_if_fail (g_type_is_a (G_OBJECT_TYPE (container), adaptor->priv->type));
if (GLADE_WIDGET_ADAPTOR_GET_CLASS (adaptor)->child_set_property)
GLADE_WIDGET_ADAPTOR_GET_CLASS
(adaptor)->child_set_property (adaptor, container, child,
property_name, value);
else
- g_critical ("No child_set_property() support in adaptor %s", adaptor->name);
+ g_critical ("No child_set_property() support in adaptor %s", adaptor->priv->name);
}
@@ -3170,14 +3270,14 @@ glade_widget_adaptor_child_get_property (GladeWidgetAdaptor * adaptor,
g_return_if_fail (G_IS_OBJECT (container));
g_return_if_fail (G_IS_OBJECT (child));
g_return_if_fail (property_name != NULL && value != NULL);
- g_return_if_fail (g_type_is_a (G_OBJECT_TYPE (container), adaptor->type));
+ g_return_if_fail (g_type_is_a (G_OBJECT_TYPE (container), adaptor->priv->type));
if (GLADE_WIDGET_ADAPTOR_GET_CLASS (adaptor)->child_get_property)
GLADE_WIDGET_ADAPTOR_GET_CLASS
(adaptor)->child_get_property (adaptor, container, child,
property_name, value);
else
- g_critical ("No child_set_property() support in adaptor %s", adaptor->name);
+ g_critical ("No child_set_property() support in adaptor %s", adaptor->priv->name);
}
/**
@@ -3208,7 +3308,7 @@ glade_widget_adaptor_child_verify_property (GladeWidgetAdaptor * adaptor,
g_return_val_if_fail (G_IS_OBJECT (container), FALSE);
g_return_val_if_fail (G_IS_OBJECT (child), FALSE);
g_return_val_if_fail (property_name != NULL && value != NULL, FALSE);
- g_return_val_if_fail (g_type_is_a (G_OBJECT_TYPE (container), adaptor->type),
+ g_return_val_if_fail (g_type_is_a (G_OBJECT_TYPE (container), adaptor->priv->type),
FALSE);
if (GLADE_WIDGET_ADAPTOR_GET_CLASS (adaptor)->child_verify_property)
@@ -3241,13 +3341,13 @@ glade_widget_adaptor_replace_child (GladeWidgetAdaptor * adaptor,
g_return_if_fail (G_IS_OBJECT (container));
g_return_if_fail (G_IS_OBJECT (old_obj));
g_return_if_fail (G_IS_OBJECT (new_obj));
- g_return_if_fail (g_type_is_a (G_OBJECT_TYPE (container), adaptor->type));
+ g_return_if_fail (g_type_is_a (G_OBJECT_TYPE (container), adaptor->priv->type));
if (GLADE_WIDGET_ADAPTOR_GET_CLASS (adaptor)->replace_child)
GLADE_WIDGET_ADAPTOR_GET_CLASS
(adaptor)->replace_child (adaptor, container, old_obj, new_obj);
else
- g_critical ("No replace_child() support in adaptor %s", adaptor->name);
+ g_critical ("No replace_child() support in adaptor %s", adaptor->priv->name);
}
/**
@@ -3265,7 +3365,7 @@ glade_widget_adaptor_query (GladeWidgetAdaptor * adaptor)
g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), FALSE);
- for (l = adaptor->properties; l; l = l->next)
+ for (l = adaptor->priv->properties; l; l = l->next)
{
pclass = l->data;
@@ -3300,7 +3400,7 @@ glade_widget_adaptor_get_packing_default (GladeWidgetAdaptor * child_adaptor,
if ((packing =
glade_widget_adaptor_get_child_packing (child_adaptor,
- container_adaptor->name)) !=
+ container_adaptor->priv->name)) !=
NULL)
{
for (l = packing->packing_defaults; l; l = l->next)
@@ -3460,7 +3560,7 @@ glade_widget_adaptor_action_add (GladeWidgetAdaptor * adaptor,
g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), FALSE);
g_return_val_if_fail (action_path != NULL, FALSE);
- return glade_widget_adaptor_action_add_real (&adaptor->actions,
+ return glade_widget_adaptor_action_add_real (&adaptor->priv->actions,
action_path,
label, stock, important);
}
@@ -3487,7 +3587,7 @@ glade_widget_adaptor_pack_action_add (GladeWidgetAdaptor * adaptor,
g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), FALSE);
g_return_val_if_fail (action_path != NULL, FALSE);
- return glade_widget_adaptor_action_add_real (&adaptor->packing_actions,
+ return glade_widget_adaptor_action_add_real (&adaptor->priv->packing_actions,
action_path,
label, stock, important);
}
@@ -3530,7 +3630,7 @@ glade_widget_adaptor_action_remove (GladeWidgetAdaptor * adaptor,
g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), FALSE);
g_return_val_if_fail (action_path != NULL, FALSE);
- return glade_widget_adaptor_action_remove_real (&adaptor->actions,
+ return glade_widget_adaptor_action_remove_real (&adaptor->priv->actions,
action_path);
}
@@ -3550,10 +3650,35 @@ glade_widget_adaptor_pack_action_remove (GladeWidgetAdaptor * adaptor,
g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), FALSE);
g_return_val_if_fail (action_path != NULL, FALSE);
- return glade_widget_adaptor_action_remove_real (&adaptor->packing_actions,
+ return glade_widget_adaptor_action_remove_real (&adaptor->priv->packing_actions,
action_path);
}
+/**
+ * glade_widget_adaptor_actions_new:
+ * @adaptor: A #GladeWidgetAdaptor
+ *
+ * Create a list of actions.
+ *
+ * Returns: a new list of GladeWidgetAction.
+ */
+GList *
+glade_widget_adaptor_actions_new (GladeWidgetAdaptor * adaptor)
+{
+ GList *l, *list = NULL;
+
+ g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL);
+
+ for (l = adaptor->priv->actions; l; l = g_list_next (l))
+ {
+ GWActionClass *action = l->data;
+ GObject *obj = g_object_new (GLADE_TYPE_WIDGET_ACTION,
+ "class", action, NULL);
+
+ list = g_list_prepend (list, GLADE_WIDGET_ACTION (obj));
+ }
+ return g_list_reverse (list);
+}
/**
* glade_widget_adaptor_pack_actions_new:
@@ -3570,7 +3695,7 @@ glade_widget_adaptor_pack_actions_new (GladeWidgetAdaptor * adaptor)
g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL);
- for (l = adaptor->packing_actions; l; l = g_list_next (l))
+ for (l = adaptor->priv->packing_actions; l; l = g_list_next (l))
{
GWActionClass *action = l->data;
GObject *obj = g_object_new (GLADE_TYPE_WIDGET_ACTION,
@@ -3596,7 +3721,7 @@ glade_widget_adaptor_action_activate (GladeWidgetAdaptor * adaptor,
{
g_return_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor));
g_return_if_fail (G_IS_OBJECT (object));
- g_return_if_fail (g_type_is_a (G_OBJECT_TYPE (object), adaptor->type));
+ g_return_if_fail (g_type_is_a (G_OBJECT_TYPE (object), adaptor->priv->type));
GLADE_WIDGET_ADAPTOR_GET_CLASS (adaptor)->action_activate (adaptor, object,
action_path);
@@ -3619,7 +3744,7 @@ glade_widget_adaptor_child_action_activate (GladeWidgetAdaptor * adaptor,
g_return_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor));
g_return_if_fail (G_IS_OBJECT (container));
g_return_if_fail (G_IS_OBJECT (object));
- g_return_if_fail (g_type_is_a (G_OBJECT_TYPE (container), adaptor->type));
+ g_return_if_fail (g_type_is_a (G_OBJECT_TYPE (container), adaptor->priv->type));
GLADE_WIDGET_ADAPTOR_GET_CLASS (adaptor)->child_action_activate (adaptor,
container,
@@ -3645,7 +3770,7 @@ glade_widget_adaptor_action_submenu (GladeWidgetAdaptor * adaptor,
{
g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL);
g_return_val_if_fail (G_IS_OBJECT (object), NULL);
- g_return_val_if_fail (g_type_is_a (G_OBJECT_TYPE (object), adaptor->type),
+ g_return_val_if_fail (g_type_is_a (G_OBJECT_TYPE (object), adaptor->priv->type),
NULL);
if (GLADE_WIDGET_ADAPTOR_GET_CLASS (adaptor)->action_submenu)
@@ -3886,7 +4011,7 @@ glade_widget_adaptor_get_signal_class (GladeWidgetAdaptor * adaptor,
g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL);
g_return_val_if_fail (name != NULL, NULL);
- for (list = adaptor->signals; list; list = list->next)
+ for (list = adaptor->priv->signals; list; list = list->next)
{
signal = list->data;
if (!strcmp (signal->name, name))
diff --git a/gladeui/glade-widget-adaptor.h b/gladeui/glade-widget-adaptor.h
index 13a86ba..751815a 100644
--- a/gladeui/glade-widget-adaptor.h
+++ b/gladeui/glade-widget-adaptor.h
@@ -30,7 +30,7 @@ typedef struct _GladeWidgetAdaptorClass GladeWidgetAdaptorClass;
* Checks whether this widget class is marked as deprecated
*/
#define GWA_DEPRECATED(obj) \
- ((obj) ? GLADE_WIDGET_ADAPTOR_GET_CLASS(obj)->deprecated : FALSE)
+ ((obj) ? GLADE_WIDGET_ADAPTOR_GET_CLASS(obj)->deprecated : FALSE)
/**
* GWA_VERSION_SINCE_MAJOR:
@@ -39,7 +39,7 @@ typedef struct _GladeWidgetAdaptorClass GladeWidgetAdaptorClass;
* Checks major version in which this widget was introduced
*/
#define GWA_VERSION_SINCE_MAJOR(obj) \
- ((obj) ? GLADE_WIDGET_ADAPTOR_GET_CLASS(obj)->version_since_major : 0)
+ ((obj) ? GLADE_WIDGET_ADAPTOR_GET_CLASS(obj)->version_since_major : 0)
/**
* GWA_VERSION_SINCE_MINOR:
@@ -48,7 +48,7 @@ typedef struct _GladeWidgetAdaptorClass GladeWidgetAdaptorClass;
* Checks minor version in which this widget was introduced
*/
#define GWA_VERSION_SINCE_MINOR(obj) \
- ((obj) ? GLADE_WIDGET_ADAPTOR_GET_CLASS(obj)->version_since_minor : 0)
+ ((obj) ? GLADE_WIDGET_ADAPTOR_GET_CLASS(obj)->version_since_minor : 0)
/**
* GWA_VERSION_CHECK:
@@ -60,9 +60,9 @@ typedef struct _GladeWidgetAdaptorClass GladeWidgetAdaptorClass;
*
*/
#define GWA_VERSION_CHECK(adaptor, major_version, minor_version) \
- ((GWA_VERSION_SINCE_MAJOR (adaptor) == major_version) ? \
- (GWA_VERSION_SINCE_MINOR (adaptor) <= minor_version) : \
- (GWA_VERSION_SINCE_MAJOR (adaptor) <= major_version))
+ ((GWA_VERSION_SINCE_MAJOR (adaptor) == major_version) ? \
+ (GWA_VERSION_SINCE_MINOR (adaptor) <= minor_version) : \
+ (GWA_VERSION_SINCE_MAJOR (adaptor) <= major_version))
/**
* GWA_IS_TOPLEVEL:
@@ -72,7 +72,7 @@ typedef struct _GladeWidgetAdaptorClass GladeWidgetAdaptorClass;
* a toplevel one.
*/
#define GWA_IS_TOPLEVEL(obj) \
- ((obj) ? GLADE_WIDGET_ADAPTOR_GET_CLASS(obj)->toplevel : FALSE)
+ ((obj) ? GLADE_WIDGET_ADAPTOR_GET_CLASS(obj)->toplevel : FALSE)
/**
* GWA_USE_PLACEHOLDERS:
@@ -82,7 +82,7 @@ typedef struct _GladeWidgetAdaptorClass GladeWidgetAdaptorClass;
* use placeholders in child widget operations
*/
#define GWA_USE_PLACEHOLDERS(obj) \
- ((obj) ? GLADE_WIDGET_ADAPTOR_GET_CLASS(obj)->use_placeholders : FALSE)
+ ((obj) ? GLADE_WIDGET_ADAPTOR_GET_CLASS(obj)->use_placeholders : FALSE)
/**
@@ -93,7 +93,7 @@ typedef struct _GladeWidgetAdaptorClass GladeWidgetAdaptorClass;
* is toplevel in the GladeDesignLayout
*/
#define GWA_DEFAULT_WIDTH(obj) \
- ((obj) ? GLADE_WIDGET_ADAPTOR_GET_CLASS(obj)->default_width : -1)
+ ((obj) ? GLADE_WIDGET_ADAPTOR_GET_CLASS(obj)->default_width : -1)
/**
@@ -104,7 +104,7 @@ typedef struct _GladeWidgetAdaptorClass GladeWidgetAdaptorClass;
* is toplevel in the GladeDesignLayout
*/
#define GWA_DEFAULT_HEIGHT(obj) \
- ((obj) ? GLADE_WIDGET_ADAPTOR_GET_CLASS(obj)->default_height : -1)
+ ((obj) ? GLADE_WIDGET_ADAPTOR_GET_CLASS(obj)->default_height : -1)
/**
@@ -113,8 +113,11 @@ typedef struct _GladeWidgetAdaptorClass GladeWidgetAdaptorClass;
*
* Checks whether this is a GtkWidgetClass with scrolling capabilities.
*/
-#define GWA_SCROLLABLE_WIDGET(obj) \
- ((obj) ? g_type_is_a (GLADE_WIDGET_ADAPTOR (obj)->type, GTK_TYPE_SCROLLABLE) : FALSE)
+#define GWA_SCROLLABLE_WIDGET(obj) \
+ ((obj) ? \
+ g_type_is_a (glade_widget_adaptor_get_object_type \
+ (GLADE_WIDGET_ADAPTOR (obj)), \
+ GTK_TYPE_SCROLLABLE) : FALSE)
/**
* GWA_GET_CLASS:
@@ -124,9 +127,9 @@ typedef struct _GladeWidgetAdaptorClass GladeWidgetAdaptorClass;
* the plugin eg. GWA_GET_CLASS (GTK_TYPE_CONTAINER)->post_create (adaptor...
*/
#define GWA_GET_CLASS(type) \
- (((type) == G_TYPE_OBJECT) ? \
- (GladeWidgetAdaptorClass *)g_type_class_peek (GLADE_TYPE_WIDGET_ADAPTOR) : \
- GLADE_WIDGET_ADAPTOR_GET_CLASS (glade_widget_adaptor_get_by_type(type)))
+ (((type) == G_TYPE_OBJECT) ? \
+ (GladeWidgetAdaptorClass *)g_type_class_peek (GLADE_TYPE_WIDGET_ADAPTOR) : \
+ GLADE_WIDGET_ADAPTOR_GET_CLASS (glade_widget_adaptor_get_by_type(type)))
/**
* GWA_GET_OCLASS:
@@ -149,9 +152,9 @@ typedef struct _GladeWidgetAdaptorClass GladeWidgetAdaptorClass;
*
*/
#define GSC_VERSION_CHECK(klass, major_version, minor_version) \
- ((GLADE_SIGNAL_CLASS (klass)->version_since_major == major_version) ? \
- (GLADE_SIGNAL_CLASS (klass)->version_since_minor <= minor_version) : \
- (GLADE_SIGNAL_CLASS (klass)->version_since_major <= major_version))
+ ((GLADE_SIGNAL_CLASS (klass)->version_since_major == major_version) ? \
+ (GLADE_SIGNAL_CLASS (klass)->version_since_minor <= minor_version) : \
+ (GLADE_SIGNAL_CLASS (klass)->version_since_major <= major_version))
#define GLADE_VALID_CREATE_REASON(reason) (reason >= 0 && reason < GLADE_CREATE_REASONS)
@@ -546,19 +549,19 @@ typedef GladeEditable *(* GladeCreateEditableFunc) (GladeWidgetAdaptor *adapto
typedef struct _GladeSignalClass GladeSignalClass;
struct _GladeSignalClass
{
- GladeWidgetAdaptor *adaptor; /* The adaptor that originated this signal.
- */
+ GladeWidgetAdaptor *adaptor; /* The adaptor that originated this signal.
+ */
- GSignalQuery query;
+ GSignalQuery query;
- guint16 version_since_major; /* Version in which this signal was
- * introduced
- */
- guint16 version_since_minor;
+ guint16 version_since_major; /* Version in which this signal was
+ * introduced
+ */
+ guint16 version_since_minor;
- const gchar *name; /* Name of the signal, eg clicked */
- const gchar *type; /* Name of the object class that this signal belongs to
- * eg GtkButton */
+ const gchar *name; /* Name of the signal, eg clicked */
+ const gchar *type; /* Name of the object class that this signal belongs to
+ * eg GtkButton */
};
@@ -569,157 +572,104 @@ struct _GladeSignalClass
*/
struct _GladeWidgetAdaptor
{
- GObject parent_instance;
-
- GType type; /* GType of the widget */
-
- GType real_type;
-
- gchar *name; /* Name of the widget, for example GtkButton */
-
-
- gchar *generic_name; /* Used to generate names of new widgets, for
- * example "button" so that we generate button1,
- * button2, buttonX ..
- */
-
- gchar *icon_name; /* icon name to use for widget class */
- gchar *missing_icon; /* the name of the missing icon if it was not found */
-
- gchar *title; /* Translated class name used in the UI */
-
- GList *properties; /* List of GladePropertyClass objects.
- * [see glade-property.h] this list contains
- * properties about the widget that we are going
- * to modify. Like "title", "label", "rows" .
- * Each property creates an input in the propety
- * editor.
- */
- GList *packing_props; /* List of GladePropertyClass objects that describe
- * properties for child objects packing definition -
- * note there may be more than one type of child supported
- * by a widget and thus they may have different sets
- * of properties for each type - this association is
- * managed on the GladePropertyClass proper.
- */
-
- GList *signals; /* List of GladeSignalClass objects */
+ GObject parent_instance;
- GList *child_packings; /* Default packing property values */
-
- GList *actions; /* A list of GWActionClass */
-
- GList *packing_actions;/* A list of GWActionClass for child objects */
-
- GladeWidgetAdaptorPrivate *priv;
+ GladeWidgetAdaptorPrivate *priv;
};
struct _GladeWidgetAdaptorClass
{
- GObjectClass parent_class;
-
- guint16 version_since_major; /* Version in which this widget was */
- guint16 version_since_minor; /* introduced. */
+ GObjectClass parent_class;
- guint deprecated : 1; /* If this widget is currently
- * deprecated
- */
- guint toplevel : 1; /* If this class is toplevel */
+ guint16 version_since_major; /* Version in which this widget was */
+ guint16 version_since_minor; /* introduced. */
- guint use_placeholders : 1; /* Whether or not to use placeholders
- * to interface with child widgets.
- */
+ gint16 default_width; /* Default width in GladeDesignLayout */
+ gint16 default_height; /* Default height in GladeDesignLayout */
- gint default_width; /* Default width in GladeDesignLayout */
- gint default_height; /* Default height in GladeDesignLayout */
-
- GladeCreateWidgetFunc create_widget; /* Creates a GladeWidget for this adaptor */
-
- GladeConstructObjectFunc construct_object; /* Object constructor
+ guint deprecated : 1; /* If this widget is currently
+ * deprecated
*/
+ guint toplevel : 1; /* If this class is toplevel */
- GladePostCreateFunc deep_post_create; /* Executed after widget creation:
- * plugins use this to setup various
- * support codes (adaptors must always
- * chain up in this stage of instantiation).
- */
-
- GladePostCreateFunc post_create; /* Executed after widget creation:
- * plugins use this to setup various
- * support codes (adaptors are free here
- * to chain up or not in this stage of
- * instantiation).
- */
-
- GladeGetInternalFunc get_internal_child; /* Retrieves the the internal child
- * of the given name.
+ guint use_placeholders : 1; /* Whether or not to use placeholders
+ * to interface with child widgets.
*/
- /* Delagate to verify if this is a valid value for this property,
- * if this function exists and returns FALSE, then glade_property_set
- * will abort before making any changes
- */
- GladeVerifyPropertyFunc verify_property;
-
- /* An optional backend function used instead of g_object_set()
- * virtual properties must be handled with this function.
- */
- GladeSetPropertyFunc set_property;
-
- /* An optional backend function used instead of g_object_get()
- * virtual properties must be handled with this function.
- *
- * Note that since glade knows what the property values are
- * at all times regardless of the objects copy, this is currently
- * only used to obtain the values of packing properties that are
- * set by the said object's parent at "container_add" time.
- */
- GladeGetPropertyFunc get_property;
-
-
- GladeAddChildFunc add; /* Adds a new child of this type */
- GladeRemoveChildFunc remove; /* Removes a child from the container */
- GladeGetChildrenFunc get_children; /* Returns a list of direct children for
- * this support type.
- */
-
-
-
- GladeChildVerifyPropertyFunc child_verify_property; /* A boundry checker for
- * packing properties
- */
- GladeChildSetPropertyFunc child_set_property; /* Sets/Gets a packing property */
- GladeChildGetPropertyFunc child_get_property; /* for this child */
-
- GladeReplaceChildFunc replace_child; /* This method replaces a
- * child widget with
- * another one: it's used to
- * replace a placeholder with
- * a widget and viceversa.
- */
-
- GladeActionActivateFunc action_activate; /* This method is used to catch actions */
- GladeChildActionActivateFunc child_action_activate; /* This method is used to catch packing actions */
-
- GladeActionSubmenuFunc action_submenu; /* Delagate function to create dynamic submenus */
- /* in action menus. */
-
- GladeDependsFunc depends; /* Periodically sort widgets in the project */
-
- GladeReadWidgetFunc read_widget; /* Reads widget attributes from xml */
+ GladeCreateWidgetFunc create_widget; /* Creates a GladeWidget for this adaptor */
+
+ GladeConstructObjectFunc construct_object; /* Object constructor
+ */
+
+ GladePostCreateFunc deep_post_create; /* Executed after widget creation:
+ * plugins use this to setup various
+ * support codes (adaptors must always
+ * chain up in this stage of instantiation).
+ */
+
+ GladePostCreateFunc post_create; /* Executed after widget creation:
+ * plugins use this to setup various
+ * support codes (adaptors are free here
+ * to chain up or not in this stage of
+ * instantiation).
+ */
+
+ GladeGetInternalFunc get_internal_child; /* Retrieves the the internal child
+ * of the given name.
+ */
+
+ /* Delagate to verify if this is a valid value for this property,
+ * if this function exists and returns FALSE, then glade_property_set
+ * will abort before making any changes
+ */
+ GladeVerifyPropertyFunc verify_property;
- GladeWriteWidgetFunc write_widget; /* Writes widget attributes to the xml */
-
- GladeReadWidgetFunc read_child; /* Reads widget attributes from xml */
+ /* An optional backend function used instead of g_object_set()
+ * virtual properties must be handled with this function.
+ */
+ GladeSetPropertyFunc set_property;
+
+ /* An optional backend function used instead of g_object_get()
+ * virtual properties must be handled with this function.
+ *
+ * Note that since glade knows what the property values are
+ * at all times regardless of the objects copy, this is currently
+ * only used to obtain the values of packing properties that are
+ * set by the said object's parent at "container_add" time.
+ */
+ GladeGetPropertyFunc get_property;
+
+ GladeAddChildFunc add; /* Adds a new child of this type */
+ GladeRemoveChildFunc remove; /* Removes a child from the container */
+ GladeGetChildrenFunc get_children; /* Returns a list of direct children for
+ * this support type.
+ */
+
+ GladeChildVerifyPropertyFunc child_verify_property; /* A boundry checker for
+ * packing properties
+ */
+ GladeChildSetPropertyFunc child_set_property; /* Sets/Gets a packing property */
+ GladeChildGetPropertyFunc child_get_property; /* for this child */
+ GladeReplaceChildFunc replace_child; /* This method replaces a
+ * child widget with
+ * another one: it's used to
+ * replace a placeholder with
+ * a widget and viceversa.
+ */
- GladeWriteWidgetFunc write_child; /* Writes widget attributes to the xml */
-
- GladeCreateEPropFunc create_eprop; /* Creates a GladeEditorProperty */
-
- GladeStringFromValueFunc string_from_value; /* Creates a string for a value */
-
- GladeCreateEditableFunc create_editable; /* Creates a page for the editor */
+ GladeActionActivateFunc action_activate; /* This method is used to catch actions */
+ GladeChildActionActivateFunc child_action_activate; /* This method is used to catch packing actions */
+ GladeActionSubmenuFunc action_submenu; /* Delagate function to create dynamic submenus
+ * in action menus. */
+ GladeDependsFunc depends; /* Periodically sort widgets in the project */
+ GladeReadWidgetFunc read_widget; /* Reads widget attributes from xml */
+ GladeWriteWidgetFunc write_widget; /* Writes widget attributes to the xml */
+ GladeReadWidgetFunc read_child; /* Reads widget attributes from xml */
+ GladeWriteWidgetFunc write_child; /* Writes widget attributes to the xml */
+ GladeCreateEPropFunc create_eprop; /* Creates a GladeEditorProperty */
+ GladeStringFromValueFunc string_from_value; /* Creates a string for a value */
+ GladeCreateEditableFunc create_editable; /* Creates a page for the editor */
};
#define glade_widget_adaptor_create_widget(adaptor, query, ...) \
@@ -729,198 +679,170 @@ struct _GladeWidgetAdaptorClass
((pclass) ? (GladeWidgetAdaptor *)((GladePropertyClass *)(pclass))->handle : NULL)
-GType glade_widget_adaptor_get_type (void) G_GNUC_CONST;
-
+GType glade_widget_adaptor_get_type (void) G_GNUC_CONST;
+GType glade_create_reason_get_type (void) G_GNUC_CONST;
-GType glade_create_reason_get_type (void) G_GNUC_CONST;
+GType glade_widget_adaptor_get_object_type (GladeWidgetAdaptor *adaptor);
+G_CONST_RETURN gchar *glade_widget_adaptor_get_name (GladeWidgetAdaptor *adaptor);
+G_CONST_RETURN gchar *glade_widget_adaptor_get_generic_name (GladeWidgetAdaptor *adaptor);
+G_CONST_RETURN gchar *glade_widget_adaptor_get_title (GladeWidgetAdaptor *adaptor);
+G_CONST_RETURN gchar *glade_widget_adaptor_get_icon_name (GladeWidgetAdaptor *adaptor);
+G_CONST_RETURN gchar *glade_widget_adaptor_get_missing_icon (GladeWidgetAdaptor *adaptor);
+G_CONST_RETURN GList *glade_widget_adaptor_get_properties (GladeWidgetAdaptor *adaptor);
+G_CONST_RETURN GList *glade_widget_adaptor_get_packing_props(GladeWidgetAdaptor *adaptor);
+G_CONST_RETURN GList *glade_widget_adaptor_get_signals (GladeWidgetAdaptor *adaptor);
-GList *glade_widget_adaptor_list_adaptors (void);
+GList *glade_widget_adaptor_list_adaptors (void);
-GladeWidgetAdaptor *glade_widget_adaptor_from_catalog (GladeCatalog *catalog,
- GladeXmlNode *class_node,
- GModule *module);
+GladeWidgetAdaptor *glade_widget_adaptor_from_catalog (GladeCatalog *catalog,
+ GladeXmlNode *class_node,
+ GModule *module);
-void glade_widget_adaptor_register (GladeWidgetAdaptor *adaptor);
+void glade_widget_adaptor_register (GladeWidgetAdaptor *adaptor);
-GladeWidget *glade_widget_adaptor_create_internal (GladeWidget *parent,
- GObject *internal_object,
- const gchar *internal_name,
- const gchar *parent_name,
- gboolean anarchist,
- GladeCreateReason reason);
-
-GladeWidget *glade_widget_adaptor_create_widget_real (gboolean query,
- const gchar *first_property,
- ...);
-
-
-GladeWidgetAdaptor *glade_widget_adaptor_get_by_name (const gchar *name);
-
-GladeWidgetAdaptor *glade_widget_adaptor_get_by_type (GType type);
-
-GladeWidgetAdaptor *glade_widget_adaptor_from_pspec (GladeWidgetAdaptor *adaptor,
- GParamSpec *spec);
-
-GladePropertyClass *glade_widget_adaptor_get_property_class (GladeWidgetAdaptor *adaptor,
- const gchar *name);
-
-GladePropertyClass *glade_widget_adaptor_get_pack_property_class (GladeWidgetAdaptor *adaptor,
- const gchar *name);
-
-GParameter *glade_widget_adaptor_default_params (GladeWidgetAdaptor *adaptor,
- gboolean construct,
- guint *n_params);
-
-GObject *glade_widget_adaptor_construct_object (GladeWidgetAdaptor *adaptor,
- guint n_parameters,
- GParameter *parameters);
-
-void glade_widget_adaptor_post_create (GladeWidgetAdaptor *adaptor,
- GObject *object,
- GladeCreateReason reason);
-
-GObject *glade_widget_adaptor_get_internal_child (GladeWidgetAdaptor *adaptor,
- GObject *object,
- const gchar *internal_name);
-
-void glade_widget_adaptor_set_property (GladeWidgetAdaptor *adaptor,
- GObject *object,
- const gchar *property_name,
- const GValue *value);
-
-void glade_widget_adaptor_get_property (GladeWidgetAdaptor *adaptor,
- GObject *object,
- const gchar *property_name,
- GValue *value);
-
-gboolean glade_widget_adaptor_verify_property (GladeWidgetAdaptor *adaptor,
- GObject *object,
- const gchar *property_name,
- const GValue *value);
-
-void glade_widget_adaptor_add (GladeWidgetAdaptor *adaptor,
- GObject *container,
- GObject *child);
-
-void glade_widget_adaptor_remove (GladeWidgetAdaptor *adaptor,
- GObject *container,
- GObject *child);
-
-GList *glade_widget_adaptor_get_children (GladeWidgetAdaptor *adaptor,
- GObject *container);
-
-gboolean glade_widget_adaptor_has_child (GladeWidgetAdaptor *adaptor,
- GObject *container,
- GObject *child);
-
-void glade_widget_adaptor_child_set_property (GladeWidgetAdaptor *adaptor,
- GObject *container,
- GObject *child,
- const gchar *property_name,
- const GValue *value);
-
-void glade_widget_adaptor_child_get_property (GladeWidgetAdaptor *adaptor,
- GObject *container,
- GObject *child,
- const gchar *property_name,
- GValue *value);
-
-gboolean glade_widget_adaptor_child_verify_property (GladeWidgetAdaptor *adaptor,
- GObject *container,
- GObject *child,
- const gchar *property_name,
- const GValue *value);
-
-void glade_widget_adaptor_replace_child (GladeWidgetAdaptor *adaptor,
- GObject *container,
- GObject *old_obj,
- GObject *new_obj);
-
-gboolean glade_widget_adaptor_query (GladeWidgetAdaptor *adaptor);
-
-G_CONST_RETURN
-gchar *glade_widget_adaptor_get_packing_default(GladeWidgetAdaptor *child_adaptor,
- GladeWidgetAdaptor *container_adaptor,
- const gchar *id);
-
-gboolean glade_widget_adaptor_is_container (GladeWidgetAdaptor *adaptor);
-
-gboolean glade_widget_adaptor_action_add (GladeWidgetAdaptor *adaptor,
- const gchar *action_path,
- const gchar *label,
- const gchar *stock,
- gboolean important);
-
-gboolean glade_widget_adaptor_pack_action_add (GladeWidgetAdaptor *adaptor,
- const gchar *action_path,
- const gchar *label,
- const gchar *stock,
- gboolean important);
-
-gboolean glade_widget_adaptor_action_remove (GladeWidgetAdaptor *adaptor,
- const gchar *action_path);
-
-gboolean glade_widget_adaptor_pack_action_remove (GladeWidgetAdaptor *adaptor,
- const gchar *action_path);
-
-GList *glade_widget_adaptor_pack_actions_new (GladeWidgetAdaptor *adaptor);
-
-void glade_widget_adaptor_action_activate (GladeWidgetAdaptor *adaptor,
- GObject *object,
- const gchar *action_path);
-
-void glade_widget_adaptor_child_action_activate (GladeWidgetAdaptor *adaptor,
- GObject *container,
- GObject *object,
- const gchar *action_path);
-
-GtkWidget *glade_widget_adaptor_action_submenu (GladeWidgetAdaptor *adaptor,
- GObject *object,
- const gchar *action_path);
-
-gboolean glade_widget_adaptor_depends (GladeWidgetAdaptor *adaptor,
- GladeWidget *widget,
- GladeWidget *another);
-
-
-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);
-
-void glade_widget_adaptor_read_child (GladeWidgetAdaptor *adaptor,
- GladeWidget *widget,
- GladeXmlNode *node);
-
-void glade_widget_adaptor_write_child (GladeWidgetAdaptor *adaptor,
- GladeWidget *widget,
- GladeXmlContext *context,
- GladeXmlNode *node);
-
-GladeEditorProperty *glade_widget_adaptor_create_eprop (GladeWidgetAdaptor *adaptor,
- GladePropertyClass *klass,
- gboolean use_command);
-
-GladeEditorProperty *glade_widget_adaptor_create_eprop_by_name (GladeWidgetAdaptor *adaptor,
- const gchar *property_id,
- gboolean packing,
- gboolean use_command);
-
-gchar *glade_widget_adaptor_string_from_value (GladeWidgetAdaptor *adaptor,
- GladePropertyClass *klass,
- const GValue *value);
-
-GladeEditable *glade_widget_adaptor_create_editable (GladeWidgetAdaptor *adaptor,
- GladeEditorPageType type);
-
-GladeSignalClass *glade_widget_adaptor_get_signal_class (GladeWidgetAdaptor *adaptor,
- const gchar *name);
-
-GladeWidgetAdaptor *glade_widget_adaptor_get_parent_adaptor (GladeWidgetAdaptor *adaptor);
+GladeWidget *glade_widget_adaptor_create_internal (GladeWidget *parent,
+ GObject *internal_object,
+ const gchar *internal_name,
+ const gchar *parent_name,
+ gboolean anarchist,
+ GladeCreateReason reason);
+
+GladeWidget *glade_widget_adaptor_create_widget_real (gboolean query,
+ const gchar *first_property,
+ ...);
+
+
+GladeWidgetAdaptor *glade_widget_adaptor_get_by_name (const gchar *name);
+GladeWidgetAdaptor *glade_widget_adaptor_get_by_type (GType type);
+GladeWidgetAdaptor *glade_widget_adaptor_from_pspec (GladeWidgetAdaptor *adaptor,
+ GParamSpec *spec);
+
+GladePropertyClass *glade_widget_adaptor_get_property_class (GladeWidgetAdaptor *adaptor,
+ const gchar *name);
+GladePropertyClass *glade_widget_adaptor_get_pack_property_class (GladeWidgetAdaptor *adaptor,
+ const gchar *name);
+
+GParameter *glade_widget_adaptor_default_params (GladeWidgetAdaptor *adaptor,
+ gboolean construct,
+ guint *n_params);
+GObject *glade_widget_adaptor_construct_object (GladeWidgetAdaptor *adaptor,
+ guint n_parameters,
+ GParameter *parameters);
+void glade_widget_adaptor_post_create (GladeWidgetAdaptor *adaptor,
+ GObject *object,
+ GladeCreateReason reason);
+GObject *glade_widget_adaptor_get_internal_child (GladeWidgetAdaptor *adaptor,
+ GObject *object,
+ const gchar *internal_name);
+void glade_widget_adaptor_set_property (GladeWidgetAdaptor *adaptor,
+ GObject *object,
+ const gchar *property_name,
+ const GValue *value);
+void glade_widget_adaptor_get_property (GladeWidgetAdaptor *adaptor,
+ GObject *object,
+ const gchar *property_name,
+ GValue *value);
+gboolean glade_widget_adaptor_verify_property (GladeWidgetAdaptor *adaptor,
+ GObject *object,
+ const gchar *property_name,
+ const GValue *value);
+void glade_widget_adaptor_add (GladeWidgetAdaptor *adaptor,
+ GObject *container,
+ GObject *child);
+void glade_widget_adaptor_remove (GladeWidgetAdaptor *adaptor,
+ GObject *container,
+ GObject *child);
+GList *glade_widget_adaptor_get_children (GladeWidgetAdaptor *adaptor,
+ GObject *container);
+gboolean glade_widget_adaptor_has_child (GladeWidgetAdaptor *adaptor,
+ GObject *container,
+ GObject *child);
+void glade_widget_adaptor_child_set_property (GladeWidgetAdaptor *adaptor,
+ GObject *container,
+ GObject *child,
+ const gchar *property_name,
+ const GValue *value);
+void glade_widget_adaptor_child_get_property (GladeWidgetAdaptor *adaptor,
+ GObject *container,
+ GObject *child,
+ const gchar *property_name,
+ GValue *value);
+gboolean glade_widget_adaptor_child_verify_property (GladeWidgetAdaptor *adaptor,
+ GObject *container,
+ GObject *child,
+ const gchar *property_name,
+ const GValue *value);
+void glade_widget_adaptor_replace_child (GladeWidgetAdaptor *adaptor,
+ GObject *container,
+ GObject *old_obj,
+ GObject *new_obj);
+gboolean glade_widget_adaptor_query (GladeWidgetAdaptor *adaptor);
+
+G_CONST_RETURN gchar *glade_widget_adaptor_get_packing_default(GladeWidgetAdaptor *child_adaptor,
+ GladeWidgetAdaptor *container_adaptor,
+ const gchar *id);
+gboolean glade_widget_adaptor_is_container (GladeWidgetAdaptor *adaptor);
+gboolean glade_widget_adaptor_action_add (GladeWidgetAdaptor *adaptor,
+ const gchar *action_path,
+ const gchar *label,
+ const gchar *stock,
+ gboolean important);
+gboolean glade_widget_adaptor_pack_action_add (GladeWidgetAdaptor *adaptor,
+ const gchar *action_path,
+ const gchar *label,
+ const gchar *stock,
+ gboolean important);
+gboolean glade_widget_adaptor_action_remove (GladeWidgetAdaptor *adaptor,
+ const gchar *action_path);
+gboolean glade_widget_adaptor_pack_action_remove (GladeWidgetAdaptor *adaptor,
+ const gchar *action_path);
+GList *glade_widget_adaptor_actions_new (GladeWidgetAdaptor *adaptor);
+GList *glade_widget_adaptor_pack_actions_new (GladeWidgetAdaptor *adaptor);
+void glade_widget_adaptor_action_activate (GladeWidgetAdaptor *adaptor,
+ GObject *object,
+ const gchar *action_path);
+void glade_widget_adaptor_child_action_activate (GladeWidgetAdaptor *adaptor,
+ GObject *container,
+ GObject *object,
+ const gchar *action_path);
+GtkWidget *glade_widget_adaptor_action_submenu (GladeWidgetAdaptor *adaptor,
+ GObject *object,
+ const gchar *action_path);
+gboolean glade_widget_adaptor_depends (GladeWidgetAdaptor *adaptor,
+ GladeWidget *widget,
+ GladeWidget *another);
+
+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);
+void glade_widget_adaptor_read_child (GladeWidgetAdaptor *adaptor,
+ GladeWidget *widget,
+ GladeXmlNode *node);
+void glade_widget_adaptor_write_child (GladeWidgetAdaptor *adaptor,
+ GladeWidget *widget,
+ GladeXmlContext *context,
+ GladeXmlNode *node);
+
+GladeEditorProperty *glade_widget_adaptor_create_eprop (GladeWidgetAdaptor *adaptor,
+ GladePropertyClass *klass,
+ gboolean use_command);
+GladeEditorProperty *glade_widget_adaptor_create_eprop_by_name (GladeWidgetAdaptor *adaptor,
+ const gchar *property_id,
+ gboolean packing,
+ gboolean use_command);
+
+gchar *glade_widget_adaptor_string_from_value (GladeWidgetAdaptor *adaptor,
+ GladePropertyClass *klass,
+ const GValue *value);
+GladeEditable *glade_widget_adaptor_create_editable (GladeWidgetAdaptor *adaptor,
+ GladeEditorPageType type);
+GladeSignalClass *glade_widget_adaptor_get_signal_class (GladeWidgetAdaptor *adaptor,
+ const gchar *name);
+GladeWidgetAdaptor *glade_widget_adaptor_get_parent_adaptor (GladeWidgetAdaptor *adaptor);
G_END_DECLS
diff --git a/gladeui/glade-widget.c b/gladeui/glade-widget.c
index 6fabbad..0653f6e 100644
--- a/gladeui/glade-widget.c
+++ b/gladeui/glade-widget.c
@@ -216,9 +216,8 @@ glade_widget_set_packing_actions (GladeWidget * widget,
widget->priv->packing_actions = NULL;
}
- if (parent->priv->adaptor->packing_actions)
- widget->priv->packing_actions =
- glade_widget_adaptor_pack_actions_new (parent->priv->adaptor);
+ widget->priv->packing_actions =
+ glade_widget_adaptor_pack_actions_new (parent->priv->adaptor);
}
static void
@@ -533,22 +532,22 @@ static GParameter *
glade_widget_template_params (GladeWidget * widget,
gboolean construct, guint * n_params)
{
- GladeWidgetAdaptor *klass;
- GArray *params;
- GObjectClass *oclass;
- GParamSpec **pspec;
- GladeProperty *glade_property;
+ GladeWidgetAdaptor *adaptor;
+ GArray *params;
+ GObjectClass *oclass;
+ GParamSpec **pspec;
+ GladeProperty *glade_property;
GladePropertyClass *pclass;
- guint n_props, i;
+ guint n_props, i;
g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
g_return_val_if_fail (n_params != NULL, NULL);
- klass = widget->priv->adaptor;
+ adaptor = widget->priv->adaptor;
/* As a slight optimization, we never unref the class
*/
- oclass = g_type_class_ref (klass->type);
+ oclass = g_type_class_ref (glade_widget_adaptor_get_object_type (adaptor));
pspec = g_object_class_list_properties (oclass, &n_props);
params = g_array_new (FALSE, FALSE, sizeof (GParameter));
@@ -583,7 +582,8 @@ glade_widget_template_params (GladeWidget * widget,
pspec[i]->value_type) == FALSE)
{
g_critical ("Type mismatch on %s property of %s",
- parameter.name, klass->name);
+ parameter.name,
+ glade_widget_adaptor_get_name (adaptor));
continue;
}
@@ -832,9 +832,11 @@ glade_widget_constructor (GType type,
}
else if (gwidget->priv->project)
gwidget->priv->name = glade_project_new_widget_name
- (gwidget->priv->project, gwidget, gwidget->priv->adaptor->generic_name);
+ (gwidget->priv->project, gwidget,
+ glade_widget_adaptor_get_generic_name (gwidget->priv->adaptor));
else
- gwidget->priv->name = g_strdup (gwidget->priv->adaptor->generic_name);
+ gwidget->priv->name =
+ g_strdup (glade_widget_adaptor_get_generic_name (gwidget->priv->adaptor));
}
if (gwidget->priv->construct_template)
@@ -1430,9 +1432,9 @@ glade_widget_set_default_packing_properties (GladeWidget * container,
GladeWidget * child)
{
GladePropertyClass *property_class;
- GList *l;
+ const GList *l;
- for (l = container->priv->adaptor->packing_props; l; l = l->next)
+ for (l = glade_widget_adaptor_get_packing_props (container->priv->adaptor); l; l = l->next)
{
const gchar *def;
GValue *value;
@@ -1854,28 +1856,12 @@ glade_widget_set_properties (GladeWidget * widget, GList * properties)
}
static void
-glade_widget_set_actions (GladeWidget * widget, GladeWidgetAdaptor * adaptor)
-{
- GList *l;
-
- for (l = adaptor->actions; l; l = g_list_next (l))
- {
- GWActionClass *action = l->data;
- GObject *obj = g_object_new (GLADE_TYPE_WIDGET_ACTION,
- "class", action, NULL);
-
- widget->priv->actions = g_list_prepend (widget->priv->actions,
- GLADE_WIDGET_ACTION (obj));
- }
- widget->priv->actions = g_list_reverse (widget->priv->actions);
-}
-
-static void
glade_widget_set_adaptor (GladeWidget * widget, GladeWidgetAdaptor * adaptor)
{
GladePropertyClass *property_class;
- GladeProperty *property;
- GList *list, *properties = NULL;
+ GladeProperty *property;
+ const GList *list;
+ GList *properties = NULL;
g_return_if_fail (GLADE_IS_WIDGET (widget));
g_return_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor));
@@ -1888,7 +1874,7 @@ glade_widget_set_adaptor (GladeWidget * widget, GladeWidgetAdaptor * adaptor)
*/
if (!widget->priv->properties)
{
- for (list = adaptor->properties; list; list = list->next)
+ for (list = glade_widget_adaptor_get_properties (adaptor); list; list = list->next)
{
property_class = GLADE_PROPERTY_CLASS (list->data);
if ((property = glade_property_new (property_class,
@@ -1903,7 +1889,7 @@ glade_widget_set_adaptor (GladeWidget * widget, GladeWidgetAdaptor * adaptor)
}
/* Create actions from adaptor */
- glade_widget_set_actions (widget, adaptor);
+ widget->priv->actions = glade_widget_adaptor_actions_new (adaptor);
}
static gboolean
@@ -1971,13 +1957,14 @@ glade_widget_create_packing_properties (GladeWidget * container,
GladeWidget * widget)
{
GladePropertyClass *property_class;
- GladeProperty *property;
- GList *list, *packing_props = NULL;
+ GladeProperty *property;
+ const GList *list;
+ GList *packing_props = NULL;
/* XXX TODO: by checking with some GladePropertyClass metadata, decide
* which packing properties go on which type of children.
*/
- for (list = container->priv->adaptor->packing_props;
+ for (list = glade_widget_adaptor_get_packing_props (container->priv->adaptor);
list && list->data; list = list->next)
{
property_class = list->data;
@@ -3423,7 +3410,7 @@ glade_widget_set_object (GladeWidget * gwidget, GObject * new_object,
g_return_if_fail (GLADE_IS_WIDGET (gwidget));
g_return_if_fail (new_object == NULL ||
g_type_is_a (G_OBJECT_TYPE (new_object),
- gwidget->priv->adaptor->type));
+ glade_widget_adaptor_get_object_type (gwidget->priv->adaptor)));
if (gwidget->priv->object == new_object)
return;
@@ -3445,7 +3432,7 @@ glade_widget_set_object (GladeWidget * gwidget, GObject * new_object,
g_object_set_qdata (G_OBJECT (new_object), glade_widget_name_quark,
gwidget);
- if (g_type_is_a (gwidget->priv->adaptor->type, GTK_TYPE_WIDGET))
+ if (g_type_is_a (glade_widget_adaptor_get_object_type (gwidget->priv->adaptor), GTK_TYPE_WIDGET))
{
/* Disable any built-in DnD
*/
@@ -3537,7 +3524,7 @@ glade_widget_set_parent (GladeWidget * widget, GladeWidget * parent)
(parent->priv->adaptor, parent->priv->object, widget->priv->object))
{
if (old_parent == NULL || widget->priv->packing_properties == NULL ||
- old_parent->priv->adaptor->type != parent->priv->adaptor->type)
+ old_parent->priv->adaptor != parent->priv->adaptor)
glade_widget_set_packing_properties (widget, parent);
else
glade_widget_sync_packing_props (widget);
@@ -3692,10 +3679,11 @@ glade_widget_has_decendant (GladeWidget * widget, GType type)
gboolean found = FALSE;
if (G_TYPE_IS_INTERFACE (type) &&
- glade_util_class_implements_interface (widget->priv->adaptor->type, type))
+ glade_util_class_implements_interface
+ (glade_widget_adaptor_get_object_type (widget->priv->adaptor), type))
return TRUE;
else if (G_TYPE_IS_INTERFACE (type) == FALSE &&
- g_type_is_a (widget->priv->adaptor->type, type))
+ g_type_is_a (glade_widget_adaptor_get_object_type (widget->priv->adaptor), type))
return TRUE;
if ((children = glade_widget_adaptor_get_children
@@ -4001,7 +3989,7 @@ glade_widget_write (GladeWidget * widget,
/* Set class and id */
glade_xml_node_set_property_string (widget_node,
GLADE_XML_TAG_CLASS,
- widget->priv->adaptor->name);
+ glade_widget_adaptor_get_name (widget->priv->adaptor));
glade_xml_node_set_property_string (widget_node,
GLADE_XML_TAG_ID, widget->priv->name);
diff --git a/plugins/gtk+/glade-accels.c b/plugins/gtk+/glade-accels.c
index 4cd5cdc..e4e8c56 100644
--- a/plugins/gtk+/glade-accels.c
+++ b/plugins/gtk+/glade-accels.c
@@ -207,20 +207,21 @@ glade_eprop_accel_populate_view (GladeEditorProperty * eprop,
GtkTreeIter iter;
GladeEpropIterTab *parent_tab;
GladeAccelInfo *info;
- GList *list, *l, *found, *accelerators;
+ GList *l, *found, *accelerators;
gchar *name, *accel_text;
+ const GList *list;
accelerators = g_value_get_boxed (glade_property_inline_value (eprop->property));
/* First make parent iters...
*/
- for (list = adaptor->signals; list; list = list->next)
+ for (list = glade_widget_adaptor_get_signals (adaptor); list; list = list->next)
{
sclass = list->data;
/* Special case for GtkAction accelerators */
- if (adaptor->type == GTK_TYPE_ACTION ||
- g_type_is_a (adaptor->type, GTK_TYPE_ACTION))
+ if (glade_widget_adaptor_get_object_type (adaptor) == GTK_TYPE_ACTION ||
+ g_type_is_a (glade_widget_adaptor_get_object_type (adaptor), GTK_TYPE_ACTION))
{
if (g_strcmp0 (sclass->type, "GtkAction") != 0 ||
g_strcmp0 (sclass->name, "activate") != 0)
@@ -251,13 +252,13 @@ glade_eprop_accel_populate_view (GladeEditorProperty * eprop,
/* Now we populate...
*/
- for (list = adaptor->signals; list; list = list->next)
+ for (list = glade_widget_adaptor_get_signals (adaptor); list; list = list->next)
{
sclass = list->data;
/* Special case for GtkAction accelerators */
- if (adaptor->type == GTK_TYPE_ACTION ||
- g_type_is_a (adaptor->type, GTK_TYPE_ACTION))
+ if (glade_widget_adaptor_get_object_type (adaptor) == GTK_TYPE_ACTION ||
+ g_type_is_a (glade_widget_adaptor_get_object_type (adaptor), GTK_TYPE_ACTION))
{
if (g_strcmp0 (sclass->type, "GtkAction") != 0 ||
g_strcmp0 (sclass->name, "activate") != 0)
@@ -303,8 +304,8 @@ glade_eprop_accel_populate_view (GladeEditorProperty * eprop,
}
/* Special case for GtkAction accelerators */
- if ((adaptor->type == GTK_TYPE_ACTION ||
- g_type_is_a (adaptor->type, GTK_TYPE_ACTION)) &&
+ if ((glade_widget_adaptor_get_object_type (adaptor) == GTK_TYPE_ACTION ||
+ g_type_is_a (glade_widget_adaptor_get_object_type (adaptor), GTK_TYPE_ACTION)) &&
g_list_length (accelerators) > 0)
continue;
@@ -346,8 +347,8 @@ accel_edited (GtkCellRendererAccel * accel,
&iter, path_string))
return;
- is_action = (adaptor->type == GTK_TYPE_ACTION ||
- g_type_is_a (adaptor->type, GTK_TYPE_ACTION));
+ is_action = (glade_widget_adaptor_get_object_type (adaptor) == GTK_TYPE_ACTION ||
+ g_type_is_a (glade_widget_adaptor_get_object_type (adaptor), GTK_TYPE_ACTION));
gtk_tree_model_get (eprop_accel->model, &iter,
ACCEL_COLUMN_KEY_ENTERED, &key_was_set, -1);
diff --git a/plugins/gtk+/glade-cell-renderer-editor.c b/plugins/gtk+/glade-cell-renderer-editor.c
index 62b3c01..f6e86b7 100644
--- a/plugins/gtk+/glade-cell-renderer-editor.c
+++ b/plugins/gtk+/glade-cell-renderer-editor.c
@@ -310,9 +310,10 @@ property_class_comp (gconstpointer a, gconstpointer b)
static GList *
get_sorted_properties (GladeWidgetAdaptor * adaptor, GladeEditorPageType type)
{
- GList *l, *list = NULL;
+ GList *list = NULL;
+ const GList *l;
- for (l = adaptor->properties; l; l = g_list_next (l))
+ for (l = glade_widget_adaptor_get_properties (adaptor); l; l = l->next)
{
GladePropertyClass *klass = l->data;
diff --git a/plugins/gtk+/glade-column-types.c b/plugins/gtk+/glade-column-types.c
index 4ac8a5c..5d6ca5d 100644
--- a/plugins/gtk+/glade-column-types.c
+++ b/plugins/gtk+/glade-column-types.c
@@ -54,15 +54,16 @@ static void
column_types_store_populate_enums_flags (GtkListStore * store, gboolean enums)
{
GtkTreeIter iter;
- GList *types = NULL, *list, *l;
+ GList *types = NULL, *list;
GList *adaptors = glade_widget_adaptor_list_adaptors ();
+ const GList *l;
for (list = adaptors; list; list = list->next)
{
GladeWidgetAdaptor *adaptor = list->data;
GladePropertyClass *pclass;
- for (l = adaptor->properties; l; l = l->next)
+ for (l = glade_widget_adaptor_get_properties (adaptor); l; l = l->next)
{
pclass = l->data;
diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c
index fc0b9e4..a3c8ae1 100644
--- a/plugins/gtk+/glade-gtk.c
+++ b/plugins/gtk+/glade-gtk.c
@@ -841,7 +841,8 @@ glade_gtk_widget_action_activate (GladeWidgetAdaptor * adaptor,
return;
glade_command_push_group (_("Adding parent %s for %s"),
- adaptor->title, glade_widget_get_name (gwidget));
+ glade_widget_adaptor_get_title (adaptor),
+ glade_widget_get_name (gwidget));
/* Record packing properties */
saved_props =
@@ -9993,11 +9994,11 @@ glade_gtk_cell_renderer_deep_post_create (GladeWidgetAdaptor * adaptor,
GladePropertyClass *pclass;
GladeProperty *property;
GladeWidget *widget;
- GList *l;
+ const GList *l;
widget = glade_widget_get_from_gobject (object);
- for (l = adaptor->properties; l; l = l->next)
+ for (l = glade_widget_adaptor_get_properties (adaptor); l; l = l->next)
{
pclass = l->data;
diff --git a/plugins/gtk+/glade-image-item-editor.c b/plugins/gtk+/glade-image-item-editor.c
index 238ac5c..6ce6156 100644
--- a/plugins/gtk+/glade-image-item-editor.c
+++ b/plugins/gtk+/glade-image-item-editor.c
@@ -274,7 +274,7 @@ custom_toggled (GtkWidget * widget, GladeImageItemEditor * item_editor)
/* Now setup default label and create image... */
property = glade_widget_get_property (item_editor->loaded_widget, "label");
- glade_command_set_property (property, adaptor->generic_name);
+ glade_command_set_property (property, glade_widget_adaptor_get_generic_name (adaptor));
property = glade_widget_get_property (item_editor->loaded_widget, "use-underline");
glade_command_set_property (property, FALSE);
diff --git a/plugins/gtk+/glade-store-editor.c b/plugins/gtk+/glade-store-editor.c
index 5924cd2..0c23466 100644
--- a/plugins/gtk+/glade-store-editor.c
+++ b/plugins/gtk+/glade-store-editor.c
@@ -203,8 +203,8 @@ glade_store_editor_new (GladeWidgetAdaptor * adaptor, GladeEditable * embed)
gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (eprop), FALSE, FALSE, 4);
- if (adaptor->type == GTK_TYPE_LIST_STORE ||
- g_type_is_a (adaptor->type, GTK_TYPE_LIST_STORE))
+ if (glade_widget_adaptor_get_object_type (adaptor) == GTK_TYPE_LIST_STORE ||
+ g_type_is_a (glade_widget_adaptor_get_object_type (adaptor), GTK_TYPE_LIST_STORE))
{
/* -------------- The data area here -------------- */
/* Label item in frame label widget on top.. */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]