[glade] * gladeui/glade-*-editor.c: Fixed all GladeEditable implementations to use the new glade_editabl
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade] * gladeui/glade-*-editor.c: Fixed all GladeEditable implementations to use the new glade_editabl
- Date: Mon, 7 Mar 2011 20:22:53 +0000 (UTC)
commit 25ce935c1c86c818dd2a5e0bd80aefb2327e813e
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Mon Mar 7 17:18:33 2011 +0900
* gladeui/glade-*-editor.c: Fixed all GladeEditable implementations to use
the new glade_editable_loading() and glade_editable_loaded_widget() instead
of manually bookkeeping those states in each implementation.
ChangeLog | 4 +
plugins/gtk+/glade-activatable-editor.c | 11 +--
plugins/gtk+/glade-activatable-editor.h | 4 -
plugins/gtk+/glade-button-editor.c | 86 +++++++--------
plugins/gtk+/glade-button-editor.h | 4 -
plugins/gtk+/glade-cell-renderer-editor.c | 5 +-
plugins/gtk+/glade-cell-renderer-editor.h | 2 -
plugins/gtk+/glade-entry-editor.c | 128 ++++++++++-------------
plugins/gtk+/glade-entry-editor.h | 4 -
plugins/gtk+/glade-icon-factory-editor.c | 3 -
plugins/gtk+/glade-icon-factory-editor.h | 2 -
plugins/gtk+/glade-image-editor.c | 65 +++++-------
plugins/gtk+/glade-image-editor.h | 4 -
plugins/gtk+/glade-image-item-editor.c | 37 +++----
plugins/gtk+/glade-image-item-editor.h | 22 ++---
plugins/gtk+/glade-label-editor.c | 152 ++++++++++-----------------
plugins/gtk+/glade-label-editor.h | 4 -
plugins/gtk+/glade-store-editor.c | 3 -
plugins/gtk+/glade-store-editor.h | 2 -
plugins/gtk+/glade-tool-button-editor.c | 92 +++++++----------
plugins/gtk+/glade-tool-button-editor.h | 4 -
plugins/gtk+/glade-tool-item-group-editor.c | 34 +++----
plugins/gtk+/glade-tool-item-group-editor.h | 4 -
plugins/gtk+/glade-treeview-editor.c | 7 +-
plugins/gtk+/glade-treeview-editor.h | 2 -
25 files changed, 262 insertions(+), 423 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ae74da6..51225aa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,10 @@
* gladeui/glade-cell-renderer-editor.c: Fixed to properly use GladeEditable iface.
+ * gladeui/glade-*-editor.c: Fixed all GladeEditable implementations to use
+ the new glade_editable_loading() and glade_editable_loaded_widget() instead
+ of manually bookkeeping those states in each implementation.
+
2011-03-06 Christopher Aillon <caillon redhat com>
* data/icons/hicolor/*/apps/glade-3.{png,svg,xcf}:
diff --git a/plugins/gtk+/glade-activatable-editor.c b/plugins/gtk+/glade-activatable-editor.c
index a1179e7..a8d5cfc 100644
--- a/plugins/gtk+/glade-activatable-editor.c
+++ b/plugins/gtk+/glade-activatable-editor.c
@@ -66,11 +66,6 @@ glade_activatable_editor_load (GladeEditable * editable, GladeWidget * widget)
/* Chain up to default implementation */
parent_editable_iface->load (editable, widget);
- activatable_editor->loading = TRUE;
-
- /* Mark our widget... */
- activatable_editor->loaded_widget = widget;
-
/* load the embedded editable... */
if (activatable_editor->embed)
glade_editable_load (GLADE_EDITABLE (activatable_editor->embed), widget);
@@ -78,8 +73,6 @@ glade_activatable_editor_load (GladeEditable * editable, GladeWidget * widget)
for (l = activatable_editor->properties; l; l = l->next)
glade_editor_property_load_by_widget (GLADE_EDITOR_PROPERTY (l->data),
widget);
-
- activatable_editor->loading = FALSE;
}
static void
@@ -277,7 +270,7 @@ related_action_pre_commit (GladeEditorProperty * property,
GValue * value,
GladeActivatableEditor * activatable_editor)
{
- GladeWidget *gwidget = activatable_editor->loaded_widget;
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (activatable_editor));
GtkAction *action = g_value_get_object (value);
gboolean use_appearance = FALSE;
@@ -304,7 +297,7 @@ use_appearance_pre_commit (GladeEditorProperty * property,
GValue * value,
GladeActivatableEditor * activatable_editor)
{
- GladeWidget *gwidget = activatable_editor->loaded_widget;
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (activatable_editor));
GtkAction *action = NULL;
gboolean use_appearance = g_value_get_boolean (value);
diff --git a/plugins/gtk+/glade-activatable-editor.h b/plugins/gtk+/glade-activatable-editor.h
index 3fca6fd..ba588e4 100644
--- a/plugins/gtk+/glade-activatable-editor.h
+++ b/plugins/gtk+/glade-activatable-editor.h
@@ -39,13 +39,9 @@ struct _GladeActivatableEditor
{
GtkVBox parent;
- GladeWidget *loaded_widget; /* A handy pointer to the loaded widget ... */
-
GtkWidget *embed;
GList *properties; /* A list of eprops to update at load() time */
-
- gboolean loading; /* Loading flag for loading widgets in the editor */
};
struct _GladeActivatableEditorClass
diff --git a/plugins/gtk+/glade-button-editor.c b/plugins/gtk+/glade-button-editor.c
index aca6ff8..33ab3aa 100644
--- a/plugins/gtk+/glade-button-editor.c
+++ b/plugins/gtk+/glade-button-editor.c
@@ -68,11 +68,6 @@ glade_button_editor_load (GladeEditable * editable, GladeWidget * widget)
/* Chain up to default implementation */
parent_editable_iface->load (editable, widget);
- button_editor->loading = TRUE;
-
- /* Mark our widget... */
- button_editor->loaded_widget = widget;
-
/* load the embedded editable... */
if (button_editor->embed)
glade_editable_load (GLADE_EDITABLE (button_editor->embed), widget);
@@ -132,7 +127,6 @@ glade_button_editor_load (GladeEditable * editable, GladeWidget * widget)
gtk_widget_set_sensitive (button_editor->custom_radio, TRUE);
}
- button_editor->loading = FALSE;
}
static void
@@ -181,12 +175,14 @@ static void
standard_toggled (GtkWidget * widget, GladeButtonEditor * button_editor)
{
GladeProperty *property;
- GladeWidget *gchild = NULL;
+ GladeWidget *gchild = NULL, *gwidget;
GtkWidget *child, *button;
GValue value = { 0, };
gboolean use_appearance = FALSE;
- if (button_editor->loading || !button_editor->loaded_widget)
+ gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (button_editor));
+
+ if (glade_editable_loading (GLADE_EDITABLE (button_editor)) || !gwidget)
return;
if (!gtk_toggle_button_get_active
@@ -196,15 +192,15 @@ standard_toggled (GtkWidget * widget, GladeButtonEditor * button_editor)
glade_editable_block (GLADE_EDITABLE (button_editor));
glade_command_push_group (_("Setting %s to use standard configuration"),
- glade_widget_get_name (button_editor->loaded_widget));
+ glade_widget_get_name (gwidget));
/* If theres a widget customly inside... command remove it first... */
- button = GTK_WIDGET (glade_widget_get_object (button_editor->loaded_widget));
+ button = GTK_WIDGET (glade_widget_get_object (gwidget));
child = gtk_bin_get_child (GTK_BIN (button));
if (child)
gchild = glade_widget_get_from_gobject (child);
- if (gchild && glade_widget_get_parent (gchild) == button_editor->loaded_widget)
+ if (gchild && glade_widget_get_parent (gchild) == gwidget)
{
GList widgets = { 0, };
widgets.data = gchild;
@@ -212,23 +208,23 @@ standard_toggled (GtkWidget * widget, GladeButtonEditor * button_editor)
}
property =
- glade_widget_get_property (button_editor->loaded_widget, "custom-child");
+ glade_widget_get_property (gwidget, "custom-child");
glade_command_set_property (property, FALSE);
/* Setup reasonable defaults for button label. */
- property = glade_widget_get_property (button_editor->loaded_widget, "stock");
+ property = glade_widget_get_property (gwidget, "stock");
glade_command_set_property (property, NULL);
property =
- glade_widget_get_property (button_editor->loaded_widget, "use-stock");
+ glade_widget_get_property (gwidget, "use-stock");
glade_command_set_property (property, FALSE);
- glade_widget_property_get (button_editor->loaded_widget,
+ glade_widget_property_get (gwidget,
"use-action-appearance", &use_appearance);
if (!use_appearance)
{
property =
- glade_widget_get_property (button_editor->loaded_widget, "label");
+ glade_widget_get_property (gwidget, "label");
glade_property_get_default (property, &value);
glade_command_set_property_value (property, &value);
g_value_unset (&value);
@@ -239,16 +235,16 @@ standard_toggled (GtkWidget * widget, GladeButtonEditor * button_editor)
glade_editable_unblock (GLADE_EDITABLE (button_editor));
/* reload buttons and sensitivity and stuff... */
- glade_editable_load (GLADE_EDITABLE (button_editor),
- button_editor->loaded_widget);
+ glade_editable_load (GLADE_EDITABLE (button_editor), gwidget);
}
static void
custom_toggled (GtkWidget * widget, GladeButtonEditor * button_editor)
{
GladeProperty *property;
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (button_editor));
- if (button_editor->loading || !button_editor->loaded_widget)
+ if (glade_editable_loading (GLADE_EDITABLE (button_editor)) || !gwidget)
return;
if (!gtk_toggle_button_get_active
@@ -258,25 +254,25 @@ custom_toggled (GtkWidget * widget, GladeButtonEditor * button_editor)
glade_editable_block (GLADE_EDITABLE (button_editor));
glade_command_push_group (_("Setting %s to use a custom child"),
- glade_widget_get_name (button_editor->loaded_widget));
+ glade_widget_get_name (gwidget));
/* clear out some things... */
- property = glade_widget_get_property (button_editor->loaded_widget, "image");
+ property = glade_widget_get_property (gwidget, "image");
glade_command_set_property (property, NULL);
property =
- glade_widget_get_property (button_editor->loaded_widget, "use-stock");
+ glade_widget_get_property (gwidget, "use-stock");
glade_command_set_property (property, FALSE);
- property = glade_widget_get_property (button_editor->loaded_widget, "stock");
+ property = glade_widget_get_property (gwidget, "stock");
glade_command_set_property (property, NULL);
- property = glade_widget_get_property (button_editor->loaded_widget, "label");
+ property = glade_widget_get_property (gwidget, "label");
glade_command_set_property (property, NULL);
/* Add a placeholder via the custom-child property... */
property =
- glade_widget_get_property (button_editor->loaded_widget, "custom-child");
+ glade_widget_get_property (gwidget, "custom-child");
glade_command_set_property (property, TRUE);
glade_command_pop_group ();
@@ -284,8 +280,7 @@ custom_toggled (GtkWidget * widget, GladeButtonEditor * button_editor)
glade_editable_unblock (GLADE_EDITABLE (button_editor));
/* reload buttons and sensitivity and stuff... */
- glade_editable_load (GLADE_EDITABLE (button_editor),
- button_editor->loaded_widget);
+ glade_editable_load (GLADE_EDITABLE (button_editor), gwidget);
}
static void
@@ -293,8 +288,9 @@ stock_toggled (GtkWidget * widget, GladeButtonEditor * button_editor)
{
GladeProperty *property;
gboolean use_appearance = FALSE;
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (button_editor));
- if (button_editor->loading || !button_editor->loaded_widget)
+ if (glade_editable_loading (GLADE_EDITABLE (button_editor)) || !gwidget)
return;
if (!gtk_toggle_button_get_active
@@ -304,26 +300,25 @@ stock_toggled (GtkWidget * widget, GladeButtonEditor * button_editor)
glade_editable_block (GLADE_EDITABLE (button_editor));
glade_command_push_group (_("Setting %s to use a stock button"),
- glade_widget_get_name (button_editor->loaded_widget));
+ glade_widget_get_name (gwidget));
/* clear out stuff... */
- property = glade_widget_get_property (button_editor->loaded_widget, "image");
+ property = glade_widget_get_property (gwidget, "image");
glade_command_set_property (property, NULL);
- glade_widget_property_get (button_editor->loaded_widget,
- "use-action-appearance", &use_appearance);
+ glade_widget_property_get (gwidget, "use-action-appearance", &use_appearance);
if (!use_appearance)
{
property =
- glade_widget_get_property (button_editor->loaded_widget, "label");
+ glade_widget_get_property (gwidget, "label");
glade_command_set_property (property, "");
}
property =
- glade_widget_get_property (button_editor->loaded_widget, "use-stock");
+ glade_widget_get_property (gwidget, "use-stock");
glade_command_set_property (property, TRUE);
- property = glade_widget_get_property (button_editor->loaded_widget, "stock");
+ property = glade_widget_get_property (gwidget, "stock");
glade_command_set_property (property, NULL);
glade_command_pop_group ();
@@ -331,8 +326,7 @@ stock_toggled (GtkWidget * widget, GladeButtonEditor * button_editor)
glade_editable_unblock (GLADE_EDITABLE (button_editor));
/* reload buttons and sensitivity and stuff... */
- glade_editable_load (GLADE_EDITABLE (button_editor),
- button_editor->loaded_widget);
+ glade_editable_load (GLADE_EDITABLE (button_editor), gwidget);
}
static void
@@ -341,8 +335,9 @@ label_toggled (GtkWidget * widget, GladeButtonEditor * button_editor)
GladeProperty *property;
GValue value = { 0, };
gboolean use_appearance = FALSE;
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (button_editor));
- if (button_editor->loading || !button_editor->loaded_widget)
+ if (glade_editable_loading (GLADE_EDITABLE (button_editor)) || !gwidget)
return;
if (!gtk_toggle_button_get_active
@@ -352,21 +347,19 @@ label_toggled (GtkWidget * widget, GladeButtonEditor * button_editor)
glade_editable_block (GLADE_EDITABLE (button_editor));
glade_command_push_group (_("Setting %s to use a label and image"),
- glade_widget_get_name (button_editor->loaded_widget));
+ glade_widget_get_name (gwidget));
- property = glade_widget_get_property (button_editor->loaded_widget, "stock");
+ property = glade_widget_get_property (gwidget, "stock");
glade_command_set_property (property, NULL);
- property =
- glade_widget_get_property (button_editor->loaded_widget, "use-stock");
+ property = glade_widget_get_property (gwidget, "use-stock");
glade_command_set_property (property, FALSE);
- glade_widget_property_get (button_editor->loaded_widget,
- "use-action-appearance", &use_appearance);
+ glade_widget_property_get (gwidget, "use-action-appearance", &use_appearance);
if (!use_appearance)
{
property =
- glade_widget_get_property (button_editor->loaded_widget, "label");
+ glade_widget_get_property (gwidget, "label");
glade_property_get_default (property, &value);
glade_command_set_property_value (property, &value);
g_value_unset (&value);
@@ -377,8 +370,7 @@ label_toggled (GtkWidget * widget, GladeButtonEditor * button_editor)
glade_editable_unblock (GLADE_EDITABLE (button_editor));
/* reload buttons and sensitivity and stuff... */
- glade_editable_load (GLADE_EDITABLE (button_editor),
- button_editor->loaded_widget);
+ glade_editable_load (GLADE_EDITABLE (button_editor), gwidget);
}
static void
diff --git a/plugins/gtk+/glade-button-editor.h b/plugins/gtk+/glade-button-editor.h
index 281e6ef..7091726 100644
--- a/plugins/gtk+/glade-button-editor.h
+++ b/plugins/gtk+/glade-button-editor.h
@@ -39,8 +39,6 @@ struct _GladeButtonEditor
{
GtkVBox parent;
- GladeWidget *loaded_widget; /* A handy pointer to the loaded widget ... */
-
GtkWidget *embed;
GtkWidget *standard_radio; /* Use standard properties to layout a button */
@@ -59,8 +57,6 @@ struct _GladeButtonEditor
*/
GList *properties; /* A list of eprops to update at load() time */
-
- gboolean loading; /* Loading flag for loading widgets in the editor */
};
struct _GladeButtonEditorClass
diff --git a/plugins/gtk+/glade-cell-renderer-editor.c b/plugins/gtk+/glade-cell-renderer-editor.c
index 643fe9a..8371bca 100644
--- a/plugins/gtk+/glade-cell-renderer-editor.c
+++ b/plugins/gtk+/glade-cell-renderer-editor.c
@@ -84,8 +84,6 @@ glade_cell_renderer_editor_load (GladeEditable * editable, GladeWidget * widget)
/* Chain up to default implementation */
parent_editable_iface->load (editable, widget);
- renderer_editor->loading = TRUE;
-
/* load the embedded editable... */
if (renderer_editor->embed)
glade_editable_load (GLADE_EDITABLE (renderer_editor->embed), widget);
@@ -120,7 +118,6 @@ glade_cell_renderer_editor_load (GladeEditable * editable, GladeWidget * widget)
}
}
}
- renderer_editor->loading = FALSE;
}
static void
@@ -181,7 +178,7 @@ attributes_toggled (GtkWidget * widget, CheckTab * tab)
gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (renderer_editor));
- if (renderer_editor->loading || !gwidget)
+ if (glade_editable_loading (GLADE_EDITABLE (renderer_editor)) || !gwidget)
return;
glade_editable_block (GLADE_EDITABLE (renderer_editor));
diff --git a/plugins/gtk+/glade-cell-renderer-editor.h b/plugins/gtk+/glade-cell-renderer-editor.h
index 8e0d339..81012d7 100644
--- a/plugins/gtk+/glade-cell-renderer-editor.h
+++ b/plugins/gtk+/glade-cell-renderer-editor.h
@@ -48,8 +48,6 @@ struct _GladeCellRendererEditor
GList *checks; /* A list of radio buttons for each property/attribute pair */
GList *properties; /* A list of eprops to update at load() time */
-
- gboolean loading; /* Loading flag for loading widgets in the editor */
};
struct _GladeCellRendererEditorClass
diff --git a/plugins/gtk+/glade-entry-editor.c b/plugins/gtk+/glade-entry-editor.c
index 4746b20..86320da 100644
--- a/plugins/gtk+/glade-entry-editor.c
+++ b/plugins/gtk+/glade-entry-editor.c
@@ -67,11 +67,6 @@ glade_entry_editor_load (GladeEditable * editable, GladeWidget * widget)
/* Chain up to default implementation */
parent_editable_iface->load (editable, widget);
- entry_editor->loading = TRUE;
-
- /* Mark our widget... */
- entry_editor->loaded_widget = widget;
-
/* load the embedded editable... */
if (entry_editor->embed)
glade_editable_load (GLADE_EDITABLE (entry_editor->embed), widget);
@@ -136,7 +131,6 @@ glade_entry_editor_load (GladeEditable * editable, GladeWidget * widget)
break;
}
}
- entry_editor->loading = FALSE;
}
static void
@@ -185,8 +179,9 @@ static void
text_toggled (GtkWidget * widget, GladeEntryEditor * entry_editor)
{
GladeProperty *property;
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (entry_editor));
- if (entry_editor->loading || !entry_editor->loaded_widget)
+ if (glade_editable_loading (GLADE_EDITABLE (entry_editor)) || !gwidget)
return;
if (!gtk_toggle_button_get_active
@@ -196,18 +191,18 @@ text_toggled (GtkWidget * widget, GladeEntryEditor * entry_editor)
glade_editable_block (GLADE_EDITABLE (entry_editor));
glade_command_push_group (_("Setting %s to use static text"),
- glade_widget_get_name (entry_editor->loaded_widget));
+ glade_widget_get_name (gwidget));
- property = glade_widget_get_property (entry_editor->loaded_widget, "buffer");
+ property = glade_widget_get_property (gwidget, "buffer");
glade_command_set_property (property, NULL);
property =
- glade_widget_get_property (entry_editor->loaded_widget,
+ glade_widget_get_property (gwidget,
"use-entry-buffer");
glade_command_set_property (property, FALSE);
/* Text will only take effect after setting the property under the hood */
- property = glade_widget_get_property (entry_editor->loaded_widget, "text");
+ property = glade_widget_get_property (gwidget, "text");
glade_command_set_property (property, NULL);
/* Incase the NULL text didnt change */
@@ -218,16 +213,16 @@ text_toggled (GtkWidget * widget, GladeEntryEditor * entry_editor)
glade_editable_unblock (GLADE_EDITABLE (entry_editor));
/* reload buttons and sensitivity and stuff... */
- glade_editable_load (GLADE_EDITABLE (entry_editor),
- entry_editor->loaded_widget);
+ glade_editable_load (GLADE_EDITABLE (entry_editor), gwidget);
}
static void
buffer_toggled (GtkWidget * widget, GladeEntryEditor * entry_editor)
{
GladeProperty *property;
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (entry_editor));
- if (entry_editor->loading || !entry_editor->loaded_widget)
+ if (glade_editable_loading (GLADE_EDITABLE (entry_editor)) || !gwidget)
return;
if (!gtk_toggle_button_get_active
@@ -237,15 +232,14 @@ buffer_toggled (GtkWidget * widget, GladeEntryEditor * entry_editor)
glade_editable_block (GLADE_EDITABLE (entry_editor));
glade_command_push_group (_("Setting %s to use an external buffer"),
- glade_widget_get_name (entry_editor->loaded_widget));
+ glade_widget_get_name (gwidget));
/* Reset the text while still in static text mode */
- property = glade_widget_get_property (entry_editor->loaded_widget, "text");
+ property = glade_widget_get_property (gwidget, "text");
glade_command_set_property (property, NULL);
property =
- glade_widget_get_property (entry_editor->loaded_widget,
- "use-entry-buffer");
+ glade_widget_get_property (gwidget, "use-entry-buffer");
glade_command_set_property (property, TRUE);
glade_command_pop_group ();
@@ -253,8 +247,7 @@ buffer_toggled (GtkWidget * widget, GladeEntryEditor * entry_editor)
glade_editable_unblock (GLADE_EDITABLE (entry_editor));
/* reload buttons and sensitivity and stuff... */
- glade_editable_load (GLADE_EDITABLE (entry_editor),
- entry_editor->loaded_widget);
+ glade_editable_load (GLADE_EDITABLE (entry_editor), gwidget);
}
@@ -267,27 +260,20 @@ static void
set_stock_mode (GladeEntryEditor * entry_editor, gboolean primary)
{
GladeProperty *property;
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (entry_editor));
GValue value = { 0, };
- property =
- glade_widget_get_property (entry_editor->loaded_widget,
- ICON_NAME_NAME (primary));
+ property = glade_widget_get_property (gwidget, ICON_NAME_NAME (primary));
glade_command_set_property (property, NULL);
- property =
- glade_widget_get_property (entry_editor->loaded_widget,
- PIXBUF_NAME (primary));
+ property = glade_widget_get_property (gwidget, PIXBUF_NAME (primary));
glade_command_set_property (property, NULL);
- property =
- glade_widget_get_property (entry_editor->loaded_widget,
- STOCK_NAME (primary));
+ property = glade_widget_get_property (gwidget, STOCK_NAME (primary));
glade_property_get_default (property, &value);
glade_command_set_property_value (property, &value);
g_value_unset (&value);
- property =
- glade_widget_get_property (entry_editor->loaded_widget,
- ICON_MODE_NAME (primary));
+ property = glade_widget_get_property (gwidget, ICON_MODE_NAME (primary));
glade_command_set_property (property, GLADE_IMAGE_MODE_STOCK);
}
@@ -295,18 +281,13 @@ static void
set_icon_name_mode (GladeEntryEditor * entry_editor, gboolean primary)
{
GladeProperty *property;
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (entry_editor));
- property =
- glade_widget_get_property (entry_editor->loaded_widget,
- STOCK_NAME (primary));
+ property = glade_widget_get_property (gwidget, STOCK_NAME (primary));
glade_command_set_property (property, NULL);
- property =
- glade_widget_get_property (entry_editor->loaded_widget,
- PIXBUF_NAME (primary));
+ property = glade_widget_get_property (gwidget, PIXBUF_NAME (primary));
glade_command_set_property (property, NULL);
- property =
- glade_widget_get_property (entry_editor->loaded_widget,
- ICON_MODE_NAME (primary));
+ property = glade_widget_get_property (gwidget, ICON_MODE_NAME (primary));
glade_command_set_property (property, GLADE_IMAGE_MODE_ICON);
}
@@ -314,28 +295,24 @@ static void
set_pixbuf_mode (GladeEntryEditor * entry_editor, gboolean primary)
{
GladeProperty *property;
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (entry_editor));
- property =
- glade_widget_get_property (entry_editor->loaded_widget,
- STOCK_NAME (primary));
+ property = glade_widget_get_property (gwidget, STOCK_NAME (primary));
glade_command_set_property (property, NULL);
- property =
- glade_widget_get_property (entry_editor->loaded_widget,
- ICON_NAME_NAME (primary));
+ property = glade_widget_get_property (gwidget, ICON_NAME_NAME (primary));
glade_command_set_property (property, NULL);
- property =
- glade_widget_get_property (entry_editor->loaded_widget,
- ICON_MODE_NAME (primary));
+ property = glade_widget_get_property (gwidget, ICON_MODE_NAME (primary));
glade_command_set_property (property, GLADE_IMAGE_MODE_FILENAME);
}
static void
primary_stock_toggled (GtkWidget * widget, GladeEntryEditor * entry_editor)
{
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (entry_editor));
- if (entry_editor->loading || !entry_editor->loaded_widget)
+ if (glade_editable_loading (GLADE_EDITABLE (entry_editor)) || !gwidget)
return;
if (!gtk_toggle_button_get_active
@@ -345,22 +322,23 @@ primary_stock_toggled (GtkWidget * widget, GladeEntryEditor * entry_editor)
glade_editable_block (GLADE_EDITABLE (entry_editor));
glade_command_push_group (_("Setting %s to use a primary icon from stock"),
- glade_widget_get_name (entry_editor->loaded_widget));
+ glade_widget_get_name (gwidget));
set_stock_mode (entry_editor, TRUE);
glade_command_pop_group ();
glade_editable_unblock (GLADE_EDITABLE (entry_editor));
/* reload buttons and sensitivity and stuff... */
- glade_editable_load (GLADE_EDITABLE (entry_editor),
- entry_editor->loaded_widget);
+ glade_editable_load (GLADE_EDITABLE (entry_editor), gwidget);
}
static void
primary_icon_name_toggled (GtkWidget * widget, GladeEntryEditor * entry_editor)
{
- if (entry_editor->loading || !entry_editor->loaded_widget)
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (entry_editor));
+
+ if (glade_editable_loading (GLADE_EDITABLE (entry_editor)) || !gwidget)
return;
if (!gtk_toggle_button_get_active
@@ -370,21 +348,22 @@ primary_icon_name_toggled (GtkWidget * widget, GladeEntryEditor * entry_editor)
glade_editable_block (GLADE_EDITABLE (entry_editor));
glade_command_push_group (_("Setting %s to use a primary icon from the icon theme"),
- glade_widget_get_name (entry_editor->loaded_widget));
+ glade_widget_get_name (gwidget));
set_icon_name_mode (entry_editor, TRUE);
glade_command_pop_group ();
glade_editable_unblock (GLADE_EDITABLE (entry_editor));
/* reload buttons and sensitivity and stuff... */
- glade_editable_load (GLADE_EDITABLE (entry_editor),
- entry_editor->loaded_widget);
+ glade_editable_load (GLADE_EDITABLE (entry_editor), gwidget);
}
static void
primary_pixbuf_toggled (GtkWidget * widget, GladeEntryEditor * entry_editor)
{
- if (entry_editor->loading || !entry_editor->loaded_widget)
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (entry_editor));
+
+ if (glade_editable_loading (GLADE_EDITABLE (entry_editor)) || !gwidget)
return;
if (!gtk_toggle_button_get_active
@@ -394,23 +373,23 @@ primary_pixbuf_toggled (GtkWidget * widget, GladeEntryEditor * entry_editor)
glade_editable_block (GLADE_EDITABLE (entry_editor));
glade_command_push_group (_("Setting %s to use a primary icon from filename"),
- glade_widget_get_name (entry_editor->loaded_widget));
+ glade_widget_get_name (gwidget));
set_pixbuf_mode (entry_editor, TRUE);
glade_command_pop_group ();
glade_editable_unblock (GLADE_EDITABLE (entry_editor));
/* reload buttons and sensitivity and stuff... */
- glade_editable_load (GLADE_EDITABLE (entry_editor),
- entry_editor->loaded_widget);
+ glade_editable_load (GLADE_EDITABLE (entry_editor), gwidget);
}
static void
secondary_stock_toggled (GtkWidget * widget, GladeEntryEditor * entry_editor)
{
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (entry_editor));
- if (entry_editor->loading || !entry_editor->loaded_widget)
+ if (glade_editable_loading (GLADE_EDITABLE (entry_editor)) || !gwidget)
return;
if (!gtk_toggle_button_get_active
@@ -420,15 +399,14 @@ secondary_stock_toggled (GtkWidget * widget, GladeEntryEditor * entry_editor)
glade_editable_block (GLADE_EDITABLE (entry_editor));
glade_command_push_group (_("Setting %s to use a secondary icon from stock"),
- glade_widget_get_name (entry_editor->loaded_widget));
+ glade_widget_get_name (gwidget));
set_stock_mode (entry_editor, FALSE);
glade_command_pop_group ();
glade_editable_unblock (GLADE_EDITABLE (entry_editor));
/* reload buttons and sensitivity and stuff... */
- glade_editable_load (GLADE_EDITABLE (entry_editor),
- entry_editor->loaded_widget);
+ glade_editable_load (GLADE_EDITABLE (entry_editor), gwidget);
}
@@ -436,7 +414,9 @@ static void
secondary_icon_name_toggled (GtkWidget * widget,
GladeEntryEditor * entry_editor)
{
- if (entry_editor->loading || !entry_editor->loaded_widget)
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (entry_editor));
+
+ if (glade_editable_loading (GLADE_EDITABLE (entry_editor)) || !gwidget)
return;
if (!gtk_toggle_button_get_active
@@ -446,21 +426,22 @@ secondary_icon_name_toggled (GtkWidget * widget,
glade_editable_block (GLADE_EDITABLE (entry_editor));
glade_command_push_group (_("Setting %s to use a secondary icon from the icon theme"),
- glade_widget_get_name (entry_editor->loaded_widget));
+ glade_widget_get_name (gwidget));
set_icon_name_mode (entry_editor, FALSE);
glade_command_pop_group ();
glade_editable_unblock (GLADE_EDITABLE (entry_editor));
/* reload buttons and sensitivity and stuff... */
- glade_editable_load (GLADE_EDITABLE (entry_editor),
- entry_editor->loaded_widget);
+ glade_editable_load (GLADE_EDITABLE (entry_editor), gwidget);
}
static void
secondary_pixbuf_toggled (GtkWidget * widget, GladeEntryEditor * entry_editor)
{
- if (entry_editor->loading || !entry_editor->loaded_widget)
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (entry_editor));
+
+ if (glade_editable_loading (GLADE_EDITABLE (entry_editor)) || !gwidget)
return;
if (!gtk_toggle_button_get_active
@@ -470,15 +451,14 @@ secondary_pixbuf_toggled (GtkWidget * widget, GladeEntryEditor * entry_editor)
glade_editable_block (GLADE_EDITABLE (entry_editor));
glade_command_push_group (_("Setting %s to use a secondary icon from filename"),
- glade_widget_get_name (entry_editor->loaded_widget));
+ glade_widget_get_name (gwidget));
set_pixbuf_mode (entry_editor, FALSE);
glade_command_pop_group ();
glade_editable_unblock (GLADE_EDITABLE (entry_editor));
/* reload buttons and sensitivity and stuff... */
- glade_editable_load (GLADE_EDITABLE (entry_editor),
- entry_editor->loaded_widget);
+ glade_editable_load (GLADE_EDITABLE (entry_editor), gwidget);
}
diff --git a/plugins/gtk+/glade-entry-editor.h b/plugins/gtk+/glade-entry-editor.h
index 6d045eb..6819b72 100644
--- a/plugins/gtk+/glade-entry-editor.h
+++ b/plugins/gtk+/glade-entry-editor.h
@@ -39,8 +39,6 @@ struct _GladeEntryEditor
{
GtkVBox parent;
- GladeWidget *loaded_widget; /* A handy pointer to the loaded widget ... */
-
GtkWidget *embed;
GtkWidget *text_radio;
@@ -55,8 +53,6 @@ struct _GladeEntryEditor
GtkWidget *secondary_icon_name_radio;
GList *properties;
-
- gboolean loading;
};
struct _GladeEntryEditorClass
diff --git a/plugins/gtk+/glade-icon-factory-editor.c b/plugins/gtk+/glade-icon-factory-editor.c
index 548957e..f83b50f 100644
--- a/plugins/gtk+/glade-icon-factory-editor.c
+++ b/plugins/gtk+/glade-icon-factory-editor.c
@@ -66,9 +66,6 @@ glade_icon_factory_editor_load (GladeEditable * editable, GladeWidget * widget)
/* Chain up to default implementation */
parent_editable_iface->load (editable, widget);
- /* Mark our widget... */
- factory_editor->loaded_widget = widget;
-
/* load the embedded editable... */
if (factory_editor->embed)
glade_editable_load (GLADE_EDITABLE (factory_editor->embed), widget);
diff --git a/plugins/gtk+/glade-icon-factory-editor.h b/plugins/gtk+/glade-icon-factory-editor.h
index 00d1c3b..5fe3dcb 100644
--- a/plugins/gtk+/glade-icon-factory-editor.h
+++ b/plugins/gtk+/glade-icon-factory-editor.h
@@ -39,8 +39,6 @@ struct _GladeIconFactoryEditor
{
GtkVBox parent;
- GladeWidget *loaded_widget; /* A handy pointer to the loaded widget ... */
-
GtkWidget *embed; /* Embedded parent class editor */
GList *properties; /* A list of eprops to update at load() time */
diff --git a/plugins/gtk+/glade-image-editor.c b/plugins/gtk+/glade-image-editor.c
index 06d5929..8e24dac 100644
--- a/plugins/gtk+/glade-image-editor.c
+++ b/plugins/gtk+/glade-image-editor.c
@@ -65,11 +65,6 @@ glade_image_editor_load (GladeEditable * editable, GladeWidget * widget)
/* Chain up to default implementation */
parent_editable_iface->load (editable, widget);
- image_editor->loading = TRUE;
-
- /* Mark our widget... */
- image_editor->loaded_widget = widget;
-
/* load the embedded editable... */
if (image_editor->embed)
glade_editable_load (GLADE_EDITABLE (image_editor->embed), widget);
@@ -100,7 +95,6 @@ glade_image_editor_load (GladeEditable * editable, GladeWidget * widget)
break;
}
}
- image_editor->loading = FALSE;
}
static void
@@ -157,21 +151,20 @@ static void
set_stock_mode (GladeImageEditor * image_editor)
{
GladeProperty *property;
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (image_editor));
GValue value = { 0, };
- property =
- glade_widget_get_property (image_editor->loaded_widget, "icon-name");
+ property = glade_widget_get_property (gwidget, "icon-name");
glade_command_set_property (property, NULL);
- property = glade_widget_get_property (image_editor->loaded_widget, "pixbuf");
+ property = glade_widget_get_property (gwidget, "pixbuf");
glade_command_set_property (property, NULL);
- property = glade_widget_get_property (image_editor->loaded_widget, "stock");
+ property = glade_widget_get_property (gwidget, "stock");
glade_property_get_default (property, &value);
glade_command_set_property_value (property, &value);
g_value_unset (&value);
- property =
- glade_widget_get_property (image_editor->loaded_widget, "image-mode");
+ property = glade_widget_get_property (gwidget, "image-mode");
glade_command_set_property (property, GLADE_IMAGE_MODE_STOCK);
}
@@ -179,13 +172,13 @@ static void
set_icon_mode (GladeImageEditor * image_editor)
{
GladeProperty *property;
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (image_editor));
- property = glade_widget_get_property (image_editor->loaded_widget, "stock");
+ property = glade_widget_get_property (gwidget, "stock");
glade_command_set_property (property, NULL);
- property = glade_widget_get_property (image_editor->loaded_widget, "pixbuf");
+ property = glade_widget_get_property (gwidget, "pixbuf");
glade_command_set_property (property, NULL);
- property =
- glade_widget_get_property (image_editor->loaded_widget, "image-mode");
+ property = glade_widget_get_property (gwidget, "image-mode");
glade_command_set_property (property, GLADE_IMAGE_MODE_ICON);
}
@@ -195,47 +188,47 @@ static void
set_file_mode (GladeImageEditor * image_editor)
{
GladeProperty *property;
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (image_editor));
- property = glade_widget_get_property (image_editor->loaded_widget, "stock");
+ property = glade_widget_get_property (gwidget, "stock");
glade_command_set_property (property, NULL);
- property =
- glade_widget_get_property (image_editor->loaded_widget, "icon-name");
+ property = glade_widget_get_property (gwidget, "icon-name");
glade_command_set_property (property, NULL);
- property =
- glade_widget_get_property (image_editor->loaded_widget, "image-mode");
+ property = glade_widget_get_property (gwidget, "image-mode");
glade_command_set_property (property, GLADE_IMAGE_MODE_FILENAME);
}
static void
stock_toggled (GtkWidget * widget, GladeImageEditor * image_editor)
{
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (image_editor));
- if (image_editor->loading || !image_editor->loaded_widget)
+ if (glade_editable_loading (GLADE_EDITABLE (image_editor)) || !gwidget)
return;
- if (!gtk_toggle_button_get_active
- (GTK_TOGGLE_BUTTON (image_editor->stock_radio)))
+ if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (image_editor->stock_radio)))
return;
glade_editable_block (GLADE_EDITABLE (image_editor));
glade_command_push_group (_("Setting %s to use an image from stock"),
- glade_widget_get_name (image_editor->loaded_widget));
+ glade_widget_get_name (gwidget));
set_stock_mode (image_editor);
glade_command_pop_group ();
glade_editable_unblock (GLADE_EDITABLE (image_editor));
/* reload buttons and sensitivity and stuff... */
- glade_editable_load (GLADE_EDITABLE (image_editor),
- image_editor->loaded_widget);
+ glade_editable_load (GLADE_EDITABLE (image_editor), gwidget);
}
static void
icon_toggled (GtkWidget * widget, GladeImageEditor * image_editor)
{
- if (image_editor->loading || !image_editor->loaded_widget)
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (image_editor));
+
+ if (glade_editable_loading (GLADE_EDITABLE (image_editor)) || !gwidget)
return;
if (!gtk_toggle_button_get_active
@@ -245,21 +238,22 @@ icon_toggled (GtkWidget * widget, GladeImageEditor * image_editor)
glade_editable_block (GLADE_EDITABLE (image_editor));
glade_command_push_group (_("Setting %s to use an image from the icon theme"),
- glade_widget_get_name (image_editor->loaded_widget));
+ glade_widget_get_name (gwidget));
set_icon_mode (image_editor);
glade_command_pop_group ();
glade_editable_unblock (GLADE_EDITABLE (image_editor));
/* reload buttons and sensitivity and stuff... */
- glade_editable_load (GLADE_EDITABLE (image_editor),
- image_editor->loaded_widget);
+ glade_editable_load (GLADE_EDITABLE (image_editor), gwidget);
}
static void
file_toggled (GtkWidget * widget, GladeImageEditor * image_editor)
-{
- if (image_editor->loading || !image_editor->loaded_widget)
+{
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (image_editor));
+
+ if (glade_editable_loading (GLADE_EDITABLE (image_editor)) || !gwidget)
return;
if (!gtk_toggle_button_get_active
@@ -269,15 +263,14 @@ file_toggled (GtkWidget * widget, GladeImageEditor * image_editor)
glade_editable_block (GLADE_EDITABLE (image_editor));
glade_command_push_group (_("Setting %s to use an image from filename"),
- glade_widget_get_name (image_editor->loaded_widget));
+ glade_widget_get_name (gwidget));
set_file_mode (image_editor);
glade_command_pop_group ();
glade_editable_unblock (GLADE_EDITABLE (image_editor));
/* reload buttons and sensitivity and stuff... */
- glade_editable_load (GLADE_EDITABLE (image_editor),
- image_editor->loaded_widget);
+ glade_editable_load (GLADE_EDITABLE (image_editor), gwidget);
}
diff --git a/plugins/gtk+/glade-image-editor.h b/plugins/gtk+/glade-image-editor.h
index 32c0363..6851c03 100644
--- a/plugins/gtk+/glade-image-editor.h
+++ b/plugins/gtk+/glade-image-editor.h
@@ -45,8 +45,6 @@ struct _GladeImageEditor
{
GtkVBox parent;
- GladeWidget *loaded_widget; /* A handy pointer to the loaded widget ... */
-
GtkWidget *embed;
GtkWidget *stock_radio; /* Create the image from stock-id */
@@ -57,8 +55,6 @@ struct _GladeImageEditor
GtkWidget *pixels_radio; /* Set size in Pixel value */
GList *properties; /* A list of eprops to update at load() time */
-
- gboolean loading; /* Loading flag for loading widgets in the editor */
};
struct _GladeImageEditorClass
diff --git a/plugins/gtk+/glade-image-item-editor.c b/plugins/gtk+/glade-image-item-editor.c
index 64fae00..b5d9e4c 100644
--- a/plugins/gtk+/glade-image-item-editor.c
+++ b/plugins/gtk+/glade-image-item-editor.c
@@ -75,11 +75,6 @@ glade_image_item_editor_load (GladeEditable * editable, GladeWidget * widget)
/* Chain up to default implementation */
parent_editable_iface->load (editable, widget);
- item_editor->loading = TRUE;
-
- /* Mark our widget... */
- item_editor->loaded_widget = widget;
-
/* load the embedded editable... */
if (item_editor->embed)
glade_editable_load (GLADE_EDITABLE (item_editor->embed), widget);
@@ -111,7 +106,6 @@ glade_image_item_editor_load (GladeEditable * editable, GladeWidget * widget)
gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON (item_editor->custom_radio), TRUE);
}
- item_editor->loading = FALSE;
}
static void
@@ -164,7 +158,9 @@ stock_toggled (GtkWidget * widget, GladeImageItemEditor * item_editor)
GladeProperty *property;
GladeWidget *image, *loaded;
- if (item_editor->loading || !item_editor->loaded_widget)
+ loaded = glade_editable_loaded_widget (GLADE_EDITABLE (item_editor));
+
+ if (glade_editable_loading (GLADE_EDITABLE (item_editor)) || !loaded)
return;
if (!gtk_toggle_button_get_active
@@ -172,7 +168,6 @@ stock_toggled (GtkWidget * widget, GladeImageItemEditor * item_editor)
return;
glade_editable_block (GLADE_EDITABLE (item_editor));
- loaded = item_editor->loaded_widget;
glade_command_push_group (_("Setting %s to use a stock item"), glade_widget_get_name (loaded));
@@ -200,8 +195,7 @@ stock_toggled (GtkWidget * widget, GladeImageItemEditor * item_editor)
glade_editable_unblock (GLADE_EDITABLE (item_editor));
/* reload buttons and sensitivity and stuff... */
- glade_editable_load (GLADE_EDITABLE (item_editor),
- item_editor->loaded_widget);
+ glade_editable_load (GLADE_EDITABLE (item_editor), loaded);
}
static void
@@ -209,8 +203,9 @@ custom_toggled (GtkWidget * widget, GladeImageItemEditor * item_editor)
{
GladeProperty *property;
GladeWidgetAdaptor *adaptor;
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (item_editor));
- if (item_editor->loading || !item_editor->loaded_widget)
+ if (glade_editable_loading (GLADE_EDITABLE (item_editor)) || !gwidget)
return;
if (!gtk_toggle_button_get_active
@@ -219,29 +214,28 @@ custom_toggled (GtkWidget * widget, GladeImageItemEditor * item_editor)
glade_editable_block (GLADE_EDITABLE (item_editor));
- adaptor = glade_widget_get_adaptor (item_editor->loaded_widget);
+ adaptor = glade_widget_get_adaptor (gwidget);
glade_command_push_group (_("Setting %s to use a label and image"),
- glade_widget_get_name (item_editor->loaded_widget));
+ glade_widget_get_name (gwidget));
/* First clear stock... */
- property = glade_widget_get_property (item_editor->loaded_widget, "stock");
+ property = glade_widget_get_property (gwidget, "stock");
glade_command_set_property (property, NULL);
- property =
- glade_widget_get_property (item_editor->loaded_widget, "use-stock");
+ property = glade_widget_get_property (gwidget, "use-stock");
glade_command_set_property (property, FALSE);
/* Now setup default label and create image... */
- property = glade_widget_get_property (item_editor->loaded_widget, "label");
+ property = glade_widget_get_property (gwidget, "label");
glade_command_set_property (property, glade_widget_adaptor_get_generic_name (adaptor));
- property = glade_widget_get_property (item_editor->loaded_widget, "use-underline");
+ property = glade_widget_get_property (gwidget, "use-underline");
glade_command_set_property (property, FALSE);
/* There shouldnt be an image widget here... */
- if (!get_image_widget (item_editor->loaded_widget))
+ if (!get_image_widget (gwidget))
{
/* item_editor->loaded_widget may be set to NULL after the create_command. */
- GladeWidget *loaded = item_editor->loaded_widget;
+ GladeWidget *loaded = gwidget;
GladeWidget *image;
property = glade_widget_get_property (loaded, "image");
@@ -265,8 +259,7 @@ custom_toggled (GtkWidget * widget, GladeImageItemEditor * item_editor)
glade_editable_unblock (GLADE_EDITABLE (item_editor));
/* reload buttons and sensitivity and stuff... */
- glade_editable_load (GLADE_EDITABLE (item_editor),
- item_editor->loaded_widget);
+ glade_editable_load (GLADE_EDITABLE (item_editor), gwidget);
}
static void
diff --git a/plugins/gtk+/glade-image-item-editor.h b/plugins/gtk+/glade-image-item-editor.h
index 7d901e5..66c1465 100644
--- a/plugins/gtk+/glade-image-item-editor.h
+++ b/plugins/gtk+/glade-image-item-editor.h
@@ -37,26 +37,22 @@ typedef struct _GladeImageItemEditorClass GladeImageItemEditorClass;
struct _GladeImageItemEditor
{
- GtkVBox parent;
+ GtkVBox parent;
- GladeWidget *loaded_widget; /* A handy pointer to the loaded widget ... */
+ GtkWidget *embed; /* Embedded parent class editor */
+ GtkWidget *embed_image; /* Embedded GladeEditable for the image */
- GtkWidget *embed; /* Embedded parent class editor */
- GtkWidget *embed_image; /* Embedded GladeEditable for the image */
+ GtkWidget *stock_radio; /* Use a stock-item for the menu */
+ GtkWidget *custom_radio; /* Set a widget to be placed as the image item's label */
+ GtkWidget *embed_frame; /* Use to set the whole image area insensitive */
+ GtkWidget *label_frame; /* Use to set the whole custom label area insensitive */
- GtkWidget *stock_radio; /* Use a stock-item for the menu */
- GtkWidget *custom_radio; /* Set a widget to be placed as the image item's label */
- GtkWidget *embed_frame; /* Use to set the whole image area insensitive */
- GtkWidget *label_frame; /* Use to set the whole custom label area insensitive */
-
- GList *properties; /* A list of eprops to update at load() time */
-
- gboolean loading; /* Loading flag for loading widgets in the editor */
+ GList *properties; /* A list of eprops to update at load() time */
};
struct _GladeImageItemEditorClass
{
- GtkVBoxClass parent;
+ GtkVBoxClass parent;
};
GType glade_image_item_editor_get_type (void) G_GNUC_CONST;
diff --git a/plugins/gtk+/glade-label-editor.c b/plugins/gtk+/glade-label-editor.c
index 68947f0..c1ad58c 100644
--- a/plugins/gtk+/glade-label-editor.c
+++ b/plugins/gtk+/glade-label-editor.c
@@ -65,11 +65,6 @@ glade_label_editor_load (GladeEditable * editable, GladeWidget * widget)
/* Chain up to default implementation */
parent_editable_iface->load (editable, widget);
- label_editor->loading = TRUE;
-
- /* Mark our widget... */
- label_editor->loaded_widget = widget;
-
/* load the embedded editable... */
if (label_editor->embed)
glade_editable_load (GLADE_EDITABLE (label_editor->embed), widget);
@@ -151,7 +146,6 @@ glade_label_editor_load (GladeEditable * editable, GladeWidget * widget)
(label_editor->width_radio), TRUE);
}
- label_editor->loading = FALSE;
}
static void
@@ -203,8 +197,9 @@ static void
attributes_toggled (GtkWidget * widget, GladeLabelEditor * label_editor)
{
GladeProperty *property;
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (label_editor));
- if (label_editor->loading || !label_editor->loaded_widget)
+ if (glade_editable_loading (GLADE_EDITABLE (label_editor)) || !gwidget)
return;
if (!gtk_toggle_button_get_active
@@ -214,16 +209,13 @@ attributes_toggled (GtkWidget * widget, GladeLabelEditor * label_editor)
glade_editable_block (GLADE_EDITABLE (label_editor));
glade_command_push_group (_("Setting %s to use an attribute list"),
- glade_widget_get_name (label_editor->loaded_widget));
+ glade_widget_get_name (gwidget));
- property =
- glade_widget_get_property (label_editor->loaded_widget, "use-markup");
+ property = glade_widget_get_property (gwidget, "use-markup");
glade_command_set_property (property, FALSE);
- property = glade_widget_get_property (label_editor->loaded_widget, "pattern");
+ property = glade_widget_get_property (gwidget, "pattern");
glade_command_set_property (property, NULL);
- property =
- glade_widget_get_property (label_editor->loaded_widget,
- "label-content-mode");
+ property = glade_widget_get_property (gwidget, "label-content-mode");
glade_command_set_property (property, GLADE_LABEL_MODE_ATTRIBUTES);
glade_command_pop_group ();
@@ -231,16 +223,16 @@ attributes_toggled (GtkWidget * widget, GladeLabelEditor * label_editor)
glade_editable_unblock (GLADE_EDITABLE (label_editor));
/* reload buttons and sensitivity and stuff... */
- glade_editable_load (GLADE_EDITABLE (label_editor),
- label_editor->loaded_widget);
+ glade_editable_load (GLADE_EDITABLE (label_editor), gwidget);
}
static void
markup_toggled (GtkWidget * widget, GladeLabelEditor * label_editor)
{
GladeProperty *property;
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (label_editor));
- if (label_editor->loading || !label_editor->loaded_widget)
+ if (glade_editable_loading (GLADE_EDITABLE (label_editor)) || !gwidget)
return;
if (!gtk_toggle_button_get_active
@@ -250,21 +242,16 @@ markup_toggled (GtkWidget * widget, GladeLabelEditor * label_editor)
glade_editable_block (GLADE_EDITABLE (label_editor));
glade_command_push_group (_("Setting %s to use a Pango markup string"),
- glade_widget_get_name (label_editor->loaded_widget));
+ glade_widget_get_name (gwidget));
- property = glade_widget_get_property (label_editor->loaded_widget, "pattern");
+ property = glade_widget_get_property (gwidget, "pattern");
glade_command_set_property (property, NULL);
- property =
- glade_widget_get_property (label_editor->loaded_widget,
- "glade-attributes");
+ property = glade_widget_get_property (gwidget, "glade-attributes");
glade_command_set_property (property, NULL);
- property =
- glade_widget_get_property (label_editor->loaded_widget, "use-markup");
+ property = glade_widget_get_property (gwidget, "use-markup");
glade_command_set_property (property, TRUE);
- property =
- glade_widget_get_property (label_editor->loaded_widget,
- "label-content-mode");
+ property = glade_widget_get_property (gwidget, "label-content-mode");
glade_command_set_property (property, GLADE_LABEL_MODE_MARKUP);
glade_command_pop_group ();
@@ -272,16 +259,16 @@ markup_toggled (GtkWidget * widget, GladeLabelEditor * label_editor)
glade_editable_unblock (GLADE_EDITABLE (label_editor));
/* reload buttons and sensitivity and stuff... */
- glade_editable_load (GLADE_EDITABLE (label_editor),
- label_editor->loaded_widget);
+ glade_editable_load (GLADE_EDITABLE (label_editor), gwidget);
}
static void
pattern_toggled (GtkWidget * widget, GladeLabelEditor * label_editor)
{
GladeProperty *property;
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (label_editor));
- if (label_editor->loading || !label_editor->loaded_widget)
+ if (glade_editable_loading (GLADE_EDITABLE (label_editor)) || !gwidget)
return;
if (!gtk_toggle_button_get_active
@@ -291,18 +278,13 @@ pattern_toggled (GtkWidget * widget, GladeLabelEditor * label_editor)
glade_editable_block (GLADE_EDITABLE (label_editor));
glade_command_push_group (_("Setting %s to use a pattern string"),
- glade_widget_get_name (label_editor->loaded_widget));
+ glade_widget_get_name (gwidget));
- property =
- glade_widget_get_property (label_editor->loaded_widget,
- "glade-attributes");
+ property = glade_widget_get_property (gwidget, "glade-attributes");
glade_command_set_property (property, NULL);
- property =
- glade_widget_get_property (label_editor->loaded_widget, "use-markup");
+ property = glade_widget_get_property (gwidget, "use-markup");
glade_command_set_property (property, FALSE);
- property =
- glade_widget_get_property (label_editor->loaded_widget,
- "label-content-mode");
+ property = glade_widget_get_property (gwidget, "label-content-mode");
glade_command_set_property (property, GLADE_LABEL_MODE_PATTERN);
glade_command_pop_group ();
@@ -310,8 +292,7 @@ pattern_toggled (GtkWidget * widget, GladeLabelEditor * label_editor)
glade_editable_unblock (GLADE_EDITABLE (label_editor));
/* reload buttons and sensitivity and stuff... */
- glade_editable_load (GLADE_EDITABLE (label_editor),
- label_editor->loaded_widget);
+ glade_editable_load (GLADE_EDITABLE (label_editor), gwidget);
}
/**********************************************************************
@@ -322,8 +303,9 @@ static void
width_toggled (GtkWidget * widget, GladeLabelEditor * label_editor)
{
GladeProperty *property;
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (label_editor));
- if (label_editor->loading || !label_editor->loaded_widget)
+ if (glade_editable_loading (GLADE_EDITABLE (label_editor)) || !gwidget)
return;
if (!gtk_toggle_button_get_active
@@ -333,14 +315,11 @@ width_toggled (GtkWidget * widget, GladeLabelEditor * label_editor)
glade_editable_block (GLADE_EDITABLE (label_editor));
glade_command_push_group (_("Setting %s to set desired width in characters"),
- glade_widget_get_name (label_editor->loaded_widget));
+ glade_widget_get_name (gwidget));
- property =
- glade_widget_get_property (label_editor->loaded_widget,
- "max-width-chars");
+ property = glade_widget_get_property (gwidget, "max-width-chars");
glade_command_set_property (property, -1);
- property =
- glade_widget_get_property (label_editor->loaded_widget, "use-max-width");
+ property = glade_widget_get_property (gwidget, "use-max-width");
glade_command_set_property (property, FALSE);
glade_command_pop_group ();
@@ -348,16 +327,16 @@ width_toggled (GtkWidget * widget, GladeLabelEditor * label_editor)
glade_editable_unblock (GLADE_EDITABLE (label_editor));
/* reload buttons and sensitivity and stuff... */
- glade_editable_load (GLADE_EDITABLE (label_editor),
- label_editor->loaded_widget);
+ glade_editable_load (GLADE_EDITABLE (label_editor), gwidget);
}
static void
max_width_toggled (GtkWidget * widget, GladeLabelEditor * label_editor)
{
GladeProperty *property;
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (label_editor));
- if (label_editor->loading || !label_editor->loaded_widget)
+ if (glade_editable_loading (GLADE_EDITABLE (label_editor)) || !gwidget)
return;
if (!gtk_toggle_button_get_active
@@ -367,13 +346,11 @@ max_width_toggled (GtkWidget * widget, GladeLabelEditor * label_editor)
glade_editable_block (GLADE_EDITABLE (label_editor));
glade_command_push_group (_("Setting %s to set maximum width in characters"),
- glade_widget_get_name (label_editor->loaded_widget));
+ glade_widget_get_name (gwidget));
- property =
- glade_widget_get_property (label_editor->loaded_widget, "width-chars");
+ property = glade_widget_get_property (gwidget, "width-chars");
glade_command_set_property (property, -1);
- property =
- glade_widget_get_property (label_editor->loaded_widget, "use-max-width");
+ property = glade_widget_get_property (gwidget, "use-max-width");
glade_command_set_property (property, TRUE);
glade_command_pop_group ();
@@ -381,8 +358,7 @@ max_width_toggled (GtkWidget * widget, GladeLabelEditor * label_editor)
glade_editable_unblock (GLADE_EDITABLE (label_editor));
/* reload buttons and sensitivity and stuff... */
- glade_editable_load (GLADE_EDITABLE (label_editor),
- label_editor->loaded_widget);
+ glade_editable_load (GLADE_EDITABLE (label_editor), gwidget);
}
/**********************************************************************
@@ -392,8 +368,9 @@ static void
wrap_free_toggled (GtkWidget * widget, GladeLabelEditor * label_editor)
{
GladeProperty *property;
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (label_editor));
- if (label_editor->loading || !label_editor->loaded_widget)
+ if (glade_editable_loading (GLADE_EDITABLE (label_editor)) || !gwidget)
return;
if (!gtk_toggle_button_get_active
@@ -403,21 +380,16 @@ wrap_free_toggled (GtkWidget * widget, GladeLabelEditor * label_editor)
glade_editable_block (GLADE_EDITABLE (label_editor));
glade_command_push_group (_("Setting %s to use normal line wrapping"),
- glade_widget_get_name (label_editor->loaded_widget));
+ glade_widget_get_name (gwidget));
- property =
- glade_widget_get_property (label_editor->loaded_widget,
- "single-line-mode");
+ property = glade_widget_get_property (gwidget, "single-line-mode");
glade_command_set_property (property, FALSE);
- property =
- glade_widget_get_property (label_editor->loaded_widget, "wrap-mode");
+ property = glade_widget_get_property (gwidget, "wrap-mode");
glade_command_set_property (property, PANGO_WRAP_WORD);
- property = glade_widget_get_property (label_editor->loaded_widget, "wrap");
+ property = glade_widget_get_property (gwidget, "wrap");
glade_command_set_property (property, FALSE);
- property =
- glade_widget_get_property (label_editor->loaded_widget,
- "label-wrap-mode");
+ property = glade_widget_get_property (gwidget, "label-wrap-mode");
glade_command_set_property (property, GLADE_LABEL_WRAP_FREE);
glade_command_pop_group ();
@@ -425,16 +397,16 @@ wrap_free_toggled (GtkWidget * widget, GladeLabelEditor * label_editor)
glade_editable_unblock (GLADE_EDITABLE (label_editor));
/* reload buttons and sensitivity and stuff... */
- glade_editable_load (GLADE_EDITABLE (label_editor),
- label_editor->loaded_widget);
+ glade_editable_load (GLADE_EDITABLE (label_editor), gwidget);
}
static void
single_toggled (GtkWidget * widget, GladeLabelEditor * label_editor)
{
GladeProperty *property;
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (label_editor));
- if (label_editor->loading || !label_editor->loaded_widget)
+ if (glade_editable_loading (GLADE_EDITABLE (label_editor)) || !gwidget)
return;
if (!gtk_toggle_button_get_active
@@ -444,21 +416,16 @@ single_toggled (GtkWidget * widget, GladeLabelEditor * label_editor)
glade_editable_block (GLADE_EDITABLE (label_editor));
glade_command_push_group (_("Setting %s to use a single line"),
- glade_widget_get_name (label_editor->loaded_widget));
+ glade_widget_get_name (gwidget));
- property =
- glade_widget_get_property (label_editor->loaded_widget, "wrap-mode");
+ property = glade_widget_get_property (gwidget, "wrap-mode");
glade_command_set_property (property, PANGO_WRAP_WORD);
- property = glade_widget_get_property (label_editor->loaded_widget, "wrap");
+ property = glade_widget_get_property (gwidget, "wrap");
glade_command_set_property (property, FALSE);
- property =
- glade_widget_get_property (label_editor->loaded_widget,
- "single-line-mode");
+ property = glade_widget_get_property (gwidget, "single-line-mode");
glade_command_set_property (property, TRUE);
- property =
- glade_widget_get_property (label_editor->loaded_widget,
- "label-wrap-mode");
+ property = glade_widget_get_property (gwidget, "label-wrap-mode");
glade_command_set_property (property, GLADE_LABEL_SINGLE_LINE);
glade_command_pop_group ();
@@ -466,16 +433,16 @@ single_toggled (GtkWidget * widget, GladeLabelEditor * label_editor)
glade_editable_unblock (GLADE_EDITABLE (label_editor));
/* reload buttons and sensitivity and stuff... */
- glade_editable_load (GLADE_EDITABLE (label_editor),
- label_editor->loaded_widget);
+ glade_editable_load (GLADE_EDITABLE (label_editor), gwidget);
}
static void
wrap_mode_toggled (GtkWidget * widget, GladeLabelEditor * label_editor)
{
GladeProperty *property;
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (label_editor));
- if (label_editor->loading || !label_editor->loaded_widget)
+ if (glade_editable_loading (GLADE_EDITABLE (label_editor)) || !gwidget)
return;
if (!gtk_toggle_button_get_active
@@ -485,18 +452,14 @@ wrap_mode_toggled (GtkWidget * widget, GladeLabelEditor * label_editor)
glade_editable_block (GLADE_EDITABLE (label_editor));
glade_command_push_group (_("Setting %s to use specific Pango word wrapping"),
- glade_widget_get_name (label_editor->loaded_widget));
+ glade_widget_get_name (gwidget));
- property =
- glade_widget_get_property (label_editor->loaded_widget,
- "single-line-mode");
+ property = glade_widget_get_property (gwidget, "single-line-mode");
glade_command_set_property (property, FALSE);
- property = glade_widget_get_property (label_editor->loaded_widget, "wrap");
+ property = glade_widget_get_property (gwidget, "wrap");
glade_command_set_property (property, TRUE);
- property =
- glade_widget_get_property (label_editor->loaded_widget,
- "label-wrap-mode");
+ property = glade_widget_get_property (gwidget, "label-wrap-mode");
glade_command_set_property (property, GLADE_LABEL_WRAP_MODE);
glade_command_pop_group ();
@@ -504,8 +467,7 @@ wrap_mode_toggled (GtkWidget * widget, GladeLabelEditor * label_editor)
glade_editable_unblock (GLADE_EDITABLE (label_editor));
/* reload buttons and sensitivity and stuff... */
- glade_editable_load (GLADE_EDITABLE (label_editor),
- label_editor->loaded_widget);
+ glade_editable_load (GLADE_EDITABLE (label_editor), gwidget);
}
static void
diff --git a/plugins/gtk+/glade-label-editor.h b/plugins/gtk+/glade-label-editor.h
index 5be31ef..260aa0e 100644
--- a/plugins/gtk+/glade-label-editor.h
+++ b/plugins/gtk+/glade-label-editor.h
@@ -51,8 +51,6 @@ struct _GladeLabelEditor
{
GtkVBox parent;
- GladeWidget *loaded_widget; /* A handy pointer to the loaded widget ... */
-
GtkWidget *embed;
GtkWidget *attributes_radio; /* Set pango attributes manually (attributes eprop embedded) */
@@ -71,8 +69,6 @@ struct _GladeLabelEditor
GtkWidget *wrap_mode_radio;
GList *properties; /* A list of eprops to update at load() time */
-
- gboolean loading; /* Loading flag for loading widgets in the editor */
};
struct _GladeLabelEditorClass
diff --git a/plugins/gtk+/glade-store-editor.c b/plugins/gtk+/glade-store-editor.c
index 1fa4178..392feec 100644
--- a/plugins/gtk+/glade-store-editor.c
+++ b/plugins/gtk+/glade-store-editor.c
@@ -65,9 +65,6 @@ glade_store_editor_load (GladeEditable * editable, GladeWidget * widget)
/* Chain up to default implementation */
parent_editable_iface->load (editable, widget);
- /* Mark our widget... */
- store_editor->loaded_widget = widget;
-
/* load the embedded editable... */
if (store_editor->embed)
glade_editable_load (GLADE_EDITABLE (store_editor->embed), widget);
diff --git a/plugins/gtk+/glade-store-editor.h b/plugins/gtk+/glade-store-editor.h
index 0e33aa6..93ba9c5 100644
--- a/plugins/gtk+/glade-store-editor.h
+++ b/plugins/gtk+/glade-store-editor.h
@@ -39,8 +39,6 @@ struct _GladeStoreEditor
{
GtkVBox parent;
- GladeWidget *loaded_widget; /* A handy pointer to the loaded widget ... */
-
GtkWidget *embed;
GList *properties; /* A list of eprops to update at load() time */
diff --git a/plugins/gtk+/glade-tool-button-editor.c b/plugins/gtk+/glade-tool-button-editor.c
index e127228..7703475 100644
--- a/plugins/gtk+/glade-tool-button-editor.c
+++ b/plugins/gtk+/glade-tool-button-editor.c
@@ -67,11 +67,6 @@ glade_tool_button_editor_load (GladeEditable * editable, GladeWidget * widget)
/* Chain up to default implementation */
parent_editable_iface->load (editable, widget);
- button_editor->loading = TRUE;
-
- /* Mark our widget... */
- button_editor->loaded_widget = widget;
-
/* load the embedded editable... */
if (button_editor->embed)
glade_editable_load (GLADE_EDITABLE (button_editor->embed), widget);
@@ -123,7 +118,6 @@ glade_tool_button_editor_load (GladeEditable * editable, GladeWidget * widget)
gtk_widget_set_sensitive (button_editor->image_table, TRUE);
}
}
- button_editor->loading = FALSE;
}
@@ -132,9 +126,10 @@ standard_label_toggled (GtkWidget * widget,
GladeToolButtonEditor * button_editor)
{
GladeProperty *property;
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (button_editor));
GValue value = { 0, };
- if (button_editor->loading || !button_editor->loaded_widget)
+ if (glade_editable_loading (GLADE_EDITABLE (button_editor)) || !gwidget)
return;
if (!gtk_toggle_button_get_active
@@ -144,18 +139,16 @@ standard_label_toggled (GtkWidget * widget,
glade_editable_block (GLADE_EDITABLE (button_editor));
glade_command_push_group (_("Setting %s to use standard label text"),
- glade_widget_get_name (button_editor->loaded_widget));
+ glade_widget_get_name (gwidget));
- property =
- glade_widget_get_property (button_editor->loaded_widget, "label-widget");
+ property = glade_widget_get_property (gwidget, "label-widget");
glade_command_set_property (property, NULL);
- property = glade_widget_get_property (button_editor->loaded_widget, "label");
+ property = glade_widget_get_property (gwidget, "label");
glade_property_get_default (property, &value);
glade_command_set_property_value (property, &value);
g_value_unset (&value);
- property =
- glade_widget_get_property (button_editor->loaded_widget, "custom-label");
+ property = glade_widget_get_property (gwidget, "custom-label");
glade_command_set_property (property, FALSE);
glade_command_pop_group ();
@@ -163,16 +156,16 @@ standard_label_toggled (GtkWidget * widget,
glade_editable_unblock (GLADE_EDITABLE (button_editor));
/* reload buttons and sensitivity and stuff... */
- glade_editable_load (GLADE_EDITABLE (button_editor),
- button_editor->loaded_widget);
+ glade_editable_load (GLADE_EDITABLE (button_editor), gwidget);
}
static void
custom_label_toggled (GtkWidget * widget, GladeToolButtonEditor * button_editor)
{
GladeProperty *property;
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (button_editor));
- if (button_editor->loading || !button_editor->loaded_widget)
+ if (glade_editable_loading (GLADE_EDITABLE (button_editor)) || !gwidget)
return;
if (!gtk_toggle_button_get_active
@@ -182,12 +175,11 @@ custom_label_toggled (GtkWidget * widget, GladeToolButtonEditor * button_editor)
glade_editable_block (GLADE_EDITABLE (button_editor));
glade_command_push_group (_("Setting %s to use a custom label widget"),
- glade_widget_get_name (button_editor->loaded_widget));
+ glade_widget_get_name (gwidget));
- property = glade_widget_get_property (button_editor->loaded_widget, "label");
+ property = glade_widget_get_property (gwidget, "label");
glade_command_set_property (property, NULL);
- property =
- glade_widget_get_property (button_editor->loaded_widget, "custom-label");
+ property = glade_widget_get_property (gwidget, "custom-label");
glade_command_set_property (property, TRUE);
glade_command_pop_group ();
@@ -195,16 +187,16 @@ custom_label_toggled (GtkWidget * widget, GladeToolButtonEditor * button_editor)
glade_editable_unblock (GLADE_EDITABLE (button_editor));
/* reload buttons and sensitivity and stuff... */
- glade_editable_load (GLADE_EDITABLE (button_editor),
- button_editor->loaded_widget);
+ glade_editable_load (GLADE_EDITABLE (button_editor), gwidget);
}
static void
stock_toggled (GtkWidget * widget, GladeToolButtonEditor * button_editor)
{
GladeProperty *property;
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (button_editor));
- if (button_editor->loading || !button_editor->loaded_widget)
+ if (glade_editable_loading (GLADE_EDITABLE (button_editor)) || !gwidget)
return;
if (!gtk_toggle_button_get_active
@@ -214,18 +206,15 @@ stock_toggled (GtkWidget * widget, GladeToolButtonEditor * button_editor)
glade_editable_block (GLADE_EDITABLE (button_editor));
glade_command_push_group (_("Setting %s to use an image from stock"),
- glade_widget_get_name (button_editor->loaded_widget));
+ glade_widget_get_name (gwidget));
- property =
- glade_widget_get_property (button_editor->loaded_widget, "icon-name");
+ property = glade_widget_get_property (gwidget, "icon-name");
glade_command_set_property (property, NULL);
- property = glade_widget_get_property (button_editor->loaded_widget, "icon");
+ property = glade_widget_get_property (gwidget, "icon");
glade_command_set_property (property, NULL);
- property =
- glade_widget_get_property (button_editor->loaded_widget, "icon-widget");
+ property = glade_widget_get_property (gwidget, "icon-widget");
glade_command_set_property (property, NULL);
- property =
- glade_widget_get_property (button_editor->loaded_widget, "image-mode");
+ property = glade_widget_get_property (gwidget, "image-mode");
glade_command_set_property (property, GLADE_TB_MODE_STOCK);
glade_command_pop_group ();
@@ -233,8 +222,7 @@ stock_toggled (GtkWidget * widget, GladeToolButtonEditor * button_editor)
glade_editable_unblock (GLADE_EDITABLE (button_editor));
/* reload buttons and sensitivity and stuff... */
- glade_editable_load (GLADE_EDITABLE (button_editor),
- button_editor->loaded_widget);
+ glade_editable_load (GLADE_EDITABLE (button_editor), gwidget);
}
@@ -242,8 +230,9 @@ static void
icon_toggled (GtkWidget * widget, GladeToolButtonEditor * button_editor)
{
GladeProperty *property;
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (button_editor));
- if (button_editor->loading || !button_editor->loaded_widget)
+ if (glade_editable_loading (GLADE_EDITABLE (button_editor)) || !gwidget)
return;
if (!gtk_toggle_button_get_active
@@ -253,18 +242,15 @@ icon_toggled (GtkWidget * widget, GladeToolButtonEditor * button_editor)
glade_editable_block (GLADE_EDITABLE (button_editor));
glade_command_push_group (_("Setting %s to use an image from the icon theme"),
- glade_widget_get_name (button_editor->loaded_widget));
+ glade_widget_get_name (gwidget));
- property =
- glade_widget_get_property (button_editor->loaded_widget, "stock-id");
+ property = glade_widget_get_property (gwidget, "stock-id");
glade_command_set_property (property, NULL);
- property = glade_widget_get_property (button_editor->loaded_widget, "icon");
+ property = glade_widget_get_property (gwidget, "icon");
glade_command_set_property (property, NULL);
- property =
- glade_widget_get_property (button_editor->loaded_widget, "icon-widget");
+ property = glade_widget_get_property (gwidget, "icon-widget");
glade_command_set_property (property, NULL);
- property =
- glade_widget_get_property (button_editor->loaded_widget, "image-mode");
+ property = glade_widget_get_property (gwidget, "image-mode");
glade_command_set_property (property, GLADE_TB_MODE_ICON);
glade_command_pop_group ();
@@ -272,16 +258,16 @@ icon_toggled (GtkWidget * widget, GladeToolButtonEditor * button_editor)
glade_editable_unblock (GLADE_EDITABLE (button_editor));
/* reload buttons and sensitivity and stuff... */
- glade_editable_load (GLADE_EDITABLE (button_editor),
- button_editor->loaded_widget);
+ glade_editable_load (GLADE_EDITABLE (button_editor), gwidget);
}
static void
custom_toggled (GtkWidget * widget, GladeToolButtonEditor * button_editor)
{
GladeProperty *property;
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (button_editor));
- if (button_editor->loading || !button_editor->loaded_widget)
+ if (glade_editable_loading (GLADE_EDITABLE (button_editor)) || !gwidget)
return;
if (!gtk_toggle_button_get_active
@@ -291,18 +277,15 @@ custom_toggled (GtkWidget * widget, GladeToolButtonEditor * button_editor)
glade_editable_block (GLADE_EDITABLE (button_editor));
glade_command_push_group (_("Setting %s to use an image from the icon theme"),
- glade_widget_get_name (button_editor->loaded_widget));
+ glade_widget_get_name (gwidget));
- property =
- glade_widget_get_property (button_editor->loaded_widget, "stock-id");
+ property = glade_widget_get_property (gwidget, "stock-id");
glade_command_set_property (property, NULL);
- property =
- glade_widget_get_property (button_editor->loaded_widget, "icon-name");
+ property = glade_widget_get_property (gwidget, "icon-name");
glade_command_set_property (property, NULL);
- property = glade_widget_get_property (button_editor->loaded_widget, "icon");
+ property = glade_widget_get_property (gwidget, "icon");
glade_command_set_property (property, NULL);
- property =
- glade_widget_get_property (button_editor->loaded_widget, "image-mode");
+ property = glade_widget_get_property (gwidget, "image-mode");
glade_command_set_property (property, GLADE_TB_MODE_CUSTOM);
glade_command_pop_group ();
@@ -310,8 +293,7 @@ custom_toggled (GtkWidget * widget, GladeToolButtonEditor * button_editor)
glade_editable_unblock (GLADE_EDITABLE (button_editor));
/* reload buttons and sensitivity and stuff... */
- glade_editable_load (GLADE_EDITABLE (button_editor),
- button_editor->loaded_widget);
+ glade_editable_load (GLADE_EDITABLE (button_editor), gwidget);
}
static void
diff --git a/plugins/gtk+/glade-tool-button-editor.h b/plugins/gtk+/glade-tool-button-editor.h
index 75faf99..fc59e85 100644
--- a/plugins/gtk+/glade-tool-button-editor.h
+++ b/plugins/gtk+/glade-tool-button-editor.h
@@ -46,8 +46,6 @@ struct _GladeToolButtonEditor
{
GtkVBox parent;
- GladeWidget *loaded_widget; /* A handy pointer to the loaded widget ... */
-
GtkWidget *embed; /* Embedded parent class editor */
GtkWidget *label_table;
@@ -62,8 +60,6 @@ struct _GladeToolButtonEditor
GList *properties; /* A list of eprops to update at load() time */
-
- gboolean loading; /* Loading flag for loading widgets in the editor */
};
struct _GladeToolButtonEditorClass
diff --git a/plugins/gtk+/glade-tool-item-group-editor.c b/plugins/gtk+/glade-tool-item-group-editor.c
index 986054a..c8678a6 100644
--- a/plugins/gtk+/glade-tool-item-group-editor.c
+++ b/plugins/gtk+/glade-tool-item-group-editor.c
@@ -66,11 +66,6 @@ glade_tool_item_group_editor_load (GladeEditable * editable, GladeWidget * widge
/* Chain up to default implementation */
parent_editable_iface->load (editable, widget);
- group_editor->loading = TRUE;
-
- /* Mark our widget... */
- group_editor->loaded_widget = widget;
-
/* load the embedded editable... */
if (group_editor->embed)
glade_editable_load (GLADE_EDITABLE (group_editor->embed), widget);
@@ -91,8 +86,6 @@ glade_tool_item_group_editor_load (GladeEditable * editable, GladeWidget * widge
gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON (group_editor->label_radio), TRUE);
}
-
- group_editor->loading = FALSE;
}
static void
@@ -142,9 +135,10 @@ label_toggled (GtkWidget * widget,
GladeToolItemGroupEditor *group_editor)
{
GladeProperty *property;
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (group_editor));
GValue value = { 0, };
- if (group_editor->loading || !group_editor->loaded_widget)
+ if (glade_editable_loading (GLADE_EDITABLE (group_editor)) || !gwidget)
return;
if (!gtk_toggle_button_get_active
@@ -154,18 +148,16 @@ label_toggled (GtkWidget * widget,
glade_editable_block (GLADE_EDITABLE (group_editor));
glade_command_push_group (_("Setting %s to use standard label text"),
- glade_widget_get_name (group_editor->loaded_widget));
+ glade_widget_get_name (gwidget));
- property =
- glade_widget_get_property (group_editor->loaded_widget, "label-widget");
+ property = glade_widget_get_property (gwidget, "label-widget");
glade_command_set_property (property, NULL);
- property = glade_widget_get_property (group_editor->loaded_widget, "label");
+ property = glade_widget_get_property (gwidget, "label");
glade_property_get_default (property, &value);
glade_command_set_property_value (property, &value);
g_value_unset (&value);
- property =
- glade_widget_get_property (group_editor->loaded_widget, "custom-label");
+ property = glade_widget_get_property (gwidget, "custom-label");
glade_command_set_property (property, FALSE);
glade_command_pop_group ();
@@ -173,15 +165,16 @@ label_toggled (GtkWidget * widget,
glade_editable_unblock (GLADE_EDITABLE (group_editor));
/* reload buttons and sensitivity and stuff... */
- glade_editable_load (GLADE_EDITABLE (group_editor), group_editor->loaded_widget);
+ glade_editable_load (GLADE_EDITABLE (group_editor), gwidget);
}
static void
label_widget_toggled (GtkWidget * widget, GladeToolItemGroupEditor * group_editor)
{
GladeProperty *property;
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (group_editor));
- if (group_editor->loading || !group_editor->loaded_widget)
+ if (glade_editable_loading (GLADE_EDITABLE (group_editor)) || !gwidget)
return;
if (!gtk_toggle_button_get_active
@@ -191,12 +184,11 @@ label_widget_toggled (GtkWidget * widget, GladeToolItemGroupEditor * group_edito
glade_editable_block (GLADE_EDITABLE (group_editor));
glade_command_push_group (_("Setting %s to use a custom label widget"),
- glade_widget_get_name (group_editor->loaded_widget));
+ glade_widget_get_name (gwidget));
- property = glade_widget_get_property (group_editor->loaded_widget, "label");
+ property = glade_widget_get_property (gwidget, "label");
glade_command_set_property (property, NULL);
- property =
- glade_widget_get_property (group_editor->loaded_widget, "custom-label");
+ property = glade_widget_get_property (gwidget, "custom-label");
glade_command_set_property (property, TRUE);
glade_command_pop_group ();
@@ -204,7 +196,7 @@ label_widget_toggled (GtkWidget * widget, GladeToolItemGroupEditor * group_edito
glade_editable_unblock (GLADE_EDITABLE (group_editor));
/* reload buttons and sensitivity and stuff... */
- glade_editable_load (GLADE_EDITABLE (group_editor), group_editor->loaded_widget);
+ glade_editable_load (GLADE_EDITABLE (group_editor), gwidget);
}
static void
diff --git a/plugins/gtk+/glade-tool-item-group-editor.h b/plugins/gtk+/glade-tool-item-group-editor.h
index 02f277d..38a6ef6 100644
--- a/plugins/gtk+/glade-tool-item-group-editor.h
+++ b/plugins/gtk+/glade-tool-item-group-editor.h
@@ -39,16 +39,12 @@ struct _GladeToolItemGroupEditor
{
GtkVBox parent;
- GladeWidget *loaded_widget; /* A handy pointer to the loaded widget ... */
-
GtkWidget *embed;
GtkWidget *label_radio; /* Set the label directly */
GtkWidget *label_widget_radio; /* Use the custom label widget */
GList *properties; /* A list of eprops to update at load() time */
-
- gboolean loading; /* Loading flag for loading widgets in the editor */
};
struct _GladeToolItemGroupEditorClass
diff --git a/plugins/gtk+/glade-treeview-editor.c b/plugins/gtk+/glade-treeview-editor.c
index 94b67db..375152d 100644
--- a/plugins/gtk+/glade-treeview-editor.c
+++ b/plugins/gtk+/glade-treeview-editor.c
@@ -88,9 +88,6 @@ glade_tree_view_editor_load (GladeEditable * editable, GladeWidget * widget)
/* Chain up to default implementation */
parent_editable_iface->load (editable, widget);
- /* Mark our widget... */
- view_editor->loaded_widget = widget;
-
/* load the embedded editable... */
if (view_editor->embed)
glade_editable_load (GLADE_EDITABLE (view_editor->embed), widget);
@@ -167,11 +164,11 @@ static void
glade_tree_view_editor_realize (GtkWidget * widget)
{
GladeTreeViewEditor *view_editor = GLADE_TREE_VIEW_EDITOR (widget);
+ GladeWidget *gwidget = glade_editable_loaded_widget (GLADE_EDITABLE (view_editor));
GTK_WIDGET_CLASS (glade_tree_view_editor_parent_class)->realize (widget);
- glade_editable_load (GLADE_EDITABLE (view_editor),
- view_editor->loaded_widget);
+ glade_editable_load (GLADE_EDITABLE (view_editor), gwidget);
}
static void
diff --git a/plugins/gtk+/glade-treeview-editor.h b/plugins/gtk+/glade-treeview-editor.h
index b04cb5c..19e3e31 100644
--- a/plugins/gtk+/glade-treeview-editor.h
+++ b/plugins/gtk+/glade-treeview-editor.h
@@ -39,8 +39,6 @@ struct _GladeTreeViewEditor
{
GtkHBox parent;
- GladeWidget *loaded_widget; /* A handy pointer to the loaded widget ... */
-
GtkWidget *embed;
GtkWidget *embed_list_store;
GtkWidget *embed_tree_store;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]