[glade3] * Made GladeWidget internalize *everything* into a private data structure, 33 files changed, 1318
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade3] * Made GladeWidget internalize *everything* into a private data structure, 33 files changed, 1318
- Date: Sat, 1 Jan 2011 15:33:24 +0000 (UTC)
commit c856737cecfddcd6f92317e74c57645f0c3819ea
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Sun Jan 2 00:39:23 2011 +0900
* Made GladeWidget internalize *everything* into a private data structure,
33 files changed, 1318 insertions(+), 1230 deletions(-)
ChangeLog | 3 +
gladeui/glade-app.c | 19 +-
gladeui/glade-base-editor.c | 128 ++---
gladeui/glade-command.c | 194 +++---
gladeui/glade-editor-property.c | 47 +-
gladeui/glade-editor-table.c | 8 +-
gladeui/glade-editor.c | 47 +-
gladeui/glade-fixed.c | 59 +-
gladeui/glade-inspector.c | 2 +-
gladeui/glade-placeholder.c | 17 +-
gladeui/glade-popup.c | 51 +-
gladeui/glade-project.c | 221 +++----
gladeui/glade-property-class.c | 4 +-
gladeui/glade-property.c | 21 +-
gladeui/glade-signal-editor.c | 17 +-
gladeui/glade-utils.c | 15 +-
gladeui/glade-widget-adaptor.c | 31 +-
gladeui/glade-widget.c | 936 +++++++++++++++++------------
gladeui/glade-widget.h | 122 +---
plugins/gtk+/glade-activatable-editor.c | 36 +-
plugins/gtk+/glade-button-editor.c | 25 +-
plugins/gtk+/glade-cell-renderer-editor.c | 35 +-
plugins/gtk+/glade-entry-editor.c | 36 +-
plugins/gtk+/glade-gtk.c | 316 +++++-----
plugins/gtk+/glade-icon-factory-editor.c | 10 +-
plugins/gtk+/glade-icon-sources.c | 2 +-
plugins/gtk+/glade-image-editor.c | 17 +-
plugins/gtk+/glade-image-item-editor.c | 34 +-
plugins/gtk+/glade-label-editor.c | 27 +-
plugins/gtk+/glade-model-data.c | 4 +-
plugins/gtk+/glade-store-editor.c | 11 +-
plugins/gtk+/glade-tool-button-editor.c | 20 +-
plugins/gtk+/glade-treeview-editor.c | 27 +-
src/glade-window.c | 9 +-
34 files changed, 1321 insertions(+), 1230 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 9c06daa..812dc72 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,9 @@
* gladeui/glade-widget.[ch]: Added the "in_project" flag to GladeWidget, fixed glade_widget_rebuild
to save the previous project pointer.
+ * Made GladeWidget internalize *everything* into a private data structure,
+ 33 files changed, 1318 insertions(+), 1230 deletions(-)
+
2010-12-31 Tristan Van Berkom <tristanvb openismus com>
* gladeui/glade-project.c: Further fixing project dispose cycle, still leaking a little
diff --git a/gladeui/glade-app.c b/gladeui/glade-app.c
index b26e158..2ac9a50 100644
--- a/gladeui/glade-app.c
+++ b/gladeui/glade-app.c
@@ -1167,8 +1167,7 @@ glade_app_command_paste (GladePlaceholder * placeholder)
if (placeholder)
{
if (glade_placeholder_get_project (placeholder) == NULL ||
- glade_project_is_loading (glade_placeholder_get_project
- (placeholder)))
+ glade_project_is_loading (glade_placeholder_get_project (placeholder)))
return;
}
@@ -1186,14 +1185,14 @@ glade_app_command_paste (GladePlaceholder * placeholder)
/* Ignore parent argument if we are pasting a toplevel
*/
if (g_list_length (clipboard->selection) == 1 &&
- widget && GWA_IS_TOPLEVEL (widget->adaptor))
+ widget && GWA_IS_TOPLEVEL (glade_widget_get_adaptor (widget)))
parent = NULL;
if (parent && GLADE_IS_FIXED (parent))
fixed = GLADE_FIXED (parent);
/* Check if parent is actually a container of any sort */
- if (parent && !glade_widget_adaptor_is_container (parent->adaptor))
+ if (parent && !glade_widget_adaptor_is_container (glade_widget_get_adaptor (parent)))
{
glade_util_ui_message (glade_app_get_window (),
GLADE_UI_INFO, NULL,
@@ -1217,7 +1216,7 @@ glade_app_command_paste (GladePlaceholder * placeholder)
/* Abort operation when adding a non scrollable widget to any kind of GtkScrolledWindow. */
if (parent && widget &&
- glade_util_check_and_warn_scrollable (parent, widget->adaptor,
+ glade_util_check_and_warn_scrollable (parent, glade_widget_get_adaptor (widget),
glade_app_get_window ()))
return;
@@ -1235,7 +1234,7 @@ glade_app_command_paste (GladePlaceholder * placeholder)
{
widget = list->data;
- if (!GWA_IS_TOPLEVEL (widget->adaptor) && parent)
+ if (!GWA_IS_TOPLEVEL (glade_widget_get_adaptor (widget)) && parent)
{
/* Count placeholder relations
*/
@@ -1249,9 +1248,9 @@ glade_app_command_paste (GladePlaceholder * placeholder)
/* A GladeFixed that doesnt use placeholders can only paste one
* at a time
*/
- if (GTK_IS_WIDGET (widget->object) &&
- gtk_widget_is_toplevel (GTK_WIDGET (widget->object)) == FALSE &&
- parent && fixed && !GWA_USE_PLACEHOLDERS (parent->adaptor) &&
+ if (GTK_IS_WIDGET (glade_widget_get_object (widget)) &&
+ parent && fixed &&
+ !GWA_USE_PLACEHOLDERS (glade_widget_get_adaptor (parent)) &&
g_list_length (clipboard->selection) != 1)
{
glade_util_ui_message (glade_app_get_window (),
@@ -1263,7 +1262,7 @@ glade_app_command_paste (GladePlaceholder * placeholder)
/* Check that enough placeholders are available */
if (parent &&
- GWA_USE_PLACEHOLDERS (parent->adaptor) &&
+ GWA_USE_PLACEHOLDERS (glade_widget_get_adaptor (parent)) &&
glade_util_count_placeholders (parent) < placeholder_relations)
{
glade_util_ui_message (glade_app_get_window (),
diff --git a/gladeui/glade-base-editor.c b/gladeui/glade-base-editor.c
index 903de2c..b3eab7b 100644
--- a/gladeui/glade-base-editor.c
+++ b/gladeui/glade-base-editor.c
@@ -239,7 +239,6 @@ static void
glade_base_editor_fill_store_real (GladeBaseEditor * e,
GladeWidget * gwidget, GtkTreeIter * parent)
{
- GObject *object = glade_widget_get_object (gwidget);
GList *children, *l;
GladeWidget *gparent = NULL;
GtkTreeIter iter;
@@ -249,50 +248,45 @@ glade_base_editor_fill_store_real (GladeBaseEditor * e,
GLADE_BASE_EDITOR_GWIDGET, &gparent, -1);
- children = glade_widget_adaptor_get_children (gwidget->adaptor, object);
+ children = glade_widget_get_children (gwidget);
for (l = children; l; l = l->next)
{
- GObject *child = (GObject *) l->data;
GladeWidget *gchild;
-
- if (child && (gchild = glade_widget_get_from_gobject (child)))
- {
- gchar *type_name = NULL, *name;
-
-
- /* Have to check parents here for compatibility (could be the parenting menuitem of this menu
- * supports a menuitem...) */
- if (glade_base_editor_get_type_info (e, NULL,
- G_OBJECT_TYPE (child),
- GLADE_BASE_EDITOR_CLASS_NAME,
- &type_name, -1))
- {
- gtk_tree_store_append (GTK_TREE_STORE (e->priv->model), &iter,
- parent);
-
- name = glade_base_editor_get_display_name (e, gchild);
-
- gtk_tree_store_set (GTK_TREE_STORE (e->priv->model), &iter,
- GLADE_BASE_EDITOR_GWIDGET, gchild,
- GLADE_BASE_EDITOR_OBJECT, child,
- GLADE_BASE_EDITOR_TYPE_NAME, type_name,
- GLADE_BASE_EDITOR_NAME, name,
- GLADE_BASE_EDITOR_CHILD_TYPES,
- get_children_model_for_child_type (e,
- G_OBJECT_TYPE
- (child)),
- -1);
-
- glade_base_editor_fill_store_real (e, gchild, &iter);
-
- g_free (name);
- g_free (type_name);
- }
- else
- glade_base_editor_fill_store_real (e, gchild, parent);
-
- }
+ GObject *child = (GObject *) l->data;
+ gchar *type_name = NULL, *name;
+
+ gchild = glade_widget_get_from_gobject (child);
+
+ /* Have to check parents here for compatibility (could be the parenting menuitem of this menu
+ * supports a menuitem...) */
+ if (glade_base_editor_get_type_info (e, NULL,
+ G_OBJECT_TYPE (child),
+ GLADE_BASE_EDITOR_CLASS_NAME,
+ &type_name, -1))
+ {
+ gtk_tree_store_append (GTK_TREE_STORE (e->priv->model), &iter, parent);
+
+ name = glade_base_editor_get_display_name (e, gchild);
+
+ gtk_tree_store_set (GTK_TREE_STORE (e->priv->model), &iter,
+ GLADE_BASE_EDITOR_GWIDGET, gchild,
+ GLADE_BASE_EDITOR_OBJECT, child,
+ GLADE_BASE_EDITOR_TYPE_NAME, type_name,
+ GLADE_BASE_EDITOR_NAME, name,
+ GLADE_BASE_EDITOR_CHILD_TYPES,
+ get_children_model_for_child_type (e,
+ G_OBJECT_TYPE
+ (child)),
+ -1);
+
+ glade_base_editor_fill_store_real (e, gchild, &iter);
+
+ g_free (name);
+ g_free (type_name);
+ }
+ else
+ glade_base_editor_fill_store_real (e, gchild, parent);
}
g_list_free (children);
@@ -356,13 +350,11 @@ glade_base_editor_name_activate (GtkEntry * entry, GladeWidget * gchild)
if (text && text[0] && strcmp (glade_widget_get_name (gchild), text))
{
- g_signal_handlers_block_by_func (gchild->project,
- glade_base_editor_project_widget_name_changed,
- editor);
+ g_signal_handlers_block_by_func (glade_widget_get_project (gchild),
+ glade_base_editor_project_widget_name_changed, editor);
glade_command_set_name (gchild, text);
- g_signal_handlers_unblock_by_func (gchild->project,
- glade_base_editor_project_widget_name_changed,
- editor);
+ g_signal_handlers_unblock_by_func (glade_widget_get_project (gchild),
+ glade_base_editor_project_widget_name_changed, editor);
}
}
@@ -538,10 +530,10 @@ glade_base_editor_child_change_type (GladeBaseEditor * editor,
if (type == G_OBJECT_TYPE (child))
return;
- if (!gchild || !gchild->parent)
+ if (!gchild || !glade_widget_get_parent (gchild))
return;
- gparent = gchild->parent;
+ gparent = glade_widget_get_parent (gchild);
/* Start of glade-command */
@@ -725,8 +717,8 @@ glade_base_editor_add_child (GladeBaseEditor * editor,
GLADE_BASE_EDITOR_NAME, name,
GLADE_BASE_EDITOR_CHILD_TYPES,
get_children_model_for_type (editor,
- G_OBJECT_TYPE (gparent->
- object)), -1);
+ G_OBJECT_TYPE (glade_widget_get_object (gparent))),
+ -1);
glade_base_editor_reorder_children (editor, &new_iter);
@@ -766,12 +758,10 @@ glade_base_editor_popup (GladeBaseEditor * editor, GladeWidget * widget)
if ((model =
get_children_model_for_child_type (editor,
- G_OBJECT_TYPE (widget->object))) ==
- NULL)
+ G_OBJECT_TYPE (glade_widget_get_object (widget)))) == NULL)
model =
- get_children_model_for_type (editor,
- G_OBJECT_TYPE (editor->priv->gcontainer->
- object));
+ get_children_model_for_type (editor,
+ G_OBJECT_TYPE (glade_widget_get_object (editor->priv->gcontainer)));
g_assert (model);
@@ -808,7 +798,7 @@ glade_base_editor_popup (GladeBaseEditor * editor, GladeWidget * widget)
if ((model =
- get_children_model_for_type (editor, G_OBJECT_TYPE (widget->object))) &&
+ get_children_model_for_type (editor, G_OBJECT_TYPE (glade_widget_get_object (widget)))) &&
gtk_tree_model_get_iter_first (model, &iter))
do
{
@@ -936,7 +926,7 @@ static gboolean
glade_base_editor_is_child (GladeBaseEditor * e,
GladeWidget * gchild, gboolean valid_type)
{
- GladeWidget *gcontainer = gchild->parent;
+ GladeWidget *gcontainer = glade_widget_get_parent (gchild);
if (!gcontainer)
return FALSE;
@@ -945,7 +935,7 @@ glade_base_editor_is_child (GladeBaseEditor * e,
{
GObject *child = glade_widget_get_object (gchild);
- if (gchild->internal ||
+ if (glade_widget_get_internal (gchild) ||
glade_base_editor_get_type_info (e, NULL,
G_OBJECT_TYPE (child), -1) == FALSE)
return FALSE;
@@ -1103,7 +1093,8 @@ glade_base_editor_project_remove_widget (GladeProject * project,
}
}
- if (widget->internal && glade_base_editor_is_child (e, widget, FALSE))
+ if (glade_widget_get_internal (widget) &&
+ glade_base_editor_is_child (e, widget, FALSE))
glade_base_editor_update_properties (e);
}
@@ -1120,7 +1111,8 @@ glade_base_editor_project_add_widget (GladeProject * project,
g_idle_add (glade_base_editor_update_treeview_idle, e);
}
- if (widget->internal && glade_base_editor_is_child (e, widget, FALSE))
+ if (glade_widget_get_internal (widget) &&
+ glade_base_editor_is_child (e, widget, FALSE))
glade_base_editor_update_properties (e);
}
@@ -1298,7 +1290,7 @@ glade_base_editor_get_property (GObject * object,
switch (prop_id)
{
case PROP_CONTAINER:
- g_value_set_object (value, editor->priv->gcontainer->object);
+ g_value_set_object (value, glade_widget_get_object (editor->priv->gcontainer));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -1344,7 +1336,7 @@ glade_base_editor_change_type (GladeBaseEditor * editor,
{
GladeWidget *w = glade_widget_get_from_gobject (l->data);
- if (w && !w->internal)
+ if (w && !glade_widget_get_internal (w))
gchildren = g_list_prepend (gchildren, w);
l = g_list_next (l);
@@ -1370,7 +1362,7 @@ glade_base_editor_change_type (GladeBaseEditor * editor,
* No need to use GladeCommand here on the newly created widget,
* they just become the initial state for this object.
*/
- l = gchild->packing_properties;
+ l = glade_widget_get_packing_properties (gchild);
while (l)
{
GladeProperty *orig_prop = (GladeProperty *) l->data;
@@ -1895,8 +1887,8 @@ glade_base_editor_new (GObject * container, GladeEditable * main_editable, ...)
/* Invent one if not provided */
if (!main_editable)
main_editable =
- glade_widget_adaptor_create_editable (gcontainer->adaptor,
- GLADE_PAGE_GENERAL);
+ glade_widget_adaptor_create_editable (glade_widget_get_adaptor (gcontainer),
+ GLADE_PAGE_GENERAL);
glade_editable_load (main_editable, gcontainer);
gtk_widget_show (GTK_WIDGET (main_editable));
@@ -2004,7 +1996,7 @@ glade_base_editor_add_default_properties (GladeBaseEditor * editor,
g_return_if_fail (GLADE_IS_BASE_EDITOR (editor));
g_return_if_fail (GLADE_IS_WIDGET (gchild));
- g_return_if_fail (GLADE_IS_WIDGET (gchild->parent));
+ g_return_if_fail (GLADE_IS_WIDGET (glade_widget_get_parent (gchild)));
child = glade_widget_get_object (gchild);
@@ -2107,7 +2099,7 @@ glade_base_editor_add_editable (GladeBaseEditor * editor,
g_return_if_fail (GLADE_IS_BASE_EDITOR (editor));
g_return_if_fail (GLADE_IS_WIDGET (gchild));
- editable = glade_widget_adaptor_create_editable (gchild->adaptor, page);
+ editable = glade_widget_adaptor_create_editable (glade_widget_get_adaptor (gchild), page);
glade_editable_set_show_name (editable, FALSE);
glade_editable_load (editable, gchild);
gtk_widget_show (GTK_WIDGET (editable));
diff --git a/gladeui/glade-command.c b/gladeui/glade-command.c
index ee413f1..090ddae 100644
--- a/gladeui/glade-command.c
+++ b/gladeui/glade-command.c
@@ -587,21 +587,18 @@ glade_command_set_property_description (GladeCommandSetProperty * me)
(GLADE_WIDGET_ADAPTOR (sdata->property->klass->handle),
sdata->property->klass, sdata->new_value);
- g_assert (sdata->property->klass->name);
- g_assert (sdata->property->widget->name);
-
if (!value_name || strlen (value_name) > MAX_UNDO_MENU_ITEM_VALUE_LEN
|| strchr (value_name, '_'))
{
description = g_strdup_printf (_("Setting %s of %s"),
sdata->property->klass->name,
- sdata->property->widget->name);
+ glade_widget_get_name (sdata->property->widget));
}
else
{
description = g_strdup_printf (_("Setting %s of %s to %s"),
sdata->property->klass->name,
- sdata->property->widget->name,
+ glade_widget_get_name (sdata->property->widget),
value_name);
}
g_free (value_name);
@@ -704,7 +701,7 @@ glade_command_set_properties (GladeProperty * property,
}
va_end (vl);
- glade_command_set_properties_list (property->widget->project, list);
+ glade_command_set_properties_list (glade_widget_get_project (property->widget), list);
}
void
@@ -855,16 +852,16 @@ glade_command_set_name (GladeWidget * widget, const gchar * name)
/* Dont spam the queue with false name changes.
*/
- if (!strcmp (widget->name, name))
+ if (!strcmp (glade_widget_get_name (widget), name))
return;
me = g_object_new (GLADE_COMMAND_SET_NAME_TYPE, NULL);
cmd = GLADE_COMMAND (me);
- cmd->project = widget->project;
+ cmd->project = glade_widget_get_project (widget);
me->widget = widget;
me->name = g_strdup (name);
- me->old_name = g_strdup (widget->name);
+ me->old_name = g_strdup (glade_widget_get_name (widget));
cmd->description =
g_strdup_printf (_("Renaming %s to %s"), me->old_name, me->name);
@@ -936,15 +933,12 @@ get_all_parentless_reffed_widgets (GList * reffed, GladeWidget * widget)
if ((list = glade_widget_get_parentless_reffed_widgets (widget)) != NULL)
reffed = g_list_concat (reffed, list);
- children = glade_widget_adaptor_get_children (widget->adaptor,
- widget->object);
+ children = glade_widget_get_children (widget);
for (l = children; l; l = l->next)
{
- if ((child = glade_widget_get_from_gobject (l->data)) != NULL)
- {
- reffed = get_all_parentless_reffed_widgets (reffed, child);
- }
+ child = glade_widget_get_from_gobject (l->data);
+ reffed = get_all_parentless_reffed_widgets (reffed, child);
}
g_list_free (children);
@@ -975,6 +969,7 @@ glade_command_add (GList * widgets,
GladeCommand *cmd;
CommandData *cdata;
GladeWidget *widget = NULL;
+ GladeWidgetAdaptor *adaptor;
GList *l, *list, *children, *placeholders = NULL;
GtkWidget *child;
@@ -990,23 +985,27 @@ glade_command_add (GList * widgets,
* we make no real attempt here to recover, just g_critical() and
* fix the bugs as they pop up.
*/
- widget = GLADE_WIDGET (widgets->data);
- if (placeholder && GWA_IS_TOPLEVEL (widget->adaptor) == FALSE)
+ widget = GLADE_WIDGET (widgets->data);
+ adaptor = glade_widget_get_adaptor (widget);
+
+ if (placeholder && GWA_IS_TOPLEVEL (adaptor) == FALSE)
cmd->project = glade_placeholder_get_project (placeholder);
else
cmd->project = glade_app_get_project ();
GLADE_COMMAND (me)->description =
g_strdup_printf (_("Add %s"), g_list_length (widgets) == 1 ?
- widget->name : _("multiple"));
+ glade_widget_get_name (widget) : _("multiple"));
for (list = widgets; list && list->data; list = list->next)
{
widget = list->data;
cdata = g_new0 (CommandData, 1);
- if (widget->internal)
+ if (glade_widget_get_internal (widget))
g_critical ("Internal widget in Add");
+ adaptor = glade_widget_get_adaptor (widget);
+
/* Widget */
cdata->widget = g_object_ref (G_OBJECT (widget));
@@ -1018,9 +1017,9 @@ glade_command_add (GList * widgets,
/* Parent */
if (parent == NULL)
cdata->parent = glade_widget_get_parent (widget);
- else if (placeholder && GWA_IS_TOPLEVEL (widget->adaptor) == FALSE)
+ else if (placeholder && GWA_IS_TOPLEVEL (adaptor) == FALSE)
cdata->parent = glade_placeholder_get_parent (placeholder);
- else if (GWA_IS_TOPLEVEL (widget->adaptor) == FALSE)
+ else if (GWA_IS_TOPLEVEL (adaptor) == FALSE)
cdata->parent = parent;
/* Placeholder */
@@ -1031,29 +1030,30 @@ glade_command_add (GList * widgets,
else if (cdata->parent &&
glade_widget_placeholder_relation (cdata->parent, widget))
{
- GtkContainer *cont = GTK_CONTAINER (cdata->parent->object);
+ GtkContainer *cont = GTK_CONTAINER (glade_widget_get_object (cdata->parent));
child = glade_util_get_placeholder_from_pointer (cont);
+
if (child && g_list_find (placeholders, child) == NULL)
{
placeholders = g_list_append (placeholders, child);
glade_command_placeholder_connect
(cdata, GLADE_PLACEHOLDER (child));
}
- else if ((children = glade_widget_adaptor_get_children
- (cdata->parent->adaptor, cdata->parent->object)) != NULL)
+ else if ((children =
+ glade_widget_adaptor_get_children (glade_widget_get_adaptor (cdata->parent),
+ glade_widget_get_object (cdata->parent))) != NULL)
{
for (l = children; l && l->data; l = l->next)
{
child = l->data;
/* Find a placeholder for this child */
- if (GLADE_IS_PLACEHOLDER (child) &&
- g_list_find (placeholders, child) == NULL)
+ if (GLADE_IS_PLACEHOLDER (child) &&
+ g_list_find (placeholders, child) == NULL)
{
placeholders = g_list_append (placeholders, child);
- glade_command_placeholder_connect
- (cdata, GLADE_PLACEHOLDER (child));
+ glade_command_placeholder_connect (cdata, GLADE_PLACEHOLDER (child));
break;
}
}
@@ -1083,12 +1083,15 @@ static void
glade_command_delete_prop_refs (GladeWidget * widget)
{
GladeProperty *property;
+ GList *refs, *l;
- while (widget->prop_refs)
+ refs = glade_widget_list_prop_refs (widget);
+ for (l = refs; l; l = l->next)
{
- property = GLADE_PROPERTY (widget->prop_refs->data);
+ property = l->data;
glade_command_set_property (property, NULL);
}
+ g_list_free (refs);
}
static void glade_command_remove (GList * widgets);
@@ -1099,9 +1102,9 @@ glade_command_remove_locked (GladeWidget * widget, GList * reffed)
GList list = { 0, }, *widgets, *l;
GladeWidget *locked;
- widgets = g_list_copy (widget->locked_widgets);
+ widgets = glade_widget_list_locked_widgets (widget);
- for (l = widget->locked_widgets; l; l = l->next)
+ for (l = widgets; l; l = l->next)
{
locked = l->data;
list.data = locked;
@@ -1128,6 +1131,7 @@ glade_command_remove (GList * widgets)
{
GladeCommandAddRemove *me;
GladeWidget *widget = NULL;
+ GladeWidget *lock;
CommandData *cdata;
GtkWidget *placeholder;
GList *list, *l;
@@ -1142,7 +1146,9 @@ glade_command_remove (GList * widgets)
for (list = widgets; list && list->data; list = list->next)
{
widget = list->data;
- if (widget->internal)
+ lock = glade_widget_get_locker (widget);
+
+ if (glade_widget_get_internal (widget))
{
glade_util_ui_message (glade_app_get_window (),
GLADE_UI_WARN, NULL,
@@ -1150,13 +1156,14 @@ glade_command_remove (GList * widgets)
("You cannot remove a widget internal to a composite widget."));
return;
}
- if (widget->lock)
+ else if (lock)
{
glade_util_ui_message (glade_app_get_window (),
GLADE_UI_WARN, NULL,
_("%s is locked by %s, edit %s first."),
- widget->name, widget->lock->name,
- widget->lock->name);
+ glade_widget_get_name (widget),
+ glade_widget_get_name (lock),
+ glade_widget_get_name (lock));
return;
}
}
@@ -1166,7 +1173,7 @@ glade_command_remove (GList * widgets)
if (g_list_length (widgets) == 1)
glade_command_push_group (_("Remove %s"),
- GLADE_WIDGET (widgets->data)->name);
+ glade_widget_get_name (GLADE_WIDGET (widgets->data)));
else
glade_command_push_group (_("Remove multiple"));
@@ -1188,12 +1195,6 @@ glade_command_remove (GList * widgets)
/* Undoably unlock and remove any widgets locked by this widget */
glade_command_remove_locked (widget, cdata->reffed);
- if (widget->internal)
- g_critical ("Internal widget in Remove");
-
- if (widget->lock)
- g_critical ("Locked widget in Remove");
-
if (cdata->parent != NULL &&
glade_widget_placeholder_relation (cdata->parent, cdata->widget))
{
@@ -1211,7 +1212,7 @@ glade_command_remove (GList * widgets)
/* Record packing props if not deleted from the clipboard */
if (me->from_clipboard == FALSE)
{
- for (l = widget->packing_properties; l; l = l->next)
+ for (l = glade_widget_get_packing_properties (widget); l; l = l->next)
cdata->pack_props =
g_list_prepend (cdata->pack_props,
glade_property_dup (GLADE_PROPERTY (l->data),
@@ -1276,12 +1277,12 @@ glade_command_add_execute (GladeCommandAddRemove * me)
if (cdata->props_recorded == FALSE)
{
/* Clear it the first time */
- g_object_set_data (cdata->widget->object,
+ g_object_set_data (glade_widget_get_object (cdata->widget),
"special-child-type", NULL);
}
else
{
- g_object_set_data_full (cdata->widget->object,
+ g_object_set_data_full (glade_widget_get_object (cdata->widget),
"special-child-type",
g_strdup (cdata->special_type),
g_free);
@@ -1292,12 +1293,10 @@ glade_command_add_execute (GladeCommandAddRemove * me)
*/
saved_props =
glade_widget_dup_properties (cdata->widget,
- cdata->widget->
- packing_properties, FALSE,
- FALSE, FALSE);
+ glade_widget_get_packing_properties (cdata->widget),
+ FALSE, FALSE, FALSE);
- glade_widget_set_packing_properties (cdata->widget,
- cdata->parent);
+ glade_widget_set_packing_properties (cdata->widget, cdata->parent);
}
/* glade_command_paste ganauntees that if
@@ -1306,9 +1305,9 @@ glade_command_add_execute (GladeCommandAddRemove * me)
*/
if (cdata->placeholder)
{
- glade_widget_replace
- (cdata->parent,
- G_OBJECT (cdata->placeholder), cdata->widget->object);
+ glade_widget_replace (cdata->parent,
+ G_OBJECT (cdata->placeholder),
+ glade_widget_get_object (cdata->widget));
}
else
{
@@ -1317,7 +1316,6 @@ glade_command_add_execute (GladeCommandAddRemove * me)
cdata->props_recorded == FALSE);
}
-
glade_command_transfer_props (cdata->widget, saved_props);
if (saved_props)
@@ -1350,17 +1348,15 @@ glade_command_add_execute (GladeCommandAddRemove * me)
* Otherwise this recorded marker was set when cutting
*/
g_assert (cdata->pack_props == NULL);
- for (l = cdata->widget->packing_properties; l; l = l->next)
- cdata->pack_props =
- g_list_prepend
- (cdata->pack_props,
- glade_property_dup
- (GLADE_PROPERTY (l->data), cdata->widget));
-
+ for (l = glade_widget_get_packing_properties (cdata->widget); l; l = l->next)
+ cdata->pack_props =
+ g_list_prepend (cdata->pack_props,
+ glade_property_dup (GLADE_PROPERTY (l->data),
+ cdata->widget));
/* Record the special-type here after replacing */
if ((special_child_type =
- g_object_get_data (cdata->widget->object,
+ g_object_get_data (glade_widget_get_object (cdata->widget),
"special-child-type")) != NULL)
{
g_free (cdata->special_type);
@@ -1372,16 +1368,17 @@ glade_command_add_execute (GladeCommandAddRemove * me)
}
}
- glade_project_add_object (GLADE_COMMAND (me)->project, NULL, cdata->widget->object);
+ glade_project_add_object (GLADE_COMMAND (me)->project, NULL,
+ glade_widget_get_object (cdata->widget));
for (l = cdata->reffed; l; l = l->next)
{
GladeWidget *reffed = l->data;
glade_project_add_object (GLADE_COMMAND (me)->project, NULL,
- reffed->object);
+ glade_widget_get_object (reffed));
}
- glade_app_selection_add (cdata->widget->object, FALSE);
+ glade_app_selection_add (glade_widget_get_object (cdata->widget), FALSE);
glade_widget_show (cdata->widget);
}
@@ -1404,19 +1401,19 @@ glade_command_remove_execute (GladeCommandAddRemove * me)
glade_widget_hide (cdata->widget);
glade_project_remove_object (GLADE_COMMAND (me)->project,
- cdata->widget->object);
+ glade_widget_get_object (cdata->widget));
for (l = cdata->reffed; l; l = l->next)
{
reffed = l->data;
glade_project_remove_object (GLADE_COMMAND (me)->project,
- reffed->object);
+ glade_widget_get_object (reffed));
}
if (cdata->parent)
{
if (cdata->placeholder)
- glade_widget_replace (cdata->parent, cdata->widget->object,
+ glade_widget_replace (cdata->parent, glade_widget_get_object (cdata->widget),
G_OBJECT (cdata->placeholder));
else
glade_widget_remove_child (cdata->parent, cdata->widget);
@@ -1544,19 +1541,17 @@ glade_command_clipboard_add_remove_common (GList * widgets, gboolean add)
{
if (g_list_length (widgets) == 1)
GLADE_COMMAND (me)->description =
- g_strdup_printf (_("Clipboard add %s"), widget->name);
+ g_strdup_printf (_("Clipboard add %s"), glade_widget_get_name (widget));
else
- GLADE_COMMAND (me)->description =
- g_strdup (_("Clipboard add multiple"));
+ GLADE_COMMAND (me)->description = g_strdup (_("Clipboard add multiple"));
}
else
{
if (g_list_length (widgets) == 1)
GLADE_COMMAND (me)->description =
- g_strdup_printf (_("Clipboard remove %s"), widget->name);
+ g_strdup_printf (_("Clipboard remove %s"), glade_widget_get_name (widget));
else
- GLADE_COMMAND (me)->description =
- g_strdup (_("Clipboard remove multiple"));
+ GLADE_COMMAND (me)->description = g_strdup (_("Clipboard remove multiple"));
}
glade_command_check_group (GLADE_COMMAND (me));
@@ -1711,7 +1706,7 @@ glade_command_create (GladeWidgetAdaptor * adaptor, GladeWidget * parent,
return NULL;
}
widgets = g_list_prepend (widgets, widget);
- glade_command_push_group (_("Create %s"), widget->name);
+ glade_command_push_group (_("Create %s"), glade_widget_get_name (widget));
glade_command_add (widgets, parent, placeholder, FALSE);
glade_command_pop_group ();
@@ -1735,8 +1730,8 @@ glade_command_delete (GList * widgets)
widget = widgets->data;
glade_command_push_group (_("Delete %s"),
- g_list_length (widgets) ==
- 1 ? widget->name : _("multiple"));
+ g_list_length (widgets) == 1 ?
+ glade_widget_get_name (widget) : _("multiple"));
glade_command_remove (widgets);
glade_command_pop_group ();
}
@@ -1761,8 +1756,8 @@ glade_command_cut (GList * widgets)
widget = widgets->data;
glade_command_push_group (_("Cut %s"),
- g_list_length (widgets) ==
- 1 ? widget->name : _("multiple"));
+ g_list_length (widgets) == 1 ?
+ glade_widget_get_name (widget) : _("multiple"));
glade_command_remove (widgets);
glade_command_clipboard_add (widgets);
glade_command_pop_group ();
@@ -1788,8 +1783,8 @@ glade_command_copy (GList * widgets)
copied_widgets = g_list_prepend (copied_widgets, copied_widget);
}
glade_command_push_group (_("Copy %s"),
- g_list_length (widgets) ==
- 1 ? copied_widget->name : _("multiple"));
+ g_list_length (widgets) == 1 ?
+ glade_widget_get_name (copied_widget) : _("multiple"));
glade_command_clipboard_add (copied_widgets);
glade_command_pop_group ();
@@ -1890,8 +1885,8 @@ glade_command_paste (GList * widgets, GladeWidget * parent,
}
glade_command_push_group (_("Paste %s"),
- g_list_length (widgets) ==
- 1 ? copied_widget->name : _("multiple"));
+ g_list_length (widgets) == 1 ?
+ glade_widget_get_name (copied_widget) : _("multiple"));
glade_command_add (copied_widgets, parent, placeholder, TRUE);
glade_command_pop_group ();
@@ -1920,9 +1915,9 @@ glade_command_dnd (GList * widgets, GladeWidget * parent,
widget = widgets->data;
glade_command_push_group (_("Drag-n-Drop from %s to %s"),
- parent->name,
- g_list_length (widgets) ==
- 1 ? widget->name : _("multiple"));
+ glade_widget_get_name (parent),
+ g_list_length (widgets) == 1 ?
+ glade_widget_get_name (widget) : _("multiple"));
glade_command_remove (widgets);
glade_command_add (widgets, parent, placeholder, TRUE);
glade_command_pop_group ();
@@ -2037,7 +2032,7 @@ glade_command_add_remove_change_signal (GladeWidget * glade_widget,
/* we can only add/remove a signal to a widget that has been wrapped by a GladeWidget */
g_assert (glade_widget != NULL);
- g_assert (glade_widget->project != NULL);
+ g_assert (glade_widget_get_project (glade_widget) != NULL);
me->widget = g_object_ref (glade_widget);
me->type = type;
@@ -2264,7 +2259,7 @@ glade_command_set_i18n (GladeProperty * property,
me->old_context = g_strdup (property->i18n_context);
me->old_comment = g_strdup (property->i18n_comment);
- GLADE_COMMAND (me)->project = property->widget->project;
+ GLADE_COMMAND (me)->project = glade_widget_get_project (property->widget);
GLADE_COMMAND (me)->description =
g_strdup_printf (_("Setting i18n metadata"));;
@@ -2272,13 +2267,9 @@ glade_command_set_i18n (GladeProperty * property,
/* execute the command and push it on the stack if successful */
if (glade_command_set_i18n_execute (GLADE_COMMAND (me)))
- {
- glade_project_push_undo (GLADE_COMMAND (me)->project, GLADE_COMMAND (me));
- }
+ glade_project_push_undo (GLADE_COMMAND (me)->project, GLADE_COMMAND (me));
else
- {
- g_object_unref (G_OBJECT (me));
- }
+ g_object_unref (G_OBJECT (me));
}
@@ -2514,7 +2505,7 @@ glade_command_lock_widget (GladeWidget * widget, GladeWidget * locked)
g_return_if_fail (GLADE_IS_WIDGET (widget));
g_return_if_fail (GLADE_IS_WIDGET (locked));
- g_return_if_fail (locked->lock == NULL);
+ g_return_if_fail (glade_widget_get_locker (locked) == NULL);
/* load up the command */
me = g_object_new (GLADE_COMMAND_LOCK_TYPE, NULL);
@@ -2524,8 +2515,9 @@ glade_command_lock_widget (GladeWidget * widget, GladeWidget * locked)
GLADE_COMMAND (me)->project = glade_widget_get_project (widget);
GLADE_COMMAND (me)->description =
- g_strdup_printf (_("Locking %s by widget %s"), locked->name,
- widget->name);
+ g_strdup_printf (_("Locking %s by widget %s"),
+ glade_widget_get_name (locked),
+ glade_widget_get_name (widget));
glade_command_check_group (GLADE_COMMAND (me));
@@ -2554,17 +2546,17 @@ glade_command_unlock_widget (GladeWidget * widget)
GladeCommandLock *me;
g_return_if_fail (GLADE_IS_WIDGET (widget));
- g_return_if_fail (GLADE_IS_WIDGET (widget->lock));
+ g_return_if_fail (GLADE_IS_WIDGET (glade_widget_get_locker (widget)));
/* load up the command */
me = g_object_new (GLADE_COMMAND_LOCK_TYPE, NULL);
- me->widget = g_object_ref (widget->lock);
+ me->widget = g_object_ref (glade_widget_get_locker (widget));
me->locked = g_object_ref (widget);
me->locking = FALSE;
GLADE_COMMAND (me)->project = glade_widget_get_project (widget);
GLADE_COMMAND (me)->description =
- g_strdup_printf (_("Unlocking %s"), widget->name);
+ g_strdup_printf (_("Unlocking %s"), glade_widget_get_name (widget));
glade_command_check_group (GLADE_COMMAND (me));
diff --git a/gladeui/glade-editor-property.c b/gladeui/glade-editor-property.c
index 8eeff62..9fb9b1d 100644
--- a/gladeui/glade-editor-property.c
+++ b/gladeui/glade-editor-property.c
@@ -1532,7 +1532,8 @@ glade_eprop_text_changed_common (GladeEditorProperty * eprop,
{
val = glade_property_class_make_gvalue_from_string
(eprop->property->klass, text,
- eprop->property->widget->project, eprop->property->widget);
+ glade_widget_get_project (eprop->property->widget),
+ eprop->property->widget);
}
else
{
@@ -1896,7 +1897,7 @@ static void
glade_eprop_text_show_resource_dialog (GtkWidget * entry,
GladeEditorProperty * eprop)
{
- GladeProject *project = eprop->property->widget->project;
+ GladeProject *project = glade_widget_get_project (eprop->property->widget);
gchar *text = NULL;
if (glade_editor_property_show_resource_dialog (project, entry, &text))
@@ -2380,21 +2381,22 @@ glade_eprop_object_populate_view_real (GtkTreeStore * model,
for (list = widgets; list; list = list->next)
{
GladeWidget *widget;
+ GladeWidgetAdaptor *adaptor;
if ((widget = glade_widget_get_from_gobject (list->data)) != NULL)
{
+ adaptor = glade_widget_get_adaptor (widget);
has_decendant = !parentless && glade_widget_has_decendant
(widget, object_type);
- good_type = (widget->adaptor->type == object_type ||
- g_type_is_a (widget->adaptor->type, object_type) ||
- glade_util_class_implements_interface (widget->adaptor->
- type,
+ good_type = (adaptor->type == object_type ||
+ g_type_is_a (adaptor->type, object_type) ||
+ glade_util_class_implements_interface (adaptor->type,
object_type));
if (parentless)
- good_type = good_type && !GWA_IS_TOPLEVEL (widget->adaptor);
+ good_type = good_type && !GWA_IS_TOPLEVEL (adaptor);
if (good_type || has_decendant)
{
@@ -2403,8 +2405,8 @@ glade_eprop_object_populate_view_real (GtkTreeStore * model,
(model, &iter,
OBJ_COLUMN_WIDGET, widget,
OBJ_COLUMN_WIDGET_NAME,
- glade_eprop_object_name (widget->name, model, parent_iter),
- OBJ_COLUMN_WIDGET_CLASS, widget->adaptor->title,
+ glade_eprop_object_name (glade_widget_get_name (widget), model, parent_iter),
+ OBJ_COLUMN_WIDGET_CLASS, adaptor->title,
/* Selectable if its a compatible type and
* its not itself.
*/
@@ -2416,7 +2418,7 @@ glade_eprop_object_populate_view_real (GtkTreeStore * model,
if (has_decendant &&
(children = glade_widget_adaptor_get_children
- (widget->adaptor, widget->object)) != NULL)
+ (adaptor, glade_widget_get_object (widget))) != NULL)
{
GtkTreeIter *copy = NULL;
@@ -2451,7 +2453,7 @@ glade_eprop_object_populate_view (GladeProject * project,
GladeWidget *gwidget = glade_widget_get_from_gobject (object);
g_assert (gwidget);
- if (gwidget->parent == NULL)
+ if (glade_widget_get_parent (gwidget) == NULL)
toplevels = g_list_append (toplevels, object);
}
@@ -2863,11 +2865,13 @@ glade_eprop_object_show_dialog (GtkWidget * dialog_button,
{
GValue *value;
- glade_project_selection_set (project, eprop->property->widget->object,
+ glade_project_selection_set (project,
+ glade_widget_get_object (eprop->property->widget),
TRUE);
value = glade_property_class_make_gvalue_from_string
- (eprop->klass, selected->name, project, eprop->property->widget);
+ (eprop->klass, glade_widget_get_name (selected),
+ project, eprop->property->widget);
/* Unparent the widget so we can reuse it for this property */
if (eprop->klass->parentless_widget)
@@ -2891,10 +2895,9 @@ glade_eprop_object_show_dialog (GtkWidget * dialog_button,
glade_widget_get_parentless_widget_ref (new_widget)))
{
glade_command_push_group (_("Setting %s of %s to %s"),
- eprop->property->klass->
- name,
- eprop->property->widget->
- name, new_widget->name);
+ eprop->property->klass->name,
+ glade_widget_get_name (eprop->property->widget),
+ glade_widget_get_name (new_widget));
glade_command_set_property (old_ref, NULL);
glade_editor_property_commit (eprop, value);
glade_command_pop_group ();
@@ -2920,17 +2923,16 @@ glade_eprop_object_show_dialog (GtkWidget * dialog_button,
glade_command_push_group (_("Creating %s for %s of %s"),
create_adaptor->name,
eprop->property->klass->name,
- eprop->property->widget->name);
+ glade_widget_get_name (eprop->property->widget));
/* Dont bother if the user canceled the widget */
if ((new_widget =
glade_command_create (create_adaptor, NULL, NULL, project)) != NULL)
{
- glade_project_selection_set (project, eprop->property->widget->object,
- TRUE);
+ glade_project_selection_set (project, glade_widget_get_object (eprop->property->widget), TRUE);
value = glade_property_class_make_gvalue_from_string
- (eprop->klass, new_widget->name, project, NULL);
+ (eprop->klass, glade_widget_get_name (new_widget), project, NULL);
glade_editor_property_commit (eprop, value);
@@ -3064,7 +3066,8 @@ glade_eprop_objects_selected_widget (GtkTreeModel * model,
if (selected)
{
- *ret = g_list_append (*ret, widget->object);
+ *ret = g_list_append (*ret, glade_widget_get_object (widget));
+ g_object_unref (widget);
}
return FALSE;
diff --git a/gladeui/glade-editor-table.c b/gladeui/glade-editor-table.c
index de91f5c..ceec20e 100644
--- a/gladeui/glade-editor-table.c
+++ b/gladeui/glade-editor-table.c
@@ -137,7 +137,8 @@ widget_name_edited (GtkWidget * editable, GladeEditorTable * table)
widget = table->loaded_widget;
new_name = gtk_editable_get_chars (GTK_EDITABLE (editable), 0, -1);
- if (glade_project_available_widget_name (widget->project, widget, new_name))
+ if (glade_project_available_widget_name (glade_widget_get_project (widget),
+ widget, new_name))
glade_command_set_name (widget, new_name);
g_free (new_name);
}
@@ -153,7 +154,7 @@ widget_name_changed (GladeWidget * widget,
{
BLOCK_NAME_ENTRY_CB (table);
gtk_entry_set_text (GTK_ENTRY (table->name_entry),
- table->loaded_widget->name);
+ glade_widget_get_name (table->loaded_widget));
UNBLOCK_NAME_ENTRY_CB (table);
}
@@ -204,7 +205,8 @@ glade_editor_table_load (GladeEditable * editable, GladeWidget * widget)
(GWeakNotify) widget_finalized, table);
if (table->name_entry)
- gtk_entry_set_text (GTK_ENTRY (table->name_entry), widget->name);
+ gtk_entry_set_text (GTK_ENTRY (table->name_entry),
+ glade_widget_get_name (widget));
}
else if (table->name_entry)
diff --git a/gladeui/glade-editor.c b/gladeui/glade-editor.c
index 0068eca..880ebde 100644
--- a/gladeui/glade-editor.c
+++ b/gladeui/glade-editor.c
@@ -254,9 +254,9 @@ glade_editor_on_docs_click (GtkButton * button, GladeEditor * editor)
if (editor->loaded_widget)
{
- g_object_get (editor->loaded_widget->adaptor, "book", &book, NULL);
+ g_object_get (editor->loaded_adaptor, "book", &book, NULL);
glade_editor_search_doc_search (editor, book,
- editor->loaded_widget->adaptor->name,
+ editor->loaded_adaptor->name,
NULL);
g_free (book);
}
@@ -308,12 +308,12 @@ static void
glade_editor_update_class_warning_cb (GladeWidget * widget,
GParamSpec * pspec, GladeEditor * editor)
{
- if (widget->support_warning)
+ if (glade_widget_support_warning (widget))
gtk_widget_show (editor->warning);
else
gtk_widget_hide (editor->warning);
- gtk_widget_set_tooltip_text (editor->warning, widget->support_warning);
+ gtk_widget_set_tooltip_text (editor->warning, glade_widget_support_warning (widget));
}
@@ -326,14 +326,15 @@ glade_editor_update_class_field (GladeEditor * editor)
gchar *text;
gtk_image_set_from_icon_name (GTK_IMAGE (editor->class_icon),
- widget->adaptor->icon_name,
+ editor->loaded_adaptor->icon_name,
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]"),
- widget->adaptor->title,
- widget->adaptor->name, widget->name);
+ editor->loaded_adaptor->title,
+ editor->loaded_adaptor->name,
+ glade_widget_get_name (widget));
gtk_label_set_text (GTK_LABEL (editor->class_label), text);
g_free (text);
@@ -644,21 +645,24 @@ static void
glade_editor_load_editable (GladeEditor * editor,
GladeWidget * widget, GladeEditorPageType type)
{
- GtkWidget *editable;
+ GtkWidget *editable;
+ GladeWidget *parent = glade_widget_get_parent (widget);
/* Use the parenting adaptor for packing pages... so deffer creating the widgets
* until load time.
*/
- if (type == GLADE_PAGE_PACKING && widget->parent)
+ if (type == GLADE_PAGE_PACKING && parent)
{
- GladeWidgetAdaptor *adaptor = widget->parent->adaptor;
+ GladeWidgetAdaptor *adaptor = glade_widget_get_adaptor (parent);
editable =
glade_editor_load_editable_in_page (editor, adaptor,
GLADE_PAGE_PACKING);
}
else
- editable = glade_editor_get_editable_by_adaptor
- (editor, widget->adaptor, type);
+ editable =
+ glade_editor_get_editable_by_adaptor (editor,
+ glade_widget_get_adaptor (widget),
+ type);
g_assert (editable);
@@ -711,7 +715,7 @@ glade_editor_load_widget_real (GladeEditor * editor, GladeWidget * widget)
}
/* Load the GladeWidgetClass */
- adaptor = widget ? widget->adaptor : NULL;
+ adaptor = widget ? glade_widget_get_adaptor (widget) : NULL;
if (editor->loaded_adaptor != adaptor || adaptor == NULL)
glade_editor_load_widget_class (editor, adaptor);
@@ -823,19 +827,23 @@ query_dialog_style_set_cb (GtkWidget * dialog,
gboolean
glade_editor_query_dialog (GladeEditor * editor, GladeWidget * widget)
{
+ GladeWidgetAdaptor *adaptor;
GtkWidget *dialog, *editable, *content_area;
gchar *title;
gint answer;
gboolean retval = TRUE;
- title = g_strdup_printf (_("Create a %s"), widget->adaptor->name);
+ g_return_val_if_fail (GLADE_IS_EDITOR (editor), FALSE);
+ g_return_val_if_fail (GLADE_IS_WIDGET (widget), FALSE);
+
+ adaptor = glade_widget_get_adaptor (widget);
+ title = g_strdup_printf (_("Create a %s"), adaptor->name);
dialog = gtk_dialog_new_with_buttons (title, NULL,
GTK_DIALOG_MODAL |
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
-
g_free (title);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
@@ -843,9 +851,7 @@ glade_editor_query_dialog (GladeEditor * editor, GladeWidget * widget)
GTK_RESPONSE_CANCEL, -1);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
- editable = glade_editor_get_editable_by_adaptor (editor,
- widget->adaptor,
- GLADE_PAGE_QUERY);
+ editable = glade_editor_get_editable_by_adaptor (editor, adaptor, GLADE_PAGE_QUERY);
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
gtk_box_pack_start (GTK_BOX (content_area), editable, FALSE, FALSE, 6);
@@ -1004,7 +1010,7 @@ glade_editor_populate_reset_view (GladeEditor * editor, GtkTreeView * tree_view)
COLUMN_DEFAULT, FALSE, COLUMN_NDEFAULT, FALSE, -1);
/* General & Common */
- for (list = editor->loaded_widget->properties; list; list = list->next)
+ for (list = glade_widget_get_properties (editor->loaded_widget); list; list = list->next)
{
property = list->data;
@@ -1324,14 +1330,13 @@ glade_editor_dialog_for_widget (GladeWidget * widget)
GtkWidget *window, *editor;
gchar *title, *prj_name;
-
g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
/* Window */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_type_hint (GTK_WINDOW (window), GDK_WINDOW_TYPE_HINT_DIALOG);
- prj_name = glade_project_get_name (widget->project);
+ prj_name = glade_project_get_name (glade_widget_get_project (widget));
/* Translators: first %s is the project name, second is a widget name */
title = g_strdup_printf (_("%s - %s Properties"), prj_name,
glade_widget_get_name (widget));
diff --git a/gladeui/glade-fixed.c b/gladeui/glade-fixed.c
index 71cf953..307ce90 100644
--- a/gladeui/glade-fixed.c
+++ b/gladeui/glade-fixed.c
@@ -155,18 +155,21 @@ static void
glade_fixed_save_state (GladeFixed * fixed, GladeWidget * child)
{
GtkAllocation allocation;
+ GtkWidget *widget;
+ GtkWidget *child_widget;
- gtk_widget_get_pointer (GTK_WIDGET (GLADE_WIDGET (fixed)->object),
+ widget = GTK_WIDGET (glade_widget_get_object (GLADE_WIDGET (fixed)));
+ child_widget = GTK_WIDGET (glade_widget_get_object (child));
+
+ gtk_widget_get_pointer (widget,
&(GLADE_FIXED (fixed)->pointer_x_origin),
&(GLADE_FIXED (fixed)->pointer_y_origin));
- gtk_widget_translate_coordinates (GTK_WIDGET (child->object),
- GTK_WIDGET (GLADE_WIDGET (fixed)->object),
- 0, 0,
+ gtk_widget_translate_coordinates (child_widget, widget, 0, 0,
&(fixed->child_x_origin),
&(fixed->child_y_origin));
- gtk_widget_get_allocation (GTK_WIDGET (child->object), &allocation);
+ gtk_widget_get_allocation (child_widget, &allocation);
fixed->child_width_origin = allocation.width;
fixed->child_height_origin = allocation.height;
@@ -185,11 +188,13 @@ glade_fixed_filter_event (GladeFixed * fixed,
{
GtkAllocation allocation;
gint cont_width, cont_height;
+ GtkWidget *widget;
g_return_if_fail (x && y);
- gtk_widget_get_allocation (GTK_WIDGET (GLADE_WIDGET (fixed)->object),
- &allocation);
+ widget = GTK_WIDGET (glade_widget_get_object (GLADE_WIDGET (fixed)));
+
+ gtk_widget_get_allocation (widget, &allocation);
cont_width = allocation.width;
cont_height = allocation.height;
@@ -256,12 +261,14 @@ glade_fixed_filter_event (GladeFixed * fixed,
static void
glade_fixed_handle_swindow (GladeFixed * fixed, GdkRectangle * area)
{
- GtkWidget *fixed_widget = GTK_WIDGET (GLADE_WIDGET (fixed)->object);
GtkWidget *swindow = NULL, *swindow_child = NULL;
GtkAdjustment *hadj, *vadj;
GtkAllocation child_allocation;
+ GtkWidget *fixed_widget;
gint x, y;
+ fixed_widget = GTK_WIDGET (glade_widget_get_object (GLADE_WIDGET (fixed)));
+
swindow_child = swindow = fixed_widget;
while (swindow && !GTK_IS_SCROLLED_WINDOW (swindow))
{
@@ -303,11 +310,14 @@ static void
glade_fixed_configure_widget (GladeFixed * fixed, GladeWidget * child)
{
GladeWidget *gwidget = GLADE_WIDGET (fixed);
+ GtkWidget *widget;
GdkRectangle new_area;
gboolean handled, right, left, top, bottom;
gint x, y;
- gtk_widget_get_pointer (GTK_WIDGET (gwidget->object), &x, &y);
+ widget = GTK_WIDGET (glade_widget_get_object (gwidget));
+
+ gtk_widget_get_pointer (widget, &x, &y);
right = GLADE_FIXED_CURSOR_RIGHT (fixed->operation);
left = GLADE_FIXED_CURSOR_LEFT (fixed->operation);
@@ -378,7 +388,7 @@ glade_fixed_configure_widget (GladeFixed * fixed, GladeWidget * child)
0, child, &new_area, &handled);
/* Correct glitches when some widgets are draged over others */
- gtk_widget_queue_draw (GTK_WIDGET (GLADE_WIDGET (fixed)->object));
+ gtk_widget_queue_draw (widget);
}
static void
@@ -386,7 +396,7 @@ glade_fixed_disconnect_child (GladeFixed * fixed, GladeWidget * child)
{
GFSigData *data;
- if (GTK_IS_WIDGET (child->object) == FALSE)
+ if (GTK_IS_WIDGET (glade_widget_get_object (child)) == FALSE)
return;
if ((data =
@@ -405,7 +415,7 @@ glade_fixed_connect_child (GladeFixed * fixed, GladeWidget * child)
{
GFSigData *data;
- if (GTK_IS_WIDGET (child->object) == FALSE)
+ if (GTK_IS_WIDGET (glade_widget_get_object (child)) == FALSE)
return;
if ((data =
@@ -494,7 +504,8 @@ glade_fixed_configure_end_impl (GladeFixed * fixed, GladeWidget * child)
g_value_set_int (&height_value, fixed->child_height_origin);
glade_command_push_group (_("Placing %s inside %s"),
- child->name, GLADE_WIDGET (fixed)->name);
+ glade_widget_get_name (child),
+ glade_widget_get_name (GLADE_WIDGET (fixed)));
/* whew, all that for this call !
*/
@@ -547,8 +558,8 @@ glade_fixed_handle_child_event (GladeFixed * fixed,
gint fixed_x, fixed_y, child_x, child_y;
gboolean handled = FALSE, sig_handled;
- fixed_widget = GTK_WIDGET (GLADE_WIDGET (fixed)->object);
- child_widget = GTK_WIDGET (child->object);
+ fixed_widget = GTK_WIDGET (glade_widget_get_object (GLADE_WIDGET (fixed)));
+ child_widget = GTK_WIDGET (glade_widget_get_object (child));
pointer_mode = glade_app_get_pointer_mode ();
@@ -566,8 +577,7 @@ glade_fixed_handle_child_event (GladeFixed * fixed,
fixed_x, fixed_y, &child_x, &child_y);
if (fixed->can_resize)
- operation = glade_fixed_get_operation (GTK_WIDGET (child->object),
- child_x, child_y);
+ operation = glade_fixed_get_operation (child_widget, child_x, child_y);
else
operation = GLADE_CURSOR_DRAG;
@@ -606,8 +616,7 @@ glade_fixed_handle_child_event (GladeFixed * fixed,
handled = TRUE;
}
- gdk_window_get_pointer (gtk_widget_get_window
- (GTK_WIDGET (child->object)), NULL, NULL, NULL);
+ gdk_window_get_pointer (gtk_widget_get_window (child_widget), NULL, NULL, NULL);
break;
case GDK_BUTTON_PRESS:
/* We cant rely on GDK_BUTTON1_MASK since event->state isnt yet updated
@@ -708,10 +717,10 @@ glade_fixed_add_child_impl (GladeWidget * gwidget_fixed,
(GLADE_WIDGET (fixed), child, at_mouse);
/* We only operate on widgets here */
- if (!GTK_IS_WIDGET (child->object))
+ if (!GTK_IS_WIDGET (glade_widget_get_object (child)))
return;
- gtk_widget_add_events (GTK_WIDGET (child->object),
+ gtk_widget_add_events (GTK_WIDGET (glade_widget_get_object (child)),
GDK_POINTER_MOTION_MASK |
GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_PRESS_MASK |
@@ -734,7 +743,7 @@ glade_fixed_add_child_impl (GladeWidget * gwidget_fixed,
}
else if (at_mouse)
{
- gtk_widget_get_allocation (GTK_WIDGET (child->object), &allocation);
+ gtk_widget_get_allocation (GTK_WIDGET (glade_widget_get_object (child)), &allocation);
rect.x = fixed->mouse_x;
rect.y = fixed->mouse_y;
rect.width = allocation.width;
@@ -805,7 +814,7 @@ glade_fixed_event (GladeWidget * gwidget_fixed, GdkEvent * event)
case GDK_BUTTON_PRESS:
case GDK_MOTION_NOTIFY:
case GDK_BUTTON_RELEASE:
- gtk_widget_get_pointer (GTK_WIDGET (gwidget_fixed->object),
+ gtk_widget_get_pointer (GTK_WIDGET (glade_widget_get_object (gwidget_fixed)),
&fixed->mouse_x, &fixed->mouse_y);
if (fixed->configuring)
{
@@ -831,7 +840,7 @@ glade_fixed_event (GladeWidget * gwidget_fixed, GdkEvent * event)
fixed->creating = TRUE;
glade_command_create (adaptor,
GLADE_WIDGET (fixed), NULL,
- GLADE_WIDGET (fixed)->project);
+ glade_widget_get_project (GLADE_WIDGET (fixed)));
fixed->creating = FALSE;
glade_palette_deselect_current_item (glade_app_get_palette (),
@@ -849,7 +858,7 @@ glade_fixed_event (GladeWidget * gwidget_fixed, GdkEvent * event)
handled = TRUE;
}
- else if (GLADE_IS_FIXED (gwidget_fixed->parent) == FALSE &&
+ else if (GLADE_IS_FIXED (glade_widget_get_parent (gwidget_fixed)) == FALSE &&
glade_app_get_pointer_mode () == GLADE_POINTER_SELECT)
glade_cursor_set (((GdkEventAny *) event)->window,
GLADE_CURSOR_SELECTOR);
diff --git a/gladeui/glade-inspector.c b/gladeui/glade-inspector.c
index 70d6ee2..bbaa7a5 100644
--- a/gladeui/glade-inspector.c
+++ b/gladeui/glade-inspector.c
@@ -335,7 +335,7 @@ search_entry_key_press_event_cb (GtkEntry * entry,
{
widget = glade_widget_get_from_gobject (list->data);
- gtk_entry_set_text (GTK_ENTRY (entry), widget->name);
+ gtk_entry_set_text (GTK_ENTRY (entry), glade_widget_get_name (widget));
gtk_editable_set_position (GTK_EDITABLE (entry), -1);
gtk_editable_select_region (GTK_EDITABLE (entry), -1, -1);
diff --git a/gladeui/glade-placeholder.c b/gladeui/glade-placeholder.c
index 1daa30e..0a0f221 100644
--- a/gladeui/glade-placeholder.c
+++ b/gladeui/glade-placeholder.c
@@ -123,6 +123,7 @@ glade_placeholder_notify_parent (GObject * gobject,
GParamSpec * arg1, gpointer user_data)
{
GladePlaceholder *placeholder = GLADE_PLACEHOLDER (gobject);
+ GladeWidgetAdaptor *parent_adaptor = NULL;
GladeWidget *parent = glade_placeholder_get_parent (placeholder);
if (placeholder->packing_actions)
@@ -133,9 +134,12 @@ glade_placeholder_notify_parent (GObject * gobject,
placeholder->packing_actions = NULL;
}
- if (parent && parent->adaptor->packing_actions)
+ if (parent)
+ parent_adaptor = glade_widget_get_adaptor (parent);
+
+ if (parent_adaptor && parent_adaptor->packing_actions)
placeholder->packing_actions =
- glade_widget_adaptor_pack_actions_new (parent->adaptor);
+ glade_widget_adaptor_pack_actions_new (parent_adaptor);
}
static void
@@ -333,7 +337,7 @@ glade_placeholder_get_project (GladePlaceholder * placeholder)
{
GladeWidget *parent;
parent = glade_placeholder_get_parent (placeholder);
- return parent ? GLADE_PROJECT (parent->project) : NULL;
+ return parent ? glade_widget_get_project (parent) : NULL;
}
static void
@@ -402,11 +406,14 @@ glade_placeholder_motion_notify_event (GtkWidget * widget,
GdkEventMotion * event)
{
GladePointerMode pointer_mode;
- GladeWidget *gparent;
+ GladeWidget *gparent, *gparent_parent = NULL;
g_return_val_if_fail (GLADE_IS_PLACEHOLDER (widget), FALSE);
gparent = glade_placeholder_get_parent (GLADE_PLACEHOLDER (widget));
+ if (gparent)
+ gparent_parent = glade_widget_get_parent (gparent);
+
pointer_mode = glade_app_get_pointer_mode ();
if (pointer_mode == GLADE_POINTER_SELECT &&
@@ -415,7 +422,7 @@ glade_placeholder_motion_notify_event (GtkWidget * widget,
* the cursor (ideally; GladeCursor should somehow deal with such
* concurrencies I suppose).
*/
- (gparent->parent && GLADE_IS_FIXED (gparent->parent)) == FALSE)
+ (gparent_parent && GLADE_IS_FIXED (gparent_parent)) == FALSE)
glade_cursor_set (event->window, GLADE_CURSOR_SELECTOR);
else if (pointer_mode == GLADE_POINTER_ADD_WIDGET)
glade_cursor_set (event->window, GLADE_CURSOR_ADD_WIDGET);
diff --git a/gladeui/glade-popup.c b/gladeui/glade-popup.c
index fc0f866..930854b 100644
--- a/gladeui/glade-popup.c
+++ b/gladeui/glade-popup.c
@@ -276,20 +276,23 @@ glade_popup_menuitem_activated (GtkMenuItem * item, const gchar * action_path)
GladeWidget *widget;
if ((widget = g_object_get_data (G_OBJECT (item), "gwa-data")))
- glade_widget_adaptor_action_activate (widget->adaptor,
- widget->object, action_path);
+ glade_widget_adaptor_action_activate (glade_widget_get_adaptor (widget),
+ glade_widget_get_object (widget), action_path);
}
static void
glade_popup_menuitem_packing_activated (GtkMenuItem * item,
const gchar * action_path)
{
- GladeWidget *widget;
+ GladeWidget *widget, *parent;
if ((widget = g_object_get_data (G_OBJECT (item), "gwa-data")))
- glade_widget_adaptor_child_action_activate (widget->parent->adaptor,
- widget->parent->object,
- widget->object, action_path);
+ {
+ parent = glade_widget_get_parent (widget);
+ glade_widget_adaptor_child_action_activate (glade_widget_get_adaptor (parent),
+ glade_widget_get_object (parent),
+ glade_widget_get_object (widget), action_path);
+ }
}
static void
@@ -302,8 +305,8 @@ glade_popup_menuitem_ph_packing_activated (GtkMenuItem * item,
if ((ph = g_object_get_data (G_OBJECT (item), "gwa-data")))
{
parent = glade_placeholder_get_parent (ph);
- glade_widget_adaptor_child_action_activate (parent->adaptor,
- parent->object,
+ glade_widget_adaptor_child_action_activate (glade_widget_get_adaptor (parent),
+ glade_widget_get_object (parent),
G_OBJECT (ph), action_path);
}
}
@@ -332,8 +335,8 @@ glade_popup_action_populate_menu_real (GtkWidget * menu,
callback, data);
}
else
- submenu = glade_widget_adaptor_action_submenu (gwidget->adaptor,
- gwidget->object,
+ submenu = glade_widget_adaptor_action_submenu (glade_widget_get_adaptor (gwidget),
+ glade_widget_get_object (gwidget),
a->klass->path);
@@ -401,12 +404,12 @@ glade_popup_action_populate_menu (GtkWidget * menu,
n = glade_popup_action_populate_menu_real (menu,
widget,
- widget->actions,
+ glade_widget_get_actions (widget),
G_CALLBACK
(glade_popup_menuitem_activated),
widget);
- if (packing && widget->packing_actions)
+ if (packing && glade_widget_get_pack_actions (widget))
{
if (n)
{
@@ -414,13 +417,10 @@ glade_popup_action_populate_menu (GtkWidget * menu,
gtk_menu_shell_append (GTK_MENU_SHELL (menu), separator);
gtk_widget_show (separator);
}
- n += glade_popup_action_populate_menu_real (menu,
- glade_widget_get_parent
- (widget),
- widget->packing_actions,
- G_CALLBACK
- (glade_popup_menuitem_packing_activated),
- widget);
+ n += glade_popup_action_populate_menu_real
+ (menu, glade_widget_get_parent (widget),
+ glade_widget_get_pack_actions (widget),
+ G_CALLBACK (glade_popup_menuitem_packing_activated), widget);
}
return n;
@@ -447,7 +447,7 @@ glade_popup_create_menu (GladeWidget * widget,
{
/* Special case for GtkAction accelerators */
- if (widget && GTK_IS_ACTION_GROUP (widget->object) &&
+ 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)))
{
@@ -506,7 +506,7 @@ glade_popup_create_menu (GladeWidget * widget,
/* packing actions are a little different on placholders */
if (placeholder)
{
- if (widget && widget->actions)
+ if (widget && glade_widget_get_actions (widget))
{
GtkWidget *separator = gtk_menu_item_new ();
gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), separator);
@@ -515,7 +515,7 @@ glade_popup_create_menu (GladeWidget * widget,
glade_popup_action_populate_menu_real
(popup_menu,
widget,
- widget->actions,
+ glade_widget_get_actions (widget),
G_CALLBACK (glade_popup_menuitem_activated), widget);
}
@@ -533,7 +533,8 @@ glade_popup_create_menu (GladeWidget * widget,
placeholder);
}
}
- else if (widget && (widget->actions || (packing && widget->packing_actions)))
+ else if (widget && (glade_widget_get_actions (widget) ||
+ (packing && glade_widget_get_pack_actions (widget))))
{
GtkWidget *separator = gtk_menu_item_new ();
gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), separator);
@@ -544,7 +545,7 @@ glade_popup_create_menu (GladeWidget * widget,
if (widget)
{
- g_object_get (widget->adaptor, "book", &book, NULL);
+ g_object_get (glade_widget_get_adaptor (widget), "book", &book, NULL);
if (book)
{
GtkWidget *icon = glade_util_get_devhelp_icon (GTK_ICON_SIZE_MENU);
@@ -554,7 +555,7 @@ glade_popup_create_menu (GladeWidget * widget,
glade_popup_append_item (popup_menu, NULL, _("Read _documentation"),
icon, TRUE, glade_popup_docs_cb,
- widget->adaptor);
+ glade_widget_get_adaptor (widget));
}
g_free (book);
}
diff --git a/gladeui/glade-project.c b/gladeui/glade-project.c
index ccad2f7..d19ffd3 100644
--- a/gladeui/glade-project.c
+++ b/gladeui/glade-project.c
@@ -268,7 +268,7 @@ unparent_objects_recurse (GladeWidget * widget)
unparent_objects_recurse (child);
- if (child->internal == NULL)
+ if (!glade_widget_get_internal (child))
glade_widget_remove_child (widget, child);
}
g_list_free (children);
@@ -978,7 +978,7 @@ glade_project_fix_object_props (GladeProject * project)
{
gwidget = glade_widget_get_from_gobject (l->data);
- for (ll = gwidget->properties; ll; ll = ll->next)
+ for (ll = glade_widget_get_properties (gwidget); ll; ll = ll->next)
{
property = GLADE_PROPERTY (ll->data);
@@ -990,7 +990,7 @@ glade_project_fix_object_props (GladeProject * project)
* (this magicly works for both objects & object lists)
*/
value = glade_property_class_make_gvalue_from_string
- (property->klass, txt, gwidget->project, gwidget);
+ (property->klass, txt, glade_widget_get_project (gwidget), gwidget);
glade_property_set_value (property, value);
@@ -1188,7 +1188,7 @@ update_project_for_resource_path (GladeProject * project)
widget = glade_widget_get_from_gobject (l->data);
- for (list = widget->properties; list; list = list->next)
+ for (list = glade_widget_get_properties (widget); list; list = list->next)
{
property = list->data;
@@ -1266,42 +1266,35 @@ typedef struct
} VersionData;
static void
-glade_project_introspect_signal_versions (const gchar * signal_name,
- GPtrArray * signals,
- VersionData * data)
+glade_project_introspect_signal_versions (GladeSignal *signal,
+ VersionData *data)
{
- gint i;
+ GladeSignalClass *signal_class;
+ gchar *catalog = NULL;
+ gboolean is_gtk_adaptor = FALSE;
- for (i = 0; i < signals->len; i++)
- {
- GladeSignalClass *signal_class;
- GladeSignal *signal = g_ptr_array_index (signals, i);
- gchar *catalog = NULL;
- gboolean is_gtk_adaptor = FALSE;
+ signal_class =
+ glade_widget_adaptor_get_signal_class (glade_widget_get_adaptor (data->widget), signal->name);
- signal_class =
- glade_widget_adaptor_get_signal_class (data->widget->adaptor,
- signal->name);
- /* unknown signal... can it happen ? */
- if (!signal_class)
- continue;
- g_assert (signal_class->adaptor);
+ /* unknown signal... can it happen ? */
+ if (!signal_class)
+ return;
+ g_assert (signal_class->adaptor);
- /* Check if the signal comes from a GTK+ widget class */
- g_object_get (signal_class->adaptor, "catalog", &catalog, NULL);
- if (strcmp (catalog, "gtk+") == 0)
- is_gtk_adaptor = TRUE;
- g_free (catalog);
+ /* Check if the signal comes from a GTK+ widget class */
+ g_object_get (signal_class->adaptor, "catalog", &catalog, NULL);
+ if (strcmp (catalog, "gtk+") == 0)
+ is_gtk_adaptor = TRUE;
+ g_free (catalog);
- /* Check GTK+ version that signal was introduced */
- if (is_gtk_adaptor &&
- (data->major < signal_class->version_since_major ||
- (data->major == signal_class->version_since_major &&
- data->minor < signal_class->version_since_minor)))
- {
- data->major = signal_class->version_since_major;
- data->minor = signal_class->version_since_minor;
- }
+ /* Check GTK+ version that signal was introduced */
+ if (is_gtk_adaptor &&
+ (data->major < signal_class->version_since_major ||
+ (data->major == signal_class->version_since_major &&
+ data->minor < signal_class->version_since_minor)))
+ {
+ data->major = signal_class->version_since_major;
+ data->minor = signal_class->version_since_minor;
}
}
@@ -1317,25 +1310,26 @@ glade_project_introspect_gtk_version (GladeProject * project)
gboolean is_gtk_adaptor = FALSE;
gchar *catalog = NULL;
VersionData data = { 0, };
+ GList *signals;
widget = glade_widget_get_from_gobject (list->data);
/* Check if its a GTK+ widget class */
- g_object_get (widget->adaptor, "catalog", &catalog, NULL);
+ g_object_get (glade_widget_get_adaptor (widget), "catalog", &catalog, NULL);
if (strcmp (catalog, "gtk+") == 0)
is_gtk_adaptor = TRUE;
g_free (catalog);
/* Check widget class version */
if (is_gtk_adaptor &&
- !GWA_VERSION_CHECK (widget->adaptor, target_major, target_minor))
+ !GWA_VERSION_CHECK (glade_widget_get_adaptor (widget), target_major, target_minor))
{
- target_major = GWA_VERSION_SINCE_MAJOR (widget->adaptor);
- target_minor = GWA_VERSION_SINCE_MINOR (widget->adaptor);
+ target_major = GWA_VERSION_SINCE_MAJOR (glade_widget_get_adaptor (widget));
+ target_minor = GWA_VERSION_SINCE_MINOR (glade_widget_get_adaptor (widget));
}
/* Check all properties */
- for (l = widget->properties; l; l = l->next)
+ for (l = glade_widget_get_properties (widget); l; l = l->next)
{
GladeProperty *property = l->data;
GladeWidgetAdaptor *prop_adaptor, *adaptor;
@@ -1371,9 +1365,9 @@ glade_project_introspect_gtk_version (GladeProject * project)
data.major = target_major;
data.minor = target_minor;
- g_hash_table_foreach (widget->signals,
- (GHFunc) glade_project_introspect_signal_versions,
- &data);
+ signals = glade_widget_get_signal_list (widget);
+ g_list_foreach (signals, (GFunc)glade_project_introspect_signal_versions, &data);
+ g_list_free (signals);
if (target_major < data.major)
target_major = data.major;
@@ -1502,7 +1496,7 @@ glade_project_load_internal (GladeProject * project)
continue;
if ((widget = glade_widget_read (project, NULL, node, NULL)) != NULL)
- glade_project_add_object (project, NULL, widget->object);
+ glade_project_add_object (project, NULL, glade_widget_get_object (widget));
if (project->priv->load_cancel)
break;
@@ -1758,12 +1752,12 @@ sort_project_dependancies (GObject * a, GObject * b)
ga = glade_widget_get_from_gobject (a);
gb = glade_widget_get_from_gobject (b);
- if (glade_widget_adaptor_depends (ga->adaptor, ga, gb))
+ if (glade_widget_adaptor_depends (glade_widget_get_adaptor (ga), ga, gb))
return 1;
- else if (glade_widget_adaptor_depends (gb->adaptor, gb, ga))
+ else if (glade_widget_adaptor_depends (glade_widget_get_adaptor (gb), gb, ga))
return -1;
else
- return strcmp (ga->name, gb->name);
+ return strcmp (glade_widget_get_name (ga), glade_widget_get_name (gb));
}
static GladeXmlContext *
@@ -1806,7 +1800,7 @@ glade_project_write (GladeProject * project)
* Append toplevel widgets. Each widget then takes
* care of appending its children.
*/
- if (widget->parent == NULL)
+ if (!glade_widget_get_parent (widget))
glade_widget_write (widget, context, root);
}
@@ -1911,7 +1905,7 @@ glade_project_launch_preview (GladeProject * project, gchar * buffer,
if (widget != NULL)
{
glade_widget = glade_widget_get_from_gobject (G_OBJECT (widget));
- argv[2] = g_strdup_printf ("--toplevel=%s", glade_widget->name);
+ argv[2] = g_strdup_printf ("--toplevel=%s", glade_widget_get_name (glade_widget));
argv[3] = NULL;
}
@@ -1996,9 +1990,9 @@ glade_project_preview (GladeProject * project, GladeWidget * gwidget)
text = glade_xml_dump_from_context (context);
gwidget = glade_widget_get_toplevel (gwidget);
- if (!GTK_IS_WIDGET (gwidget->object))
+ if (!GTK_IS_WIDGET (glade_widget_get_object (gwidget)))
return;
- widget = GTK_WIDGET (gwidget->object);
+ widget = GTK_WIDGET (glade_widget_get_object (gwidget));
glade_project_launch_preview (project, text, widget);
@@ -2062,7 +2056,7 @@ glade_project_verify_property (GladeProject * project,
glade_widget_adaptor_from_pspec (prop_adaptor, property->klass->pspec);
g_object_get (adaptor, "catalog", &catalog, NULL);
- glade_project_target_version_for_adaptor (property->widget->project, adaptor,
+ glade_project_target_version_for_adaptor (glade_widget_get_project (property->widget), adaptor,
&target_major, &target_minor);
if (!GPC_VERSION_CHECK (property->klass, target_major, target_minor))
@@ -2103,21 +2097,21 @@ glade_project_verify_properties_internal (GladeWidget * widget,
GList *list;
GladeProperty *property;
- for (list = widget->properties; list; list = list->next)
+ for (list = glade_widget_get_properties (widget); list; list = list->next)
{
property = list->data;
- glade_project_verify_property (widget->project, property, path_name,
+ glade_project_verify_property (glade_widget_get_project (widget), property, path_name,
string, forwidget);
}
/* Sometimes widgets on the clipboard have packing props with no parent */
- if (widget->parent)
+ if (glade_widget_get_parent (widget))
{
- for (list = widget->packing_properties; list; list = list->next)
+ for (list = glade_widget_get_packing_properties (widget); list; list = list->next)
{
property = list->data;
- glade_project_verify_property (widget->project, property, path_name,
- string, forwidget);
+ glade_project_verify_property (glade_widget_get_project (widget),
+ property, path_name, string, forwidget);
}
}
}
@@ -2133,14 +2127,14 @@ glade_project_verify_signal (GladeWidget * widget,
gchar *catalog;
signal_class =
- glade_widget_adaptor_get_signal_class (widget->adaptor, signal->name);
+ glade_widget_adaptor_get_signal_class (glade_widget_get_adaptor (widget), signal->name);
//* Cannot verify unknown signal */
if (!signal_class)
return;
g_assert (signal_class->adaptor);
g_object_get (signal_class->adaptor, "catalog", &catalog, NULL);
- glade_project_target_version_for_adaptor (widget->project,
+ glade_project_target_version_for_adaptor (glade_widget_get_project (widget),
signal_class->adaptor,
&target_major, &target_minor);
@@ -2281,7 +2275,7 @@ glade_project_verify (GladeProject * project, gboolean saving)
path_name = glade_widget_generate_path_name (widget);
- glade_project_verify_adaptor (project, widget->adaptor,
+ glade_project_verify_adaptor (project, glade_widget_get_adaptor (widget),
path_name, string, saving, FALSE, NULL);
glade_project_verify_properties_internal (widget, path_name, string,
FALSE);
@@ -2435,7 +2429,7 @@ glade_project_verify_project_for_ui (GladeProject * project)
widget = glade_widget_get_from_gobject (list->data);
warning =
- glade_project_verify_widget_adaptor (project, widget->adaptor, NULL);
+ glade_project_verify_widget_adaptor (project, glade_widget_get_adaptor (widget), NULL);
glade_widget_set_support_warning (widget, warning);
if (warning)
@@ -2456,20 +2450,18 @@ static GladeNameContext *
name_context_by_widget (GladeProject * project, GladeWidget * gwidget)
{
TopLevelInfo *tinfo;
- GladeWidget *iter;
+ GladeWidget *toplevel;
GList *list;
- if (!gwidget->parent)
+ if (!glade_widget_get_parent (gwidget))
return NULL;
- iter = gwidget;
- while (iter->parent)
- iter = iter->parent;
+ toplevel = glade_widget_get_toplevel (gwidget);
for (list = project->priv->toplevels; list; list = list->next)
{
tinfo = list->data;
- if (tinfo->toplevel == iter)
+ if (tinfo->toplevel == toplevel)
return tinfo->names;
}
return NULL;
@@ -2485,9 +2477,12 @@ search_ancestry_by_name (GladeWidget * toplevel, const gchar * name)
{
for (list = children; list; list = list->next)
{
- iter = glade_widget_get_from_gobject (list->data);
+ const gchar *iter_name;
+
+ iter = glade_widget_get_from_gobject (list->data);
+ iter_name = glade_widget_get_name (iter);
- if (iter->name && strcmp (iter->name, name) == 0)
+ if (iter_name && strcmp (iter_name, name) == 0)
{
widget = iter;
break;
@@ -2534,8 +2529,8 @@ glade_project_get_widget_by_name (GladeProject * project,
GladeWidget *widget;
widget = glade_widget_get_from_gobject (list->data);
- g_assert (widget->name);
- if (strcmp (widget->name, name) == 0)
+ g_assert (glade_widget_get_name (widget));
+ if (strcmp (glade_widget_get_name (widget), name) == 0)
return widget;
}
@@ -2545,8 +2540,8 @@ glade_project_get_widget_by_name (GladeProject * project,
GladeWidget *widget;
widget = glade_widget_get_from_gobject (list->data);
- g_return_val_if_fail (widget->name != NULL, NULL);
- if (strcmp (widget->name, name) == 0)
+ g_return_val_if_fail (glade_widget_get_name (widget) != NULL, NULL);
+ if (strcmp (glade_widget_get_name (widget), name) == 0)
return widget;
}
@@ -2560,18 +2555,16 @@ glade_project_release_widget_name (GladeProject * project,
{
GladeNameContext *context = NULL;
TopLevelInfo *tinfo = NULL;
- GladeWidget *iter;
+ GladeWidget *toplevel;
GList *list;
/* Search by hand here since we need the tinfo to free... */
- iter = gwidget;
- while (iter->parent)
- iter = iter->parent;
+ toplevel = glade_widget_get_toplevel (gwidget);
for (list = project->priv->toplevels; list; list = list->next)
{
tinfo = list->data;
- if (tinfo->toplevel == iter)
+ if (tinfo->toplevel == toplevel)
{
context = tinfo->names;
break;
@@ -2579,18 +2572,11 @@ glade_project_release_widget_name (GladeProject * project,
}
if (context)
- {
- glade_name_context_release_name (context, widget_name);
- //g_print ("Released widget name %s from sub context\n", widget_name);
- }
+ glade_name_context_release_name (context, widget_name);
- if (project->priv->naming_policy == GLADE_POLICY_PROJECT_WIDE ||
- !gwidget->parent)
- {
- glade_name_context_release_name (project->priv->toplevel_names,
- widget_name);
- //g_print ("Released widget name %s from toplevel context\n", widget_name);
- }
+ if (project->priv->naming_policy == GLADE_POLICY_PROJECT_WIDE ||
+ !glade_widget_get_parent (gwidget))
+ glade_name_context_release_name (project->priv->toplevel_names, widget_name);
if (context && glade_name_context_n_names (context) == 0)
{
@@ -2656,25 +2642,18 @@ glade_project_reserve_widget_name (GladeProject * project,
if (!glade_project_available_widget_name (project, gwidget, widget_name))
{
- g_warning
- ("BUG: widget '%s' attempting to reserve an unavailable widget name '%s' !",
- gwidget->name, widget_name);
+ g_warning ("BUG: widget '%s' attempting to reserve an unavailable widget name '%s' !",
+ glade_widget_get_name (gwidget), widget_name);
return;
}
/* Add to name context(s) */
if ((context = name_context_by_widget (project, gwidget)) != NULL)
- {
- //g_print ("Reserving widget name %s from sub context\n", widget_name);
- glade_name_context_add_name (context, widget_name);
- }
+ glade_name_context_add_name (context, widget_name);
if (project->priv->naming_policy == GLADE_POLICY_PROJECT_WIDE ||
- !gwidget->parent)
- {
- glade_name_context_add_name (project->priv->toplevel_names, widget_name);
- //g_print ("Reserving widget name %s from main context\n", widget_name);
- }
+ !glade_widget_get_parent (gwidget))
+ glade_name_context_add_name (project->priv->toplevel_names, widget_name);
}
@@ -2747,7 +2726,7 @@ glade_project_set_widget_name (GladeProject * project,
g_return_if_fail (GLADE_IS_WIDGET (widget));
g_return_if_fail (name && name[0]);
- if (strcmp (name, widget->name) == 0)
+ if (strcmp (name, glade_widget_get_name (widget)) == 0)
return;
/* Police the widget name */
@@ -2759,7 +2738,7 @@ glade_project_set_widget_name (GladeProject * project,
glade_project_reserve_widget_name (project, widget, new_name);
/* Release old name and set new widget name */
- glade_project_release_widget_name (project, widget, widget->name);
+ glade_project_release_widget_name (project, widget, glade_widget_get_name (widget));
glade_widget_set_name (widget, new_name);
g_signal_emit (G_OBJECT (project),
@@ -2768,7 +2747,7 @@ glade_project_set_widget_name (GladeProject * project,
g_free (new_name);
/* Notify views about the iter change */
- glade_project_model_get_iter_for_object (project, widget->object, &iter);
+ glade_project_model_get_iter_for_object (project, glade_widget_get_object (widget), &iter);
path = gtk_tree_model_get_path (GTK_TREE_MODEL (project), &iter);
gtk_tree_model_row_changed (GTK_TREE_MODEL (project), path, &iter);
gtk_tree_path_free (path);
@@ -2821,7 +2800,7 @@ glade_project_notify_row_inserted (GladeProject * project,
* until the next change */
project->priv->stamp++;
- glade_project_model_get_iter_for_object (project, gwidget->object, &iter);
+ glade_project_model_get_iter_for_object (project, glade_widget_get_object (gwidget), &iter);
path = gtk_tree_model_get_path (GTK_TREE_MODEL (project), &iter);
gtk_tree_model_row_inserted (GTK_TREE_MODEL (project), path, &iter);
gtk_tree_path_free (path);
@@ -2835,7 +2814,7 @@ glade_project_notify_row_deleted (GladeProject * project, GladeWidget * gwidget)
GtkTreeIter iter;
GtkTreePath *path;
- glade_project_model_get_iter_for_object (project, gwidget->object, &iter);
+ glade_project_model_get_iter_for_object (project, glade_widget_get_object (gwidget), &iter);
path = gtk_tree_model_get_path (GTK_TREE_MODEL (project), &iter);
gtk_tree_model_row_deleted (GTK_TREE_MODEL (project), path);
gtk_tree_path_free (path);
@@ -2886,7 +2865,7 @@ glade_project_add_object (GladeProject * project,
}
/* Create a name context for newly added toplevels... */
- if (!gwidget->parent)
+ if (!glade_widget_get_parent (gwidget))
{
TopLevelInfo *tinfo = g_new0 (TopLevelInfo, 1);
tinfo->toplevel = gwidget;
@@ -2896,19 +2875,19 @@ glade_project_add_object (GladeProject * project,
}
/* Make sure we have an exclusive name first... */
- if (!glade_project_available_widget_name (project, gwidget, gwidget->name))
+ if (!glade_project_available_widget_name (project, gwidget, glade_widget_get_name (gwidget)))
{
- name = glade_project_new_widget_name (project, gwidget, gwidget->name);
+ name = glade_project_new_widget_name (project, gwidget, glade_widget_get_name (gwidget));
glade_widget_set_name (gwidget, name);
g_free (name);
}
- glade_project_reserve_widget_name (project, gwidget, gwidget->name);
+ glade_project_reserve_widget_name (project, gwidget, glade_widget_get_name (gwidget));
glade_widget_set_project (gwidget, (gpointer) project);
- gwidget->in_project = TRUE;
+ glade_widget_set_in_project (gwidget, TRUE);
g_object_ref_sink (gwidget);
/* Be sure to update the lists before emitting signals */
@@ -2958,7 +2937,7 @@ glade_project_has_object (GladeProject * project, GObject * object)
g_return_val_if_fail (GLADE_IS_WIDGET (gwidget), FALSE);
- return (glade_widget_get_project (gwidget) == project && gwidget->in_project);
+ return (glade_widget_get_project (gwidget) == project && glade_widget_in_project (gwidget));
}
/**
@@ -3015,7 +2994,7 @@ glade_project_remove_object (GladeProject * project, GObject * object)
/* Unset the project pointer on the GladeWidget */
glade_widget_set_project (gwidget, NULL);
- gwidget->in_project = FALSE;
+ glade_widget_set_in_project (gwidget, FALSE);
g_object_unref (gwidget);
glade_project_update_previewable (project);
@@ -3371,7 +3350,7 @@ glade_project_required_libs (GladeProject * project)
gwidget = glade_widget_get_from_gobject (l->data);
g_assert (gwidget);
- g_object_get (gwidget->adaptor, "catalog", &catalog, NULL);
+ g_object_get (glade_widget_get_adaptor (gwidget), "catalog", &catalog, NULL);
if (catalog)
{
@@ -3811,7 +3790,7 @@ count_objects_with_name (GladeProject * project, const gchar * name)
for (l = project->priv->objects; l; l = l->next)
{
widget = glade_widget_get_from_gobject (l->data);
- if (!strcmp (widget->name, name))
+ if (!strcmp (glade_widget_get_name (widget), name))
count++;
}
return count;
@@ -3835,18 +3814,18 @@ policy_project_wide_button_clicked (GtkWidget * widget, GladeProject * project)
{
gwidget = glade_widget_get_from_gobject (l->data);
- if (count_objects_with_name (project, gwidget->name) > 1)
+ if (count_objects_with_name (project, glade_widget_get_name (gwidget)) > 1)
{
GladeNameContext *context = name_context_by_widget (project, gwidget);
gchar *new_name;
if (context)
new_name = glade_name_context_dual_new_name
- (context, project->priv->toplevel_names, gwidget->name);
+ (context, project->priv->toplevel_names, glade_widget_get_name (gwidget));
else
new_name =
- glade_name_context_new_name (project->priv->toplevel_names,
- gwidget->name);
+ glade_name_context_new_name (project->priv->toplevel_names,
+ glade_widget_get_name (gwidget));
glade_command_set_name (gwidget, new_name);
}
@@ -4534,7 +4513,7 @@ glade_project_model_get_value (GtkTreeModel * model,
switch (column)
{
case GLADE_PROJECT_MODEL_COLUMN_ICON_NAME:
- g_object_get (widget->adaptor, "icon-name", &str, NULL);
+ g_object_get (glade_widget_get_adaptor (widget), "icon-name", &str, NULL);
g_value_take_string (value, str);
break;
case GLADE_PROJECT_MODEL_COLUMN_NAME:
diff --git a/gladeui/glade-property-class.c b/gladeui/glade-property-class.c
index fd4f44f..a3f951b 100644
--- a/gladeui/glade-property-class.c
+++ b/gladeui/glade-property-class.c
@@ -284,7 +284,7 @@ glade_property_class_make_string_from_object (GladePropertyClass *
string = g_strdup (filename);
}
else if ((gwidget = glade_widget_get_from_gobject (object)) != NULL)
- string = g_strdup (gwidget->name);
+ string = g_strdup (glade_widget_get_name (gwidget));
else
g_critical ("Object type property refers to an object "
"outside the project");
@@ -606,7 +606,7 @@ glade_property_class_make_object_from_string (GladePropertyClass *
GladeWidget *gwidget;
if ((gwidget = glade_project_get_widget_by_name
(project, widget, string)) != NULL)
- object = gwidget->object;
+ object = glade_widget_get_object (gwidget);
}
return object;
diff --git a/gladeui/glade-property.c b/gladeui/glade-property.c
index e134823..1b0b558 100644
--- a/gladeui/glade-property.c
+++ b/gladeui/glade-property.c
@@ -191,18 +191,19 @@ static gboolean
glade_property_verify (GladeProperty * property, const GValue * value)
{
gboolean ret = FALSE;
+ GladeWidget *parent;
- if (property->klass->packing && property->widget->parent)
+ parent = glade_widget_get_parent (property->widget);
+
+ if (property->klass->packing && parent)
ret =
- glade_widget_adaptor_child_verify_property (property->widget->parent->
- adaptor,
- property->widget->parent->
- object,
- property->widget->object,
- property->klass->id, value);
+ glade_widget_adaptor_child_verify_property (glade_widget_get_adaptor (parent),
+ glade_widget_get_object (parent),
+ glade_widget_get_object (property->widget),
+ property->klass->id, value);
else if (!property->klass->packing)
- ret = glade_widget_adaptor_verify_property (property->widget->adaptor,
- property->widget->object,
+ ret = glade_widget_adaptor_verify_property (glade_widget_get_adaptor (property->widget),
+ glade_widget_get_object (property->widget),
property->klass->id, value);
return ret;
@@ -1057,7 +1058,7 @@ glade_property_write (GladeProperty * property,
g_return_if_fail (GLADE_IS_PROPERTY (property));
g_return_if_fail (node != NULL);
- project = property->widget->project;
+ project = glade_widget_get_project (property->widget);
/* This code should work the same for <packing> and <widget> */
if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_PACKING) ||
diff --git a/gladeui/glade-signal-editor.c b/gladeui/glade-signal-editor.c
index fca6c68..c078191 100644
--- a/gladeui/glade-signal-editor.c
+++ b/gladeui/glade-signal-editor.c
@@ -727,8 +727,8 @@ glade_signal_editor_devhelp_cb (GtkCellRenderer * cell,
signal = glade_signal_editor_get_signal_name (model, &iter);
search = g_strdup_printf ("The %s signal", signal);
- signal_class = glade_widget_adaptor_get_signal_class (priv->widget->adaptor,
- signal);
+ signal_class =
+ glade_widget_adaptor_get_signal_class (glade_widget_get_adaptor (priv->widget), signal);
g_assert (signal_class);
g_object_get (signal_class->adaptor, "book", &book, NULL);
@@ -823,7 +823,7 @@ glade_signal_editor_user_data_activate (GtkCellRenderer * icon_renderer,
glade_signal_new (signal_name, handler, object_name, after, swapped);
GladeSignal *new_signal = glade_signal_new (signal_name, handler,
project_object ?
- project_object->name : NULL,
+ glade_widget_get_name (project_object) : NULL,
after, swapped);
glade_command_change_signal (priv->widget, old_signal, new_signal);
@@ -843,7 +843,7 @@ glade_signal_editor_user_data_activate (GtkCellRenderer * icon_renderer,
{
gtk_tree_store_set (GTK_TREE_STORE (model), &iter,
GSE_COLUMN_USERDATA_SLOT, FALSE,
- GSE_COLUMN_USERDATA, project_object->name,
+ GSE_COLUMN_USERDATA, glade_widget_get_name (project_object),
GSE_COLUMN_SWAPPED_VISIBLE, TRUE, -1);
}
}
@@ -1186,7 +1186,7 @@ glade_signal_editor_load_widget (GladeSignalEditor * editor,
}
priv->widget = widget;
- priv->adaptor = widget ? widget->adaptor : NULL;
+ priv->adaptor = widget ? glade_widget_get_adaptor (widget) : NULL;
if (priv->widget)
{
@@ -1603,12 +1603,15 @@ glade_signal_editor_userdata_store_update (GladeSignalEditor * self,
{
GtkTreeIter tmp_iter;
GList *list;
+ GladeProject *project;
GladeSignalEditorPrivate *priv = self->priv;
+ project = glade_widget_get_project (priv->widget);
+
gtk_list_store_clear (store);
- for (list = (GList *) glade_project_get_objects (priv->widget->project);
+ for (list = (GList *) glade_project_get_objects (project);
list && list->data; list = g_list_next (list))
{
GladeWidget *widget = glade_widget_get_from_gobject (list->data);
@@ -1616,7 +1619,7 @@ glade_signal_editor_userdata_store_update (GladeSignalEditor * self,
if (widget)
{
gtk_list_store_append (store, &tmp_iter);
- gtk_list_store_set (store, &tmp_iter, 0, widget->name, -1);
+ gtk_list_store_set (store, &tmp_iter, 0, glade_widget_get_name (widget), -1);
}
}
diff --git a/gladeui/glade-utils.c b/gladeui/glade-utils.c
index d1378d1..1a7b8f3 100644
--- a/gladeui/glade-utils.c
+++ b/gladeui/glade-utils.c
@@ -278,18 +278,18 @@ glade_util_check_and_warn_scrollable (GladeWidget * parent,
GladeWidgetAdaptor * child_adaptor,
GtkWidget * parent_widget)
{
- if (GTK_IS_SCROLLED_WINDOW (parent->object) &&
+ if (GTK_IS_SCROLLED_WINDOW (glade_widget_get_object (parent)) &&
GWA_SCROLLABLE_WIDGET (child_adaptor) == FALSE)
{
GladeWidgetAdaptor *vadaptor =
glade_widget_adaptor_get_by_type (GTK_TYPE_VIEWPORT);
+ GladeWidgetAdaptor *parent_adaptor = glade_widget_get_adaptor (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);
+ _("Cannot add non scrollable %s widget to a %s directly.\n"
+ "Add a %s first."), child_adaptor->title,
+ parent_adaptor->title, vadaptor->title);
return TRUE;
}
return FALSE;
@@ -797,8 +797,9 @@ glade_util_count_placeholders (GladeWidget * parent)
GList *list, *children;
/* count placeholders */
- if ((children = glade_widget_adaptor_get_children
- (parent->adaptor, parent->object)) != NULL)
+ if ((children =
+ glade_widget_adaptor_get_children (glade_widget_get_adaptor (parent),
+ glade_widget_get_object (parent))) != NULL)
{
for (list = children; list && list->data; list = list->next)
{
diff --git a/gladeui/glade-widget-adaptor.c b/gladeui/glade-widget-adaptor.c
index cfd6c7b..30ed4af 100644
--- a/gladeui/glade-widget-adaptor.c
+++ b/gladeui/glade-widget-adaptor.c
@@ -914,7 +914,7 @@ glade_widget_adaptor_object_read_widget (GladeWidgetAdaptor * adaptor,
/* Some properties may be special child type of custom, just leave them for the adaptor */
if ((property = glade_widget_get_property (widget, prop_name)) != NULL)
{
- glade_property_read (property, widget->project, iter_node);
+ glade_property_read (property, glade_widget_get_project (widget), iter_node);
read_properties = g_list_prepend (read_properties, property);
}
@@ -923,7 +923,7 @@ glade_widget_adaptor_object_read_widget (GladeWidgetAdaptor * adaptor,
}
/* Sync the remaining values not read in from the Glade file.. */
- for (l = widget->properties; l; l = l->next)
+ for (l = glade_widget_get_properties (widget); l; l = l->next)
{
property = l->data;
@@ -952,7 +952,7 @@ glade_widget_adaptor_object_read_widget (GladeWidgetAdaptor * adaptor,
if (glade_xml_node_verify_silent (iter_node, GLADE_XML_TAG_CHILD))
glade_widget_read_child (widget, iter_node);
- if (glade_project_load_cancelled (widget->project))
+ if (glade_project_load_cancelled (glade_widget_get_project (widget)))
return;
}
}
@@ -966,7 +966,7 @@ glade_widget_adaptor_object_write_widget (GladeWidgetAdaptor * adaptor,
GList *props;
/* Write the properties */
- for (props = widget->properties; props; props = props->next)
+ for (props = glade_widget_get_properties (widget); props; props = props->next)
{
if (GLADE_PROPERTY (props->data)->klass->save &&
GLADE_PROPERTY (props->data)->enabled)
@@ -995,15 +995,15 @@ glade_widget_adaptor_object_read_child (GladeWidgetAdaptor * adaptor,
glade_xml_search_child (node, GLADE_XML_TAG_WIDGET)) != NULL)
{
child_widget =
- glade_widget_read (widget->project,
- widget, widget_node, internal_name);
+ glade_widget_read (glade_widget_get_project (widget),
+ widget, widget_node, internal_name);
if (child_widget)
{
if (!internal_name)
{
glade_widget_set_child_type_from_node
- (widget, child_widget->object, node);
+ (widget, glade_widget_get_object (child_widget), node);
glade_widget_add_child (widget, child_widget, FALSE);
}
@@ -1031,7 +1031,8 @@ glade_widget_adaptor_object_read_child (GladeWidgetAdaptor * adaptor,
if ((property =
glade_widget_get_pack_property (child_widget,
prop_name)) != NULL)
- glade_property_read (property, child_widget->project,
+ glade_property_read (property,
+ glade_widget_get_project (child_widget),
iter_node);
g_free (prop_name);
@@ -1045,8 +1046,7 @@ glade_widget_adaptor_object_read_child (GladeWidgetAdaptor * adaptor,
{
GObject *palaceholder = G_OBJECT (glade_placeholder_new ());
glade_widget_set_child_type_from_node (widget, palaceholder, node);
- glade_widget_adaptor_add (adaptor, widget->object, palaceholder);
-
+ glade_widget_adaptor_add (adaptor, glade_widget_get_object (widget), palaceholder);
}
g_free (internal_name);
}
@@ -1064,10 +1064,10 @@ glade_widget_adaptor_object_write_child (GladeWidgetAdaptor * adaptor,
glade_xml_node_append_child (node, child_node);
/* Set internal child */
- if (widget->internal)
+ if (glade_widget_get_internal (widget))
glade_xml_node_set_property_string (child_node,
GLADE_XML_TAG_INTERNAL_CHILD,
- widget->internal);
+ glade_widget_get_internal (widget));
/* Write out the widget */
glade_widget_write (widget, context, child_node);
@@ -1076,7 +1076,7 @@ glade_widget_adaptor_object_write_child (GladeWidgetAdaptor * adaptor,
packing_node = glade_xml_node_new (context, GLADE_XML_TAG_PACKING);
glade_xml_node_append_child (child_node, packing_node);
- for (props = widget->packing_properties; props; props = props->next)
+ for (props = glade_widget_get_packing_properties (widget); props; props = props->next)
{
if (GLADE_PROPERTY (props->data)->klass->save &&
GLADE_PROPERTY (props->data)->enabled)
@@ -1084,8 +1084,9 @@ glade_widget_adaptor_object_write_child (GladeWidgetAdaptor * adaptor,
context, packing_node);
}
- glade_widget_write_special_child_prop (widget->parent,
- widget->object, context, child_node);
+ glade_widget_write_special_child_prop (glade_widget_get_parent (widget),
+ glade_widget_get_object (widget),
+ context, child_node);
/* Default packing properties and such are not saved,
* so lets check afterwords if there was anything saved
diff --git a/gladeui/glade-widget.c b/gladeui/glade-widget.c
index 3f9517a..a2efec5 100644
--- a/gladeui/glade-widget.c
+++ b/gladeui/glade-widget.c
@@ -65,6 +65,100 @@ static void glade_widget_set_properties (GladeWidget * widget,
static void glade_widget_set_object (GladeWidget * gwidget,
GObject * new_object, gboolean destroy);
+
+struct _GladeWidgetPrivate {
+
+ GladeWidgetAdaptor *adaptor; /* An adaptor class for the object type */
+
+ GladeProject *project; /* A pointer to the project that this
+ widget currently belongs to. */
+
+ GladeWidget *parent; /* A pointer to the parent widget in the hierarchy */
+
+ gchar *name; /* The name of the widget. For example window1 or
+ * button2. This is a unique name and is the one
+ * used when loading widget with libglade
+ */
+
+ gchar *support_warning; /* A warning message for version incompatabilities
+ * in this widget
+ */
+
+ gchar *internal; /* If the widget is an internal child of
+ * another widget this is the name of the
+ * internal child, otherwise is NULL.
+ * Internal children cannot be deleted.
+ */
+
+ gboolean anarchist; /* Some composite widgets have internal children
+ * that are not part of the same hierarchy; hence 'anarchists',
+ * typicly a popup window or its child (we need to mark
+ * them so we can avoid bookkeeping packing props on them etc.).
+ */
+
+ GObject *object; /* A pointer to the object that was created.
+ * if it is a GtkWidget; it is shown as a "view"
+ * of the GladeWidget. This object is updated as
+ * the properties are modified for the GladeWidget.
+ */
+
+ GList *properties; /* A list of GladeProperty. A GladeProperty is an
+ * instance of a GladePropertyClass. If a
+ * GladePropertyClass for a gtkbutton is label, its
+ * property is "Ok".
+ */
+
+ GList *packing_properties; /* A list of GladeProperty. Note that these
+ * properties are related to the container
+ * of the widget, thus they change after
+ * pasting the widget to a different
+ * container. Toplevels widget do not have
+ * packing properties.
+ * See also child_properties of
+ * GladeWidgetClass.
+ */
+
+ GHashTable *props_hash; /* A Quick reference table to speed up calls to glade_widget_get_property()
+ */
+ GHashTable *pack_props_hash; /* A Quick reference table to speed up calls to glade_widget_get_pack_property()
+ */
+
+ GHashTable *signals; /* A table with a GPtrArray of GladeSignals (signal handlers),
+ * indexed by its name */
+
+ GList *prop_refs; /* List of properties in the project who's value are `this object'
+ * (this is used to set/unset those properties when the object is
+ * added/removed from the project).
+ */
+
+ gint width; /* Current size used in the UI, this is only */
+ gint height; /* usefull for parentless widgets in the
+ * GladeDesignLayout */
+
+ GList *actions; /* A GladeWidgetAction list */
+
+ GList *packing_actions; /* A GladeWidgetAction list, this actions are
+ * related to the container and they are not always present.
+ */
+
+ GladeWidget *lock; /* The glade widget that has locked this widget down.
+ */
+ GList *locked_widgets; /* A list of widgets this widget has locked down.
+ */
+
+ /* Construct parameters: */
+ GladeWidget *construct_template;
+ GladeCreateReason construct_reason;
+ gchar *construct_internal;
+ guint construct_exact : 1;
+
+ guint in_project : 1;
+
+ guint visible : 1; /* Local copy of widget visibility, we need to keep track of this
+ * since the objects copy may be invalid due to a rebuild.
+ */
+};
+
enum
{
ADD_SIGNAL_HANDLER,
@@ -111,20 +205,20 @@ G_DEFINE_TYPE (GladeWidget, glade_widget, G_TYPE_INITIALLY_UNOWNED)
/*******************************************************************************
GladeWidget class methods
*******************************************************************************/
- static void
- glade_widget_set_packing_actions (GladeWidget * widget,
- GladeWidget * parent)
+static void
+glade_widget_set_packing_actions (GladeWidget * widget,
+ GladeWidget * parent)
{
- if (widget->packing_actions)
+ if (widget->priv->packing_actions)
{
- g_list_foreach (widget->packing_actions, (GFunc) g_object_unref, NULL);
- g_list_free (widget->packing_actions);
- widget->packing_actions = NULL;
+ g_list_foreach (widget->priv->packing_actions, (GFunc) g_object_unref, NULL);
+ g_list_free (widget->priv->packing_actions);
+ widget->priv->packing_actions = NULL;
}
- if (parent->adaptor->packing_actions)
- widget->packing_actions =
- glade_widget_adaptor_pack_actions_new (parent->adaptor);
+ if (parent->priv->adaptor->packing_actions)
+ widget->priv->packing_actions =
+ glade_widget_adaptor_pack_actions_new (parent->priv->adaptor);
}
static void
@@ -143,7 +237,9 @@ glade_widget_add_child_impl (GladeWidget * widget,
*/
glade_widget_set_packing_actions (child, widget);
- glade_widget_adaptor_add (widget->adaptor, widget->object, child->object);
+ glade_widget_adaptor_add (widget->priv->adaptor,
+ widget->priv->object,
+ child->priv->object);
/* XXX FIXME:
* We have a fundamental flaw here, we set packing props
@@ -165,9 +261,9 @@ glade_widget_add_child_impl (GladeWidget * widget,
static void
glade_widget_remove_child_impl (GladeWidget * widget, GladeWidget * child)
{
- glade_widget_adaptor_remove (widget->adaptor, widget->object, child->object);
+ glade_widget_adaptor_remove (widget->priv->adaptor, widget->priv->object, child->priv->object);
- child->parent = NULL;
+ child->priv->parent = NULL;
g_object_unref (child);
}
@@ -183,7 +279,7 @@ glade_widget_replace_child_impl (GladeWidget * widget,
{
g_object_ref (gnew_widget);
- gnew_widget->parent = widget;
+ gnew_widget->priv->parent = widget;
/* Set packing actions first so we have access from the plugin
*/
@@ -195,11 +291,11 @@ glade_widget_replace_child_impl (GladeWidget * widget,
g_object_unref (gold_widget);
if (gold_widget != gnew_widget)
- gold_widget->parent = NULL;
+ gold_widget->priv->parent = NULL;
}
glade_widget_adaptor_replace_child
- (widget->adaptor, widget->object, old_object, new_object);
+ (widget->priv->adaptor, widget->priv->object, old_object, new_object);
/* Setup packing properties here so we can introspect the new
* values from the backend.
@@ -222,7 +318,7 @@ glade_widget_add_signal_handler_impl (GladeWidget * widget,
if (!signals)
{
signals = g_ptr_array_new ();
- g_hash_table_insert (widget->signals, g_strdup (signal_handler->name),
+ g_hash_table_insert (widget->priv->signals, g_strdup (signal_handler->name),
signals);
}
@@ -331,17 +427,17 @@ glade_widget_button_press_event_impl (GladeWidget * gwidget,
{
if (event->state & GDK_CONTROL_MASK)
{
- if (glade_project_is_selected (gwidget->project, gwidget->object))
- glade_app_selection_remove (gwidget->object, TRUE);
+ if (glade_project_is_selected (gwidget->priv->project, gwidget->priv->object))
+ glade_app_selection_remove (gwidget->priv->object, TRUE);
else
- glade_app_selection_add (gwidget->object, TRUE);
+ glade_app_selection_add (gwidget->priv->object, TRUE);
handled = TRUE;
}
- else if (glade_project_is_selected (gwidget->project,
- gwidget->object) == FALSE)
+ else if (glade_project_is_selected (gwidget->priv->project,
+ gwidget->priv->object) == FALSE)
{
glade_util_clear_selection ();
- glade_app_selection_set (gwidget->object, TRUE);
+ glade_app_selection_set (gwidget->priv->object, TRUE);
/* Add selection without interrupting event flow
* when shift is down, this allows better behaviour
@@ -416,7 +512,7 @@ glade_widget_event (GladeWidget * gwidget, GdkEvent * event)
#if 0
if (event->type != GDK_EXPOSE)
g_print ("event widget '%s' handled '%d' event '%d'\n",
- gwidget->name, handled, event->type);
+ gwidget->priv->name, handled, event->type);
#endif
return handled;
@@ -448,7 +544,7 @@ glade_widget_template_params (GladeWidget * widget,
g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
g_return_val_if_fail (n_params != NULL, NULL);
- klass = widget->adaptor;
+ klass = widget->priv->adaptor;
/* As a slight optimization, we never unref the class
*/
@@ -527,7 +623,7 @@ glade_widget_build_object (GladeWidget * widget,
if (reason == GLADE_CREATE_LOAD)
{
- object = glade_widget_adaptor_construct_object (widget->adaptor, 0, NULL);
+ object = glade_widget_adaptor_construct_object (widget->priv->adaptor, 0, NULL);
glade_widget_set_object (widget, object, TRUE);
return object;
}
@@ -536,12 +632,12 @@ glade_widget_build_object (GladeWidget * widget,
params = glade_widget_template_params (widget, TRUE, &n_params);
else
params =
- glade_widget_adaptor_default_params (widget->adaptor, TRUE, &n_params);
+ glade_widget_adaptor_default_params (widget->priv->adaptor, TRUE, &n_params);
/* Create the new object with the correct parameters.
*/
object =
- glade_widget_adaptor_construct_object (widget->adaptor, n_params, params);
+ glade_widget_adaptor_construct_object (widget->priv->adaptor, n_params, params);
free_params (params, n_params);
@@ -552,10 +648,10 @@ glade_widget_build_object (GladeWidget * widget,
params = glade_widget_template_params (widget, FALSE, &n_params);
else
params =
- glade_widget_adaptor_default_params (widget->adaptor, FALSE, &n_params);
+ glade_widget_adaptor_default_params (widget->priv->adaptor, FALSE, &n_params);
for (i = 0; i < n_params; i++)
- glade_widget_adaptor_set_property (widget->adaptor, object, params[i].name,
+ glade_widget_adaptor_set_property (widget->priv->adaptor, object, params[i].name,
&(params[i].value));
free_params (params, n_params);
@@ -606,9 +702,9 @@ glade_widget_dup_properties (GladeWidget * dest_widget, GList * template_props,
parentless = glade_widget_dup (parentless, exact);
- glade_widget_set_project (parentless, dest_widget->project);
+ glade_widget_set_project (parentless, dest_widget->priv->project);
- glade_property_set (prop, parentless->object);
+ glade_property_set (prop, parentless->priv->object);
}
}
else
@@ -646,13 +742,13 @@ glade_widget_remove_property (GladeWidget * widget, const gchar * id_property)
*/
if ((prop = glade_widget_get_property (widget, id_property)) != NULL)
{
- widget->properties = g_list_remove (widget->properties, prop);
- g_hash_table_remove (widget->props_hash, prop->klass->id);
+ widget->priv->properties = g_list_remove (widget->priv->properties, prop);
+ g_hash_table_remove (widget->priv->props_hash, prop->klass->id);
g_object_unref (prop);
}
else
g_critical ("Couldnt find property %s on widget %s\n",
- id_property, widget->name);
+ id_property, widget->priv->name);
}
static void
@@ -674,7 +770,7 @@ static void
glade_widget_sync_custom_props (GladeWidget * widget)
{
GList *l;
- for (l = widget->properties; l && l->data; l = l->next)
+ for (l = widget->priv->properties; l && l->data; l = l->next)
{
GladeProperty *prop = GLADE_PROPERTY (l->data);
@@ -688,7 +784,7 @@ static void
glade_widget_sync_packing_props (GladeWidget * widget)
{
GList *l;
- for (l = widget->packing_properties; l && l->data; l = l->next)
+ for (l = widget->priv->packing_properties; l && l->data; l = l->next)
{
GladeProperty *prop = GLADE_PROPERTY (l->data);
glade_property_sync (prop);
@@ -710,53 +806,53 @@ glade_widget_constructor (GType type,
gwidget = GLADE_WIDGET (ret_obj);
- if (gwidget->name == NULL)
+ if (gwidget->priv->name == NULL)
{
- if (gwidget->internal)
+ if (gwidget->priv->internal)
{
gchar *name_base = g_strdup_printf ("%s-%s",
- gwidget->construct_internal,
- gwidget->internal);
+ gwidget->priv->construct_internal,
+ gwidget->priv->internal);
- if (gwidget->project)
+ if (gwidget->priv->project)
{
- gwidget->name =
- glade_project_new_widget_name (gwidget->project,
+ gwidget->priv->name =
+ glade_project_new_widget_name (gwidget->priv->project,
gwidget, name_base);
g_free (name_base);
}
else
- gwidget->name = name_base;
+ gwidget->priv->name = name_base;
}
- else if (gwidget->project)
- gwidget->name = glade_project_new_widget_name
- (gwidget->project, gwidget, gwidget->adaptor->generic_name);
+ else if (gwidget->priv->project)
+ gwidget->priv->name = glade_project_new_widget_name
+ (gwidget->priv->project, gwidget, gwidget->priv->adaptor->generic_name);
else
- gwidget->name = g_strdup (gwidget->adaptor->generic_name);
+ gwidget->priv->name = g_strdup (gwidget->priv->adaptor->generic_name);
}
- if (gwidget->construct_template)
+ if (gwidget->priv->construct_template)
{
properties = glade_widget_dup_properties
- (gwidget, gwidget->construct_template->properties, FALSE, TRUE,
- gwidget->construct_exact);
+ (gwidget, gwidget->priv->construct_template->priv->properties, FALSE, TRUE,
+ gwidget->priv->construct_exact);
glade_widget_set_properties (gwidget, properties);
}
- if (gwidget->object == NULL)
+ if (gwidget->priv->object == NULL)
{
object = glade_widget_build_object (gwidget,
- gwidget->construct_template,
- gwidget->construct_reason);
+ gwidget->priv->construct_template,
+ gwidget->priv->construct_reason);
}
/* Copy sync parentless widget props here after a dup
*/
- if (gwidget->construct_reason == GLADE_CREATE_COPY)
+ if (gwidget->priv->construct_reason == GLADE_CREATE_COPY)
{
- for (list = gwidget->properties; list; list = list->next)
+ for (list = gwidget->priv->properties; list; list = list->next)
{
GladeProperty *property = list->data;
if (property->klass->parentless_widget)
@@ -765,43 +861,43 @@ glade_widget_constructor (GType type,
}
/* Setup width/height */
- gwidget->width = GWA_DEFAULT_WIDTH (gwidget->adaptor);
- gwidget->height = GWA_DEFAULT_HEIGHT (gwidget->adaptor);
+ gwidget->priv->width = GWA_DEFAULT_WIDTH (gwidget->priv->adaptor);
+ gwidget->priv->height = GWA_DEFAULT_HEIGHT (gwidget->priv->adaptor);
/* Introspect object properties before passing it to post_create,
* but only when its freshly created (depend on glade file at
* load time and copying properties at dup time).
*/
- if (gwidget->construct_reason == GLADE_CREATE_USER)
- for (list = gwidget->properties; list; list = list->next)
+ if (gwidget->priv->construct_reason == GLADE_CREATE_USER)
+ for (list = gwidget->priv->properties; list; list = list->next)
glade_property_load (GLADE_PROPERTY (list->data));
/* We only use catalog defaults when the widget was created by the user! */
- if (gwidget->construct_reason == GLADE_CREATE_USER)
- glade_widget_set_catalog_defaults (gwidget->properties);
+ if (gwidget->priv->construct_reason == GLADE_CREATE_USER)
+ glade_widget_set_catalog_defaults (gwidget->priv->properties);
/* Only call this once the GladeWidget is completely built
* (but before calling custom handlers...)
*/
- glade_widget_adaptor_post_create (gwidget->adaptor,
- gwidget->object, gwidget->construct_reason);
+ glade_widget_adaptor_post_create (gwidget->priv->adaptor,
+ gwidget->priv->object, gwidget->priv->construct_reason);
/* Virtual properties need to be explicitly synchronized.
*/
- if (gwidget->construct_reason == GLADE_CREATE_USER)
+ if (gwidget->priv->construct_reason == GLADE_CREATE_USER)
glade_widget_sync_custom_props (gwidget);
- if (gwidget->parent && gwidget->packing_properties == NULL)
- glade_widget_set_packing_properties (gwidget, gwidget->parent);
+ if (gwidget->priv->parent && gwidget->priv->packing_properties == NULL)
+ glade_widget_set_packing_properties (gwidget, gwidget->priv->parent);
- if (GTK_IS_WIDGET (gwidget->object) &&
- !gtk_widget_is_toplevel (GTK_WIDGET (gwidget->object)))
+ if (GTK_IS_WIDGET (gwidget->priv->object) &&
+ !gtk_widget_is_toplevel (GTK_WIDGET (gwidget->priv->object)))
{
- gwidget->visible = TRUE;
- gtk_widget_show_all (GTK_WIDGET (gwidget->object));
+ gwidget->priv->visible = TRUE;
+ gtk_widget_show_all (GTK_WIDGET (gwidget->priv->object));
}
- else if (GTK_IS_WIDGET (gwidget->object) == FALSE)
- gwidget->visible = TRUE;
+ else if (GTK_IS_WIDGET (gwidget->priv->object) == FALSE)
+ gwidget->priv->visible = TRUE;
return ret_obj;
}
@@ -815,18 +911,18 @@ glade_widget_finalize (GObject * object)
#if 0
/* A good way to check if refcounts are balancing at project close time */
- g_print ("Finalizing widget %s\n", widget->name);
+ g_print ("Finalizing widget %s\n", widget->priv->name);
#endif
- g_free (widget->name);
- g_free (widget->internal);
- g_free (widget->support_warning);
- g_hash_table_destroy (widget->signals);
+ g_free (widget->priv->name);
+ g_free (widget->priv->internal);
+ g_free (widget->priv->support_warning);
+ g_hash_table_destroy (widget->priv->signals);
- if (widget->props_hash)
- g_hash_table_destroy (widget->props_hash);
- if (widget->pack_props_hash)
- g_hash_table_destroy (widget->pack_props_hash);
+ if (widget->priv->props_hash)
+ g_hash_table_destroy (widget->priv->props_hash);
+ if (widget->priv->pack_props_hash)
+ g_hash_table_destroy (widget->priv->pack_props_hash);
G_OBJECT_CLASS (glade_widget_parent_class)->finalize (object);
}
@@ -846,46 +942,46 @@ glade_widget_dispose (GObject * object)
glade_widget_push_superuser ();
/* Release references by way of object properties... */
- while (widget->prop_refs)
+ while (widget->priv->prop_refs)
{
- GladeProperty *property = GLADE_PROPERTY (widget->prop_refs->data);
+ GladeProperty *property = GLADE_PROPERTY (widget->priv->prop_refs->data);
glade_property_set (property, NULL);
}
- if (widget->properties)
- g_list_foreach (widget->properties, (GFunc) reset_object_property,
- widget->project);
+ if (widget->priv->properties)
+ g_list_foreach (widget->priv->properties, (GFunc) reset_object_property,
+ widget->priv->project);
/* We have to make sure properties release thier references on other widgets first
* hence the reset (for object properties) */
- if (widget->properties)
+ if (widget->priv->properties)
{
- g_list_foreach (widget->properties, (GFunc) g_object_unref, NULL);
- g_list_free (widget->properties);
- widget->properties = NULL;
+ g_list_foreach (widget->priv->properties, (GFunc) g_object_unref, NULL);
+ g_list_free (widget->priv->properties);
+ widget->priv->properties = NULL;
}
glade_widget_set_object (widget, NULL, TRUE);
- if (widget->packing_properties)
+ if (widget->priv->packing_properties)
{
- g_list_foreach (widget->packing_properties, (GFunc) g_object_unref, NULL);
- g_list_free (widget->packing_properties);
- widget->packing_properties = NULL;
+ g_list_foreach (widget->priv->packing_properties, (GFunc) g_object_unref, NULL);
+ g_list_free (widget->priv->packing_properties);
+ widget->priv->packing_properties = NULL;
}
- if (widget->actions)
+ if (widget->priv->actions)
{
- g_list_foreach (widget->actions, (GFunc) g_object_unref, NULL);
- g_list_free (widget->actions);
- widget->actions = NULL;
+ g_list_foreach (widget->priv->actions, (GFunc) g_object_unref, NULL);
+ g_list_free (widget->priv->actions);
+ widget->priv->actions = NULL;
}
- if (widget->packing_actions)
+ if (widget->priv->packing_actions)
{
- g_list_foreach (widget->packing_actions, (GFunc) g_object_unref, NULL);
- g_list_free (widget->packing_actions);
- widget->packing_actions = NULL;
+ g_list_foreach (widget->priv->packing_actions, (GFunc) g_object_unref, NULL);
+ g_list_free (widget->priv->packing_actions);
+ widget->priv->packing_actions = NULL;
}
glade_widget_pop_superuser ();
@@ -911,7 +1007,7 @@ glade_widget_set_real_property (GObject * object,
glade_widget_set_internal (widget, g_value_get_string (value));
break;
case PROP_ANARCHIST:
- widget->anarchist = g_value_get_boolean (value);
+ widget->priv->anarchist = g_value_get_boolean (value);
break;
case PROP_OBJECT:
if (g_value_get_object (value))
@@ -935,22 +1031,22 @@ glade_widget_set_real_property (GObject * object,
break;
case PROP_INTERNAL_NAME:
if (g_value_get_string (value))
- widget->construct_internal = g_value_dup_string (value);
+ widget->priv->construct_internal = g_value_dup_string (value);
break;
case PROP_TEMPLATE:
- widget->construct_template = g_value_get_object (value);
+ widget->priv->construct_template = g_value_get_object (value);
break;
case PROP_TEMPLATE_EXACT:
- widget->construct_exact = g_value_get_boolean (value);
+ widget->priv->construct_exact = g_value_get_boolean (value);
break;
case PROP_REASON:
- widget->construct_reason = g_value_get_int (value);
+ widget->priv->construct_reason = g_value_get_int (value);
break;
case PROP_TOPLEVEL_WIDTH:
- widget->width = g_value_get_int (value);
+ widget->priv->width = g_value_get_int (value);
break;
case PROP_TOPLEVEL_HEIGHT:
- widget->height = g_value_get_int (value);
+ widget->priv->height = g_value_get_int (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -970,37 +1066,37 @@ glade_widget_get_real_property (GObject * object,
switch (prop_id)
{
case PROP_NAME:
- g_value_set_string (value, widget->name);
+ g_value_set_string (value, widget->priv->name);
break;
case PROP_INTERNAL:
- g_value_set_string (value, widget->internal);
+ g_value_set_string (value, widget->priv->internal);
break;
case PROP_ANARCHIST:
- g_value_set_boolean (value, widget->anarchist);
+ g_value_set_boolean (value, widget->priv->anarchist);
break;
case PROP_ADAPTOR:
- g_value_set_object (value, widget->adaptor);
+ g_value_set_object (value, widget->priv->adaptor);
break;
case PROP_PROJECT:
- g_value_set_object (value, G_OBJECT (widget->project));
+ g_value_set_object (value, G_OBJECT (widget->priv->project));
break;
case PROP_OBJECT:
- g_value_set_object (value, widget->object);
+ g_value_set_object (value, widget->priv->object);
break;
case PROP_PROPERTIES:
- g_value_set_pointer (value, widget->properties);
+ g_value_set_pointer (value, widget->priv->properties);
break;
case PROP_PARENT:
- g_value_set_object (value, widget->parent);
+ g_value_set_object (value, widget->priv->parent);
break;
case PROP_TOPLEVEL_WIDTH:
- g_value_set_int (value, widget->width);
+ g_value_set_int (value, widget->priv->width);
break;
case PROP_TOPLEVEL_HEIGHT:
- g_value_set_int (value, widget->height);
+ g_value_set_int (value, widget->priv->height);
break;
case PROP_SUPPORT_WARNING:
- g_value_set_string (value, widget->support_warning);
+ g_value_set_string (value, widget->priv->support_warning);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -1030,21 +1126,25 @@ free_signals (gpointer value)
static void
glade_widget_init (GladeWidget * widget)
{
- widget->adaptor = NULL;
- widget->project = NULL;
- widget->name = NULL;
- widget->internal = NULL;
- widget->object = NULL;
- widget->properties = NULL;
- widget->packing_properties = NULL;
- widget->prop_refs = NULL;
- widget->signals = g_hash_table_new_full
+ widget->priv = G_TYPE_INSTANCE_GET_PRIVATE (widget,
+ GLADE_TYPE_WIDGET,
+ GladeWidgetPrivate);
+
+ widget->priv->adaptor = NULL;
+ widget->priv->project = NULL;
+ widget->priv->name = NULL;
+ widget->priv->internal = NULL;
+ widget->priv->object = NULL;
+ widget->priv->properties = NULL;
+ widget->priv->packing_properties = NULL;
+ widget->priv->prop_refs = NULL;
+ widget->priv->signals = g_hash_table_new_full
(g_str_hash, g_str_equal,
(GDestroyNotify) g_free, (GDestroyNotify) free_signals);
/* Initial invalid values */
- widget->width = -1;
- widget->height = -1;
+ widget->priv->width = -1;
+ widget->priv->height = -1;
}
static void
@@ -1180,11 +1280,11 @@ glade_widget_class_init (GladeWidgetClass * klass)
_("A warning string about version mismatches"),
NULL, G_PARAM_READABLE));
- /**
- * GladeWidget::add-signal-handler:
- * @gladewidget: the #GladeWidget which received the signal.
- * @arg1: the #GladeSignal that was added to @gladewidget.
- */
+ /**
+ * GladeWidget::add-signal-handler:
+ * @gladewidget: the #GladeWidget which received the signal.
+ * @arg1: the #GladeSignal that was added to @gladewidget.
+ */
glade_widget_signals[ADD_SIGNAL_HANDLER] =
g_signal_new ("add-signal-handler",
G_TYPE_FROM_CLASS (object_class),
@@ -1194,11 +1294,11 @@ glade_widget_class_init (GladeWidgetClass * klass)
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1, G_TYPE_POINTER);
- /**
- * GladeWidget::remove-signal-handler:
- * @gladewidget: the #GladeWidget which received the signal.
- * @arg1: the #GladeSignal that was removed from @gladewidget.
- */
+ /**
+ * GladeWidget::remove-signal-handler:
+ * @gladewidget: the #GladeWidget which received the signal.
+ * @arg1: the #GladeSignal that was removed from @gladewidget.
+ */
glade_widget_signals[REMOVE_SIGNAL_HANDLER] =
g_signal_new ("remove-signal-handler",
G_TYPE_FROM_CLASS (object_class),
@@ -1209,12 +1309,12 @@ glade_widget_class_init (GladeWidgetClass * klass)
G_TYPE_NONE, 1, G_TYPE_POINTER);
- /**
- * GladeWidget::change-signal-handler:
- * @gladewidget: the #GladeWidget which received the signal.
- * @arg1: the old #GladeSignal
- * @arg2: the new #GladeSignal
- */
+ /**
+ * GladeWidget::change-signal-handler:
+ * @gladewidget: the #GladeWidget which received the signal.
+ * @arg1: the old #GladeSignal
+ * @arg2: the new #GladeSignal
+ */
glade_widget_signals[CHANGE_SIGNAL_HANDLER] =
g_signal_new ("change-signal-handler",
G_TYPE_FROM_CLASS (object_class),
@@ -1225,11 +1325,11 @@ glade_widget_class_init (GladeWidgetClass * klass)
G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_POINTER);
- /**
- * GladeWidget::button-press-event:
- * @gladewidget: the #GladeWidget which received the signal.
- * @arg1: the #GdkEvent
- */
+ /**
+ * GladeWidget::button-press-event:
+ * @gladewidget: the #GladeWidget which received the signal.
+ * @arg1: the #GdkEvent
+ */
glade_widget_signals[BUTTON_PRESS_EVENT] =
g_signal_new ("button-press-event",
G_TYPE_FROM_CLASS (object_class),
@@ -1240,11 +1340,11 @@ glade_widget_class_init (GladeWidgetClass * klass)
G_TYPE_BOOLEAN, 1,
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
- /**
- * GladeWidget::button-relese-event:
- * @gladewidget: the #GladeWidget which received the signal.
- * @arg1: the #GdkEvent
- */
+ /**
+ * GladeWidget::button-relese-event:
+ * @gladewidget: the #GladeWidget which received the signal.
+ * @arg1: the #GdkEvent
+ */
glade_widget_signals[BUTTON_RELEASE_EVENT] =
g_signal_new ("button-release-event",
G_TYPE_FROM_CLASS (object_class),
@@ -1256,11 +1356,11 @@ glade_widget_class_init (GladeWidgetClass * klass)
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
- /**
- * GladeWidget::motion-notify-event:
- * @gladewidget: the #GladeWidget which received the signal.
- * @arg1: the #GdkEvent
- */
+ /**
+ * GladeWidget::motion-notify-event:
+ * @gladewidget: the #GladeWidget which received the signal.
+ * @arg1: the #GdkEvent
+ */
glade_widget_signals[MOTION_NOTIFY_EVENT] =
g_signal_new ("motion-notify-event",
G_TYPE_FROM_CLASS (object_class),
@@ -1272,13 +1372,13 @@ glade_widget_class_init (GladeWidgetClass * klass)
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
- /**
- * GladeWidget::support-changed:
- * @gladewidget: the #GladeWidget which received the signal.
- *
- * Emitted when property and signal support metadatas and messages
- * have been updated.
- */
+ /**
+ * GladeWidget::support-changed:
+ * @gladewidget: the #GladeWidget which received the signal.
+ *
+ * Emitted when property and signal support metadatas and messages
+ * have been updated.
+ */
glade_widget_signals[SUPPORT_CHANGED] =
g_signal_new ("support-changed",
G_TYPE_FROM_CLASS (object_class),
@@ -1286,7 +1386,7 @@ glade_widget_class_init (GladeWidgetClass * klass)
0, NULL, NULL,
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
-
+ g_type_class_add_private (klass, sizeof (GladeWidgetPrivate));
}
/*******************************************************************************
@@ -1300,11 +1400,11 @@ glade_widget_copy_packing_props (GladeWidget * parent,
GladeProperty *dup_prop, *orig_prop;
GList *l;
- g_return_if_fail (child->parent == parent);
+ g_return_if_fail (child->priv->parent == parent);
glade_widget_set_packing_properties (child, parent);
- for (l = child->packing_properties; l && l->data; l = l->next)
+ for (l = child->priv->packing_properties; l && l->data; l = l->next)
{
dup_prop = GLADE_PROPERTY (l->data);
orig_prop =
@@ -1320,7 +1420,7 @@ glade_widget_set_default_packing_properties (GladeWidget * container,
GladePropertyClass *property_class;
GList *l;
- for (l = container->adaptor->packing_props; l; l = l->next)
+ for (l = container->priv->adaptor->packing_props; l; l = l->next)
{
const gchar *def;
GValue *value;
@@ -1329,12 +1429,12 @@ glade_widget_set_default_packing_properties (GladeWidget * container,
if ((def =
glade_widget_adaptor_get_packing_default
- (child->adaptor, container->adaptor, property_class->id)) == NULL)
+ (child->priv->adaptor, container->priv->adaptor, property_class->id)) == NULL)
continue;
value = glade_property_class_make_gvalue_from_string (property_class,
def,
- child->project,
+ child->priv->project,
child);
glade_widget_child_set_property (container, child,
@@ -1353,11 +1453,11 @@ glade_widget_get_internal_child (GladeWidget * parent, const gchar * internal)
while (parent)
{
GladeWidgetAdaptorClass *adaptor_class =
- GLADE_WIDGET_ADAPTOR_GET_CLASS (parent->adaptor);
+ GLADE_WIDGET_ADAPTOR_GET_CLASS (parent->priv->adaptor);
if (adaptor_class->get_internal_child)
return glade_widget_adaptor_get_internal_child
- (parent->adaptor, parent->object, internal);
+ (parent->priv->adaptor, parent->priv->object, internal);
parent = glade_widget_get_parent (parent);
}
@@ -1372,10 +1472,10 @@ glade_widget_get_internal_func (GladeWidget * main_target,
g_return_val_if_fail (GLADE_IS_WIDGET (parent), NULL);
- for (gwidget = parent; gwidget; gwidget = gwidget->parent)
+ for (gwidget = parent; gwidget; gwidget = gwidget->priv->parent)
{
GladeWidgetAdaptorClass *adaptor_class =
- GLADE_WIDGET_ADAPTOR_GET_CLASS (gwidget->adaptor);
+ GLADE_WIDGET_ADAPTOR_GET_CLASS (gwidget->priv->adaptor);
if (adaptor_class->get_internal_child)
{
@@ -1409,7 +1509,7 @@ glade_widget_dup_internal (GladeWidget * main_target,
g_return_val_if_fail (parent == NULL || GLADE_IS_WIDGET (parent), NULL);
/* Dont actually duplicate internal widgets, but recurse through them anyway. */
- if (parent && template_widget->internal)
+ if (parent && template_widget->priv->internal)
{
GObject *internal_object = NULL;
@@ -1421,10 +1521,10 @@ glade_widget_dup_internal (GladeWidget * main_target,
* the "parent" that has `get_internal_child' support (i.e. internal children
* may have depth).
*/
- if ((internal_object = get_internal (internal_parent->adaptor,
- internal_parent->object,
- template_widget->internal)) !=
- NULL)
+ if ((internal_object =
+ get_internal (internal_parent->priv->adaptor,
+ internal_parent->priv->object,
+ template_widget->priv->internal)) != NULL)
{
gwidget = glade_widget_get_from_gobject (internal_object);
g_assert (gwidget);
@@ -1437,12 +1537,12 @@ glade_widget_dup_internal (GladeWidget * main_target,
* a composite dialog for instance). */
if (gwidget == NULL)
{
- gchar *name = g_strdup (template_widget->name);
+ gchar *name = g_strdup (template_widget->priv->name);
gwidget = glade_widget_adaptor_create_widget
- (template_widget->adaptor, FALSE,
+ (template_widget->priv->adaptor, FALSE,
"name", name,
"parent", parent,
- "project", template_widget->project,
+ "project", template_widget->priv->project,
"template", template_widget,
"template-exact", exact, "reason", GLADE_CREATE_COPY, NULL);
g_free (name);
@@ -1453,8 +1553,8 @@ glade_widget_dup_internal (GladeWidget * main_target,
glade_widget_copy_signals (gwidget, template_widget);
if ((children =
- glade_widget_adaptor_get_children (template_widget->adaptor,
- template_widget->object)) != NULL)
+ glade_widget_adaptor_get_children (template_widget->priv->adaptor,
+ template_widget->priv->object)) != NULL)
{
GList *list;
@@ -1477,8 +1577,8 @@ glade_widget_dup_internal (GladeWidget * main_target,
"special-child-type",
g_strdup (child_type), g_free);
- glade_widget_adaptor_add (gwidget->adaptor,
- gwidget->object,
+ glade_widget_adaptor_add (gwidget->priv->adaptor,
+ gwidget->priv->object,
G_OBJECT (placeholder));
}
}
@@ -1489,9 +1589,9 @@ glade_widget_dup_internal (GladeWidget * main_target,
glade_widget_dup_internal (main_target, gwidget,
child_gwidget, exact);
- if (child_dup->internal == NULL)
+ if (child_dup->priv->internal == NULL)
{
- g_object_set_data_full (child_dup->object,
+ g_object_set_data_full (child_dup->priv->object,
"special-child-type",
g_strdup (child_type), g_free);
@@ -1502,24 +1602,23 @@ glade_widget_dup_internal (GladeWidget * main_target,
* need to avoid copying these packing props (like popup windows
* created on behalf of composite widgets).
*/
- if (glade_widget_adaptor_has_child (gwidget->adaptor,
- gwidget->object,
- child_dup->object))
- glade_widget_copy_packing_props (gwidget,
- child_dup, child_gwidget);
+ if (glade_widget_adaptor_has_child (gwidget->priv->adaptor,
+ gwidget->priv->object,
+ child_dup->priv->object))
+ glade_widget_copy_packing_props (gwidget, child_dup, child_gwidget);
}
}
g_list_free (children);
}
- if (gwidget->internal)
+ if (gwidget->priv->internal)
glade_widget_copy_properties (gwidget, template_widget, TRUE, exact);
- if (gwidget->packing_properties == NULL)
- gwidget->packing_properties =
+ if (gwidget->priv->packing_properties == NULL)
+ gwidget->priv->packing_properties =
glade_widget_dup_properties (gwidget,
- template_widget->packing_properties, FALSE,
+ template_widget->priv->packing_properties, FALSE,
FALSE, FALSE);
/* If custom properties are still at thier
@@ -1528,13 +1627,13 @@ glade_widget_dup_internal (GladeWidget * main_target,
glade_widget_sync_custom_props (gwidget);
/* Some properties may not be synced so we reload them */
- for (l = gwidget->properties; l; l = l->next)
+ for (l = gwidget->priv->properties; l; l = l->next)
glade_property_load (GLADE_PROPERTY (l->data));
- if (GWA_IS_TOPLEVEL (gwidget->adaptor) && GTK_IS_WIDGET (gwidget->object))
+ if (GWA_IS_TOPLEVEL (gwidget->priv->adaptor) && GTK_IS_WIDGET (gwidget->priv->object))
g_object_set (gwidget,
- "toplevel-width", template_widget->width,
- "toplevel-height", template_widget->height, NULL);
+ "toplevel-width", template_widget->priv->width,
+ "toplevel-height", template_widget->priv->height, NULL);
return gwidget;
}
@@ -1557,7 +1656,7 @@ glade_widget_extract_children (GladeWidget * gwidget)
GList *children, *list;
children = glade_widget_adaptor_get_children
- (gwidget->adaptor, gwidget->object);
+ (gwidget->priv->adaptor, gwidget->priv->object);
for (list = children; list && list->data; list = list->next)
{
@@ -1567,18 +1666,18 @@ glade_widget_extract_children (GladeWidget * gwidget)
g_print ("Extracting %s from %s\n",
gchild ? gchild->name :
GLADE_IS_PLACEHOLDER (child) ? "placeholder" : "unknown widget",
- gwidget->name);
+ gwidget->priv->name);
#endif
- if (gchild && gchild->internal)
+ if (gchild && gchild->priv->internal)
{
/* Recurse and collect any deep child hierarchies
* inside composite widgets.
*/
extract = g_new0 (GladeChildExtract, 1);
- extract->internal_name = g_strdup (gchild->internal);
+ extract->internal_name = g_strdup (gchild->priv->internal);
extract->internal_list = glade_widget_extract_children (gchild);
extract->properties =
- glade_widget_dup_properties (gchild, gchild->properties, TRUE,
+ glade_widget_dup_properties (gchild, gchild->priv->properties, TRUE,
FALSE, FALSE);
extract_list = g_list_prepend (extract_list, extract);
@@ -1596,7 +1695,7 @@ glade_widget_extract_children (GladeWidget * gwidget)
*/
extract->properties =
glade_widget_dup_properties
- (gchild, gchild->packing_properties, TRUE, FALSE, FALSE);
+ (gchild, gchild->priv->packing_properties, TRUE, FALSE, FALSE);
glade_widget_remove_child (gwidget, gchild);
}
@@ -1604,8 +1703,8 @@ glade_widget_extract_children (GladeWidget * gwidget)
{
/* need to handle placeholders by hand here */
extract->placeholder = g_object_ref (child);
- glade_widget_adaptor_remove (gwidget->adaptor,
- gwidget->object, child);
+ glade_widget_adaptor_remove (gwidget->priv->adaptor,
+ gwidget->priv->object, child);
}
extract_list = g_list_prepend (extract_list, extract);
}
@@ -1641,8 +1740,8 @@ glade_widget_insert_children (GladeWidget * gwidget, GList * children)
get_internal = glade_widget_get_internal_func
(NULL, gwidget, &internal_parent);
- internal_object = get_internal (internal_parent->adaptor,
- internal_parent->object,
+ internal_object = get_internal (internal_parent->priv->adaptor,
+ internal_parent->priv->object,
extract->internal_name);
gchild = glade_widget_get_from_gobject (internal_object);
@@ -1655,10 +1754,8 @@ glade_widget_insert_children (GladeWidget * gwidget, GList * children)
{
GValue value = { 0, };
GladeProperty *saved_prop = l->data;
- GladeProperty *widget_prop = glade_widget_get_property (gchild,
- saved_prop->
- klass->
- id);
+ GladeProperty *widget_prop =
+ glade_widget_get_property (gchild, saved_prop->klass->id);
glade_property_get_value (saved_prop, &value);
glade_property_set_value (widget_prop, &value);
@@ -1698,8 +1795,8 @@ glade_widget_insert_children (GladeWidget * gwidget, GList * children)
}
else
{
- glade_widget_adaptor_add (gwidget->adaptor,
- gwidget->object,
+ glade_widget_adaptor_add (gwidget->priv->adaptor,
+ gwidget->priv->object,
G_OBJECT (extract->placeholder));
g_object_unref (extract->placeholder);
}
@@ -1718,23 +1815,23 @@ glade_widget_set_properties (GladeWidget * widget, GList * properties)
if (properties)
{
- if (widget->properties)
+ if (widget->priv->properties)
{
- g_list_foreach (widget->properties, (GFunc) g_object_unref, NULL);
- g_list_free (widget->properties);
+ g_list_foreach (widget->priv->properties, (GFunc) g_object_unref, NULL);
+ g_list_free (widget->priv->properties);
}
- if (widget->props_hash)
- g_hash_table_destroy (widget->props_hash);
+ if (widget->priv->props_hash)
+ g_hash_table_destroy (widget->priv->props_hash);
- widget->properties = properties;
- widget->props_hash = g_hash_table_new (g_str_hash, g_str_equal);
+ widget->priv->properties = properties;
+ widget->priv->props_hash = g_hash_table_new (g_str_hash, g_str_equal);
for (list = properties; list; list = list->next)
{
property = list->data;
property->widget = widget;
- g_hash_table_insert (widget->props_hash, property->klass->id,
+ g_hash_table_insert (widget->priv->props_hash, property->klass->id,
property);
}
}
@@ -1751,10 +1848,10 @@ glade_widget_set_actions (GladeWidget * widget, GladeWidgetAdaptor * adaptor)
GObject *obj = g_object_new (GLADE_TYPE_WIDGET_ACTION,
"class", action, NULL);
- widget->actions = g_list_prepend (widget->actions,
+ widget->priv->actions = g_list_prepend (widget->priv->actions,
GLADE_WIDGET_ACTION (obj));
}
- widget->actions = g_list_reverse (widget->actions);
+ widget->priv->actions = g_list_reverse (widget->priv->actions);
}
static void
@@ -1767,13 +1864,13 @@ glade_widget_set_adaptor (GladeWidget * widget, GladeWidgetAdaptor * adaptor)
g_return_if_fail (GLADE_IS_WIDGET (widget));
g_return_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor));
/* calling set_class out of the constructor? */
- g_return_if_fail (widget->adaptor == NULL);
+ g_return_if_fail (widget->priv->adaptor == NULL);
- widget->adaptor = adaptor;
+ widget->priv->adaptor = adaptor;
/* If we have no properties; we are not in the process of loading
*/
- if (!widget->properties)
+ if (!widget->priv->properties)
{
for (list = adaptor->properties; list; list = list->next)
{
@@ -1864,7 +1961,7 @@ glade_widget_create_packing_properties (GladeWidget * container,
/* XXX TODO: by checking with some GladePropertyClass metadata, decide
* which packing properties go on which type of children.
*/
- for (list = container->adaptor->packing_props;
+ for (list = container->priv->adaptor->packing_props;
list && list->data; list = list->next)
{
property_class = list->data;
@@ -1889,14 +1986,14 @@ glade_widget_get_from_gobject (gpointer object)
static void
glade_widget_add_to_layout (GladeWidget * widget, GtkWidget * layout)
{
- if (gtk_bin_get_child (GTK_BIN (layout)) != GTK_WIDGET (widget->object))
+ if (gtk_bin_get_child (GTK_BIN (layout)) != GTK_WIDGET (widget->priv->object))
{
if (gtk_bin_get_child (GTK_BIN (layout)) != NULL)
gtk_container_remove (GTK_CONTAINER (layout),
gtk_bin_get_child (GTK_BIN (layout)));
- gtk_container_add (GTK_CONTAINER (layout), GTK_WIDGET (widget->object));
- gtk_widget_show_all (GTK_WIDGET (widget->object));
+ gtk_container_add (GTK_CONTAINER (layout), GTK_WIDGET (widget->priv->object));
+ gtk_widget_show_all (GTK_WIDGET (widget->priv->object));
}
}
@@ -1916,7 +2013,7 @@ glade_widget_show (GladeWidget * widget)
g_return_if_fail (GLADE_IS_WIDGET (widget));
/* Position window at saved coordinates or in the center */
- if (GTK_IS_WIDGET (widget->object) && !widget->parent)
+ if (GTK_IS_WIDGET (widget->priv->object) && !widget->priv->parent)
{
/* Maybe a property references this widget internally, show that widget instead */
if ((property = glade_widget_get_parentless_widget_ref (widget)) != NULL)
@@ -1948,13 +2045,13 @@ glade_widget_show (GladeWidget * widget)
G_CONNECT_AFTER | G_CONNECT_SWAPPED);
}
- else if (GTK_IS_WIDGET (widget->object))
+ else if (GTK_IS_WIDGET (widget->priv->object))
{
GladeWidget *toplevel = glade_widget_get_toplevel (widget);
if (toplevel != widget)
glade_widget_show (toplevel);
}
- widget->visible = TRUE;
+ widget->priv->visible = TRUE;
}
/**
@@ -1967,7 +2064,7 @@ void
glade_widget_hide (GladeWidget * widget)
{
g_return_if_fail (GLADE_IS_WIDGET (widget));
- if (GTK_IS_WIDGET (widget->object))
+ if (GTK_IS_WIDGET (widget->priv->object))
{
GladeDesignView *view;
GtkWidget *layout;
@@ -1981,11 +2078,11 @@ glade_widget_hide (GladeWidget * widget)
layout = GTK_WIDGET (glade_design_view_get_layout (view));
child = gtk_bin_get_child (GTK_BIN (layout));
- if (child == GTK_WIDGET (widget->object))
+ if (child == GTK_WIDGET (widget->priv->object))
gtk_container_remove (GTK_CONTAINER (layout), child);
}
}
- widget->visible = FALSE;
+ widget->priv->visible = FALSE;
}
/**
@@ -2004,8 +2101,8 @@ glade_widget_add_prop_ref (GladeWidget * widget, GladeProperty * property)
g_return_if_fail (GLADE_IS_WIDGET (widget));
g_return_if_fail (GLADE_IS_PROPERTY (property));
- if (!g_list_find (widget->prop_refs, property))
- widget->prop_refs = g_list_prepend (widget->prop_refs, property);
+ if (!g_list_find (widget->priv->prop_refs, property))
+ widget->priv->prop_refs = g_list_prepend (widget->priv->prop_refs, property);
/* parentless widget reffed widgets are added to thier reffering widgets.
* they cant be in the design view.
@@ -2030,9 +2127,18 @@ glade_widget_remove_prop_ref (GladeWidget * widget, GladeProperty * property)
g_return_if_fail (GLADE_IS_WIDGET (widget));
g_return_if_fail (GLADE_IS_PROPERTY (property));
- widget->prop_refs = g_list_remove (widget->prop_refs, property);
+ widget->priv->prop_refs = g_list_remove (widget->priv->prop_refs, property);
+}
+
+GList *
+glade_widget_list_prop_refs (GladeWidget *widget)
+{
+ g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
+
+ return g_list_copy (widget->priv->prop_refs);
}
+
GladeProperty *
glade_widget_get_parentless_widget_ref (GladeWidget * widget)
{
@@ -2041,7 +2147,7 @@ glade_widget_get_parentless_widget_ref (GladeWidget * widget)
g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
- for (l = widget->prop_refs; l && l->data; l = l->next)
+ for (l = widget->priv->prop_refs; l && l->data; l = l->next)
{
property = GLADE_PROPERTY (l->data);
@@ -2062,7 +2168,7 @@ glade_widget_get_parentless_reffed_widgets (GladeWidget * widget)
g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
- for (l = widget->properties; l && l->data; l = l->next)
+ for (l = widget->priv->properties; l && l->data; l = l->next)
{
property = GLADE_PROPERTY (l->data);
reffed = NULL;
@@ -2109,7 +2215,7 @@ glade_widget_get_signal_list (GladeWidget * widget)
g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
- g_hash_table_foreach (widget->signals,
+ g_hash_table_foreach (widget->priv->signals,
(GHFunc) glade_widget_accum_signal_foreach, &signals);
return signals;
@@ -2143,7 +2249,7 @@ glade_widget_copy_signals (GladeWidget * widget, GladeWidget * template_widget)
g_return_if_fail (GLADE_IS_WIDGET (widget));
g_return_if_fail (GLADE_IS_WIDGET (template_widget));
- g_hash_table_foreach (template_widget->signals,
+ g_hash_table_foreach (template_widget->priv->signals,
(GHFunc) glade_widget_copy_signal_foreach, widget);
}
@@ -2167,7 +2273,7 @@ glade_widget_copy_properties (GladeWidget * widget,
g_return_if_fail (GLADE_IS_WIDGET (widget));
g_return_if_fail (GLADE_IS_WIDGET (template_widget));
- for (l = widget->properties; l && l->data; l = l->next)
+ for (l = widget->priv->properties; l && l->data; l = l->next)
{
GladeProperty *widget_prop = GLADE_PROPERTY (l->data);
GladeProperty *template_prop;
@@ -2193,9 +2299,9 @@ glade_widget_copy_properties (GladeWidget * widget,
parentless = glade_widget_get_from_gobject (object);
parentless = glade_widget_dup (parentless, exact);
- glade_widget_set_project (parentless, widget->project);
+ glade_widget_set_project (parentless, widget->priv->project);
- glade_property_set (widget_prop, parentless->object);
+ glade_property_set (widget_prop, parentless->priv->object);
}
else
glade_property_set (widget_prop, NULL);
@@ -2296,7 +2402,7 @@ glade_widget_rebuild (GladeWidget * gwidget)
g_return_if_fail (GLADE_IS_WIDGET (gwidget));
- adaptor = gwidget->adaptor;
+ adaptor = gwidget->priv->adaptor;
g_object_ref (gwidget);
@@ -2306,23 +2412,23 @@ glade_widget_rebuild (GladeWidget * gwidget)
/* Here we take care removing the widget from the project and
* the selection before rebuilding the instance.
*/
- if (gwidget->project && glade_project_has_object (gwidget->project, gwidget->object))
- project = gwidget->project;
+ if (gwidget->priv->project && glade_project_has_object (gwidget->priv->project, gwidget->priv->object))
+ project = gwidget->priv->project;
if (project)
{
- if (glade_project_is_selected (project, gwidget->object))
+ if (glade_project_is_selected (project, gwidget->priv->object))
{
reselect = TRUE;
- glade_project_selection_remove (project, gwidget->object, FALSE);
+ glade_project_selection_remove (project, gwidget->priv->object, FALSE);
}
- glade_project_remove_object (project, gwidget->object);
+ glade_project_remove_object (project, gwidget->priv->object);
}
/* parentless_widget and object properties that reffer to this widget
* should be unset before transfering */
- l = g_list_copy (gwidget->properties);
- save_properties = g_list_copy (gwidget->prop_refs);
+ l = g_list_copy (gwidget->priv->properties);
+ save_properties = g_list_copy (gwidget->priv->prop_refs);
save_properties = g_list_concat (l, save_properties);
for (l = save_properties; l; l = l->next)
@@ -2364,12 +2470,12 @@ glade_widget_rebuild (GladeWidget * gwidget)
* added to the parent but the parent pointer is set).
*/
- inparent = (gwidget->parent &&
- glade_widget_adaptor_has_child (gwidget->parent->adaptor,
- gwidget->parent->object,
+ inparent = (gwidget->priv->parent &&
+ glade_widget_adaptor_has_child (gwidget->priv->parent->priv->adaptor,
+ gwidget->priv->parent->priv->object,
old_object));
if (inparent)
- glade_widget_replace (gwidget->parent, old_object, new_object);
+ glade_widget_replace (gwidget->priv->parent, old_object, new_object);
/* Must call dispose for cases like dialogs and toplevels */
if (GTK_IS_WINDOW (old_object))
@@ -2403,7 +2509,7 @@ glade_widget_rebuild (GladeWidget * gwidget)
else
{
/* restore property references on rebuilt objects */
- glade_property_set (property, gwidget->object);
+ glade_property_set (property, gwidget->priv->object);
}
g_free (prop_data);
}
@@ -2419,13 +2525,13 @@ glade_widget_rebuild (GladeWidget * gwidget)
*/
if (project)
{
- glade_project_add_object (project, NULL, gwidget->object);
+ glade_project_add_object (project, NULL, gwidget->priv->object);
if (reselect)
- glade_project_selection_add (project, gwidget->object, TRUE);
+ glade_project_selection_add (project, gwidget->priv->object, TRUE);
}
/* We shouldnt show if its not already visible */
- if (gwidget->visible)
+ if (gwidget->priv->visible)
glade_widget_show (gwidget);
g_object_unref (gwidget);
@@ -2496,7 +2602,7 @@ GPtrArray *
glade_widget_list_signal_handlers (GladeWidget * widget, const gchar * signal_name) /* array of GladeSignal* */
{
g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
- return g_hash_table_lookup (widget->signals, signal_name);
+ return g_hash_table_lookup (widget->priv->signals, signal_name);
}
/**
@@ -2510,12 +2616,12 @@ void
glade_widget_set_name (GladeWidget * widget, const gchar * name)
{
g_return_if_fail (GLADE_IS_WIDGET (widget));
- if (widget->name != name)
+ if (widget->priv->name != name)
{
- if (widget->name)
- g_free (widget->name);
+ if (widget->priv->name)
+ g_free (widget->priv->name);
- widget->name = g_strdup (name);
+ widget->priv->name = g_strdup (name);
g_object_notify (G_OBJECT (widget), "name");
}
}
@@ -2530,7 +2636,7 @@ const gchar *
glade_widget_get_name (GladeWidget * widget)
{
g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
- return widget->name;
+ return widget->priv->name;
}
/**
@@ -2544,10 +2650,10 @@ void
glade_widget_set_internal (GladeWidget * widget, const gchar * internal)
{
g_return_if_fail (GLADE_IS_WIDGET (widget));
- if (widget->internal != internal)
+ if (widget->priv->internal != internal)
{
- g_free (widget->internal);
- widget->internal = g_strdup (internal);
+ g_free (widget->priv->internal);
+ widget->priv->internal = g_strdup (internal);
g_object_notify (G_OBJECT (widget), "internal");
}
}
@@ -2562,7 +2668,7 @@ G_CONST_RETURN gchar *
glade_widget_get_internal (GladeWidget * widget)
{
g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
- return widget->internal;
+ return widget->priv->internal;
}
/**
@@ -2575,7 +2681,7 @@ GladeWidgetAdaptor *
glade_widget_get_adaptor (GladeWidget * widget)
{
g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
- return widget->adaptor;
+ return widget->priv->adaptor;
}
/**
@@ -2588,9 +2694,9 @@ glade_widget_get_adaptor (GladeWidget * widget)
void
glade_widget_set_project (GladeWidget * widget, GladeProject * project)
{
- if (widget->project != project)
+ if (widget->priv->project != project)
{
- widget->project = project;
+ widget->priv->project = project;
g_object_notify (G_OBJECT (widget), "project");
}
}
@@ -2605,7 +2711,24 @@ GladeProject *
glade_widget_get_project (GladeWidget * widget)
{
g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
- return widget->project;
+ return widget->priv->project;
+}
+
+void
+glade_widget_set_in_project (GladeWidget *widget,
+ gboolean in_project)
+{
+ g_return_if_fail (GLADE_IS_WIDGET (widget));
+
+ widget->priv->in_project = in_project;
+}
+
+gboolean
+glade_widget_in_project (GladeWidget *widget)
+{
+ g_return_val_if_fail (GLADE_IS_WIDGET (widget), FALSE);
+
+ return widget->priv->in_project;
}
/**
@@ -2623,8 +2746,8 @@ glade_widget_get_property (GladeWidget * widget, const gchar * id_property)
g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
g_return_val_if_fail (id_property != NULL, NULL);
- if (widget->props_hash &&
- (property = g_hash_table_lookup (widget->props_hash, id_property)))
+ if (widget->priv->props_hash &&
+ (property = g_hash_table_lookup (widget->priv->props_hash, id_property)))
return property;
return glade_widget_get_pack_property (widget, id_property);
@@ -2645,8 +2768,8 @@ glade_widget_get_pack_property (GladeWidget * widget, const gchar * id_property)
g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
g_return_val_if_fail (id_property != NULL, NULL);
- if (widget->pack_props_hash &&
- (property = g_hash_table_lookup (widget->pack_props_hash, id_property)))
+ if (widget->priv->pack_props_hash &&
+ (property = g_hash_table_lookup (widget->priv->pack_props_hash, id_property)))
return property;
return NULL;
@@ -3152,8 +3275,8 @@ glade_widget_object_set_property (GladeWidget * widget,
g_return_if_fail (GLADE_IS_WIDGET (widget));
g_return_if_fail (property_name != NULL && value != NULL);
- glade_widget_adaptor_set_property (widget->adaptor,
- widget->object, property_name, value);
+ glade_widget_adaptor_set_property (widget->priv->adaptor,
+ widget->priv->object, property_name, value);
}
@@ -3173,8 +3296,8 @@ glade_widget_object_get_property (GladeWidget * widget,
g_return_if_fail (GLADE_IS_WIDGET (widget));
g_return_if_fail (property_name != NULL && value != NULL);
- glade_widget_adaptor_get_property (widget->adaptor,
- widget->object, property_name, value);
+ glade_widget_adaptor_get_property (widget->priv->adaptor,
+ widget->priv->object, property_name, value);
}
/**
@@ -3196,9 +3319,9 @@ glade_widget_child_set_property (GladeWidget * widget,
g_return_if_fail (GLADE_IS_WIDGET (child));
g_return_if_fail (property_name != NULL && value != NULL);
- glade_widget_adaptor_child_set_property (widget->adaptor,
- widget->object,
- child->object, property_name, value);
+ glade_widget_adaptor_child_set_property (widget->priv->adaptor,
+ widget->priv->object,
+ child->priv->object, property_name, value);
}
/**
@@ -3219,9 +3342,9 @@ glade_widget_child_get_property (GladeWidget * widget,
g_return_if_fail (GLADE_IS_WIDGET (child));
g_return_if_fail (property_name != NULL && value != NULL);
- glade_widget_adaptor_child_get_property (widget->adaptor,
- widget->object,
- child->object, property_name, value);
+ glade_widget_adaptor_child_get_property (widget->priv->adaptor,
+ widget->priv->object,
+ child->priv->object, property_name, value);
}
@@ -3267,19 +3390,19 @@ 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->adaptor->type));
+ gwidget->priv->adaptor->type));
- if (gwidget->object == new_object)
+ if (gwidget->priv->object == new_object)
return;
- adaptor = gwidget->adaptor;
- old_object = gwidget->object;
- gwidget->object = new_object;
+ adaptor = gwidget->priv->adaptor;
+ old_object = gwidget->priv->object;
+ gwidget->priv->object = new_object;
if (new_object)
{
/* Add internal reference to new widget if its not internal */
- if (gwidget->internal == NULL)
+ if (gwidget->priv->internal == NULL)
{
/* Assume ownership of floating objects */
if (g_object_is_floating (new_object))
@@ -3289,7 +3412,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->adaptor->type, GTK_TYPE_WIDGET))
+ if (g_type_is_a (gwidget->priv->adaptor->type, GTK_TYPE_WIDGET))
{
/* Disable any built-in DnD
*/
@@ -3312,12 +3435,12 @@ glade_widget_set_object (GladeWidget * gwidget, GObject * new_object,
* glade_widget_get_from_gobject() */
g_object_set_qdata (G_OBJECT (old_object), glade_widget_name_quark, NULL);
- if (gwidget->internal == NULL)
+ if (gwidget->priv->internal == NULL)
{
#if _YOU_WANT_TO_LOOK_AT_PROJECT_REFCOUNT_BALANCING_
g_print ("Killing '%s::%s' widget's object with reference count %d\n",
- gwidget->adaptor->name,
- gwidget->name ? gwidget->name : "(unknown)",
+ gwidget->priv->adaptor->name,
+ gwidget->priv->name ? gwidget->priv->name : "(unknown)",
old_object->ref_count);
#endif
if (GTK_IS_WINDOW (old_object) && destroy)
@@ -3340,7 +3463,7 @@ GObject *
glade_widget_get_object (GladeWidget * widget)
{
g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
- return widget->object;
+ return widget->priv->object;
}
/**
@@ -3353,7 +3476,7 @@ GladeWidget *
glade_widget_get_parent (GladeWidget * widget)
{
g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
- return widget->parent;
+ return widget->priv->parent;
}
/**
@@ -3370,18 +3493,18 @@ glade_widget_set_parent (GladeWidget * widget, GladeWidget * parent)
g_return_if_fail (GLADE_IS_WIDGET (widget));
- old_parent = widget->parent;
- widget->parent = parent;
+ old_parent = widget->priv->parent;
+ widget->priv->parent = parent;
/* Set packing props only if the object is actually parented by 'parent'
* (a subsequent call should come from glade_command after parenting).
*/
- if (widget->object && parent != NULL &&
+ if (widget->priv->object && parent != NULL &&
glade_widget_adaptor_has_child
- (parent->adaptor, parent->object, widget->object))
+ (parent->priv->adaptor, parent->priv->object, widget->priv->object))
{
- if (old_parent == NULL || widget->packing_properties == NULL ||
- old_parent->adaptor->type != parent->adaptor->type)
+ if (old_parent == NULL || widget->priv->packing_properties == NULL ||
+ old_parent->priv->adaptor->type != parent->priv->adaptor->type)
glade_widget_set_packing_properties (widget, parent);
else
glade_widget_sync_packing_props (widget);
@@ -3417,7 +3540,7 @@ glade_widget_get_children (GladeWidget * widget)
adapter_children =
glade_widget_adaptor_get_children (glade_widget_get_adaptor (widget),
- widget->object);
+ widget->priv->object);
for (node = adapter_children; node != NULL; node = g_list_next (node))
{
@@ -3444,8 +3567,8 @@ glade_widget_get_toplevel (GladeWidget * widget)
GladeWidget *toplevel = widget;
g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
- while (toplevel->parent)
- toplevel = toplevel->parent;
+ while (toplevel->priv->parent)
+ toplevel = toplevel->priv->parent;
return toplevel;
}
@@ -3469,42 +3592,42 @@ glade_widget_set_packing_properties (GladeWidget * widget,
g_return_if_fail (GLADE_IS_WIDGET (widget));
g_return_if_fail (GLADE_IS_WIDGET (container));
- g_list_foreach (widget->packing_properties, (GFunc) g_object_unref, NULL);
- g_list_free (widget->packing_properties);
- widget->packing_properties = NULL;
+ g_list_foreach (widget->priv->packing_properties, (GFunc) g_object_unref, NULL);
+ g_list_free (widget->priv->packing_properties);
+ widget->priv->packing_properties = NULL;
- if (widget->pack_props_hash)
- g_hash_table_destroy (widget->pack_props_hash);
- widget->pack_props_hash = NULL;
+ if (widget->priv->pack_props_hash)
+ g_hash_table_destroy (widget->priv->pack_props_hash);
+ widget->priv->pack_props_hash = NULL;
/* We have to detect whether this is an anarchist child of a composite
* widget or not, in otherwords; whether its really a direct child or
* a child of a popup window created on the composite widget's behalf.
*/
- if (widget->anarchist)
+ if (widget->priv->anarchist)
return;
- widget->packing_properties =
+ widget->priv->packing_properties =
glade_widget_create_packing_properties (container, widget);
- widget->pack_props_hash = g_hash_table_new (g_str_hash, g_str_equal);
+ widget->priv->pack_props_hash = g_hash_table_new (g_str_hash, g_str_equal);
/* update the quick reference hash table */
- for (list = widget->packing_properties; list && list->data; list = list->next)
+ for (list = widget->priv->packing_properties; list && list->data; list = list->next)
{
GladeProperty *property = list->data;
- g_hash_table_insert (widget->pack_props_hash, property->klass->id,
+ g_hash_table_insert (widget->priv->pack_props_hash, property->klass->id,
property);
}
/* Dont introspect on properties that are not parented yet.
*/
- if (glade_widget_adaptor_has_child (container->adaptor,
- container->object, widget->object))
+ if (glade_widget_adaptor_has_child (container->priv->adaptor,
+ container->priv->object, widget->priv->object))
{
glade_widget_set_default_packing_properties (container, widget);
/* update the values of the properties to the ones we get from gtk */
- for (list = widget->packing_properties;
+ for (list = widget->priv->packing_properties;
list && list->data; list = list->next)
{
GladeProperty *property = list->data;
@@ -3531,14 +3654,14 @@ glade_widget_has_decendant (GladeWidget * widget, GType type)
gboolean found = FALSE;
if (G_TYPE_IS_INTERFACE (type) &&
- glade_util_class_implements_interface (widget->adaptor->type, type))
+ glade_util_class_implements_interface (widget->priv->adaptor->type, type))
return TRUE;
else if (G_TYPE_IS_INTERFACE (type) == FALSE &&
- g_type_is_a (widget->adaptor->type, type))
+ g_type_is_a (widget->priv->adaptor->type, type))
return TRUE;
if ((children = glade_widget_adaptor_get_children
- (widget->adaptor, widget->object)) != NULL)
+ (widget->priv->adaptor, widget->priv->object)) != NULL)
{
for (l = children; l; l = l->next)
if ((child = glade_widget_get_from_gobject (l->data)) != NULL &&
@@ -3584,7 +3707,7 @@ glade_widget_write_special_child_prop (GladeWidget * parent,
gchar *buff, *special_child_type;
buff = g_object_get_data (object, "special-child-type");
- g_object_get (parent->adaptor, "special-child-type", &special_child_type,
+ g_object_get (parent->priv->adaptor, "special-child-type", &special_child_type,
NULL);
packing_node = glade_xml_search_child (node, GLADE_XML_TAG_PACKING);
@@ -3606,8 +3729,9 @@ glade_widget_set_child_type_from_node (GladeWidget * parent,
if (!glade_xml_node_verify (node, GLADE_XML_TAG_CHILD))
return;
- g_object_get (parent->adaptor, "special-child-type", &special_child_type,
- NULL);
+ g_object_get (parent->priv->adaptor,
+ "special-child-type", &special_child_type,
+ NULL);
if (!special_child_type)
return;
@@ -3630,10 +3754,10 @@ glade_widget_set_child_type_from_node (GladeWidget * parent,
void
glade_widget_read_child (GladeWidget * widget, GladeXmlNode * node)
{
- if (glade_project_load_cancelled (widget->project))
+ if (glade_project_load_cancelled (widget->priv->project))
return;
- glade_widget_adaptor_read_child (widget->adaptor, widget, node);
+ glade_widget_adaptor_read_child (widget->priv->adaptor, widget, node);
}
/**
@@ -3739,9 +3863,9 @@ glade_widget_write_child (GladeWidget * widget,
{
g_return_if_fail (GLADE_IS_WIDGET (widget));
g_return_if_fail (GLADE_IS_WIDGET (child));
- g_return_if_fail (child->parent == widget);
+ g_return_if_fail (child->priv->parent == widget);
- glade_widget_adaptor_write_child (widget->adaptor, child, context, node);
+ glade_widget_adaptor_write_child (widget->priv->adaptor, child, context, node);
}
@@ -3812,7 +3936,7 @@ glade_widget_write_signals (GladeWidget * widget,
info.context = context;
info.node = node;
- g_hash_table_foreach (widget->signals,
+ g_hash_table_foreach (widget->priv->signals,
glade_widget_adaptor_write_signals, &info);
}
@@ -3839,12 +3963,12 @@ glade_widget_write (GladeWidget * widget,
/* Set class and id */
glade_xml_node_set_property_string (widget_node,
GLADE_XML_TAG_CLASS,
- widget->adaptor->name);
+ widget->priv->adaptor->name);
glade_xml_node_set_property_string (widget_node,
- GLADE_XML_TAG_ID, widget->name);
+ GLADE_XML_TAG_ID, widget->priv->name);
/* Write out widget content (properties and signals) */
- glade_widget_adaptor_write_widget (widget->adaptor, widget, context,
+ glade_widget_adaptor_write_widget (widget->priv->adaptor, widget, context,
widget_node);
/* Write the signals strictly after all properties and before children
@@ -3853,8 +3977,8 @@ glade_widget_write (GladeWidget * widget,
/* Write the children */
if ((list =
- glade_widget_adaptor_get_children (widget->adaptor,
- widget->object)) != NULL)
+ glade_widget_adaptor_get_children (widget->priv->adaptor,
+ widget->priv->object)) != NULL)
{
for (l = list; l; l = l->next)
{
@@ -3891,9 +4015,9 @@ glade_widget_is_ancestor (GladeWidget * widget, GladeWidget * ancestor)
while (widget)
{
- if (widget->parent == ancestor)
+ if (widget->priv->parent == ancestor)
return TRUE;
- widget = widget->parent;
+ widget = widget->priv->parent;
}
return FALSE;
@@ -3972,9 +4096,9 @@ glade_widget_placeholder_relation (GladeWidget * parent, GladeWidget * widget)
g_return_val_if_fail (GLADE_IS_WIDGET (parent), FALSE);
g_return_val_if_fail (GLADE_IS_WIDGET (widget), FALSE);
- return (GTK_IS_CONTAINER (parent->object) &&
- GTK_IS_WIDGET (widget->object) &&
- GWA_USE_PLACEHOLDERS (parent->adaptor));
+ return (GTK_IS_CONTAINER (parent->priv->object) &&
+ GTK_IS_WIDGET (widget->priv->object) &&
+ GWA_USE_PLACEHOLDERS (parent->priv->adaptor));
}
static GladeWidgetAction *
@@ -4023,7 +4147,7 @@ glade_widget_get_action (GladeWidget * widget, const gchar * action_path)
g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
g_return_val_if_fail (action_path != NULL, NULL);
- return glade_widget_action_lookup (&widget->actions, action_path, FALSE);
+ return glade_widget_action_lookup (&widget->priv->actions, action_path, FALSE);
}
/**
@@ -4041,11 +4165,27 @@ glade_widget_get_pack_action (GladeWidget * widget, const gchar * action_path)
g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
g_return_val_if_fail (action_path != NULL, NULL);
- return glade_widget_action_lookup (&widget->packing_actions, action_path,
+ return glade_widget_action_lookup (&widget->priv->packing_actions, action_path,
FALSE);
}
+GList *
+glade_widget_get_actions (GladeWidget *widget)
+{
+ g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
+
+ return widget->priv->actions;
+}
+
+GList *
+glade_widget_get_pack_actions (GladeWidget *widget)
+{
+ g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
+
+ return widget->priv->packing_actions;
+}
+
/**
* glade_widget_set_action_sensitive:
@@ -4115,7 +4255,7 @@ glade_widget_remove_action (GladeWidget * widget, const gchar * action_path)
g_return_if_fail (GLADE_IS_WIDGET (widget));
g_return_if_fail (action_path != NULL);
- glade_widget_action_lookup (&widget->actions, action_path, TRUE);
+ glade_widget_action_lookup (&widget->priv->actions, action_path, TRUE);
}
/**
@@ -4132,7 +4272,7 @@ glade_widget_remove_pack_action (GladeWidget * widget,
g_return_if_fail (GLADE_IS_WIDGET (widget));
g_return_if_fail (action_path != NULL);
- glade_widget_action_lookup (&widget->packing_actions, action_path, TRUE);
+ glade_widget_action_lookup (&widget->priv->packing_actions, action_path, TRUE);
}
/**
@@ -4162,7 +4302,7 @@ glade_widget_create_editor_property (GladeWidget * widget,
g_return_val_if_fail (GLADE_IS_PROPERTY (p), NULL);
- eprop = glade_widget_adaptor_create_eprop (widget->adaptor,
+ eprop = glade_widget_adaptor_create_eprop (widget->priv->adaptor,
p->klass, use_command);
glade_editor_property_load (eprop, p);
@@ -4185,11 +4325,11 @@ glade_widget_generate_path_name (GladeWidget * widget)
g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
- string = g_string_new (widget->name);
+ string = g_string_new (widget->priv->name);
- for (iter = widget->parent; iter; iter = iter->parent)
+ for (iter = widget->priv->parent; iter; iter = iter->priv->parent)
{
- gchar *str = g_strdup_printf ("%s:", iter->name);
+ gchar *str = g_strdup_printf ("%s:", iter->priv->name);
g_string_prepend (string, str);
g_free (str);
}
@@ -4202,13 +4342,21 @@ glade_widget_set_support_warning (GladeWidget * widget, const gchar * warning)
{
g_return_if_fail (GLADE_IS_WIDGET (widget));
- if (widget->support_warning)
- g_free (widget->support_warning);
- widget->support_warning = g_strdup (warning);
+ if (widget->priv->support_warning)
+ g_free (widget->priv->support_warning);
+ widget->priv->support_warning = g_strdup (warning);
g_object_notify (G_OBJECT (widget), "support-warning");
}
+G_CONST_RETURN gchar *
+glade_widget_support_warning (GladeWidget *widget)
+{
+ g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
+
+ return widget->priv->support_warning;
+}
+
/**
* glade_widget_lock:
* @widget: A #GladeWidget
@@ -4224,10 +4372,10 @@ glade_widget_lock (GladeWidget * widget, GladeWidget * locked)
{
g_return_if_fail (GLADE_IS_WIDGET (widget));
g_return_if_fail (GLADE_IS_WIDGET (locked));
- g_return_if_fail (locked->lock == NULL);
+ g_return_if_fail (locked->priv->lock == NULL);
- locked->lock = widget;
- widget->locked_widgets = g_list_prepend (widget->locked_widgets, locked);
+ locked->priv->lock = widget;
+ widget->priv->locked_widgets = g_list_prepend (widget->priv->locked_widgets, locked);
}
/**
@@ -4241,12 +4389,34 @@ glade_widget_lock (GladeWidget * widget, GladeWidget * locked)
void
glade_widget_unlock (GladeWidget * widget)
{
+ GladeWidget *lock;
+
g_return_if_fail (GLADE_IS_WIDGET (widget));
- g_return_if_fail (GLADE_IS_WIDGET (widget->lock));
+ g_return_if_fail (GLADE_IS_WIDGET (widget->priv->lock));
+
+ lock = widget->priv->lock;
- widget->lock->locked_widgets =
- g_list_remove (widget->lock->locked_widgets, widget);
- widget->lock = NULL;
+ lock->priv->locked_widgets =
+ g_list_remove (lock->priv->locked_widgets, widget);
+
+ widget->priv->lock = NULL;
+}
+
+
+GladeWidget *
+glade_widget_get_locker (GladeWidget *widget)
+{
+ g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
+
+ return widget->priv->lock;
+}
+
+GList *
+glade_widget_list_locked_widgets (GladeWidget *widget)
+{
+ g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
+
+ return g_list_copy (widget->priv->locked_widgets);
}
@@ -4264,3 +4434,19 @@ glade_widget_support_changed (GladeWidget * widget)
g_signal_emit (widget, glade_widget_signals[SUPPORT_CHANGED], 0);
}
+
+GList *
+glade_widget_get_properties (GladeWidget *widget)
+{
+ g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
+
+ return widget->priv->properties;
+}
+
+GList *
+glade_widget_get_packing_properties (GladeWidget *widget)
+{
+ g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
+
+ return widget->priv->packing_properties;
+}
diff --git a/gladeui/glade-widget.h b/gladeui/glade-widget.h
index 3f014db..ac87b02 100644
--- a/gladeui/glade-widget.h
+++ b/gladeui/glade-widget.h
@@ -18,101 +18,14 @@ G_BEGIN_DECLS
#define GLADE_IS_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GLADE_TYPE_WIDGET))
#define GLADE_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GLADE_TYPE_WIDGET, GladeWidgetClass))
-typedef struct _GladeWidgetClass GladeWidgetClass;
+typedef struct _GladeWidgetClass GladeWidgetClass;
+typedef struct _GladeWidgetPrivate GladeWidgetPrivate;
struct _GladeWidget
{
GInitiallyUnowned parent_instance;
- GladeWidgetAdaptor *adaptor; /* An adaptor class for the object type */
-
- GladeProject *project; /* A pointer to the project that this
- widget currently belongs to. */
-
- GladeWidget *parent; /* A pointer to the parent widget in the hierarchy */
-
- gchar *name; /* The name of the widget. For example window1 or
- * button2. This is a unique name and is the one
- * used when loading widget with libglade
- */
-
- gchar *support_warning; /* A warning message for version incompatabilities
- * in this widget
- */
-
- gchar *internal; /* If the widget is an internal child of
- * another widget this is the name of the
- * internal child, otherwise is NULL.
- * Internal children cannot be deleted.
- */
-
- gboolean anarchist; /* Some composite widgets have internal children
- * that are not part of the same hierarchy; hence 'anarchists',
- * typicly a popup window or its child (we need to mark
- * them so we can avoid bookkeeping packing props on them etc.).
- */
-
- GObject *object; /* A pointer to the object that was created.
- * if it is a GtkWidget; it is shown as a "view"
- * of the GladeWidget. This object is updated as
- * the properties are modified for the GladeWidget.
- */
-
- GList *properties; /* A list of GladeProperty. A GladeProperty is an
- * instance of a GladePropertyClass. If a
- * GladePropertyClass for a gtkbutton is label, its
- * property is "Ok".
- */
-
- GList *packing_properties; /* A list of GladeProperty. Note that these
- * properties are related to the container
- * of the widget, thus they change after
- * pasting the widget to a different
- * container. Toplevels widget do not have
- * packing properties.
- * See also child_properties of
- * GladeWidgetClass.
- */
-
- GHashTable *props_hash; /* A Quick reference table to speed up calls to glade_widget_get_property()
- */
- GHashTable *pack_props_hash; /* A Quick reference table to speed up calls to glade_widget_get_pack_property()
- */
-
- GHashTable *signals; /* A table with a GPtrArray of GladeSignals (signal handlers),
- * indexed by its name */
-
- GList *prop_refs; /* List of properties in the project who's value are `this object'
- * (this is used to set/unset those properties when the object is
- * added/removed from the project).
- */
-
- gint width; /* Current size used in the UI, this is only */
- gint height; /* usefull for parentless widgets in the
- * GladeDesignLayout */
-
- GList *actions; /* A GladeWidgetAction list */
-
- GList *packing_actions; /* A GladeWidgetAction list, this actions are
- * related to the container and they are not always present.
- */
-
- GladeWidget *lock; /* The glade widget that has locked this widget down.
- */
- GList *locked_widgets; /* A list of widgets this widget has locked down.
- */
-
- /* Construct parameters: */
- GladeWidget *construct_template;
- GladeCreateReason construct_reason;
- gchar *construct_internal;
- guint construct_exact : 1;
-
- guint in_project : 1;
-
- guint visible : 1; /* Local copy of widget visibility, we need to keep track of this
- * since the objects copy may be invalid due to a rebuild.
- */
+ GladeWidgetPrivate *priv;
};
struct _GladeWidgetClass
@@ -169,7 +82,10 @@ void glade_widget_copy_properties (GladeWidget *w
void glade_widget_set_packing_properties (GladeWidget *widget,
GladeWidget *container);
-
+
+GList *glade_widget_get_properties (GladeWidget *widget);
+GList *glade_widget_get_packing_properties (GladeWidget *widget);
+
GladeProperty *glade_widget_get_property (GladeWidget *widget,
const gchar *id_property);
@@ -217,6 +133,9 @@ GladeWidgetAction *glade_widget_get_action (GladeWidget *widget
GladeWidgetAction *glade_widget_get_pack_action (GladeWidget *widget,
const gchar *action_path);
+GList *glade_widget_get_actions (GladeWidget *widget);
+GList *glade_widget_get_pack_actions (GladeWidget *widget);
+
gboolean glade_widget_set_action_sensitive (GladeWidget *widget,
const gchar *action_path,
gboolean sensitive);
@@ -263,9 +182,9 @@ void glade_widget_write_special_child_prop (GladeWidget *
GladeXmlContext *context,
GladeXmlNode *node);
-void glade_widget_set_child_type_from_node (GladeWidget *parent,
- GObject *child,
- GladeXmlNode *node);
+void glade_widget_set_child_type_from_node (GladeWidget *parent,
+ GObject *child,
+ GladeXmlNode *node);
GladeEditorProperty *glade_widget_create_editor_property (GladeWidget *widget,
const gchar *property,
@@ -287,6 +206,8 @@ void glade_widget_add_prop_ref (GladeWidget *w
void glade_widget_remove_prop_ref (GladeWidget *widget,
GladeProperty *property);
+GList *glade_widget_list_prop_refs (GladeWidget *widget);
+
GladeProperty *glade_widget_get_parentless_widget_ref (GladeWidget *widget);
@@ -398,14 +319,18 @@ void glade_widget_set_internal (GladeWidget *widget,
const gchar *internal);
G_CONST_RETURN gchar *glade_widget_get_internal (GladeWidget *widget);
-
+
GObject *glade_widget_get_object (GladeWidget *widget);
void glade_widget_set_project (GladeWidget *widget,
GladeProject *project);
GladeProject *glade_widget_get_project (GladeWidget *widget);
-
+
+void glade_widget_set_in_project (GladeWidget *widget,
+ gboolean in_project);
+gboolean glade_widget_in_project (GladeWidget *widget);
+
GladeWidgetAdaptor *glade_widget_get_adaptor (GladeWidget *widget);
GladeWidget *glade_widget_get_parent (GladeWidget *widget);
@@ -425,11 +350,16 @@ void glade_widget_pop_superuser (void);
void glade_widget_set_support_warning (GladeWidget *widget,
const gchar *warning);
+G_CONST_RETURN gchar *glade_widget_support_warning (GladeWidget *widget);
void glade_widget_lock (GladeWidget *widget,
GladeWidget *locked);
void glade_widget_unlock (GladeWidget *widget);
+GladeWidget *glade_widget_get_locker (GladeWidget *widget);
+
+GList *glade_widget_list_locked_widgets (GladeWidget *widget);
+
void glade_widget_support_changed (GladeWidget *widget);
G_END_DECLS
diff --git a/plugins/gtk+/glade-activatable-editor.c b/plugins/gtk+/glade-activatable-editor.c
index 49faf8e..345aedd 100644
--- a/plugins/gtk+/glade-activatable-editor.c
+++ b/plugins/gtk+/glade-activatable-editor.c
@@ -92,16 +92,13 @@ glade_activatable_editor_load (GladeEditable * editable, GladeWidget * widget)
if (activatable_editor->loaded_widget)
{
/* watch custom-child and use-stock properties here for reloads !!! */
-
- g_signal_handlers_disconnect_by_func (G_OBJECT
- (activatable_editor->loaded_widget->
- project),
+ g_signal_handlers_disconnect_by_func (glade_widget_get_project (activatable_editor->loaded_widget),
G_CALLBACK (project_changed),
activatable_editor);
/* The widget could die unexpectedly... */
g_object_weak_unref (G_OBJECT
- (activatable_editor->loaded_widget->project),
+ (glade_widget_get_project (activatable_editor->loaded_widget)),
(GWeakNotify) project_finalized, activatable_editor);
}
@@ -111,12 +108,12 @@ glade_activatable_editor_load (GladeEditable * editable, GladeWidget * widget)
if (activatable_editor->loaded_widget)
{
/* This fires for undo/redo */
- g_signal_connect (G_OBJECT (activatable_editor->loaded_widget->project),
+ g_signal_connect (glade_widget_get_project (activatable_editor->loaded_widget),
"changed", G_CALLBACK (project_changed),
activatable_editor);
/* The widget/project could die unexpectedly... */
- g_object_weak_ref (G_OBJECT (activatable_editor->loaded_widget->project),
+ g_object_weak_ref (G_OBJECT (glade_widget_get_project (activatable_editor->loaded_widget)),
(GWeakNotify) project_finalized, activatable_editor);
}
@@ -205,9 +202,8 @@ get_image_widget (GladeWidget * widget)
{
GtkWidget *image = NULL;
- if (GTK_IS_IMAGE_MENU_ITEM (widget->object))
- image =
- gtk_image_menu_item_get_image (GTK_IMAGE_MENU_ITEM (widget->object));
+ if (GTK_IS_IMAGE_MENU_ITEM (glade_widget_get_object (widget)))
+ image = gtk_image_menu_item_get_image (GTK_IMAGE_MENU_ITEM (glade_widget_get_object (widget)));
return image ? glade_widget_get_from_gobject (image) : NULL;
}
@@ -216,10 +212,14 @@ reset_properties (GladeWidget * gwidget,
GtkAction * action,
gboolean use_appearance, gboolean use_appearance_changed)
{
+ GObject *object;
+
reset_property (gwidget, "visible");
reset_property (gwidget, "sensitive");
- if (GTK_IS_MENU_ITEM (gwidget->object))
+ object = glade_widget_get_object (gwidget);
+
+ if (GTK_IS_MENU_ITEM (object))
{
if (!use_appearance_changed)
reset_property (gwidget, "accel-group");
@@ -255,7 +255,7 @@ reset_properties (GladeWidget * gwidget,
}
}
- else if (GTK_IS_TOOL_ITEM (gwidget->object))
+ else if (GTK_IS_TOOL_ITEM (object))
{
reset_property (gwidget, "visible-horizontal");
reset_property (gwidget, "visible-vertical");
@@ -272,7 +272,7 @@ reset_properties (GladeWidget * gwidget,
reset_property (gwidget, "image-mode");
}
}
- else if (GTK_IS_BUTTON (gwidget->object))
+ else if (GTK_IS_BUTTON (object))
{
reset_property (gwidget, "active");
@@ -285,12 +285,12 @@ reset_properties (GladeWidget * gwidget,
GladeProperty *property;
/* If theres a widget customly inside... command remove it first... */
- button = GTK_WIDGET (gwidget->object);
+ button = GTK_WIDGET (object);
child = gtk_bin_get_child (GTK_BIN (button));
if (child)
gchild = glade_widget_get_from_gobject (child);
- if (gchild && gchild->parent == gwidget)
+ if (gchild && glade_widget_get_parent (gchild) == gwidget)
{
GList widgets = { 0, };
widgets.data = gchild;
@@ -316,7 +316,7 @@ reset_properties (GladeWidget * gwidget,
/* Make sure none of our property resets screw with the current selection,
* since we rely on the selection during commit time.
*/
- glade_project_selection_set (gwidget->project, gwidget->object, TRUE);
+ glade_project_selection_set (glade_widget_get_project (gwidget), object, TRUE);
}
static void
@@ -330,7 +330,7 @@ related_action_pre_commit (GladeEditorProperty * property,
glade_widget_property_get (gwidget, "use-action-appearance", &use_appearance);
- glade_command_push_group (_("Setting %s action"), gwidget->name);
+ glade_command_push_group (_("Setting %s action"), glade_widget_get_name (gwidget));
reset_properties (gwidget, action, use_appearance, FALSE);
@@ -360,7 +360,7 @@ use_appearance_pre_commit (GladeEditorProperty * property,
glade_command_push_group (use_appearance ?
_("Setting %s to use action appearance") :
_("Setting %s to not use action appearance"),
- gwidget->name);
+ glade_widget_get_name (gwidget));
reset_properties (gwidget, action, use_appearance, TRUE);
}
diff --git a/plugins/gtk+/glade-button-editor.c b/plugins/gtk+/glade-button-editor.c
index 5b988c0..288e04f 100644
--- a/plugins/gtk+/glade-button-editor.c
+++ b/plugins/gtk+/glade-button-editor.c
@@ -94,13 +94,12 @@ glade_button_editor_load (GladeEditable * editable, GladeWidget * widget)
{
/* watch custom-child and use-stock properties here for reloads !!! */
- g_signal_handlers_disconnect_by_func (G_OBJECT
- (button_editor->loaded_widget->project),
+ g_signal_handlers_disconnect_by_func (glade_widget_get_project (button_editor->loaded_widget),
G_CALLBACK (project_changed),
button_editor);
/* The widget could die unexpectedly... */
- g_object_weak_unref (G_OBJECT (button_editor->loaded_widget->project),
+ g_object_weak_unref (G_OBJECT (glade_widget_get_project (button_editor->loaded_widget)),
(GWeakNotify) project_finalized, button_editor);
}
@@ -110,11 +109,11 @@ glade_button_editor_load (GladeEditable * editable, GladeWidget * widget)
if (button_editor->loaded_widget)
{
/* This fires for undo/redo */
- g_signal_connect (G_OBJECT (button_editor->loaded_widget->project),
+ g_signal_connect (glade_widget_get_project (button_editor->loaded_widget),
"changed", G_CALLBACK (project_changed), button_editor);
/* The widget/project could die unexpectedly... */
- g_object_weak_ref (G_OBJECT (button_editor->loaded_widget->project),
+ g_object_weak_ref (G_OBJECT (glade_widget_get_project (button_editor->loaded_widget)),
(GWeakNotify) project_finalized, button_editor);
}
@@ -132,13 +131,13 @@ glade_button_editor_load (GladeEditable * editable, GladeWidget * widget)
glade_widget_property_get (widget, "use-action-appearance",
&use_appearance);
- button = GTK_WIDGET (widget->object);
+ button = GTK_WIDGET (glade_widget_get_object (widget));
child = gtk_bin_get_child (GTK_BIN (button));
if (child)
gchild = glade_widget_get_from_gobject (child);
/* Setup radio and sensitivity states */
- if ((gchild && gchild->parent) || // a widget is manually inside
+ if ((gchild && glade_widget_get_parent (gchild)) || // a widget is manually inside
GLADE_IS_PLACEHOLDER (child)) // placeholder there, custom mode
{
/* Custom */
@@ -239,15 +238,15 @@ standard_toggled (GtkWidget * widget, GladeButtonEditor * button_editor)
button_editor->modifying = TRUE;
glade_command_push_group (_("Setting %s to use standard configuration"),
- button_editor->loaded_widget->name);
+ glade_widget_get_name (button_editor->loaded_widget));
/* If theres a widget customly inside... command remove it first... */
- button = GTK_WIDGET (button_editor->loaded_widget->object);
+ button = GTK_WIDGET (glade_widget_get_object (button_editor->loaded_widget));
child = gtk_bin_get_child (GTK_BIN (button));
if (child)
gchild = glade_widget_get_from_gobject (child);
- if (gchild && gchild->parent == button_editor->loaded_widget)
+ if (gchild && glade_widget_get_parent (gchild) == button_editor->loaded_widget)
{
GList widgets = { 0, };
widgets.data = gchild;
@@ -301,7 +300,7 @@ custom_toggled (GtkWidget * widget, GladeButtonEditor * button_editor)
button_editor->modifying = TRUE;
glade_command_push_group (_("Setting %s to use a custom child"),
- button_editor->loaded_widget->name);
+ glade_widget_get_name (button_editor->loaded_widget));
/* clear out some things... */
property = glade_widget_get_property (button_editor->loaded_widget, "image");
@@ -347,7 +346,7 @@ stock_toggled (GtkWidget * widget, GladeButtonEditor * button_editor)
button_editor->modifying = TRUE;
glade_command_push_group (_("Setting %s to use a stock button"),
- button_editor->loaded_widget->name);
+ glade_widget_get_name (button_editor->loaded_widget));
/* clear out stuff... */
property = glade_widget_get_property (button_editor->loaded_widget, "image");
@@ -395,7 +394,7 @@ label_toggled (GtkWidget * widget, GladeButtonEditor * button_editor)
button_editor->modifying = TRUE;
glade_command_push_group (_("Setting %s to use a label and image"),
- button_editor->loaded_widget->name);
+ glade_widget_get_name (button_editor->loaded_widget));
property = glade_widget_get_property (button_editor->loaded_widget, "stock");
glade_command_set_property (property, NULL);
diff --git a/plugins/gtk+/glade-cell-renderer-editor.c b/plugins/gtk+/glade-cell-renderer-editor.c
index 9b2ac73..f8e257e 100644
--- a/plugins/gtk+/glade-cell-renderer-editor.c
+++ b/plugins/gtk+/glade-cell-renderer-editor.c
@@ -108,14 +108,12 @@ glade_cell_renderer_editor_load (GladeEditable * editable, GladeWidget * widget)
/* Since we watch the project */
if (renderer_editor->loaded_widget)
{
- g_signal_handlers_disconnect_by_func (G_OBJECT
- (renderer_editor->loaded_widget->
- project),
+ g_signal_handlers_disconnect_by_func (glade_widget_get_project (renderer_editor->loaded_widget),
G_CALLBACK (project_changed),
renderer_editor);
/* The widget could die unexpectedly... */
- g_object_weak_unref (G_OBJECT (renderer_editor->loaded_widget->project),
+ g_object_weak_unref (G_OBJECT (glade_widget_get_project (renderer_editor->loaded_widget)),
(GWeakNotify) project_finalized, renderer_editor);
}
@@ -125,12 +123,12 @@ glade_cell_renderer_editor_load (GladeEditable * editable, GladeWidget * widget)
if (renderer_editor->loaded_widget)
{
/* This fires for undo/redo */
- g_signal_connect (G_OBJECT (renderer_editor->loaded_widget->project),
+ g_signal_connect (glade_widget_get_project (renderer_editor->loaded_widget),
"changed", G_CALLBACK (project_changed),
renderer_editor);
/* The widget/project could die unexpectedly... */
- g_object_weak_ref (G_OBJECT (renderer_editor->loaded_widget->project),
+ g_object_weak_ref (G_OBJECT (glade_widget_get_project (renderer_editor->loaded_widget)),
(GWeakNotify) project_finalized, renderer_editor);
}
@@ -235,9 +233,8 @@ attributes_toggled (GtkWidget * widget, CheckTab * tab)
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (tab->attributes_check)))
{
- glade_command_push_group (_
- ("Setting %s to use the %s property as an attribute"),
- renderer_editor->loaded_widget->name,
+ glade_command_push_group (_("Setting %s to use the %s property as an attribute"),
+ glade_widget_get_name (renderer_editor->loaded_widget),
tab->pclass->id);
@@ -260,7 +257,7 @@ attributes_toggled (GtkWidget * widget, CheckTab * tab)
else
{
glade_command_push_group (_("Setting %s to use the %s property directly"),
- renderer_editor->loaded_widget->name,
+ glade_widget_get_name (renderer_editor->loaded_widget),
tab->pclass->id);
@@ -480,32 +477,34 @@ GladeWidget *
glade_cell_renderer_get_model (GladeWidget * renderer)
{
GladeWidget *model = NULL;
+ GladeWidget *parent = glade_widget_get_parent (renderer);
/* Keep inline with all new cell layouts !!! */
- if (renderer->parent && GTK_IS_TREE_VIEW_COLUMN (renderer->parent->object))
+ if (parent && GTK_IS_TREE_VIEW_COLUMN (glade_widget_get_object (parent)))
{
- GladeWidget *column = renderer->parent;
+ GladeWidget *column = parent;
+ GladeWidget *column_parent = glade_widget_get_parent (column);
- if (column->parent && GTK_IS_TREE_VIEW (column->parent->object))
+ if (column_parent && GTK_IS_TREE_VIEW (glade_widget_get_object (column_parent)))
{
- GladeWidget *view = column->parent;
+ GladeWidget *view = column_parent;
GtkTreeModel *real_model = NULL;
glade_widget_property_get (view, "model", &real_model);
if (real_model)
model = glade_widget_get_from_gobject (real_model);
}
}
- else if (renderer->parent && GTK_IS_ICON_VIEW (renderer->parent->object))
+ else if (parent && GTK_IS_ICON_VIEW (glade_widget_get_object (parent)))
{
- GladeWidget *view = renderer->parent;
+ GladeWidget *view = parent;
GtkTreeModel *real_model = NULL;
glade_widget_property_get (view, "model", &real_model);
if (real_model)
model = glade_widget_get_from_gobject (real_model);
}
- else if (renderer->parent && GTK_IS_COMBO_BOX (renderer->parent->object))
+ else if (parent && GTK_IS_COMBO_BOX (glade_widget_get_object (parent)))
{
- GladeWidget *combo = renderer->parent;
+ GladeWidget *combo = parent;
GtkTreeModel *real_model = NULL;
glade_widget_property_get (combo, "model", &real_model);
if (real_model)
diff --git a/plugins/gtk+/glade-entry-editor.c b/plugins/gtk+/glade-entry-editor.c
index 8be4982..6ed5eee 100644
--- a/plugins/gtk+/glade-entry-editor.c
+++ b/plugins/gtk+/glade-entry-editor.c
@@ -93,15 +93,12 @@ glade_entry_editor_load (GladeEditable * editable, GladeWidget * widget)
if (entry_editor->loaded_widget)
{
/* watch custom-child and use-stock properties here for reloads !!! */
-
- g_signal_handlers_disconnect_by_func (G_OBJECT
- (entry_editor->loaded_widget->
- project),
+ g_signal_handlers_disconnect_by_func (glade_widget_get_project (entry_editor->loaded_widget),
G_CALLBACK (project_changed),
entry_editor);
/* The widget could die unexpectedly... */
- g_object_weak_unref (G_OBJECT (entry_editor->loaded_widget->project),
+ g_object_weak_unref (G_OBJECT (glade_widget_get_project (entry_editor->loaded_widget)),
(GWeakNotify) project_finalized, entry_editor);
}
@@ -111,11 +108,11 @@ glade_entry_editor_load (GladeEditable * editable, GladeWidget * widget)
if (entry_editor->loaded_widget)
{
/* This fires for undo/redo */
- g_signal_connect (G_OBJECT (entry_editor->loaded_widget->project),
+ g_signal_connect (glade_widget_get_project (entry_editor->loaded_widget),
"changed", G_CALLBACK (project_changed), entry_editor);
/* The widget/project could die unexpectedly... */
- g_object_weak_ref (G_OBJECT (entry_editor->loaded_widget->project),
+ g_object_weak_ref (G_OBJECT (glade_widget_get_project (entry_editor->loaded_widget)),
(GWeakNotify) project_finalized, entry_editor);
}
@@ -241,7 +238,7 @@ text_toggled (GtkWidget * widget, GladeEntryEditor * entry_editor)
entry_editor->modifying = TRUE;
glade_command_push_group (_("Setting %s to use static text"),
- entry_editor->loaded_widget->name);
+ glade_widget_get_name (entry_editor->loaded_widget));
property = glade_widget_get_property (entry_editor->loaded_widget, "buffer");
glade_command_set_property (property, NULL);
@@ -282,7 +279,7 @@ buffer_toggled (GtkWidget * widget, GladeEntryEditor * entry_editor)
entry_editor->modifying = TRUE;
glade_command_push_group (_("Setting %s to use an external buffer"),
- entry_editor->loaded_widget->name);
+ glade_widget_get_name (entry_editor->loaded_widget));
/* Reset the text while still in static text mode */
property = glade_widget_get_property (entry_editor->loaded_widget, "text");
@@ -390,7 +387,7 @@ primary_stock_toggled (GtkWidget * widget, GladeEntryEditor * entry_editor)
entry_editor->modifying = TRUE;
glade_command_push_group (_("Setting %s to use a primary icon from stock"),
- entry_editor->loaded_widget->name);
+ glade_widget_get_name (entry_editor->loaded_widget));
set_stock_mode (entry_editor, TRUE);
glade_command_pop_group ();
@@ -414,9 +411,8 @@ primary_icon_name_toggled (GtkWidget * widget, GladeEntryEditor * entry_editor)
entry_editor->modifying = TRUE;
- glade_command_push_group (_
- ("Setting %s to use a primary icon from the icon theme"),
- entry_editor->loaded_widget->name);
+ glade_command_push_group (_("Setting %s to use a primary icon from the icon theme"),
+ glade_widget_get_name (entry_editor->loaded_widget));
set_icon_name_mode (entry_editor, TRUE);
glade_command_pop_group ();
@@ -440,7 +436,7 @@ primary_pixbuf_toggled (GtkWidget * widget, GladeEntryEditor * entry_editor)
entry_editor->modifying = TRUE;
glade_command_push_group (_("Setting %s to use a primary icon from filename"),
- entry_editor->loaded_widget->name);
+ glade_widget_get_name (entry_editor->loaded_widget));
set_pixbuf_mode (entry_editor, TRUE);
glade_command_pop_group ();
@@ -466,7 +462,7 @@ secondary_stock_toggled (GtkWidget * widget, GladeEntryEditor * entry_editor)
entry_editor->modifying = TRUE;
glade_command_push_group (_("Setting %s to use a secondary icon from stock"),
- entry_editor->loaded_widget->name);
+ glade_widget_get_name (entry_editor->loaded_widget));
set_stock_mode (entry_editor, FALSE);
glade_command_pop_group ();
@@ -491,9 +487,8 @@ secondary_icon_name_toggled (GtkWidget * widget,
entry_editor->modifying = TRUE;
- glade_command_push_group (_
- ("Setting %s to use a secondary icon from the icon theme"),
- entry_editor->loaded_widget->name);
+ glade_command_push_group (_("Setting %s to use a secondary icon from the icon theme"),
+ glade_widget_get_name (entry_editor->loaded_widget));
set_icon_name_mode (entry_editor, FALSE);
glade_command_pop_group ();
@@ -516,9 +511,8 @@ secondary_pixbuf_toggled (GtkWidget * widget, GladeEntryEditor * entry_editor)
entry_editor->modifying = TRUE;
- glade_command_push_group (_
- ("Setting %s to use a secondary icon from filename"),
- entry_editor->loaded_widget->name);
+ glade_command_push_group (_("Setting %s to use a secondary icon from filename"),
+ glade_widget_get_name (entry_editor->loaded_widget));
set_pixbuf_mode (entry_editor, FALSE);
glade_command_pop_group ();
diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c
index d7b1f81..28d4100 100644
--- a/plugins/gtk+/glade-gtk.c
+++ b/plugins/gtk+/glade-gtk.c
@@ -104,8 +104,9 @@ gboolean
glade_gtk_widget_depends (GladeWidgetAdaptor * adaptor,
GladeWidget * widget, GladeWidget * another)
{
- if (GTK_IS_ICON_FACTORY (another->object) ||
- GTK_IS_ACTION (another->object) || GTK_IS_ACTION_GROUP (another->object))
+ if (GTK_IS_ICON_FACTORY (glade_widget_get_object (another)) ||
+ GTK_IS_ACTION (glade_widget_get_object (another)) ||
+ GTK_IS_ACTION_GROUP (glade_widget_get_object (another)))
return TRUE;
return GWA_GET_CLASS (G_TYPE_OBJECT)->depends (adaptor, widget, another);
@@ -242,7 +243,7 @@ glade_gtk_parse_atk_props (GladeWidget * widget, GladeXmlNode * node)
/* Set the parsed value on the property ... */
gvalue = glade_property_class_make_gvalue_from_string
- (property->klass, value, widget->project, widget);
+ (property->klass, value, glade_widget_get_project (widget), widget);
glade_property_set_value (property, gvalue);
g_value_unset (gvalue);
g_free (gvalue);
@@ -442,7 +443,7 @@ glade_gtk_widget_write_atk_properties (GladeWidget * widget,
if (!glade_property_default (name_prop) ||
!glade_property_default (desc_prop))
{
- gchar *atkname = g_strdup_printf ("%s-atkobject", widget->name);
+ gchar *atkname = g_strdup_printf ("%s-atkobject", glade_widget_get_name (widget));
child_node = glade_xml_node_new (context, GLADE_XML_TAG_CHILD);
glade_xml_node_append_child (node, child_node);
@@ -517,7 +518,7 @@ glade_gtk_widget_write_atk_relations (GladeWidget * widget,
glade_gtk_widget_write_atk_relation (property, context, node);
else
g_warning ("Couldnt find atk relation %s on widget %s",
- atk_relations_list[i], widget->name);
+ atk_relations_list[i], glade_widget_get_name (widget));
}
}
@@ -654,13 +655,16 @@ widget_parent_changed (GtkWidget * widget,
GParamSpec * pspec, GladeWidgetAdaptor * adaptor)
{
GladeWidget *gwidget = glade_widget_get_from_gobject (widget);
+ GladeWidget *parent;
/* this could get called for a stale instance of an object
* being rebuilt for a contruct-only property. */
if (!gwidget)
return;
- if (gwidget->parent && gwidget->parent->internal == NULL)
+ parent = glade_widget_get_parent (gwidget);
+
+ if (parent && !glade_widget_get_internal (parent))
glade_widget_set_action_sensitive (gwidget, "remove_parent", TRUE);
else
glade_widget_set_action_sensitive (gwidget, "remove_parent", FALSE);
@@ -679,18 +683,15 @@ glade_gtk_widget_deep_post_create (GladeWidgetAdaptor * adaptor,
glade_widget_set_action_sensitive (gwidget, "remove_parent", FALSE);
- if (GWA_IS_TOPLEVEL (adaptor) || gwidget->internal)
+ if (GWA_IS_TOPLEVEL (adaptor) || glade_widget_get_internal (gwidget))
glade_widget_set_action_sensitive (gwidget, "add_parent", FALSE);
-
/* Watch parents/projects and set actions sensitive/insensitive */
- if (gwidget->internal == NULL)
+ if (!glade_widget_get_internal (gwidget))
g_signal_connect (G_OBJECT (widget), "notify::parent",
G_CALLBACK (widget_parent_changed), adaptor);
-
}
-
void
glade_gtk_widget_set_property (GladeWidgetAdaptor * adaptor,
GObject * object,
@@ -775,9 +776,9 @@ glade_gtk_widget_action_activate (GladeWidgetAdaptor * adaptor,
GladeWidget *new_gparent;
g_return_if_fail (gparent);
- new_gparent = gparent->parent;
+ new_gparent = glade_widget_get_parent (gparent);
- glade_command_push_group (_("Removing parent of %s"), gwidget->name);
+ glade_command_push_group (_("Removing parent of %s"), glade_widget_get_name (gwidget));
/* Remove "this" widget */
this_widget.data = gwidget;
@@ -836,12 +837,12 @@ glade_gtk_widget_action_activate (GladeWidgetAdaptor * adaptor,
return;
glade_command_push_group (_("Adding parent %s for %s"),
- adaptor->title, gwidget->name);
+ adaptor->title, glade_widget_get_name (gwidget));
/* Record packing properties */
saved_props =
- glade_widget_dup_properties (gwidget, gwidget->packing_properties,
- FALSE, FALSE, FALSE);
+ glade_widget_dup_properties (gwidget, glade_widget_get_packing_properties (gwidget),
+ FALSE, FALSE, FALSE);
/* Remove "this" widget */
this_widget.data = gwidget;
@@ -911,7 +912,7 @@ list_sizegroups (GladeWidget * gwidget)
for (list = glade_project_get_objects (project); list; list = list->next)
{
GladeWidget *iter = glade_widget_get_from_gobject (list->data);
- if (GTK_IS_SIZE_GROUP (iter->object))
+ if (GTK_IS_SIZE_GROUP (glade_widget_get_object (iter)))
groups = g_list_prepend (groups, iter);
}
return g_list_reverse (groups);
@@ -928,11 +929,12 @@ glade_gtk_widget_add2group_cb (GtkMenuItem * item, GladeWidget * gwidget)
GladeProperty *property;
if (group)
- glade_command_push_group (_("Adding %s to Size Group %s"), gwidget->name,
- group->name);
+ glade_command_push_group (_("Adding %s to Size Group %s"),
+ glade_widget_get_name (gwidget),
+ glade_widget_get_name (group));
else
glade_command_push_group (_("Adding %s to a new Size Group"),
- gwidget->name);
+ glade_widget_get_name (gwidget));
if (!group)
/* Cant cancel a size group */
@@ -943,8 +945,8 @@ glade_gtk_widget_add2group_cb (GtkMenuItem * item, GladeWidget * gwidget)
property = glade_widget_get_property (group, "widgets");
glade_property_get (property, &widget_list);
new_list = g_list_copy (widget_list);
- if (!g_list_find (widget_list, gwidget->object))
- new_list = g_list_append (new_list, gwidget->object);
+ if (!g_list_find (widget_list, glade_widget_get_object (gwidget)))
+ new_list = g_list_append (new_list, glade_widget_get_object (gwidget));
glade_command_set_property (property, new_list);
g_list_free (new_list);
@@ -971,7 +973,7 @@ glade_gtk_widget_action_submenu (GladeWidgetAdaptor * adaptor,
for (list = groups; list; list = list->next)
{
group = list->data;
- item = gtk_menu_item_new_with_label (group->name);
+ item = gtk_menu_item_new_with_label (glade_widget_get_name (group));
g_object_set_data (G_OBJECT (item), "glade-group-widget", group);
g_signal_connect (G_OBJECT (item), "activate",
@@ -1187,7 +1189,7 @@ glade_gtk_box_configure_child (GladeFixed * fixed,
iter_span, position, old_position, offset, orig_offset;
gboolean found = FALSE;
- gtk_widget_get_allocation (GTK_WIDGET (child->object), &allocation);
+ gtk_widget_get_allocation (GTK_WIDGET (glade_widget_get_object (child)), &allocation);
if (GTK_IS_HBOX (box) || GTK_IS_HBUTTON_BOX (box))
{
point = fixed->mouse_x;
@@ -1211,7 +1213,7 @@ glade_gtk_box_configure_child (GladeFixed * fixed,
{
bchild = list->data;
- if (bchild == GTK_WIDGET (child->object))
+ if (bchild == GTK_WIDGET (glade_widget_get_object (child)))
continue;
/* Find the widget in the box where the center of
@@ -1352,10 +1354,10 @@ glade_gtk_box_configure_end (GladeFixed * fixed,
g_list_free (children);
glade_command_push_group (_("Ordering children of %s"),
- GLADE_WIDGET (fixed)->name);
+ glade_widget_get_name (GLADE_WIDGET (fixed)));
glade_property_push_superuser ();
if (prop_list)
- glade_command_set_properties_list (GLADE_WIDGET (fixed)->project,
+ glade_command_set_properties_list (glade_widget_get_project (GLADE_WIDGET (fixed)),
prop_list);
glade_property_pop_superuser ();
glade_command_pop_group ();
@@ -1464,15 +1466,12 @@ glade_gtk_box_set_child_property (GladeWidgetAdaptor * adaptor,
if (is_position && recursion == FALSE)
{
- children = glade_widget_adaptor_get_children (gbox->adaptor, container);
-
+ children = glade_widget_get_children (gbox);
children = g_list_sort (children, (GCompareFunc) sort_box_children);
for (list = children; list; list = list->next)
{
- if ((gchild_iter =
- glade_widget_get_from_gobject (list->data)) == NULL)
- continue;
+ gchild_iter = glade_widget_get_from_gobject (list->data);
if (gchild_iter == gchild)
{
@@ -1505,9 +1504,7 @@ glade_gtk_box_set_child_property (GladeWidgetAdaptor * adaptor,
for (list = children; list; list = list->next)
{
- if ((gchild_iter =
- glade_widget_get_from_gobject (list->data)) == NULL)
- continue;
+ gchild_iter = glade_widget_get_from_gobject (list->data);
/* Refresh values yet again */
glade_widget_pack_property_get
@@ -1784,10 +1781,9 @@ glade_gtk_box_add_child (GladeWidgetAdaptor * adaptor,
glade_widget_remove_pack_action (gchild, "remove_slot");
/* Packing props arent around when parenting during a glade_widget_dup() */
- if (gchild && gchild->packing_properties)
+ if (gchild && glade_widget_get_packing_properties (gchild))
glade_widget_pack_property_set (gchild, "position", num_children - 1);
-
fix_response_id_on_child (gbox, child, TRUE);
}
@@ -1858,7 +1854,8 @@ glade_gtk_box_get_internal_child (GladeWidgetAdaptor * adaptor,
{
GladeWidget *gw = glade_widget_get_from_gobject (l->data);
- if (gw && gw->internal && strcmp (gw->internal, name) == 0)
+ if (gw && glade_widget_get_internal (gw) &&
+ strcmp (glade_widget_get_internal (gw), name) == 0)
{
child = G_OBJECT (l->data);
break;
@@ -2341,7 +2338,8 @@ glade_gtk_table_configure_end (GladeFixed * fixed,
g_value_set_uint (&bottom_attach_value, table_edit.bottom_attach);
glade_command_push_group (_("Placing %s inside %s"),
- child->name, GLADE_WIDGET (fixed)->name);
+ glade_widget_get_name (child),
+ glade_widget_get_name (GLADE_WIDGET (fixed)));
glade_command_set_properties
(left_attach_prop, &left_attach_value, &new_left_attach_value,
right_attach_prop, &right_attach_value, &new_right_attach_value,
@@ -3014,7 +3012,8 @@ glade_gtk_frame_post_create (GladeWidgetAdaptor * adaptor,
glade_widget_property_set (glabel, "use-markup", "TRUE");
g_free (label_text);
- g_object_set_data (glabel->object, "special-child-type", "label_item");
+ g_object_set_data (glade_widget_get_object (glabel),
+ "special-child-type", "label_item");
glade_widget_add_child (gframe, glabel, FALSE);
/* add alignment */
@@ -3123,7 +3122,7 @@ write_special_child_label_item (GladeWidgetAdaptor * adaptor,
gchar *special_child_type = NULL;
GObject *child;
- child = widget->object;
+ child = glade_widget_get_object (widget);
if (child)
special_child_type = g_object_get_data (child, "special-child-type");
@@ -3431,28 +3430,28 @@ glade_gtk_notebook_selection_changed (GladeProject * project,
GladeWidget *selected;
GList *list;
gint i;
- GtkWidget *page;
+ GtkWidget *page, *sel_widget;
+ GtkNotebook *notebook = GTK_NOTEBOOK (glade_widget_get_object (gwidget));
if ((list = glade_project_selection_get (project)) != NULL &&
g_list_length (list) == 1)
{
- selected = glade_widget_get_from_gobject (list->data);
+ selected = glade_widget_get_from_gobject (list->data);
+ sel_widget = list->data;
/* Check if selected widget is inside the notebook */
- if (GTK_IS_WIDGET (selected->object) &&
- gtk_widget_is_ancestor (GTK_WIDGET (selected->object),
- GTK_WIDGET (gwidget->object)))
+ if (GTK_IS_WIDGET (sel_widget) &&
+ gtk_widget_is_ancestor (sel_widget, GTK_WIDGET (notebook)))
{
/* Find and activate the page */
for (i = 0;
- i < gtk_notebook_get_n_pages (GTK_NOTEBOOK (gwidget->object));
+ i < gtk_notebook_get_n_pages (notebook);
i++)
{
- page =
- gtk_notebook_get_nth_page (GTK_NOTEBOOK (gwidget->object), i);
- if (GTK_WIDGET (selected->object) == page ||
- gtk_widget_is_ancestor (GTK_WIDGET (selected->object),
- GTK_WIDGET (page)))
+ page = gtk_notebook_get_nth_page (notebook, i);
+
+ if (sel_widget == page ||
+ gtk_widget_is_ancestor (sel_widget, GTK_WIDGET (page)))
{
glade_widget_property_set (gwidget, "page", i);
return;
@@ -3545,8 +3544,8 @@ glade_gtk_notebook_generate_tab (GladeWidget * notebook, gint page_id)
glade_widget_property_set (glabel, "label", str);
g_free (str);
- g_object_set_data (glabel->object, "special-child-type", "tab");
- gtk_widget_show (GTK_WIDGET (glabel->object));
+ g_object_set_data (glade_widget_get_object (glabel), "special-child-type", "tab");
+ gtk_widget_show (GTK_WIDGET (glade_widget_get_object (glabel)));
return glabel;
}
@@ -3715,7 +3714,7 @@ glade_gtk_notebook_add_child (GladeWidgetAdaptor * adaptor,
glade_widget_property_set (gwidget, "pages", num_page + 1);
gwidget = glade_widget_get_from_gobject (child);
- if (gwidget && gwidget->packing_properties)
+ if (gwidget && glade_widget_get_packing_properties (gwidget))
glade_widget_pack_property_set (gwidget, "position", num_page);
}
}
@@ -4131,7 +4130,7 @@ glade_gtk_paned_add_child (GladeWidgetAdaptor * adaptor,
{
GladeWidget *gchild = glade_widget_get_from_gobject (child);
- if (gchild && gchild->packing_properties)
+ if (gchild && glade_widget_get_packing_properties (gchild))
{
if (child1 == NULL)
glade_widget_pack_property_set (gchild, "first", TRUE);
@@ -4243,7 +4242,7 @@ glade_gtk_expander_post_create (GladeWidgetAdaptor * adaptor,
glade_widget_property_set (glabel, "label", "expander");
- g_object_set_data (glabel->object, "special-child-type", "label_item");
+ g_object_set_data (glade_widget_get_object (glabel), "special-child-type", "label_item");
glade_widget_add_child (gexpander, glabel, FALSE);
}
@@ -4342,7 +4341,7 @@ gboolean
glade_gtk_entry_depends (GladeWidgetAdaptor * adaptor,
GladeWidget * widget, GladeWidget * another)
{
- if (GTK_IS_ENTRY_BUFFER (another->object))
+ if (GTK_IS_ENTRY_BUFFER (glade_widget_get_object (another)))
return TRUE;
return GWA_GET_CLASS (GTK_TYPE_WIDGET)->depends (adaptor, widget, another);
@@ -4540,8 +4539,8 @@ glade_gtk_entry_read_widget (GladeWidgetAdaptor * adaptor,
{
gint target_minor, target_major;
- glade_project_get_target_version (widget->project, "gtk+", &target_major,
- &target_minor);
+ glade_project_get_target_version (glade_widget_get_project (widget), "gtk+",
+ &target_major, &target_minor);
property = glade_widget_get_property (widget, "buffer");
@@ -4784,7 +4783,7 @@ glade_gtk_window_write_accel_groups (GladeWidget * widget,
group_node = glade_xml_node_new (context, GLADE_TAG_ACCEL_GROUP);
glade_xml_node_append_child (groups_node, group_node);
glade_xml_node_set_property_string (group_node, GLADE_TAG_NAME,
- agroup->name);
+ glade_widget_get_name (agroup));
}
}
@@ -5154,8 +5153,8 @@ glade_gtk_dialog_read_responses (GladeWidget * widget,
widget_name = glade_xml_get_content (node);
if ((action_widget =
- glade_project_get_widget_by_name (widget->project, widget,
- widget_name)) != NULL)
+ glade_project_get_widget_by_name (glade_widget_get_project (widget),
+ widget, widget_name)) != NULL)
{
glade_widget_property_set (action_widget, "response-id",
g_ascii_strtoll (response, NULL, 10));
@@ -5188,7 +5187,7 @@ glade_gtk_dialog_write_responses (GladeWidget * widget,
GladeXmlNode * node)
{
GladeXmlNode *widget_node;
- GtkDialog *dialog = GTK_DIALOG (widget->object);
+ GtkDialog *dialog = GTK_DIALOG (glade_widget_get_object (widget));
GList *l, *action_widgets =
gtk_container_get_children (GTK_CONTAINER
(gtk_dialog_get_action_area (dialog)));
@@ -5214,12 +5213,11 @@ glade_gtk_dialog_write_responses (GladeWidget * widget,
property->value);
glade_xml_node_set_property_string (widget_node, GLADE_TAG_RESPONSE, str);
- glade_xml_set_content (widget_node, action_widget->name);
+ glade_xml_set_content (widget_node, glade_widget_get_name (action_widget));
g_free (str);
}
-
g_list_free (action_widgets);
}
@@ -5235,10 +5233,10 @@ glade_gtk_dialog_write_child (GladeWidgetAdaptor * adaptor,
GWA_GET_CLASS (GTK_TYPE_CONTAINER)->write_child (adaptor, widget, context,
node);
- parent = widget->parent;
- project = widget->project;
+ parent = glade_widget_get_parent (widget);
+ project = glade_widget_get_project (widget);
- if (parent && GTK_IS_DIALOG (parent->object))
+ if (parent && GTK_IS_DIALOG (glade_widget_get_object (parent)))
{
widgets_node = glade_xml_node_new (context, GLADE_TAG_ACTION_WIDGETS);
@@ -5315,7 +5313,7 @@ glade_gtk_message_dialog_image_determine_action (GtkMessageDialog * dialog,
}
if (glade_widget_get_parent (*gimage) ||
- GWA_IS_TOPLEVEL ((*gimage)->adaptor))
+ GWA_IS_TOPLEVEL (glade_widget_get_adaptor (*gimage)))
return MD_IMAGE_ACTION_INVALID;
return MD_IMAGE_ACTION_SET;
@@ -5663,7 +5661,7 @@ glade_gtk_button_post_create (GladeWidgetAdaptor * adaptor,
glade_widget_property_set_enabled (gbutton, "response-id", FALSE);
if (reason == GLADE_CREATE_LOAD)
- g_signal_connect (G_OBJECT (gbutton->project), "parse-finished",
+ g_signal_connect (glade_widget_get_project (gbutton), "parse-finished",
G_CALLBACK (activatable_parse_finished),
gbutton);
}
@@ -5747,8 +5745,8 @@ glade_gtk_button_write_widget (GladeWidgetAdaptor * adaptor,
return;
/* Do not save GtkColorButton and GtkFontButton label property */
- if (!(GTK_IS_COLOR_BUTTON (widget->object) ||
- GTK_IS_FONT_BUTTON (widget->object)))
+ if (!(GTK_IS_COLOR_BUTTON (glade_widget_get_object (widget)) ||
+ GTK_IS_FONT_BUTTON (glade_widget_get_object (widget))))
{
/* Make a copy of the GladeProperty,
* override its value and ensure non-translatable if use-stock is TRUE
@@ -6206,9 +6204,10 @@ glade_gtk_menu_shell_move_child (GladeBaseEditor * editor,
GladeWidget * gparent,
GladeWidget * gchild, gpointer data)
{
- GObject *parent = glade_widget_get_object (gparent);
- GObject *child = glade_widget_get_object (gchild);
- GladeWidget *old_parent = gchild->parent;
+ GObject *parent = glade_widget_get_object (gparent);
+ GObject *child = glade_widget_get_object (gchild);
+ GladeWidget *old_parent = glade_widget_get_parent (gchild);
+ GladeWidget *old_parent_parent;
GList list = { 0, };
if (GTK_IS_SEPARATOR_MENU_ITEM (parent) ||
@@ -6237,14 +6236,15 @@ glade_gtk_menu_shell_move_child (GladeBaseEditor * editor,
}
/* Delete dangling childless menus */
- if (GTK_IS_MENU (old_parent->object) &&
- old_parent->parent && GTK_IS_MENU_ITEM (old_parent->parent->object))
+ old_parent_parent = glade_widget_get_parent (old_parent);
+ if (GTK_IS_MENU (glade_widget_get_object (old_parent)) &&
+ old_parent_parent &&
+ GTK_IS_MENU_ITEM (glade_widget_get_object (old_parent_parent)))
{
- GList del = { 0, }
- , *children;
+ GList del = { 0, }, *children;
children =
- gtk_container_get_children (GTK_CONTAINER (old_parent->object));
+ gtk_container_get_children (GTK_CONTAINER (glade_widget_get_object (old_parent)));
if (!children)
{
del.data = old_parent;
@@ -6502,7 +6502,7 @@ glade_gtk_menu_item_post_create (GladeWidgetAdaptor * adaptor,
}
if (reason == GLADE_CREATE_LOAD)
- g_signal_connect (G_OBJECT (gitem->project), "parse-finished",
+ g_signal_connect (G_OBJECT (glade_widget_get_project (gitem)), "parse-finished",
G_CALLBACK (activatable_parse_finished),
gitem);
}
@@ -6788,7 +6788,7 @@ glade_gtk_image_menu_item_read_widget (GladeWidgetAdaptor * adaptor,
/* Run this after the load so that image is resolved. */
- g_signal_connect (G_OBJECT (widget->project), "parse-finished",
+ g_signal_connect (G_OBJECT (glade_widget_get_project (widget)), "parse-finished",
G_CALLBACK (glade_gtk_image_menu_item_parse_finished),
widget);
}
@@ -7104,7 +7104,7 @@ glade_gtk_toolbar_add_child (GladeWidgetAdaptor * adaptor,
GladeWidget *gchild = glade_widget_get_from_gobject (child);
/* Packing props arent around when parenting during a glade_widget_dup() */
- if (gchild && gchild->packing_properties)
+ if (gchild && glade_widget_get_packing_properties (gchild))
glade_widget_pack_property_set (gchild, "position",
gtk_toolbar_get_item_index (toolbar,
item));
@@ -7222,7 +7222,7 @@ glade_gtk_tool_item_post_create (GladeWidgetAdaptor *adaptor,
gtk_container_add (GTK_CONTAINER (object), glade_placeholder_new ());
if (reason == GLADE_CREATE_LOAD)
- g_signal_connect (G_OBJECT (gitem->project), "parse-finished",
+ g_signal_connect (G_OBJECT (glade_widget_get_project (gitem)), "parse-finished",
G_CALLBACK (activatable_parse_finished),
gitem);
}
@@ -7868,7 +7868,7 @@ glade_gtk_label_read_widget (GladeWidgetAdaptor * adaptor,
/* sync label property after a load... */
prop = glade_widget_get_property (widget, "label");
- glade_gtk_label_set_label (widget->object, prop->value);
+ glade_gtk_label_set_label (glade_widget_get_object (widget), prop->value);
/* Resolve "label-content-mode" virtual control property */
if (!glade_widget_property_original_default (widget, "use-markup"))
@@ -8660,7 +8660,7 @@ gboolean
glade_gtk_size_group_depends (GladeWidgetAdaptor * adaptor,
GladeWidget * widget, GladeWidget * another)
{
- if (GTK_IS_WIDGET (another->object))
+ if (GTK_IS_WIDGET (glade_widget_get_object (another)))
return TRUE;
return GWA_GET_CLASS (G_TYPE_OBJECT)->depends (adaptor, widget, another);
@@ -8754,7 +8754,7 @@ glade_gtk_size_group_write_widgets (GladeWidget * widget,
glade_xml_node_new (context, GLADE_TAG_SIZEGROUP_WIDGET);
glade_xml_node_append_child (widgets_node, widget_node);
glade_xml_node_set_property_string (widget_node, GLADE_TAG_NAME,
- awidget->name);
+ glade_widget_get_name (awidget));
}
}
@@ -8882,7 +8882,7 @@ glade_gtk_icon_factory_read_sources (GladeWidget * widget, GladeXmlNode * node)
/* Deal with the filename... */
value = glade_utils_value_from_string (GDK_TYPE_PIXBUF, str,
- widget->project, widget);
+ glade_widget_get_project (widget), widget);
pixbuf = g_value_dup_object (value);
g_value_unset (value);
g_free (value);
@@ -9262,6 +9262,7 @@ glade_gtk_cell_renderer_sync_attributes (GObject * object)
GtkCellLayout *layout;
GtkCellRenderer *cell;
GladeWidget *widget = glade_widget_get_from_gobject (object);
+ GladeWidget *parent;
GladeWidget *gmodel;
GladeProperty *property;
gchar *attr_prop_name;
@@ -9275,14 +9276,15 @@ glade_gtk_cell_renderer_sync_attributes (GObject * object)
/* Apply attributes to renderer when bound to a model in runtime */
widget = glade_widget_get_from_gobject (object);
- if (widget->parent == NULL)
+ parent = glade_widget_get_parent (widget);
+ if (parent == NULL)
return FALSE;
/* When creating widgets, sometimes the parent is set before parenting happens,
* here we have to be careful for that..
*/
- layout = GTK_CELL_LAYOUT (widget->parent->object);
- cell = GTK_CELL_RENDERER (object);
+ layout = GTK_CELL_LAYOUT (glade_widget_get_object (parent));
+ cell = GTK_CELL_RENDERER (object);
if (!glade_gtk_cell_layout_has_renderer (layout, cell))
return FALSE;
@@ -9295,7 +9297,7 @@ glade_gtk_cell_renderer_sync_attributes (GObject * object)
gtk_cell_layout_clear_attributes (layout, cell);
- for (l = widget->properties; l; l = l->next)
+ for (l = glade_widget_get_properties (widget); l; l = l->next)
{
property = l->data;
@@ -9334,7 +9336,7 @@ glade_gtk_cell_layout_sync_attributes (GObject * layout)
GObject *cell;
GList *children, *l;
- children = glade_widget_adaptor_get_children (gwidget->adaptor, layout);
+ children = glade_widget_get_children (gwidget);
for (l = children; l; l = l->next)
{
cell = l->data;
@@ -9476,20 +9478,20 @@ glade_gtk_store_columns_changed (GladeProperty * property,
GValue * old_value,
GValue * new_value, GladeWidget * store)
{
- GList *l, *list, *children;
+ GList *l, *list, *children, *prop_refs;
/* Reset the attributes for all cell renderers referring to this store */
- for (l = store->prop_refs; l; l = l->next)
+ prop_refs = glade_widget_list_prop_refs (store);
+ for (l = prop_refs; l; l = l->next)
{
GladeWidget *referring_widget = GLADE_PROPERTY (l->data)->widget;
+ GObject *referring_object = glade_widget_get_object (referring_widget);
- if (GTK_IS_CELL_LAYOUT (referring_widget->object))
- glade_gtk_cell_layout_sync_attributes (referring_widget->object);
- else if (GTK_IS_TREE_VIEW (referring_widget->object))
+ if (GTK_IS_CELL_LAYOUT (referring_object))
+ glade_gtk_cell_layout_sync_attributes (referring_object);
+ else if (GTK_IS_TREE_VIEW (referring_object))
{
- children =
- glade_widget_adaptor_get_children (referring_widget->adaptor,
- referring_widget->object);
+ children = glade_widget_get_children (referring_widget);
for (list = children; list; list = list->next)
{
@@ -9501,6 +9503,7 @@ glade_gtk_store_columns_changed (GladeProperty * property,
g_list_free (children);
}
}
+ g_list_free (prop_refs);
}
void
@@ -9894,8 +9897,8 @@ glade_gtk_store_read_data (GladeWidget * widget, GladeXmlNode * node)
*/
value_str = glade_xml_get_content (col_node);
value = glade_utils_value_from_string
- (g_type_from_name (column_type->type_name), value_str,
- widget->project, widget);
+ (g_type_from_name (column_type->type_name), value_str,
+ glade_widget_get_project (widget), widget);
g_free (value_str);
data =
@@ -9948,7 +9951,7 @@ glade_gtk_store_read_widget (GladeWidgetAdaptor * adaptor,
glade_gtk_store_read_columns (widget, node);
- if (GTK_IS_LIST_STORE (widget->object))
+ if (GTK_IS_LIST_STORE (glade_widget_get_object (widget)))
glade_gtk_store_read_data (widget, node);
}
@@ -9966,16 +9969,17 @@ glade_gtk_cell_renderer_action_activate (GladeWidgetAdaptor * adaptor,
while ((w = glade_widget_get_parent (w)))
{
- if (GTK_IS_TREE_VIEW (w->object))
+ GObject *object = glade_widget_get_object (w);
+
+ if (GTK_IS_TREE_VIEW (object))
{
- glade_gtk_treeview_launch_editor (w->object);
+ glade_gtk_treeview_launch_editor (object);
break;
}
}
}
else
- GWA_GET_CLASS (G_TYPE_OBJECT)->action_activate (adaptor,
- object, action_path);
+ GWA_GET_CLASS (G_TYPE_OBJECT)->action_activate (adaptor, object, action_path);
}
void
@@ -10001,8 +10005,7 @@ glade_gtk_cell_renderer_deep_post_create (GladeWidgetAdaptor * adaptor,
}
}
- g_idle_add ((GSourceFunc) glade_gtk_cell_renderer_sync_attributes,
- widget->object);
+ g_idle_add ((GSourceFunc) glade_gtk_cell_renderer_sync_attributes, object);
}
GladeEditorProperty *
@@ -10050,9 +10053,9 @@ glade_gtk_cell_renderer_set_use_attribute (GObject * object,
attr_prop_name = g_strdup_printf ("attr-%s", property_name);
prop_msg = g_strdup_printf (_("%s is set to load %s from the model"),
- widget->name, property_name);
+ glade_widget_get_name (widget), property_name);
attr_msg = g_strdup_printf (_("%s is set to manipulate %s directly"),
- widget->name, attr_prop_name);
+ glade_widget_get_name (widget), attr_prop_name);
glade_widget_property_set_sensitive (widget, property_name, FALSE, prop_msg);
glade_widget_property_set_sensitive (widget, attr_prop_name, FALSE, attr_msg);
@@ -10143,7 +10146,7 @@ glade_gtk_cell_renderer_write_properties (GladeWidget * widget,
if (!attr_len)
attr_len = strlen ("attr-");
- for (l = widget->properties; l; l = l->next)
+ for (l = glade_widget_get_properties (widget); l; l = l->next)
{
property = l->data;
@@ -10202,7 +10205,7 @@ glade_gtk_cell_renderer_parse_finished (GladeProject * project,
use_attr_len = strlen ("use-attr-");
}
- for (l = widget->properties; l; l = l->next)
+ for (l = glade_widget_get_properties (widget); l; l = l->next)
{
GladeProperty *switch_prop;
property = l->data;
@@ -10232,7 +10235,7 @@ glade_gtk_cell_renderer_read_widget (GladeWidgetAdaptor * adaptor,
/* First chain up and read in all the properties... */
GWA_GET_CLASS (G_TYPE_OBJECT)->read_widget (adaptor, widget, node);
- g_signal_connect (widget->project, "parse-finished",
+ g_signal_connect (glade_widget_get_project (widget), "parse-finished",
G_CALLBACK (glade_gtk_cell_renderer_parse_finished),
widget);
}
@@ -10254,7 +10257,7 @@ glade_gtk_cell_layout_add_child (GladeWidgetAdaptor * adaptor,
if (gmodel)
gtk_icon_view_set_model (GTK_ICON_VIEW (container),
- GTK_TREE_MODEL (gmodel->object));
+ GTK_TREE_MODEL (glade_widget_get_object (gmodel)));
glade_gtk_cell_renderer_sync_attributes (child);
}
@@ -10411,7 +10414,7 @@ glade_gtk_cell_layout_read_child (GladeWidgetAdaptor * adaptor,
{
/* Combo box is a special brand of cell-layout, it can also have the internal entry */
- if ((child_widget = glade_widget_read (widget->project,
+ if ((child_widget = glade_widget_read (glade_widget_get_project (widget),
widget, widget_node,
internal_name)) != NULL)
{
@@ -10427,7 +10430,7 @@ glade_gtk_cell_layout_read_child (GladeWidgetAdaptor * adaptor,
glade_gtk_cell_renderer_read_attributes (child_widget, node);
g_idle_add ((GSourceFunc) glade_gtk_cell_renderer_sync_attributes,
- child_widget->object);
+ glade_widget_get_object (child_widget));
}
}
}
@@ -10450,7 +10453,7 @@ glade_gtk_cell_renderer_write_attributes (GladeWidget * widget,
attrs_node = glade_xml_node_new (context, GLADE_TAG_ATTRIBUTES);
- for (l = widget->properties; l; l = l->next)
+ for (l = glade_widget_get_properties (widget); l; l = l->next)
{
property = l->data;
@@ -10498,10 +10501,10 @@ glade_gtk_cell_layout_write_child (GladeWidgetAdaptor * adaptor,
glade_xml_node_append_child (node, child_node);
/* ComboBox can have an internal entry */
- if (widget->internal)
+ if (glade_widget_get_internal (widget))
glade_xml_node_set_property_string (child_node,
GLADE_XML_TAG_INTERNAL_CHILD,
- widget->internal);
+ glade_widget_get_internal (widget));
/* Write out the widget */
glade_widget_write (widget, context, child_node);
@@ -10520,7 +10523,7 @@ glade_gtk_cell_layout_get_display_name (GladeBaseEditor * editor,
if (GTK_IS_TREE_VIEW_COLUMN (child))
glade_widget_property_get (gchild, "title", &name);
else
- name = gchild->name;
+ name = (gchar *)glade_widget_get_name (gchild);
return g_strdup (name);
}
@@ -10577,17 +10580,14 @@ glade_gtk_cell_layout_move_child (GladeBaseEditor * editor,
static void
glade_gtk_cell_layout_launch_editor (GObject * layout)
{
- GladeWidget *widget = glade_widget_get_from_gobject (layout);
- GladeBaseEditor *editor;
- GladeEditable *layout_editor;
- GtkWidget *window;
+ GladeWidget *widget = glade_widget_get_from_gobject (layout);
+ GladeWidgetAdaptor *adaptor = glade_widget_get_adaptor (widget);
+ GladeBaseEditor *editor;
+ GladeEditable *layout_editor;
+ GtkWidget *window;
- layout_editor =
- glade_widget_adaptor_create_editable (widget->adaptor,
- GLADE_PAGE_GENERAL);
- layout_editor =
- (GladeEditable *) glade_tree_view_editor_new (widget->adaptor,
- layout_editor);
+ layout_editor = glade_widget_adaptor_create_editable (adaptor, GLADE_PAGE_GENERAL);
+ layout_editor = (GladeEditable *) glade_tree_view_editor_new (adaptor, layout_editor);
/* Editor */
editor = glade_base_editor_new (layout, layout_editor,
@@ -10625,22 +10625,23 @@ glade_gtk_cell_layout_launch_editor_action (GObject * object)
do
{
- if (GTK_IS_TREE_VIEW (w->object))
+ GObject *obj = glade_widget_get_object (w);
+
+ if (GTK_IS_TREE_VIEW (obj))
{
- glade_gtk_treeview_launch_editor (w->object);
+ glade_gtk_treeview_launch_editor (obj);
break;
}
- else if (GTK_IS_ICON_VIEW (w->object))
+ else if (GTK_IS_ICON_VIEW (obj))
{
- glade_gtk_cell_layout_launch_editor (w->object);
+ glade_gtk_cell_layout_launch_editor (obj);
break;
}
- else if (GTK_IS_COMBO_BOX (w->object))
+ else if (GTK_IS_COMBO_BOX (obj))
{
- glade_gtk_cell_layout_launch_editor (w->object);
+ glade_gtk_cell_layout_launch_editor (obj);
break;
}
-
}
while ((w = glade_widget_get_parent (w)));
}
@@ -10675,18 +10676,14 @@ glade_gtk_cell_layout_action_activate_as_widget (GladeWidgetAdaptor * adaptor,
static void
glade_gtk_treeview_launch_editor (GObject * treeview)
{
- GladeWidget *widget = glade_widget_get_from_gobject (treeview);
- GladeBaseEditor *editor;
- GladeEditable *treeview_editor;
- GtkWidget *window;
+ GladeWidget *widget = glade_widget_get_from_gobject (treeview);
+ GladeWidgetAdaptor *adaptor = glade_widget_get_adaptor (widget);
+ GladeBaseEditor *editor;
+ GladeEditable *treeview_editor;
+ GtkWidget *window;
-
- treeview_editor =
- glade_widget_adaptor_create_editable (widget->adaptor,
- GLADE_PAGE_GENERAL);
- treeview_editor =
- (GladeEditable *) glade_tree_view_editor_new (widget->adaptor,
- treeview_editor);
+ treeview_editor = glade_widget_adaptor_create_editable (adaptor, GLADE_PAGE_GENERAL);
+ treeview_editor = (GladeEditable *) glade_tree_view_editor_new (adaptor, treeview_editor);
/* Editor */
editor = glade_base_editor_new (treeview, treeview_editor,
@@ -10882,7 +10879,7 @@ gboolean
glade_gtk_treeview_depends (GladeWidgetAdaptor * adaptor,
GladeWidget * widget, GladeWidget * another)
{
- if (GTK_IS_TREE_MODEL (another->object))
+ if (GTK_IS_TREE_MODEL (glade_widget_get_object (another)))
return TRUE;
return GWA_GET_CLASS (GTK_TYPE_CONTAINER)->depends (adaptor, widget, another);
@@ -11015,7 +11012,7 @@ glade_gtk_action_group_read_child (GladeWidgetAdaptor * adaptor,
if ((widget_node =
glade_xml_search_child (node, GLADE_XML_TAG_WIDGET)) != NULL)
{
- if ((child_widget = glade_widget_read (widget->project,
+ if ((child_widget = glade_widget_read (glade_widget_get_project (widget),
widget, widget_node,
NULL)) != NULL)
{
@@ -11071,18 +11068,19 @@ glade_gtk_action_move_child (GladeBaseEditor *editor,
static void
glade_gtk_action_launch_editor (GObject *action)
{
- GladeWidget *widget = glade_widget_get_from_gobject (action);
- GladeBaseEditor *editor;
- GladeEditable *action_editor;
- GtkWidget *window;
+ GladeWidget *widget = glade_widget_get_from_gobject (action);
+ GladeWidgetAdaptor *adaptor = glade_widget_get_adaptor (widget);
+ GladeBaseEditor *editor;
+ GladeEditable *action_editor;
+ GtkWidget *window;
/* Make sure we get the group here */
widget = glade_widget_get_toplevel (widget);
- action_editor = glade_widget_adaptor_create_editable (widget->adaptor, GLADE_PAGE_GENERAL);
+ action_editor = glade_widget_adaptor_create_editable (adaptor, GLADE_PAGE_GENERAL);
/* Editor */
- editor = glade_base_editor_new (widget->object, action_editor,
+ editor = glade_base_editor_new (glade_widget_get_object (widget), action_editor,
_("Action"), GTK_TYPE_ACTION,
_("Toggle"), GTK_TYPE_TOGGLE_ACTION,
_("Radio"), GTK_TYPE_RADIO_ACTION,
diff --git a/plugins/gtk+/glade-icon-factory-editor.c b/plugins/gtk+/glade-icon-factory-editor.c
index a34d12f..5205877 100644
--- a/plugins/gtk+/glade-icon-factory-editor.c
+++ b/plugins/gtk+/glade-icon-factory-editor.c
@@ -88,14 +88,12 @@ glade_icon_factory_editor_load (GladeEditable * editable, GladeWidget * widget)
/* Since we watch the project */
if (factory_editor->loaded_widget)
{
- g_signal_handlers_disconnect_by_func (G_OBJECT
- (factory_editor->loaded_widget->
- project),
+ g_signal_handlers_disconnect_by_func (glade_widget_get_project (factory_editor->loaded_widget),
G_CALLBACK (project_changed),
factory_editor);
/* The widget could die unexpectedly... */
- g_object_weak_unref (G_OBJECT (factory_editor->loaded_widget->project),
+ g_object_weak_unref (G_OBJECT (glade_widget_get_project (factory_editor->loaded_widget)),
(GWeakNotify) project_finalized, factory_editor);
}
@@ -105,12 +103,12 @@ glade_icon_factory_editor_load (GladeEditable * editable, GladeWidget * widget)
if (factory_editor->loaded_widget)
{
/* This fires for undo/redo */
- g_signal_connect (G_OBJECT (factory_editor->loaded_widget->project),
+ g_signal_connect (glade_widget_get_project (factory_editor->loaded_widget),
"changed", G_CALLBACK (project_changed),
factory_editor);
/* The widget/project could die unexpectedly... */
- g_object_weak_ref (G_OBJECT (factory_editor->loaded_widget->project),
+ g_object_weak_ref (G_OBJECT (glade_widget_get_project (factory_editor->loaded_widget)),
(GWeakNotify) project_finalized, factory_editor);
}
diff --git a/plugins/gtk+/glade-icon-sources.c b/plugins/gtk+/glade-icon-sources.c
index 9b6da8a..d6a2931 100644
--- a/plugins/gtk+/glade-icon-sources.c
+++ b/plugins/gtk+/glade-icon-sources.c
@@ -479,7 +479,7 @@ value_filename_edited (GtkCellRendererText * cell,
/* get new pixbuf value... */
value = glade_utils_value_from_string (GDK_TYPE_PIXBUF, new_text,
- eprop->property->widget->project,
+ glade_widget_get_project (eprop->property->widget),
eprop->property->widget);
pixbuf = g_value_get_object (value);
diff --git a/plugins/gtk+/glade-image-editor.c b/plugins/gtk+/glade-image-editor.c
index 6123ab1..fb462d7 100644
--- a/plugins/gtk+/glade-image-editor.c
+++ b/plugins/gtk+/glade-image-editor.c
@@ -91,15 +91,12 @@ glade_image_editor_load (GladeEditable * editable, GladeWidget * widget)
if (image_editor->loaded_widget)
{
/* watch custom-child and use-stock properties here for reloads !!! */
-
- g_signal_handlers_disconnect_by_func (G_OBJECT
- (image_editor->loaded_widget->
- project),
+ g_signal_handlers_disconnect_by_func (glade_widget_get_project (image_editor->loaded_widget),
G_CALLBACK (project_changed),
image_editor);
/* The widget could die unexpectedly... */
- g_object_weak_unref (G_OBJECT (image_editor->loaded_widget->project),
+ g_object_weak_unref (G_OBJECT (glade_widget_get_project (image_editor->loaded_widget)),
(GWeakNotify) project_finalized, image_editor);
}
@@ -109,11 +106,11 @@ glade_image_editor_load (GladeEditable * editable, GladeWidget * widget)
if (image_editor->loaded_widget)
{
/* This fires for undo/redo */
- g_signal_connect (G_OBJECT (image_editor->loaded_widget->project),
+ g_signal_connect (glade_widget_get_project (image_editor->loaded_widget),
"changed", G_CALLBACK (project_changed), image_editor);
/* The widget/project could die unexpectedly... */
- g_object_weak_ref (G_OBJECT (image_editor->loaded_widget->project),
+ g_object_weak_ref (G_OBJECT (glade_widget_get_project (image_editor->loaded_widget)),
(GWeakNotify) project_finalized, image_editor);
}
@@ -265,7 +262,7 @@ stock_toggled (GtkWidget * widget, GladeImageEditor * image_editor)
image_editor->modifying = TRUE;
glade_command_push_group (_("Setting %s to use an image from stock"),
- image_editor->loaded_widget->name);
+ glade_widget_get_name (image_editor->loaded_widget));
set_stock_mode (image_editor);
glade_command_pop_group ();
@@ -290,7 +287,7 @@ icon_toggled (GtkWidget * widget, GladeImageEditor * image_editor)
image_editor->modifying = TRUE;
glade_command_push_group (_("Setting %s to use an image from the icon theme"),
- image_editor->loaded_widget->name);
+ glade_widget_get_name (image_editor->loaded_widget));
set_icon_mode (image_editor);
glade_command_pop_group ();
@@ -314,7 +311,7 @@ file_toggled (GtkWidget * widget, GladeImageEditor * image_editor)
image_editor->modifying = TRUE;
glade_command_push_group (_("Setting %s to use an image from filename"),
- image_editor->loaded_widget->name);
+ glade_widget_get_name (image_editor->loaded_widget));
set_file_mode (image_editor);
glade_command_pop_group ();
diff --git a/plugins/gtk+/glade-image-item-editor.c b/plugins/gtk+/glade-image-item-editor.c
index abbdb53..238ac5c 100644
--- a/plugins/gtk+/glade-image-item-editor.c
+++ b/plugins/gtk+/glade-image-item-editor.c
@@ -83,7 +83,7 @@ static GladeWidget *
get_image_widget (GladeWidget * widget)
{
GtkWidget *image;
- image = gtk_image_menu_item_get_image (GTK_IMAGE_MENU_ITEM (widget->object));
+ image = gtk_image_menu_item_get_image (GTK_IMAGE_MENU_ITEM (glade_widget_get_object (widget)));
return image ? glade_widget_get_from_gobject (image) : NULL;
}
@@ -100,14 +100,12 @@ glade_image_item_editor_load (GladeEditable * editable, GladeWidget * widget)
/* Since we watch the project */
if (item_editor->loaded_widget)
{
- g_signal_handlers_disconnect_by_func (G_OBJECT
- (item_editor->loaded_widget->
- project),
+ g_signal_handlers_disconnect_by_func (glade_widget_get_project (item_editor->loaded_widget),
G_CALLBACK (project_changed),
item_editor);
/* The widget could die unexpectedly... */
- g_object_weak_unref (G_OBJECT (item_editor->loaded_widget->project),
+ g_object_weak_unref (G_OBJECT (glade_widget_get_project (item_editor->loaded_widget)),
(GWeakNotify) project_finalized, item_editor);
}
@@ -117,11 +115,11 @@ glade_image_item_editor_load (GladeEditable * editable, GladeWidget * widget)
if (item_editor->loaded_widget)
{
/* This fires for undo/redo */
- g_signal_connect (G_OBJECT (item_editor->loaded_widget->project),
+ g_signal_connect (glade_widget_get_project (item_editor->loaded_widget),
"changed", G_CALLBACK (project_changed), item_editor);
/* The widget/project could die unexpectedly... */
- g_object_weak_ref (G_OBJECT (item_editor->loaded_widget->project),
+ g_object_weak_ref (G_OBJECT (glade_widget_get_project (item_editor->loaded_widget)),
(GWeakNotify) project_finalized, item_editor);
}
@@ -217,7 +215,7 @@ stock_toggled (GtkWidget * widget, GladeImageItemEditor * item_editor)
item_editor->modifying = TRUE;
loaded = item_editor->loaded_widget;
- glade_command_push_group (_("Setting %s to use a stock item"), loaded->name);
+ glade_command_push_group (_("Setting %s to use a stock item"), glade_widget_get_name (loaded));
property = glade_widget_get_property (loaded, "label");
glade_command_set_property (property, NULL);
@@ -231,7 +229,8 @@ stock_toggled (GtkWidget * widget, GladeImageItemEditor * item_editor)
list.data = image;
glade_command_unlock_widget (image);
glade_command_delete (&list);
- glade_project_selection_set (loaded->project, loaded->object, TRUE);
+ glade_project_selection_set (glade_widget_get_project (loaded),
+ glade_widget_get_object (loaded), TRUE);
}
property = glade_widget_get_property (loaded, "use-stock");
@@ -250,6 +249,7 @@ static void
custom_toggled (GtkWidget * widget, GladeImageItemEditor * item_editor)
{
GladeProperty *property;
+ GladeWidgetAdaptor *adaptor;
if (item_editor->loading || !item_editor->loaded_widget)
return;
@@ -260,8 +260,10 @@ custom_toggled (GtkWidget * widget, GladeImageItemEditor * item_editor)
item_editor->modifying = TRUE;
+ adaptor = glade_widget_get_adaptor (item_editor->loaded_widget);
+
glade_command_push_group (_("Setting %s to use a label and image"),
- item_editor->loaded_widget->name);
+ glade_widget_get_name (item_editor->loaded_widget));
/* First clear stock... */
property = glade_widget_get_property (item_editor->loaded_widget, "stock");
@@ -272,11 +274,8 @@ 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,
- item_editor->loaded_widget->adaptor->
- generic_name);
- property =
- glade_widget_get_property (item_editor->loaded_widget, "use-underline");
+ glade_command_set_property (property, adaptor->generic_name);
+ property = glade_widget_get_property (item_editor->loaded_widget, "use-underline");
glade_command_set_property (property, FALSE);
/* There shouldnt be an image widget here... */
@@ -293,13 +292,14 @@ custom_toggled (GtkWidget * widget, GladeImageItemEditor * item_editor)
(GTK_TYPE_IMAGE), NULL, NULL,
glade_widget_get_project (loaded));
- glade_command_set_property (property, image->object);
+ glade_command_set_property (property, glade_widget_get_object (image));
/* Make sure nobody deletes this... */
glade_command_lock_widget (loaded, image);
/* reload widget by selection ;-) */
- glade_project_selection_set (loaded->project, loaded->object, TRUE);
+ glade_project_selection_set (glade_widget_get_project (loaded),
+ glade_widget_get_object (loaded), TRUE);
}
glade_command_pop_group ();
diff --git a/plugins/gtk+/glade-label-editor.c b/plugins/gtk+/glade-label-editor.c
index 56f0554..3baf2e9 100644
--- a/plugins/gtk+/glade-label-editor.c
+++ b/plugins/gtk+/glade-label-editor.c
@@ -90,15 +90,12 @@ glade_label_editor_load (GladeEditable * editable, GladeWidget * widget)
if (label_editor->loaded_widget)
{
/* watch custom-child and use-stock properties here for reloads !!! */
-
- g_signal_handlers_disconnect_by_func (G_OBJECT
- (label_editor->loaded_widget->
- project),
+ g_signal_handlers_disconnect_by_func (glade_widget_get_project (label_editor->loaded_widget),
G_CALLBACK (project_changed),
label_editor);
/* The widget could die unexpectedly... */
- g_object_weak_unref (G_OBJECT (label_editor->loaded_widget->project),
+ g_object_weak_unref (G_OBJECT (glade_widget_get_project (label_editor->loaded_widget)),
(GWeakNotify) project_finalized, label_editor);
}
@@ -108,11 +105,11 @@ glade_label_editor_load (GladeEditable * editable, GladeWidget * widget)
if (label_editor->loaded_widget)
{
/* This fires for undo/redo */
- g_signal_connect (G_OBJECT (label_editor->loaded_widget->project),
+ g_signal_connect (glade_widget_get_project (label_editor->loaded_widget),
"changed", G_CALLBACK (project_changed), label_editor);
/* The widget/project could die unexpectedly... */
- g_object_weak_ref (G_OBJECT (label_editor->loaded_widget->project),
+ g_object_weak_ref (G_OBJECT (glade_widget_get_project (label_editor->loaded_widget)),
(GWeakNotify) project_finalized, label_editor);
}
@@ -258,7 +255,7 @@ attributes_toggled (GtkWidget * widget, GladeLabelEditor * label_editor)
label_editor->modifying = TRUE;
glade_command_push_group (_("Setting %s to use an attribute list"),
- label_editor->loaded_widget->name);
+ glade_widget_get_name (label_editor->loaded_widget));
property =
glade_widget_get_property (label_editor->loaded_widget, "use-markup");
@@ -294,7 +291,7 @@ markup_toggled (GtkWidget * widget, GladeLabelEditor * label_editor)
label_editor->modifying = TRUE;
glade_command_push_group (_("Setting %s to use a Pango markup string"),
- label_editor->loaded_widget->name);
+ glade_widget_get_name (label_editor->loaded_widget));
property = glade_widget_get_property (label_editor->loaded_widget, "pattern");
glade_command_set_property (property, NULL);
@@ -335,7 +332,7 @@ pattern_toggled (GtkWidget * widget, GladeLabelEditor * label_editor)
label_editor->modifying = TRUE;
glade_command_push_group (_("Setting %s to use a pattern string"),
- label_editor->loaded_widget->name);
+ glade_widget_get_name (label_editor->loaded_widget));
property =
glade_widget_get_property (label_editor->loaded_widget,
@@ -377,7 +374,7 @@ width_toggled (GtkWidget * widget, GladeLabelEditor * label_editor)
label_editor->modifying = TRUE;
glade_command_push_group (_("Setting %s to set desired width in characters"),
- label_editor->loaded_widget->name);
+ glade_widget_get_name (label_editor->loaded_widget));
property =
glade_widget_get_property (label_editor->loaded_widget,
@@ -411,7 +408,7 @@ max_width_toggled (GtkWidget * widget, GladeLabelEditor * label_editor)
label_editor->modifying = TRUE;
glade_command_push_group (_("Setting %s to set maximum width in characters"),
- label_editor->loaded_widget->name);
+ glade_widget_get_name (label_editor->loaded_widget));
property =
glade_widget_get_property (label_editor->loaded_widget, "width-chars");
@@ -447,7 +444,7 @@ wrap_free_toggled (GtkWidget * widget, GladeLabelEditor * label_editor)
label_editor->modifying = TRUE;
glade_command_push_group (_("Setting %s to use normal line wrapping"),
- label_editor->loaded_widget->name);
+ glade_widget_get_name (label_editor->loaded_widget));
property =
glade_widget_get_property (label_editor->loaded_widget,
@@ -488,7 +485,7 @@ single_toggled (GtkWidget * widget, GladeLabelEditor * label_editor)
label_editor->modifying = TRUE;
glade_command_push_group (_("Setting %s to use a single line"),
- label_editor->loaded_widget->name);
+ glade_widget_get_name (label_editor->loaded_widget));
property =
glade_widget_get_property (label_editor->loaded_widget, "wrap-mode");
@@ -529,7 +526,7 @@ wrap_mode_toggled (GtkWidget * widget, GladeLabelEditor * label_editor)
label_editor->modifying = TRUE;
glade_command_push_group (_("Setting %s to use specific Pango word wrapping"),
- label_editor->loaded_widget->name);
+ glade_widget_get_name (label_editor->loaded_widget));
property =
glade_widget_get_property (label_editor->loaded_widget,
diff --git a/plugins/gtk+/glade-model-data.c b/plugins/gtk+/glade-model-data.c
index 86a7ed6..90b1a5e 100644
--- a/plugins/gtk+/glade-model-data.c
+++ b/plugins/gtk+/glade-model-data.c
@@ -749,12 +749,12 @@ value_text_edited (GtkCellRendererText * cell,
glade_get_value_from_displayable
(G_VALUE_TYPE (&data->value),
new_text),
- eprop->property->widget->project,
+ glade_widget_get_project (eprop->property->widget),
eprop->property->widget);
else
value =
glade_utils_value_from_string (G_VALUE_TYPE (&data->value), new_text,
- eprop->property->widget->project,
+ glade_widget_get_project (eprop->property->widget),
eprop->property->widget);
diff --git a/plugins/gtk+/glade-store-editor.c b/plugins/gtk+/glade-store-editor.c
index 6f6675a..5924cd2 100644
--- a/plugins/gtk+/glade-store-editor.c
+++ b/plugins/gtk+/glade-store-editor.c
@@ -87,15 +87,12 @@ glade_store_editor_load (GladeEditable * editable, GladeWidget * widget)
if (store_editor->loaded_widget)
{
/* watch custom-child and use-stock properties here for reloads !!! */
-
- g_signal_handlers_disconnect_by_func (G_OBJECT
- (store_editor->loaded_widget->
- project),
+ g_signal_handlers_disconnect_by_func (glade_widget_get_project (store_editor->loaded_widget),
G_CALLBACK (project_changed),
store_editor);
/* The widget could die unexpectedly... */
- g_object_weak_unref (G_OBJECT (store_editor->loaded_widget->project),
+ g_object_weak_unref (G_OBJECT (glade_widget_get_project (store_editor->loaded_widget)),
(GWeakNotify) project_finalized, store_editor);
}
@@ -105,11 +102,11 @@ glade_store_editor_load (GladeEditable * editable, GladeWidget * widget)
if (store_editor->loaded_widget)
{
/* This fires for undo/redo */
- g_signal_connect (G_OBJECT (store_editor->loaded_widget->project),
+ g_signal_connect (glade_widget_get_project (store_editor->loaded_widget),
"changed", G_CALLBACK (project_changed), store_editor);
/* The widget/project could die unexpectedly... */
- g_object_weak_ref (G_OBJECT (store_editor->loaded_widget->project),
+ g_object_weak_ref (G_OBJECT (glade_widget_get_project (store_editor->loaded_widget)),
(GWeakNotify) project_finalized, store_editor);
}
diff --git a/plugins/gtk+/glade-tool-button-editor.c b/plugins/gtk+/glade-tool-button-editor.c
index eab6c9d..9d2d7dd 100644
--- a/plugins/gtk+/glade-tool-button-editor.c
+++ b/plugins/gtk+/glade-tool-button-editor.c
@@ -92,14 +92,12 @@ glade_tool_button_editor_load (GladeEditable * editable, GladeWidget * widget)
/* Since we watch the project */
if (button_editor->loaded_widget)
{
- g_signal_handlers_disconnect_by_func (G_OBJECT
- (button_editor->loaded_widget->
- project),
+ g_signal_handlers_disconnect_by_func (glade_widget_get_project (button_editor->loaded_widget),
G_CALLBACK (project_changed),
button_editor);
/* The widget could die unexpectedly... */
- g_object_weak_unref (G_OBJECT (button_editor->loaded_widget->project),
+ g_object_weak_unref (G_OBJECT (glade_widget_get_project (button_editor->loaded_widget)),
(GWeakNotify) project_finalized, button_editor);
}
@@ -109,11 +107,11 @@ glade_tool_button_editor_load (GladeEditable * editable, GladeWidget * widget)
if (button_editor->loaded_widget)
{
/* This fires for undo/redo */
- g_signal_connect (G_OBJECT (button_editor->loaded_widget->project),
+ g_signal_connect (glade_widget_get_project (button_editor->loaded_widget),
"changed", G_CALLBACK (project_changed), button_editor);
/* The widget/project could die unexpectedly... */
- g_object_weak_ref (G_OBJECT (button_editor->loaded_widget->project),
+ g_object_weak_ref (G_OBJECT (glade_widget_get_project (button_editor->loaded_widget)),
(GWeakNotify) project_finalized, button_editor);
}
@@ -189,7 +187,7 @@ standard_label_toggled (GtkWidget * widget,
button_editor->modifying = TRUE;
glade_command_push_group (_("Setting %s to use standard label text"),
- button_editor->loaded_widget->name);
+ glade_widget_get_name (button_editor->loaded_widget));
property =
glade_widget_get_property (button_editor->loaded_widget, "label-widget");
@@ -227,7 +225,7 @@ custom_label_toggled (GtkWidget * widget, GladeToolButtonEditor * button_editor)
button_editor->modifying = TRUE;
glade_command_push_group (_("Setting %s to use a custom label widget"),
- button_editor->loaded_widget->name);
+ glade_widget_get_name (button_editor->loaded_widget));
property = glade_widget_get_property (button_editor->loaded_widget, "label");
glade_command_set_property (property, NULL);
@@ -259,7 +257,7 @@ stock_toggled (GtkWidget * widget, GladeToolButtonEditor * button_editor)
button_editor->modifying = TRUE;
glade_command_push_group (_("Setting %s to use an image from stock"),
- button_editor->loaded_widget->name);
+ glade_widget_get_name (button_editor->loaded_widget));
property =
glade_widget_get_property (button_editor->loaded_widget, "icon-name");
@@ -298,7 +296,7 @@ icon_toggled (GtkWidget * widget, GladeToolButtonEditor * button_editor)
button_editor->modifying = TRUE;
glade_command_push_group (_("Setting %s to use an image from the icon theme"),
- button_editor->loaded_widget->name);
+ glade_widget_get_name (button_editor->loaded_widget));
property =
glade_widget_get_property (button_editor->loaded_widget, "stock-id");
@@ -336,7 +334,7 @@ custom_toggled (GtkWidget * widget, GladeToolButtonEditor * button_editor)
button_editor->modifying = TRUE;
glade_command_push_group (_("Setting %s to use an image from the icon theme"),
- button_editor->loaded_widget->name);
+ glade_widget_get_name (button_editor->loaded_widget));
property =
glade_widget_get_property (button_editor->loaded_widget, "stock-id");
diff --git a/plugins/gtk+/glade-treeview-editor.c b/plugins/gtk+/glade-treeview-editor.c
index 6bf3ed7..7159d12 100644
--- a/plugins/gtk+/glade-treeview-editor.c
+++ b/plugins/gtk+/glade-treeview-editor.c
@@ -84,13 +84,14 @@ get_model_widget (GladeWidget * view)
{
GtkTreeModel *model = NULL;
+ GObject *object = glade_widget_get_object (view);
- if (GTK_IS_TREE_VIEW (view->object))
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (view->object));
- else if (GTK_IS_ICON_VIEW (view->object))
- model = gtk_icon_view_get_model (GTK_ICON_VIEW (view->object));
- else if (GTK_IS_COMBO_BOX (view->object))
- model = gtk_combo_box_get_model (GTK_COMBO_BOX (view->object));
+ if (GTK_IS_TREE_VIEW (object))
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (object));
+ else if (GTK_IS_ICON_VIEW (object))
+ model = gtk_icon_view_get_model (GTK_ICON_VIEW (object));
+ else if (GTK_IS_COMBO_BOX (object))
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (object));
if (model)
return glade_widget_get_from_gobject (model);
@@ -107,14 +108,12 @@ glade_tree_view_editor_load (GladeEditable * editable, GladeWidget * widget)
/* Since we watch the project */
if (view_editor->loaded_widget)
{
- g_signal_handlers_disconnect_by_func (G_OBJECT
- (view_editor->loaded_widget->
- project),
+ g_signal_handlers_disconnect_by_func (glade_widget_get_project (view_editor->loaded_widget),
G_CALLBACK (project_changed),
view_editor);
/* The widget could die unexpectedly... */
- g_object_weak_unref (G_OBJECT (view_editor->loaded_widget->project),
+ g_object_weak_unref (G_OBJECT (glade_widget_get_project (view_editor->loaded_widget)),
(GWeakNotify) project_finalized, view_editor);
}
@@ -124,11 +123,11 @@ glade_tree_view_editor_load (GladeEditable * editable, GladeWidget * widget)
if (view_editor->loaded_widget)
{
/* This fires for undo/redo */
- g_signal_connect (G_OBJECT (view_editor->loaded_widget->project),
+ g_signal_connect (glade_widget_get_project (view_editor->loaded_widget),
"changed", G_CALLBACK (project_changed), view_editor);
/* The widget/project could die unexpectedly... */
- g_object_weak_ref (G_OBJECT (view_editor->loaded_widget->project),
+ g_object_weak_ref (G_OBJECT (glade_widget_get_project (view_editor->loaded_widget)),
(GWeakNotify) project_finalized, view_editor);
}
@@ -149,14 +148,14 @@ glade_tree_view_editor_load (GladeEditable * editable, GladeWidget * widget)
/* Finalize safe code here... */
if (widget && (model_widget = get_model_widget (widget)))
{
- if (GTK_IS_LIST_STORE (model_widget->object))
+ if (GTK_IS_LIST_STORE (glade_widget_get_object (model_widget)))
{
gtk_widget_show (view_editor->embed_list_store);
glade_editable_load (GLADE_EDITABLE
(view_editor->embed_list_store),
model_widget);
}
- else if (GTK_IS_TREE_STORE (model_widget->object))
+ else if (GTK_IS_TREE_STORE (glade_widget_get_object (model_widget)))
{
gtk_widget_show (view_editor->embed_tree_store);
glade_editable_load (GLADE_EDITABLE
diff --git a/src/glade-window.c b/src/glade-window.c
index 9b2a6ec..17f05da 100644
--- a/src/glade-window.c
+++ b/src/glade-window.c
@@ -364,8 +364,9 @@ activate_action (GtkToolButton * toolbutton, GladeWidgetAction * action)
GladeWidget *widget;
if ((widget = g_object_get_data (G_OBJECT (toolbutton), "glade-widget")))
- glade_widget_adaptor_action_activate (widget->adaptor,
- widget->object, action->klass->path);
+ glade_widget_adaptor_action_activate (glade_widget_get_adaptor (widget),
+ glade_widget_get_object (widget),
+ action->klass->path);
}
static void
@@ -484,8 +485,8 @@ project_selection_changed_cb (GladeProject * project, GladeWindow * window)
glade_widget_show (glade_widget);
clean_actions (window);
- if (glade_widget->actions)
- add_actions (window, glade_widget, glade_widget->actions);
+ if (glade_widget_get_actions (glade_widget))
+ add_actions (window, glade_widget, glade_widget_get_actions (glade_widget));
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]