summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gladeui/glade-command.c145
-rw-r--r--gladeui/glade-command.h5
-rw-r--r--gladeui/glade-widget-adaptor.c34
-rw-r--r--gladeui/glade-widget-adaptor.h23
-rw-r--r--gladeui/glade-widget.c19
-rw-r--r--gladeui/glade-widget.h3
-rw-r--r--gladeui/glade-xml-utils.h1
-rw-r--r--plugins/gtk+/glade-entry-editor.c10
-rw-r--r--plugins/gtk+/glade-gtk.c180
9 files changed, 345 insertions, 75 deletions
diff --git a/gladeui/glade-command.c b/gladeui/glade-command.c
index 617994cc..45fdd402 100644
--- a/gladeui/glade-command.c
+++ b/gladeui/glade-command.c
@@ -786,6 +786,151 @@ glade_command_set_property (GladeProperty * property, ...)
glade_command_set_property_value (property, value);
}
+/***********************************************************/
+/******* GLADE_COMMAND_SET_PROPERTY_SENSITIVE ******/
+/***********************************************************/
+
+/* create a new GladeCommandSetPropertySensitive class. Objects of this class will
+ * encapsulate a "set property (in)sensitive" operation */
+
+typedef struct
+{
+ GladeCommand parent;
+ GladeProperty *property;
+ gboolean sensitive;
+ gchar *new_reason;
+ gchar *old_reason;
+ gboolean undo;
+} GladeCommandSetPropertySensitive;
+
+/* standard macros */
+GLADE_MAKE_COMMAND (GladeCommandSetPropertySensitive, glade_command_set_property_sensitive);
+#define GLADE_COMMAND_SET_PROPERTY_SENSITIVE_TYPE (glade_command_set_property_sensitive_get_type ())
+#define GLADE_COMMAND_SET_PROPERTY_SENSITIVE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GLADE_COMMAND_SET_PROPERTY_SENSITIVE_TYPE, GladeCommandSetPropertySensitive))
+#define GLADE_COMMAND_SET_PROPERTY_SENSITIVE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GLADE_COMMAND_SET_PROPERTY_SENSITIVE_TYPE, GladeCommandSetPropertySensitiveClass))
+#define GLADE_IS_COMMAND_SET_PROPERTY_SENSITIVE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GLADE_COMMAND_SET_PROPERTY_SENSITIVE_TYPE))
+#define GLADE_IS_COMMAND_SET_PROPERTY_SENSITIVE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GLADE_COMMAND_SET_PROPERTY_SENSITIVE_TYPE))
+
+/* Undo the last "set property (in)sensitive" command" */
+static gboolean
+glade_command_set_property_sensitive_undo (GladeCommand * cmd)
+{
+ return glade_command_set_property_sensitive_execute (cmd);
+}
+
+/*
+ * Execute the set property command and revert it. IE, after the execution of
+ * this function cmd will point to the undo action
+ */
+static gboolean
+glade_command_set_property_sensitive_execute (GladeCommand * cmd)
+{
+ GladeCommandSetPropertySensitive *scmd;
+
+ g_return_val_if_fail (GLADE_IS_COMMAND_SET_PROPERTY_SENSITIVE (cmd), TRUE);
+
+ scmd = GLADE_COMMAND_SET_PROPERTY_SENSITIVE (cmd);
+ glade_property_set_sensitive (scmd->property,
+ scmd->undo ? !scmd->sensitive : scmd->sensitive,
+ scmd->undo ? scmd->old_reason : scmd->new_reason);
+
+ scmd->undo = !scmd->undo;
+ return TRUE;
+}
+
+static void
+glade_command_set_property_sensitive_finalize (GObject * obj)
+{
+ GladeCommandSetPropertySensitive *cmd;
+
+ cmd = GLADE_COMMAND_SET_PROPERTY_SENSITIVE (obj);
+ g_free (cmd->new_reason);
+ g_free (cmd->old_reason);
+
+ glade_command_finalize (obj);
+}
+
+static gboolean
+glade_command_set_property_sensitive_unifies (GladeCommand * this_cmd,
+ GladeCommand * other_cmd)
+{
+ GladeCommandSetPropertySensitive *cmd1, *cmd2;
+
+ if (GLADE_IS_COMMAND_SET_PROPERTY_SENSITIVE (this_cmd) &&
+ GLADE_IS_COMMAND_SET_PROPERTY_SENSITIVE (other_cmd))
+ {
+ cmd1 = GLADE_COMMAND_SET_PROPERTY_SENSITIVE (this_cmd);
+ cmd2 = GLADE_COMMAND_SET_PROPERTY_SENSITIVE (other_cmd);
+
+ return (cmd1->property == cmd2->property &&
+ cmd1->new_reason == cmd2->new_reason);
+ }
+
+ return FALSE;
+}
+
+static void
+glade_command_set_property_sensitive_collapse (GladeCommand * this_cmd,
+ GladeCommand * other_cmd)
+{
+ g_return_if_fail (GLADE_IS_COMMAND_SET_PROPERTY_SENSITIVE (this_cmd));
+ g_return_if_fail (GLADE_IS_COMMAND_SET_PROPERTY_SENSITIVE (other_cmd));
+
+ /* Nothing to do */
+}
+
+void
+glade_command_widget_set_property_sensitive (GladeWidget * widget,
+ const gchar * property_id,
+ gboolean sensitive,
+ const gchar * reason)
+{
+ GladeProperty *property;
+
+ g_return_if_fail (GLADE_IS_WIDGET (widget));
+ g_return_if_fail (property_id != NULL);
+
+ if ((property = glade_widget_get_property (widget, property_id)) != NULL)
+ glade_command_set_property_sensitive (property, sensitive, reason);
+}
+
+void
+glade_command_set_property_sensitive (GladeProperty * property,
+ gboolean sensitive,
+ const gchar * reason)
+{
+ GladeCommandSetPropertySensitive *me;
+ GladeCommand *cmd;
+
+ g_return_if_fail (GLADE_IS_PROPERTY (property));
+
+ me = g_object_new (GLADE_COMMAND_SET_PROPERTY_SENSITIVE_TYPE, NULL);
+ me->undo = FALSE;
+ me->property = property;
+ me->sensitive = sensitive;
+
+ me->new_reason = g_strdup (reason);
+ me->old_reason = g_strdup (glade_propert_get_insensitive_tooltip (me->property));
+ if (me->old_reason)
+ me->old_reason = g_strdup (me->old_reason);
+
+ cmd = GLADE_COMMAND (me);
+ cmd->priv->project =
+ glade_widget_get_project (glade_property_get_widget (me->property));
+
+ /* This command is always part of a group, thus its description should
+ * never be visible
+ */
+ cmd->priv->description = g_strdup ("dummy");
+
+ glade_command_check_group (GLADE_COMMAND (me));
+
+ if (glade_command_set_property_sensitive_execute (GLADE_COMMAND (me)))
+ glade_project_push_undo (cmd->priv->project, cmd);
+ else
+ g_object_unref (G_OBJECT (me));
+}
+
/**************************************************/
/******* GLADE_COMMAND_SET_NAME *******/
/**************************************************/
diff --git a/gladeui/glade-command.h b/gladeui/glade-command.h
index 0e7837d7..7bc0cf41 100644
--- a/gladeui/glade-command.h
+++ b/gladeui/glade-command.h
@@ -95,6 +95,11 @@ void glade_command_set_properties (GladeProperty *property,
void glade_command_set_properties_list (GladeProject *project,
GList *props); /* list of GCSetPropData */
+void glade_command_widget_set_property_sensitive (GladeWidget *widget,
+ const gchar *property_id,
+ gboolean sensitive,
+ const gchar *reason);
+
/************************** name ******************************/
void glade_command_set_name (GladeWidget *glade_widget, const gchar *name);
diff --git a/gladeui/glade-widget-adaptor.c b/gladeui/glade-widget-adaptor.c
index 87d31eea..eb266877 100644
--- a/gladeui/glade-widget-adaptor.c
+++ b/gladeui/glade-widget-adaptor.c
@@ -1325,6 +1325,13 @@ glade_widget_adaptor_object_get_children (GladeWidgetAdaptor *adaptor,
return children;
}
+static void
+glade_widget_adaptor_object_adjust_property_flags (GladeWidgetAdaptor * adaptor,
+ GladeWidget * widget,
+ gboolean use_command)
+{
+ /* Nothing to do */
+}
/*******************************************************************************
GladeWidgetAdaptor type registration and class initializer
@@ -1378,6 +1385,7 @@ glade_widget_adaptor_class_init (GladeWidgetAdaptorClass * adaptor_class)
adaptor_class->create_eprop = glade_widget_adaptor_object_create_eprop;
adaptor_class->string_from_value = glade_widget_adaptor_object_string_from_value;
adaptor_class->create_editable = glade_widget_adaptor_object_create_editable;
+ adaptor_class->adjust_property_flags = glade_widget_adaptor_object_adjust_property_flags;
/* Base defaults here */
adaptor_class->toplevel = FALSE;
@@ -1645,6 +1653,10 @@ gwa_extend_with_node_load_sym (GladeWidgetAdaptorClass * klass,
&symbol))
klass->create_editable = symbol;
+ if (glade_xml_load_sym_from_node (node, module,
+ GLADE_TAG_ADJUST_PROPERTY_FLAGS_FUNCTION,
+ &symbol))
+ klass->adjust_property_flags = symbol;
}
static void
@@ -4358,3 +4370,25 @@ glade_widget_adaptor_create_editable (GladeWidgetAdaptor * adaptor,
return GLADE_WIDGET_ADAPTOR_GET_CLASS
(adaptor)->create_editable (adaptor, type);
}
+
+/**
+ * glade_widget_adaptor_adjust_property_flags:
+ * @adaptor: A #GladeWidgetAdaptor
+ * @widget: The #GladeWidget
+ * @use_command: whether to use the GladeCommand interface
+ *
+ * This is called after a widget is loaded or a widget's
+ * property value has changed. It allows the backend to keep the
+ * sensitive/enabled flags of all properties consistent with the
+ * property values.
+ */
+void
+glade_widget_adaptor_adjust_property_flags (GladeWidgetAdaptor * adaptor,
+ GladeWidget * widget,
+ gboolean use_command)
+{
+ g_return_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor));
+
+ GLADE_WIDGET_ADAPTOR_GET_CLASS
+ (adaptor)->adjust_property_flags (adaptor, widget, use_command);
+}
diff --git a/gladeui/glade-widget-adaptor.h b/gladeui/glade-widget-adaptor.h
index ab33a531..a1a2a29f 100644
--- a/gladeui/glade-widget-adaptor.h
+++ b/gladeui/glade-widget-adaptor.h
@@ -553,6 +553,21 @@ typedef GladeEditable *(* GladeCreateEditableFunc) (GladeWidgetAdaptor *adapto
GladeEditorPageType type);
+/**
+ * GladeAdjustPropertyFlagsFunc:
+ * @adaptor: A #GladeWidgetAdaptor
+ * @widget: The #GladeWidget
+ * @use_command: whether to use the GladeCommand interface
+ *
+ * This is called after a widget is loaded or a widget's
+ * property value has changed. It allows the backend to keep the
+ * sensitive/enabled flags of all properties consistent with the
+ * property values.
+ */
+typedef void (* GladeAdjustPropertyFlagsFunc) (GladeWidgetAdaptor *adaptor,
+ GladeWidget *widget,
+ gboolean use_command);
+
/* Note that everything that must be processed at the creation of
* every instance is managed on the instance structure, and everywhere
* that we want to take advantage of inheritance is handled in the class
@@ -659,7 +674,8 @@ struct _GladeWidgetAdaptorClass
GladeCreateEPropFunc create_eprop; /* Creates a GladeEditorProperty */
GladeStringFromValueFunc string_from_value; /* Creates a string for a value */
GladeCreateEditableFunc create_editable; /* Creates a page for the editor */
-
+ GladeAdjustPropertyFlagsFunc adjust_property_flags; /* Appropiately sets all properties' sensitive/enabled flags */
+
void (* glade_reserved1) (void);
void (* glade_reserved2) (void);
void (* glade_reserved3) (void);
@@ -667,7 +683,6 @@ struct _GladeWidgetAdaptorClass
void (* glade_reserved5) (void);
void (* glade_reserved6) (void);
void (* glade_reserved7) (void);
- void (* glade_reserved8) (void);
};
#define glade_widget_adaptor_create_widget(adaptor, query, ...) \
@@ -845,6 +860,10 @@ GladeWidgetAdaptor *glade_widget_adaptor_get_parent_adaptor (GladeWidgetAdapto
gboolean glade_widget_adaptor_has_internal_children (GladeWidgetAdaptor *adaptor);
+void glade_widget_adaptor_adjust_property_flags (GladeWidgetAdaptor *adaptor,
+ GladeWidget *widget,
+ gboolean use_command);
+
G_END_DECLS
#endif /* _GLADE_WIDGET_ADAPTOR_H_ */
diff --git a/gladeui/glade-widget.c b/gladeui/glade-widget.c
index 53226bda..b8eb1bac 100644
--- a/gladeui/glade-widget.c
+++ b/gladeui/glade-widget.c
@@ -3779,6 +3779,9 @@ glade_widget_read (GladeProject * project,
}
glade_widget_adaptor_read_widget (adaptor, widget, node);
+
+ /* Set initial property sensitivity */
+ glade_widget_adaptor_adjust_property_flags (adaptor, widget, FALSE);
}
else
{
@@ -3996,6 +3999,22 @@ glade_widget_is_ancestor (GladeWidget * widget, GladeWidget * ancestor)
return FALSE;
}
+/**
+ * glade_widget_adjust_property_flags:
+ * @widget: A #GladeWidget
+ * @use_command: whether to use the GladeCommand interface
+ *
+ * Adjusts the sensitive/enabled flags of all widget properties to match
+ * the widget's property values.
+ */
+void
+glade_widget_adjust_property_flags (GladeWidget * widget, gboolean use_command)
+{
+ g_return_if_fail (GLADE_IS_WIDGET (widget));
+
+ glade_widget_adaptor_adjust_property_flags (widget->priv->adaptor,
+ widget, use_command);
+}
static gint glade_widget_su_stack = 0;
diff --git a/gladeui/glade-widget.h b/gladeui/glade-widget.h
index aa0726f2..038c090c 100644
--- a/gladeui/glade-widget.h
+++ b/gladeui/glade-widget.h
@@ -216,6 +216,9 @@ gchar *glade_widget_generate_path_name (GladeWidget *w
gboolean glade_widget_is_ancestor (GladeWidget *widget,
GladeWidget *ancestor);
+void glade_widget_adjust_property_flags (GladeWidget *widget,
+ gboolean use_command);
+
/*******************************************************************************
Project, object property references
*******************************************************************************/
diff --git a/gladeui/glade-xml-utils.h b/gladeui/glade-xml-utils.h
index c7b116fa..8dcdc94a 100644
--- a/gladeui/glade-xml-utils.h
+++ b/gladeui/glade-xml-utils.h
@@ -113,6 +113,7 @@ typedef struct _GladeProject GladeProject;
#define GLADE_TAG_CREATE_EPROP_FUNCTION "create-editor-property-function"
#define GLADE_TAG_STRING_FROM_VALUE_FUNCTION "string-from-value-function"
#define GLADE_TAG_CREATE_EDITABLE_FUNCTION "create-editable-function"
+#define GLADE_TAG_ADJUST_PROPERTY_FLAGS_FUNCTION "adjust-property-flags-function"
#define GLADE_TAG_PROPERTIES "properties"
#define GLADE_TAG_PACKING_PROPERTIES "packing-properties"
#define GLADE_TAG_PROPERTY "property"
diff --git a/plugins/gtk+/glade-entry-editor.c b/plugins/gtk+/glade-entry-editor.c
index 86320da5..4cf3f183 100644
--- a/plugins/gtk+/glade-entry-editor.c
+++ b/plugins/gtk+/glade-entry-editor.c
@@ -24,9 +24,11 @@
#include <glib/gi18n-lib.h>
#include <gdk/gdkkeysyms.h>
+#include "glade-gtk.h"
#include "glade-entry-editor.h"
#include "glade-image-editor.h" // For GladeImageEditMode
+#include <gladeui/glade-widget-adaptor.h>
static void glade_entry_editor_finalize (GObject * object);
@@ -208,6 +210,7 @@ text_toggled (GtkWidget * widget, GladeEntryEditor * entry_editor)
/* Incase the NULL text didnt change */
glade_property_sync (property);
+ glade_widget_adjust_property_flags (gwidget, TRUE);
glade_command_pop_group ();
glade_editable_unblock (GLADE_EDITABLE (entry_editor));
@@ -242,6 +245,7 @@ buffer_toggled (GtkWidget * widget, GladeEntryEditor * entry_editor)
glade_widget_get_property (gwidget, "use-entry-buffer");
glade_command_set_property (property, TRUE);
+ glade_widget_adjust_property_flags (gwidget, TRUE);
glade_command_pop_group ();
glade_editable_unblock (GLADE_EDITABLE (entry_editor));
@@ -324,6 +328,7 @@ primary_stock_toggled (GtkWidget * widget, GladeEntryEditor * entry_editor)
glade_command_push_group (_("Setting %s to use a primary icon from stock"),
glade_widget_get_name (gwidget));
set_stock_mode (entry_editor, TRUE);
+ glade_widget_adjust_property_flags (gwidget, TRUE);
glade_command_pop_group ();
glade_editable_unblock (GLADE_EDITABLE (entry_editor));
@@ -350,6 +355,7 @@ primary_icon_name_toggled (GtkWidget * widget, GladeEntryEditor * entry_editor)
glade_command_push_group (_("Setting %s to use a primary icon from the icon theme"),
glade_widget_get_name (gwidget));
set_icon_name_mode (entry_editor, TRUE);
+ glade_widget_adjust_property_flags (gwidget, TRUE);
glade_command_pop_group ();
glade_editable_unblock (GLADE_EDITABLE (entry_editor));
@@ -375,6 +381,7 @@ primary_pixbuf_toggled (GtkWidget * widget, GladeEntryEditor * entry_editor)
glade_command_push_group (_("Setting %s to use a primary icon from filename"),
glade_widget_get_name (gwidget));
set_pixbuf_mode (entry_editor, TRUE);
+ glade_widget_adjust_property_flags (gwidget, TRUE);
glade_command_pop_group ();
glade_editable_unblock (GLADE_EDITABLE (entry_editor));
@@ -401,6 +408,7 @@ secondary_stock_toggled (GtkWidget * widget, GladeEntryEditor * entry_editor)
glade_command_push_group (_("Setting %s to use a secondary icon from stock"),
glade_widget_get_name (gwidget));
set_stock_mode (entry_editor, FALSE);
+ glade_widget_adjust_property_flags (gwidget, TRUE);
glade_command_pop_group ();
glade_editable_unblock (GLADE_EDITABLE (entry_editor));
@@ -428,6 +436,7 @@ secondary_icon_name_toggled (GtkWidget * widget,
glade_command_push_group (_("Setting %s to use a secondary icon from the icon theme"),
glade_widget_get_name (gwidget));
set_icon_name_mode (entry_editor, FALSE);
+ glade_widget_adjust_property_flags (gwidget, TRUE);
glade_command_pop_group ();
glade_editable_unblock (GLADE_EDITABLE (entry_editor));
@@ -453,6 +462,7 @@ secondary_pixbuf_toggled (GtkWidget * widget, GladeEntryEditor * entry_editor)
glade_command_push_group (_("Setting %s to use a secondary icon from filename"),
glade_widget_get_name (gwidget));
set_pixbuf_mode (entry_editor, FALSE);
+ glade_widget_adjust_property_flags (gwidget, TRUE);
glade_command_pop_group ();
glade_editable_unblock (GLADE_EDITABLE (entry_editor));
diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c
index 799c5452..d4076b35 100644
--- a/plugins/gtk+/glade-gtk.c
+++ b/plugins/gtk+/glade-gtk.c
@@ -1053,6 +1053,23 @@ glade_gtk_widget_action_submenu (GladeWidgetAdaptor * adaptor,
return NULL;
}
+static void
+glade_gtk_widget_property_set_sensitive (GladeWidget * gwidget,
+ const gchar * id, gboolean sensitive,
+ const gchar * reason,
+ gboolean use_command)
+{
+ if (use_command)
+ {
+ GladeProperty *property;
+
+ if ((property = glade_widget_get_property (gwidget, id)) != NULL)
+ glade_command_set_property_sensitive (property, sensitive, reason);
+ }
+ else
+ glade_widget_property_set_sensitive (gwidget, id, sensitive, reason);
+}
+
/* ----------------------------- GtkContainer ------------------------------ */
void
glade_gtk_container_post_create (GladeWidgetAdaptor * adaptor,
@@ -3415,80 +3432,11 @@ glade_gtk_entry_set_property (GladeWidgetAdaptor * adaptor,
GObject * object,
const gchar * id, const GValue * value)
{
- GladeImageEditMode mode;
GladeWidget *gwidget = glade_widget_get_from_gobject (object);
GladeProperty *property = glade_widget_get_property (gwidget, id);
- if (!strcmp (id, "use-entry-buffer"))
- {
- glade_widget_property_set_sensitive (gwidget, "text", FALSE,
- NOT_SELECTED_MSG);
- glade_widget_property_set_sensitive (gwidget, "buffer", FALSE,
- NOT_SELECTED_MSG);
-
- if (g_value_get_boolean (value))
- glade_widget_property_set_sensitive (gwidget, "buffer", TRUE, NULL);
- else
- glade_widget_property_set_sensitive (gwidget, "text", TRUE, NULL);
- }
- else if (!strcmp (id, "primary-icon-mode"))
- {
- mode = g_value_get_int (value);
-
- glade_widget_property_set_sensitive (gwidget, "primary-icon-stock", FALSE,
- NOT_SELECTED_MSG);
- glade_widget_property_set_sensitive (gwidget, "primary-icon-name", FALSE,
- NOT_SELECTED_MSG);
- glade_widget_property_set_sensitive (gwidget, "primary-icon-pixbuf",
- FALSE, NOT_SELECTED_MSG);
-
- switch (mode)
- {
- case GLADE_IMAGE_MODE_STOCK:
- glade_widget_property_set_sensitive (gwidget, "primary-icon-stock",
- TRUE, NULL);
- break;
- case GLADE_IMAGE_MODE_ICON:
- glade_widget_property_set_sensitive (gwidget, "primary-icon-name",
- TRUE, NULL);
- break;
- case GLADE_IMAGE_MODE_FILENAME:
- glade_widget_property_set_sensitive (gwidget, "primary-icon-pixbuf",
- TRUE, NULL);
- break;
- }
- }
- else if (!strcmp (id, "secondary-icon-mode"))
- {
- mode = g_value_get_int (value);
-
- glade_widget_property_set_sensitive (gwidget, "secondary-icon-stock",
- FALSE, NOT_SELECTED_MSG);
- glade_widget_property_set_sensitive (gwidget, "secondary-icon-name",
- FALSE, NOT_SELECTED_MSG);
- glade_widget_property_set_sensitive (gwidget, "secondary-icon-pixbuf",
- FALSE, NOT_SELECTED_MSG);
-
- switch (mode)
- {
- case GLADE_IMAGE_MODE_STOCK:
- glade_widget_property_set_sensitive (gwidget,
- "secondary-icon-stock", TRUE,
- NULL);
- break;
- case GLADE_IMAGE_MODE_ICON:
- glade_widget_property_set_sensitive (gwidget, "secondary-icon-name",
- TRUE, NULL);
- break;
- case GLADE_IMAGE_MODE_FILENAME:
- glade_widget_property_set_sensitive (gwidget,
- "secondary-icon-pixbuf", TRUE,
- NULL);
- break;
- }
- }
- else if (!strcmp (id, "primary-icon-tooltip-text") ||
- !strcmp (id, "primary-icon-tooltip-markup"))
+ if (!strcmp (id, "primary-icon-tooltip-text") ||
+ !strcmp (id, "primary-icon-tooltip-markup"))
{
/* Avoid a silly crash in GTK+ */
if (gtk_entry_get_icon_storage_type (GTK_ENTRY (object),
@@ -3519,14 +3467,100 @@ glade_gtk_entry_set_property (GladeWidgetAdaptor * adaptor,
g_signal_handlers_unblock_by_func (object, glade_gtk_entry_changed,
gwidget);
-
}
- else if (GPC_VERSION_CHECK
+ else if (strcmp (id, "use-entry-buffer") != 0 && /* virtual */
+ strcmp (id, "primary-icon-mode") != 0 && /* virtual */
+ strcmp (id, "secondary-icon-mode") != 0 && /* virtual */
+ GPC_VERSION_CHECK
(glade_property_get_class (property), gtk_major_version, gtk_minor_version + 1))
GWA_GET_CLASS (GTK_TYPE_WIDGET)->set_property (adaptor, object, id, value);
}
void
+glade_gtk_entry_adjust_property_flags (GladeWidgetAdaptor * adaptor,
+ GladeWidget * widget, gboolean use_command)
+{
+ gboolean use_buffer;
+ GladeImageEditMode mode;
+
+ GWA_GET_CLASS (GTK_TYPE_WIDGET)->adjust_property_flags (adaptor, widget, use_command);
+
+ glade_widget_property_get (widget, "use-entry-buffer", &use_buffer);
+ if (use_buffer)
+ {
+ glade_gtk_widget_property_set_sensitive (widget, "buffer", TRUE,
+ NULL, use_command);
+ glade_gtk_widget_property_set_sensitive (widget, "text", FALSE,
+ NOT_SELECTED_MSG, use_command);
+ }
+ else
+ {
+ glade_gtk_widget_property_set_sensitive (widget, "text", TRUE,
+ NULL, use_command);
+ glade_gtk_widget_property_set_sensitive (widget, "buffer", FALSE,
+ NOT_SELECTED_MSG, use_command);
+ }
+
+ glade_widget_property_get (widget, "primary-icon-mode", &mode);
+ switch (mode)
+ {
+ case GLADE_IMAGE_MODE_STOCK:
+ glade_gtk_widget_property_set_sensitive (widget, "primary-icon-stock", TRUE,
+ NULL, use_command);
+ glade_gtk_widget_property_set_sensitive (widget, "primary-icon-name", FALSE,
+ NULL, use_command);
+ glade_gtk_widget_property_set_sensitive (widget, "primary-icon-pixbuf", FALSE,
+ NULL, use_command);
+ break;
+ case GLADE_IMAGE_MODE_ICON:
+ glade_gtk_widget_property_set_sensitive (widget, "primary-icon-name", TRUE,
+ NULL, use_command);
+ glade_gtk_widget_property_set_sensitive (widget, "primary-icon-stock", FALSE,
+ NULL, use_command);
+ glade_gtk_widget_property_set_sensitive (widget, "primary-icon-pixbuf", FALSE,
+ NULL, use_command);
+ break;
+ case GLADE_IMAGE_MODE_FILENAME:
+ glade_gtk_widget_property_set_sensitive (widget, "primary-icon-pixbuf", TRUE,
+ NULL, use_command);
+ glade_gtk_widget_property_set_sensitive (widget, "primary-icon-stock", FALSE,
+ NULL, use_command);
+ glade_gtk_widget_property_set_sensitive (widget, "primary-icon-name", FALSE,
+ NULL, use_command);
+ break;
+ }
+
+ glade_widget_property_get (widget, "secondary-icon-mode", &mode);
+ switch (mode)
+ {
+ case GLADE_IMAGE_MODE_STOCK:
+ glade_gtk_widget_property_set_sensitive (widget, "secondary-icon-stock", TRUE,
+ NULL, use_command);
+ glade_gtk_widget_property_set_sensitive (widget, "secondary-icon-name", FALSE,
+ NULL, use_command);
+ glade_gtk_widget_property_set_sensitive (widget, "secondary-icon-pixbuf", FALSE,
+ NULL, use_command);
+ break;
+ case GLADE_IMAGE_MODE_ICON:
+ glade_gtk_widget_property_set_sensitive (widget, "secondary-icon-name", TRUE,
+ NULL, use_command);
+ glade_gtk_widget_property_set_sensitive (widget, "secondary-icon-stock", FALSE,
+ NULL, use_command);
+ glade_gtk_widget_property_set_sensitive (widget, "secondary-icon-pixbuf", FALSE,
+ NULL, use_command);
+ break;
+ case GLADE_IMAGE_MODE_FILENAME:
+ glade_gtk_widget_property_set_sensitive (widget, "secondary-icon-pixbuf", TRUE,
+ NULL, use_command);
+ glade_gtk_widget_property_set_sensitive (widget, "secondary-icon-stock", FALSE,
+ NULL, use_command);
+ glade_gtk_widget_property_set_sensitive (widget, "secondary-icon-name", FALSE,
+ NULL, use_command);
+ break;
+ }
+}
+
+void
glade_gtk_entry_read_widget (GladeWidgetAdaptor * adaptor,
GladeWidget * widget, GladeXmlNode * node)
{