glade3 r2004 - in trunk: . gladeui plugins/gtk+
- From: tvb svn gnome org
- To: svn-commits-list gnome org
- Subject: glade3 r2004 - in trunk: . gladeui plugins/gtk+
- Date: Mon, 27 Oct 2008 17:46:35 +0000 (UTC)
Author: tvb
Date: Mon Oct 27 17:46:35 2008
New Revision: 2004
URL: http://svn.gnome.org/viewvc/glade3?rev=2004&view=rev
Log:
* plugins/gtk+/gtk+.xml.in, plugins/gtk+/glade-gtk.c:
- Reimplemented GtkImage from ground up.
- Reimplemented stock on GtkButton.
- Made toolbutton editables show up in the toolbar editor
* gladeui/glade-base-editor.[ch]: Added glade_base_editor_add_editable()
* plugins/gtk+/glade-button-editor.c, plugins/gtk+/glade-tool-bar-editor.c:
Implement new Editable vfunc set_show_name()
* gladeui/glade-editor-table.c, gladeui/glade-editable.c, gladeui/glade-editor.c:
Added new vfunc set_show_name()
* plugins/gtk+/Makefile.am, plugins/gtk+/glade-image-editor.[ch]: New editor
widget for GtkImage
* gladeui/glade-property-class.[ch]: string props can now be "stock" or "stock-icon"
* gladeui/glade-widget-adaptor.c: No more stock enum eprops
* gladeui/glade-editor-property.c: Handle string types with "stock" or "stock-icon"
Added:
trunk/plugins/gtk+/glade-image-editor.c
trunk/plugins/gtk+/glade-image-editor.h
Modified:
trunk/ChangeLog
trunk/gladeui/glade-base-editor.c
trunk/gladeui/glade-base-editor.h
trunk/gladeui/glade-builtins.c
trunk/gladeui/glade-displayable-values.c
trunk/gladeui/glade-displayable-values.h
trunk/gladeui/glade-editable.c
trunk/gladeui/glade-editable.h
trunk/gladeui/glade-editor-property.c
trunk/gladeui/glade-editor-table.c
trunk/gladeui/glade-editor-table.h
trunk/gladeui/glade-property-class.c
trunk/gladeui/glade-property-class.h
trunk/gladeui/glade-utils.c
trunk/gladeui/glade-widget-adaptor.c
trunk/gladeui/glade-xml-utils.h
trunk/plugins/gtk+/Makefile.am
trunk/plugins/gtk+/glade-button-editor.c
trunk/plugins/gtk+/glade-gtk.c
trunk/plugins/gtk+/glade-tool-button-editor.c
trunk/plugins/gtk+/gtk+.xml.in
Modified: trunk/gladeui/glade-base-editor.c
==============================================================================
--- trunk/gladeui/glade-base-editor.c (original)
+++ trunk/gladeui/glade-base-editor.c Mon Oct 27 17:46:35 2008
@@ -1477,11 +1477,18 @@
gtk_widget_show (vbox);
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
+ /* ScrolledWindow */
+ scroll = gtk_scrolled_window_new (NULL, NULL);
+ gtk_widget_show (scroll);
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroll), GTK_SHADOW_IN);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+ gtk_box_pack_start (GTK_BOX (vbox), scroll, TRUE, TRUE, 0);
+
/* Tables */
e->table = gtk_table_new (1, 2, FALSE);
gtk_widget_show (e->table);
gtk_table_set_row_spacings (GTK_TABLE (e->table), 4);
- gtk_box_pack_start (GTK_BOX (vbox), e->table, FALSE, TRUE, 0);
+ gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scroll), e->table);
/* Signal Editor */
e->signal_editor = glade_signal_editor_new (NULL);
@@ -1688,6 +1695,44 @@
va_end (args);
}
+
+/**
+ * glade_base_editor_add_editable:
+ * @editor: a #GladeBaseEditor
+ * @gchild: the #GladeWidget
+ *
+ * Add @gchild general page editor
+ *
+ * NOTE: This function is intended to be used in "child-selected" callbacks
+ */
+void
+glade_base_editor_add_editable (GladeBaseEditor *editor,
+ GladeWidget *gchild)
+{
+ GladeEditorProperty *eprop;
+ GladeEditable *editable;
+ va_list args;
+ gchar *property;
+ gint row;
+
+ g_return_if_fail (GLADE_IS_BASE_EDITOR (editor));
+ g_return_if_fail (GLADE_IS_WIDGET (gchild));
+
+ editable = (GtkWidget *)glade_widget_adaptor_create_editable (gchild->adaptor, GLADE_PAGE_GENERAL);
+ glade_editable_set_show_name (editable, FALSE);
+ glade_editable_load (editable, gchild);
+ gtk_widget_show (GTK_WIDGET (editable));
+
+ row = editor->priv->row;
+ gtk_table_attach (GTK_TABLE (editor->priv->table), GTK_WIDGET (editable), 0, 2, row, row + 1,
+ GTK_FILL, GTK_EXPAND | GTK_FILL, 2, 0);
+
+ editor->priv->row++;
+
+}
+
+
+
/**
* glade_base_editor_add_label:
* @editor: a #GladeBaseEditor
Modified: trunk/gladeui/glade-base-editor.h
==============================================================================
--- trunk/gladeui/glade-base-editor.h (original)
+++ trunk/gladeui/glade-base-editor.h Mon Oct 27 17:46:35 2008
@@ -65,6 +65,9 @@
gboolean tree_like,
...);
+void glade_base_editor_add_editable (GladeBaseEditor *editor,
+ GladeWidget *gchild);
+
void glade_base_editor_add_default_properties (GladeBaseEditor *editor,
GladeWidget *gchild);
Modified: trunk/gladeui/glade-builtins.c
==============================================================================
--- trunk/gladeui/glade-builtins.c (original)
+++ trunk/gladeui/glade-builtins.c Mon Oct 27 17:46:35 2008
@@ -31,6 +31,7 @@
#include <glib/gi18n-lib.h>
#include <string.h>
#include "glade-builtins.h"
+#include "glade-displayable-values.h"
struct _GladeParamSpecObjects {
@@ -53,7 +54,7 @@
* Auto-generate the enum type for stock properties *
************************************************************/
-/* Hard-coded list of stock images from gtk+ that are not stock "items" */
+/* Hard-coded list of stock images (and displayable translations) from gtk+ that are not stock "items" */
static const gchar *builtin_stock_images[] =
{
"gtk-dialog-authentication", /* GTK_STOCK_DIALOG_AUTHENTICATION */
@@ -65,6 +66,17 @@
"gtk-missing-image" /* GTK_STOCK_MISSING_IMAGE */
};
+static const gchar *builtin_stock_displayables[] =
+{
+ N_("Authentication"), /* GTK_STOCK_DIALOG_AUTHENTICATION */
+ N_("DnD"), /* GTK_STOCK_DND */
+ N_("DnD Multiple"), /* GTK_STOCK_DND_MULTIPLE */
+ N_("Color Picker"), /* GTK_STOCK_COLOR_PICKER */
+ N_("Directory"), /* GTK_STOCK_DIRECTORY */
+ N_("File"), /* GTK_STOCK_FILE */
+ N_("Missing Image") /* GTK_STOCK_MISSING_IMAGE */
+};
+
static GSList *stock_prefixs = NULL;
static gboolean stock_prefixs_done = FALSE;
@@ -82,7 +94,6 @@
stock_prefixs = g_slist_append (stock_prefixs, g_strdup (prefix));
}
-
static GladeStockItem *
new_from_values (const gchar *name, const gchar *nick, gint value)
{
@@ -98,6 +109,7 @@
new_gsi->value_nick = g_strdup (nick);
new_gsi->value = value;
+
clean_name = g_strdup (name);
len = strlen (clean_name);
@@ -110,7 +122,7 @@
i++;
}
- new_gsi->clean_name = g_utf8_collate_key (clean_name, i - 1);
+ new_gsi->clean_name = g_utf8_collate_key (clean_name, i - j);
g_free (clean_name);
@@ -134,7 +146,7 @@
GtkStockItem item;
GSList *l = NULL, *stock_list = NULL, *p = NULL;
gchar *stock_id = NULL, *prefix = NULL;
- gint stock_enum = 1, i = 0;
+ gint stock_enum = 0, i = 0;
GEnumValue value;
GArray *values = NULL;
GladeStockItem *gsi;
@@ -144,13 +156,7 @@
stock_list = g_slist_reverse (gtk_stock_list_ids ());
values = g_array_sized_new (TRUE, TRUE, sizeof (GEnumValue),
- g_slist_length (stock_list) + 1);
-
- /* Add first "no stock" element which is sorted alone ! */
- gsi = new_from_values ("None", "glade-none", 0);
- gsi_list = g_slist_insert_sorted (gsi_list, gsi, (GCompareFunc) compare_two_gsi);
- gsi_list_list = g_slist_append (gsi_list_list, gsi_list);
- gsi_list = NULL;
+ g_slist_length (stock_list));
/* We want gtk+ stock items to appear first */
if ((stock_prefixs && strcmp (stock_prefixs->data, "gtk-")) ||
@@ -209,18 +215,39 @@
g_slist_free (gsi_list_list);
- /* Add the trailing end marker */
- value.value = 0;
- value.value_name = NULL;
- value.value_nick = NULL;
- values = g_array_append_val (values, value);
-
stock_prefixs_done = TRUE;
g_slist_free (stock_list);
return values;
}
+static gchar *
+clean_stock_name (const gchar *name)
+{
+ gchar *clean_name, *str;
+ size_t len = 0;
+ guint i = 0;
+ guint j = 0;
+
+ g_assert (name && name[0]);
+
+ str = g_strdup (name);
+ len = strlen (str);
+
+ while (i+j <= len)
+ {
+ if (str[i+j] == '_')
+ j++;
+
+ str[i] = str[i+j];
+ i++;
+ }
+ clean_name = g_strndup (str, i - j);
+ g_free (str);
+
+ return clean_name;
+}
+
GType
glade_standard_stock_get_type (void)
{
@@ -228,9 +255,23 @@
if (etype == 0) {
GArray *values = list_stock_items (FALSE);
+ gint i, n_values = values->len;
+ GEnumValue *enum_values = (GEnumValue *)values->data;
+ GtkStockItem item;
etype = g_enum_register_static ("GladeStock",
(GEnumValue *)g_array_free (values, FALSE));
+
+ /* Register displayable by GType, i.e. after the types been created. */
+ for (i = 0; i < n_values; i++)
+ {
+ if (gtk_stock_lookup (enum_values[i].value_nick, &item))
+ {
+ gchar *clean_name = clean_stock_name (item.label);
+ glade_register_translated_value (etype, enum_values[i].value_nick, clean_name);
+ g_free (clean_name);
+ }
+ }
}
return etype;
}
@@ -243,9 +284,33 @@
if (etype == 0) {
GArray *values = list_stock_items (TRUE);
+ gint i, n_values = values->len;
+ GEnumValue *enum_values = (GEnumValue *)values->data;
+ GtkStockItem item;
etype = g_enum_register_static ("GladeStockImage",
(GEnumValue *)g_array_free (values, FALSE));
+
+ /* Register displayable by GType, i.e. after the types been created. */
+ for (i = 0; i < n_values; i++)
+ {
+ if (gtk_stock_lookup (enum_values[i].value_nick, &item))
+ {
+ gchar *clean_name = clean_stock_name (item.label);
+
+ /* These are translated, we just cut out the mnemonic underscores */
+ glade_register_translated_value (etype, enum_values[i].value_nick, clean_name);
+ g_free (clean_name);
+ }
+ }
+
+ for (i = 0; i < G_N_ELEMENTS (builtin_stock_images); i++)
+ {
+ /* these ones are translated from glade3 */
+ glade_register_displayable_value (etype,
+ builtin_stock_images[i], GETTEXT_PACKAGE,
+ builtin_stock_displayables[i]);
+ }
}
return etype;
}
Modified: trunk/gladeui/glade-displayable-values.c
==============================================================================
--- trunk/gladeui/glade-displayable-values.c (original)
+++ trunk/gladeui/glade-displayable-values.c Mon Oct 27 17:46:35 2008
@@ -65,6 +65,24 @@
gpointer klass;
GList *values;
+ g_return_if_fail (value && value[0]);
+ g_return_if_fail (domain && domain[0]);
+ g_return_if_fail (string && string[0]);
+
+ glade_register_translated_value (type, value, dgettext (domain, string));
+}
+
+void
+glade_register_translated_value (GType type,
+ const gchar *value,
+ const gchar *string)
+{
+ ValueTab *tab;
+ gpointer klass;
+ GList *values;
+
+ g_return_if_fail (value && value[0]);
+ g_return_if_fail (string && string[0]);
klass = g_type_class_ref (type);
g_return_if_fail (klass != NULL);
@@ -73,7 +91,7 @@
tab = g_new0 (ValueTab, 1);
tab->value = g_strdup (value);
- tab->string = g_strdup (dgettext (domain, string));
+ tab->string = g_strdup (string);
if ((values =
g_hash_table_lookup (values_hash, klass)) != NULL)
@@ -119,6 +137,8 @@
GList *values, *tab_iter;
gchar *displayable = NULL;
+ g_return_val_if_fail (value && value[0], NULL);
+
if (!values_hash)
return NULL;
@@ -147,9 +167,11 @@
GList *values, *tab_iter;
gchar *value = NULL;
+ g_return_val_if_fail (displayable && displayable[0], NULL);
+
if (!values_hash)
return NULL;
-
+
klass = g_type_class_ref (type);
g_return_val_if_fail (klass != NULL, NULL);
Modified: trunk/gladeui/glade-displayable-values.h
==============================================================================
--- trunk/gladeui/glade-displayable-values.h (original)
+++ trunk/gladeui/glade-displayable-values.h Mon Oct 27 17:46:35 2008
@@ -12,6 +12,10 @@
const gchar *domain,
const gchar *string);
+void glade_register_translated_value (GType type,
+ const gchar *value,
+ const gchar *string);
+
gboolean glade_type_has_displayable_values (GType type);
G_CONST_RETURN
Modified: trunk/gladeui/glade-editable.c
==============================================================================
--- trunk/gladeui/glade-editable.c (original)
+++ trunk/gladeui/glade-editable.c Mon Oct 27 17:46:35 2008
@@ -62,6 +62,9 @@
* @editable: A #GladeEditable
* @widget: the #GladeWidget to load
*
+ * Loads @widget property values into @editable
+ * (the editable will watch the widgets properties
+ * until its loaded with another widget or %NULL)
*/
void
glade_editable_load (GladeEditable *editable,
@@ -79,3 +82,28 @@
g_critical ("No GladeEditable::load() support on type %s",
G_OBJECT_TYPE_NAME (editable));
}
+
+
+/**
+ * glade_editable_set_show_name:
+ * @editable: A #GladeEditable
+ * @show_name: Whether or not to show the name entry
+ *
+ * This only applies for the general page in the property
+ * editor, editables that embed the #GladeEditorTable implementation
+ * for the general page should use this to forward the message
+ * to its embedded editable.
+ */
+void
+glade_editable_set_show_name (GladeEditable *editable,
+ gboolean show_name)
+{
+ GladeEditableIface *iface;
+ g_return_if_fail (GLADE_IS_EDITABLE (editable));
+
+ iface = GLADE_EDITABLE_GET_IFACE (editable);
+
+ if (iface->set_show_name)
+ iface->set_show_name (editable, show_name);
+}
+
Modified: trunk/gladeui/glade-editable.h
==============================================================================
--- trunk/gladeui/glade-editable.h (original)
+++ trunk/gladeui/glade-editable.h Mon Oct 27 17:46:35 2008
@@ -32,14 +32,18 @@
GTypeInterface g_iface;
/* virtual table */
- void (* load) (GladeEditable *editable,
- GladeWidget *widget);
+ void (* load) (GladeEditable *editable,
+ GladeWidget *widget);
+ void (* set_show_name) (GladeEditable *editable,
+ gboolean show_name);
};
-GType glade_editable_get_type (void) G_GNUC_CONST;
-void glade_editable_load (GladeEditable *editable,
- GladeWidget *widget);
+GType glade_editable_get_type (void) G_GNUC_CONST;
+void glade_editable_load (GladeEditable *editable,
+ GladeWidget *widget);
+void glade_editable_set_show_name (GladeEditable *editable,
+ gboolean show_name);
G_END_DECLS
Modified: trunk/gladeui/glade-editor-property.c
==============================================================================
--- trunk/gladeui/glade-editor-property.c (original)
+++ trunk/gladeui/glade-editor-property.c Mon Oct 27 17:46:35 2008
@@ -847,35 +847,16 @@
}
static GtkWidget *
-glade_editor_create_input_stock_item (GladeEditorProperty *eprop,
- const gchar *id,
- gint value)
-{
- GtkWidget *menu_item = gtk_image_menu_item_new_from_stock (id, NULL);
-
- g_signal_connect (G_OBJECT (menu_item), "activate",
- G_CALLBACK (glade_eprop_enum_changed),
- eprop);
-
- g_object_set_data (G_OBJECT (menu_item), GLADE_ENUM_DATA_TAG, GINT_TO_POINTER(value));
-
- return menu_item;
-}
-
-static GtkWidget *
glade_eprop_enum_create_input (GladeEditorProperty *eprop)
{
GladeEPropEnum *eprop_enum = GLADE_EPROP_ENUM (eprop);
GtkWidget *menu_item, *menu;
GladePropertyClass *klass;
GEnumClass *eclass;
- gboolean stock;
guint i;
klass = eprop->klass;
eclass = g_type_class_ref (klass->pspec->value_type);
- stock = (klass->pspec->value_type == GLADE_TYPE_STOCK) ||
- (klass->pspec->value_type == GLADE_TYPE_STOCK_IMAGE);
menu = gtk_menu_new ();
@@ -886,14 +867,8 @@
eclass->values[i].value_nick);
if (value_name == NULL) value_name = eclass->values[i].value_nick;
- if (stock && strcmp (eclass->values[i].value_nick, "glade-none"))
- menu_item = glade_editor_create_input_stock_item
- (eprop,
- eclass->values[i].value_nick,
- eclass->values[i].value);
- else
- menu_item = glade_editor_create_input_enum_item
- (eprop, value_name, eclass->values[i].value);
+ menu_item = glade_editor_create_input_enum_item
+ (eprop, value_name, eclass->values[i].value);
gtk_widget_show (menu_item);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
@@ -1525,6 +1500,7 @@
GladeEditorProperty parent_instance;
GtkWidget *text_entry;
+ GtkTreeModel *store;
} GladeEPropText;
GLADE_MAKE_EPROP (GladeEPropText, glade_eprop_text)
@@ -1554,7 +1530,25 @@
fmt = glade_project_get_format (property->widget->project);
- if (GTK_IS_ENTRY (eprop_text->text_entry))
+ if (GTK_IS_COMBO_BOX (eprop_text->text_entry))
+ {
+ if (GTK_IS_COMBO_BOX_ENTRY (eprop_text->text_entry))
+ {
+ const gchar *text = g_value_get_string (property->value);
+ if (!text) text = "";
+ gtk_entry_set_text (GTK_ENTRY (GTK_BIN (eprop_text->text_entry)->child), text);
+ }
+ else
+ {
+ const gchar *text = g_value_get_string (property->value);
+ gint value = text ?
+ glade_utils_enum_value_from_string (GLADE_TYPE_STOCK, text) : 0;
+
+ /* Set active iter... */
+ gtk_combo_box_set_active (GTK_COMBO_BOX (eprop_text->text_entry), value);
+ }
+ }
+ else if (GTK_IS_ENTRY (eprop_text->text_entry))
{
GtkEntry *entry = GTK_ENTRY (eprop_text->text_entry);
const gchar *text = NULL;
@@ -1941,6 +1935,70 @@
}
}
+enum {
+ COMBO_COLUMN_TEXT = 0,
+ COMBO_COLUMN_PIXBUF,
+ COMBO_LAST_COLUMN
+};
+
+static GtkListStore *
+glade_eprop_text_create_store (GType enum_type)
+{
+ GtkListStore *store;
+ GtkTreeIter iter;
+ GEnumClass *eclass;
+ guint i;
+
+ eclass = g_type_class_ref (enum_type);
+
+ store = gtk_list_store_new (COMBO_LAST_COLUMN,
+ G_TYPE_STRING,
+ G_TYPE_STRING);
+
+ for (i = 0; i < eclass->n_values; i++)
+ {
+ const gchar *displayable = glade_get_displayable_value (enum_type, eclass->values[i].value_nick);
+ if (!displayable)
+ displayable = eclass->values[i].value_nick;
+
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter,
+ COMBO_COLUMN_TEXT, displayable,
+ COMBO_COLUMN_PIXBUF, eclass->values[i].value_nick,
+ -1);
+ }
+
+ g_type_class_unref (eclass);
+
+ return store;
+}
+
+static void
+eprop_text_stock_changed (GtkComboBox *combo,
+ GladeEditorProperty *eprop)
+{
+ GladeEPropText *eprop_text = GLADE_EPROP_TEXT (eprop);
+ GtkTreeIter iter;
+ gchar *text = NULL;
+ const gchar *str;
+
+ if (eprop->loading) return;
+
+ if (gtk_combo_box_get_active_iter (combo, &iter))
+ {
+ gtk_tree_model_get (GTK_TREE_MODEL (eprop_text->store), &iter,
+ COMBO_COLUMN_PIXBUF, &text,
+ -1);
+ glade_eprop_text_changed_common (eprop, text, eprop->use_command);
+ g_free (text);
+ }
+ else if (GTK_IS_COMBO_BOX_ENTRY (combo))
+ {
+ str = gtk_entry_get_text (GTK_ENTRY (GTK_BIN (combo)->child));
+ glade_eprop_text_changed_common (eprop, str, eprop->use_command);
+ }
+}
+
static GtkWidget *
glade_eprop_text_create_input (GladeEditorProperty *eprop)
{
@@ -1952,7 +2010,40 @@
hbox = gtk_hbox_new (FALSE, 0);
- if (klass->visible_lines > 1 ||
+ if (klass->stock || klass->stock_icon)
+ {
+ GtkCellRenderer *renderer;
+ GtkWidget *combo = gtk_combo_box_entry_new ();
+
+ eprop_text->store = (GtkTreeModel *)
+ glade_eprop_text_create_store (klass->stock ? GLADE_TYPE_STOCK :
+ GLADE_TYPE_STOCK_IMAGE);
+
+ gtk_combo_box_set_model (GTK_COMBO_BOX (combo), GTK_TREE_MODEL (eprop_text->store));
+
+ /* let the comboboxentry prepend its intrusive cell first... */
+ gtk_combo_box_entry_set_text_column (GTK_COMBO_BOX_ENTRY (combo),
+ COMBO_COLUMN_TEXT);
+
+ renderer = gtk_cell_renderer_pixbuf_new ();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, FALSE);
+ gtk_cell_layout_reorder (GTK_CELL_LAYOUT (combo), renderer, 0);
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), renderer,
+ "stock-id", COMBO_COLUMN_PIXBUF,
+ NULL);
+
+ if (klass->stock)
+ gtk_entry_set_editable (GTK_ENTRY (GTK_BIN (combo)->child), FALSE);
+
+ gtk_widget_show (combo);
+ gtk_box_pack_start (GTK_BOX (hbox), combo, FALSE, FALSE, 0);
+ g_signal_connect (G_OBJECT (combo), "changed",
+ G_CALLBACK (eprop_text_stock_changed), eprop);
+
+
+ eprop_text->text_entry = combo;
+ }
+ else if (klass->visible_lines > 1 ||
klass->pspec->value_type == G_TYPE_STRV ||
klass->pspec->value_type == G_TYPE_VALUE_ARRAY)
{
@@ -3368,6 +3459,8 @@
* @property: A #GladeProperty
*
* Loads @property values into @eprop and connects.
+ * (the editor property will watch the property's value
+ * until its loaded with another property or %NULL)
*/
void
glade_editor_property_load (GladeEditorProperty *eprop,
Modified: trunk/gladeui/glade-editor-table.c
==============================================================================
--- trunk/gladeui/glade-editor-table.c (original)
+++ trunk/gladeui/glade-editor-table.c Mon Oct 27 17:46:35 2008
@@ -159,9 +159,28 @@
}
static void
+glade_editor_table_set_show_name (GladeEditable *editable,
+ gboolean show_name)
+{
+ GladeEditorTable *table = GLADE_EDITOR_TABLE (editable);
+
+ if (show_name)
+ {
+ gtk_widget_show (table->name_label);
+ gtk_widget_show (table->name_entry);
+ }
+ else
+ {
+ gtk_widget_hide (table->name_label);
+ gtk_widget_hide (table->name_entry);
+ }
+}
+
+static void
glade_editor_table_editable_init (GladeEditableIface *iface)
{
iface->load = glade_editor_table_load;
+ iface->set_show_name = glade_editor_table_set_show_name;
}
static void
@@ -297,18 +316,17 @@
static void
append_name_field (GladeEditorTable *table)
{
- GtkWidget *label;
gchar *text = _("The Object's name");
/* Name */
- label = gtk_label_new (_("Name:"));
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
- gtk_widget_show (label);
+ table->name_label = gtk_label_new (_("Name:"));
+ gtk_misc_set_alignment (GTK_MISC (table->name_label), 0.0, 0.5);
+ gtk_widget_show (table->name_label);
table->name_entry = gtk_entry_new ();
gtk_widget_show (table->name_entry);
- gtk_widget_set_tooltip_text (label, text);
+ gtk_widget_set_tooltip_text (table->name_label, text);
gtk_widget_set_tooltip_text (table->name_entry, text);
g_signal_connect (G_OBJECT (table->name_entry), "activate",
@@ -316,7 +334,7 @@
g_signal_connect (G_OBJECT (table->name_entry), "changed",
G_CALLBACK (widget_name_edited), table);
- glade_editor_table_attach (table, label, 0, table->rows);
+ glade_editor_table_attach (table, table->name_label, 0, table->rows);
glade_editor_table_attach (table, table->name_entry, 1, table->rows);
table->rows++;
Modified: trunk/gladeui/glade-editor-table.h
==============================================================================
--- trunk/gladeui/glade-editor-table.h (original)
+++ trunk/gladeui/glade-editor-table.h Mon Oct 27 17:46:35 2008
@@ -49,6 +49,7 @@
GladeWidget *loaded_widget; /* A pointer to the currently loaded GladeWidget
*/
+ GtkWidget *name_label; /* A pointer to the "Name:" label (for show/hide) */
GtkWidget *name_entry; /* A pointer to the gtk_entry that holds
* the name of the widget. This is the
* first item _pack'ed to the table_widget.
Modified: trunk/gladeui/glade-property-class.c
==============================================================================
--- trunk/gladeui/glade-property-class.c (original)
+++ trunk/gladeui/glade-property-class.c Mon Oct 27 17:46:35 2008
@@ -91,6 +91,8 @@
property_class->ignore = FALSE;
property_class->needs_sync = FALSE;
property_class->themed_icon = FALSE;
+ property_class->stock = FALSE;
+ property_class->stock_icon = FALSE;
property_class->translatable = FALSE;
property_class->virt = TRUE;
property_class->transfer_on_paste = FALSE;
@@ -1416,6 +1418,8 @@
klass->ignore = glade_xml_get_property_boolean (node, GLADE_TAG_IGNORE, klass->ignore);
klass->needs_sync = glade_xml_get_property_boolean (node, GLADE_TAG_NEEDS_SYNC, klass->needs_sync);
klass->themed_icon = glade_xml_get_property_boolean (node, GLADE_TAG_THEMED_ICON, klass->themed_icon);
+ klass->stock = glade_xml_get_property_boolean (node, GLADE_TAG_STOCK, klass->stock);
+ klass->stock_icon = glade_xml_get_property_boolean (node, GLADE_TAG_STOCK_ICON, klass->stock_icon);
klass->weight = glade_xml_get_property_double (node, GLADE_TAG_WEIGHT, klass->weight);
klass->transfer_on_paste = glade_xml_get_property_boolean (node, GLADE_TAG_TRANSFER_ON_PASTE, klass->transfer_on_paste);
klass->save_always = glade_xml_get_property_boolean (node, GLADE_TAG_SAVE_ALWAYS, klass->save_always);
Modified: trunk/gladeui/glade-property-class.h
==============================================================================
--- trunk/gladeui/glade-property-class.h (original)
+++ trunk/gladeui/glade-property-class.h Mon Oct 27 17:46:35 2008
@@ -163,6 +163,11 @@
* property class definition if proper editing tools are to
* be used.
*/
+ gboolean stock_icon; /* String properties can also denote stock icons, including
+ * icons from icon factories...
+ */
+ gboolean stock; /* ... or a narrower list of "items" from gtk builtin stock items.
+ */
gboolean transfer_on_paste; /* If this is a packing prop,
* wether we should transfer it on paste.
Modified: trunk/gladeui/glade-utils.c
==============================================================================
--- trunk/gladeui/glade-utils.c (original)
+++ trunk/gladeui/glade-utils.c Mon Oct 27 17:46:35 2008
@@ -1944,6 +1944,8 @@
const gchar *displayable;
GValue *gvalue;
+ g_return_val_if_fail (strval && strval[0], 0);
+
if (((displayable = glade_get_value_from_displayable (enum_type, strval)) != NULL &&
(gvalue = glade_utils_value_from_string (enum_type, displayable, NULL, NULL)) != NULL) ||
(gvalue = glade_utils_value_from_string (enum_type, strval, NULL, NULL)) != NULL)
@@ -2000,6 +2002,8 @@
const gchar *displayable;
GValue *gvalue;
+ g_return_val_if_fail (strval && strval[0], 0);
+
if (((displayable = glade_get_value_from_displayable (flags_type, strval)) != NULL &&
(gvalue = glade_utils_value_from_string (flags_type, displayable, NULL, NULL)) != NULL) ||
(gvalue = glade_utils_value_from_string (flags_type, strval, NULL, NULL)) != NULL)
Modified: trunk/gladeui/glade-widget-adaptor.c
==============================================================================
--- trunk/gladeui/glade-widget-adaptor.c (original)
+++ trunk/gladeui/glade-widget-adaptor.c Mon Oct 27 17:46:35 2008
@@ -1090,8 +1090,7 @@
{
GType type = 0;
- if (pspec->value_type == GLADE_TYPE_STOCK ||
- G_IS_PARAM_SPEC_ENUM(pspec))
+ if (G_IS_PARAM_SPEC_ENUM(pspec))
type = GLADE_TYPE_EPROP_ENUM;
else if (G_IS_PARAM_SPEC_FLAGS(pspec))
type = GLADE_TYPE_EPROP_FLAGS;
Modified: trunk/gladeui/glade-xml-utils.h
==============================================================================
--- trunk/gladeui/glade-xml-utils.h (original)
+++ trunk/gladeui/glade-xml-utils.h Mon Oct 27 17:46:35 2008
@@ -182,13 +182,14 @@
#define GLADE_TAG_IGNORE "ignore"
#define GLADE_TAG_VISIBLE_LINES "visible-lines"
#define GLADE_TAG_RESOURCE "resource"
+#define GLADE_TAG_STOCK "stock"
+#define GLADE_TAG_STOCK_ICON "stock-icon"
#define GLADE_TAG_THEMED_ICON "themed-icon"
#define GLADE_TAG_INIT_FUNCTION "init-function"
#define GLADE_TAG_ATK_PROPERTY "atk-property"
#define GLADE_TAG_FIXED "fixed"
#define GLADE_TAG_TRANSFER_ON_PASTE "transfer-on-paste"
#define GLADE_TAG_WEIGHT "weight"
-#define GLADE_TAG_STOCK "stock"
#define GLADE_TAG_GET_TYPE_FUNCTION "get-type-function"
#define GLADE_TAG_TOPLEVEL "toplevel"
#define GLADE_TAG_USE_PLACEHOLDERS "use-placeholders"
Modified: trunk/plugins/gtk+/Makefile.am
==============================================================================
--- trunk/plugins/gtk+/Makefile.am (original)
+++ trunk/plugins/gtk+/Makefile.am Mon Oct 27 17:46:35 2008
@@ -25,7 +25,7 @@
libgladegtk_la_SOURCES = glade-gtk.c glade-accels.c glade-attributes.c glade-convert.c fixed-bg.xpm \
glade-column-types.c glade-model-data.c glade-text-button.c glade-cell-renderer-button.c \
- glade-icon-sources.c glade-button-editor.c glade-tool-button-editor.c
+ glade-icon-sources.c glade-button-editor.c glade-tool-button-editor.c glade-image-editor.c
libgladegtk_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
libgladegtk_la_LIBADD = $(libgladeui) $(GTK_LIBS)
@@ -33,7 +33,7 @@
libgladegtkincludedir= $(includedir)/libgladeui-1.0/gladeui
libgladegtkinclude_HEADERS = glade-gtk.h glade-accels.h glade-attributes.h glade-column-types.h glade-model-data.h \
glade-text-button.h glade-cell-renderer-button.h glade-icon-sources.h glade-button-editor.h \
- glade-tool-button-editor.c
+ glade-tool-button-editor.h glade-image-editor.h
if PLATFORM_WIN32
libgladegtk_la_LDFLAGS += -no-undefined
Modified: trunk/plugins/gtk+/glade-button-editor.c
==============================================================================
--- trunk/plugins/gtk+/glade-button-editor.c (original)
+++ trunk/plugins/gtk+/glade-button-editor.c Mon Oct 27 17:46:35 2008
@@ -168,9 +168,19 @@
}
static void
+glade_button_editor_set_show_name (GladeEditable *editable,
+ gboolean show_name)
+{
+ GladeButtonEditor *button_editor = GLADE_BUTTON_EDITOR (editable);
+
+ glade_editable_set_show_name (GLADE_EDITABLE (button_editor->embed), show_name);
+}
+
+static void
glade_button_editor_editable_init (GladeEditableIface *iface)
{
iface->load = glade_button_editor_load;
+ iface->set_show_name = glade_button_editor_set_show_name;
}
static void
@@ -231,7 +241,7 @@
/* Setup reasonable defaults for button label. */
property = glade_widget_get_property (button_editor->loaded_widget, "stock");
- glade_command_set_property (property, 0);
+ glade_command_set_property (property, NULL);
property = glade_widget_get_property (button_editor->loaded_widget, "use-stock");
glade_command_set_property (property, FALSE);
@@ -275,7 +285,7 @@
glade_command_set_property (property, FALSE);
property = glade_widget_get_property (button_editor->loaded_widget, "stock");
- glade_command_set_property (property, 0);
+ glade_command_set_property (property, NULL);
property = glade_widget_get_property (button_editor->loaded_widget, "label");
glade_command_set_property (property, NULL);
@@ -320,7 +330,7 @@
glade_command_set_property (property, TRUE);
property = glade_widget_get_property (button_editor->loaded_widget, "stock");
- glade_command_set_property (property, 0);
+ glade_command_set_property (property, NULL);
glade_command_pop_group ();
@@ -349,7 +359,7 @@
glade_command_push_group (_("Setting %s to use a label and image"), button_editor->loaded_widget->name);
property = glade_widget_get_property (button_editor->loaded_widget, "stock");
- glade_command_set_property (property, 0);
+ glade_command_set_property (property, NULL);
property = glade_widget_get_property (button_editor->loaded_widget, "use-stock");
glade_command_set_property (property, FALSE);
Modified: trunk/plugins/gtk+/glade-gtk.c
==============================================================================
--- trunk/plugins/gtk+/glade-gtk.c (original)
+++ trunk/plugins/gtk+/glade-gtk.c Mon Oct 27 17:46:35 2008
@@ -33,6 +33,7 @@
#include "glade-icon-sources.h"
#include "glade-button-editor.h"
#include "glade-tool-button-editor.h"
+#include "glade-image-editor.h"
#include <gladeui/glade-editor-property.h>
#include <gladeui/glade-base-editor.h>
@@ -5190,19 +5191,7 @@
}
else if (strcmp (id, "stock") == 0)
{
- GEnumClass *eclass;
- GEnumValue *eval;
-
- /* Do it by hand cause we need the nick not the name */
- eclass = g_type_class_ref (G_VALUE_TYPE (value));
- if ((eval = g_enum_get_value (eclass, g_value_get_enum (value))) != NULL)
- {
- if (g_value_get_enum (value) == 0)
- gtk_button_set_label (GTK_BUTTON (object), NULL);
- else
- gtk_button_set_label (GTK_BUTTON (object), eval->value_nick);
- }
- g_type_class_unref (eclass);
+ gtk_button_set_label (GTK_BUTTON (object), g_value_get_string (value));
}
else
GWA_GET_CLASS (GTK_TYPE_CONTAINER)->set_property (adaptor, object,
@@ -5216,7 +5205,6 @@
{
gboolean use_stock;
gchar *label = NULL;
- gint stock_id = 0;
if (!glade_xml_node_verify
(node, GLADE_XML_TAG_WIDGET (glade_project_get_format (widget->project))))
@@ -5230,11 +5218,7 @@
if (use_stock)
{
glade_widget_property_get (widget, "label", &label);
- if (label)
- stock_id = glade_utils_enum_value_from_string (GLADE_TYPE_STOCK, label);
- if (stock_id < 0)
- stock_id = 0;
- glade_widget_property_set (widget, "stock", stock_id);
+ glade_widget_property_set (widget, "stock", label);
}
}
@@ -5295,32 +5279,6 @@
/* ----------------------------- GtkImage ------------------------------ */
-static void
-glade_gtk_image_disable_filename (GladeWidget *gwidget)
-{
- glade_widget_property_set (gwidget, "pixbuf", NULL);
- glade_widget_property_set_sensitive (gwidget, "pixbuf", FALSE,
- _("This only applies with file type images"));
-}
-
-static void
-glade_gtk_image_disable_icon_name (GladeWidget *gwidget)
-{
- glade_widget_property_reset (gwidget, "icon-name");
- glade_widget_property_set_sensitive (gwidget, "icon-name", FALSE,
- _("This only applies to Icon Theme type images"));
-}
-
-static void
-glade_gtk_image_disable_stock (GladeWidget *gwidget)
-{
- glade_widget_property_set (gwidget, "glade-stock", NULL);
- glade_widget_property_set (gwidget, "stock", NULL);
- glade_widget_property_set_enabled (gwidget, "stock", FALSE);
- glade_widget_property_set_sensitive (gwidget, "glade-stock", FALSE,
- _("This only applies with stock type images"));
-}
-
static void
glade_gtk_image_pixel_size_changed (GladeProperty *property,
GValue *old_value,
@@ -5382,133 +5340,35 @@
}
static void
-glade_gtk_image_set_icon_name (GObject *object, const GValue *value)
-{
- GladeWidget *gimage;
- gint icon_size;
-
- g_return_if_fail (GTK_IS_IMAGE (object));
- gimage = glade_widget_get_from_gobject (object);
- g_return_if_fail (GLADE_IS_WIDGET (gimage));
-
- glade_widget_property_get (gimage, "icon-size", &icon_size);
-
- gtk_image_set_from_icon_name (GTK_IMAGE (object),
- g_value_get_string (value),
- icon_size);
-}
-
-static void
-glade_gtk_image_refresh (GladeWidget *gwidget, const gchar *property)
-{
- gpointer p;
- glade_widget_property_set_sensitive (gwidget, property, TRUE, NULL);
- glade_widget_property_get (gwidget, property, &p);
- glade_widget_property_set (gwidget, property, p);
-}
-
-static void
-glade_gtk_image_set_type (GObject *object, const GValue *value)
+glade_gtk_image_set_image_mode (GObject *object, const GValue *value)
{
+ const gchar *insensitive_msg = _("Property not selected");
GladeWidget *gwidget;
GladeGtkImageType type;
gwidget = glade_widget_get_from_gobject (object);
g_return_if_fail (GTK_IS_IMAGE (object));
g_return_if_fail (GLADE_IS_WIDGET (gwidget));
-
- /* Exit if we're still loading project objects */
- if (glade_util_object_is_loading (object)) return;
- switch ((type = g_value_get_enum (value)))
- {
- case GLADEGTK_IMAGE_STOCK:
- glade_gtk_image_disable_filename (gwidget);
- glade_gtk_image_disable_icon_name (gwidget);
- glade_widget_property_set_enabled (gwidget, "stock", TRUE);
- glade_gtk_image_refresh (gwidget, "glade-stock");
- break;
+ glade_widget_property_set_sensitive (gwidget, "stock", FALSE, insensitive_msg);
+ glade_widget_property_set_sensitive (gwidget, "icon-name", FALSE, insensitive_msg);
+ glade_widget_property_set_sensitive (gwidget, "pixbuf", FALSE, insensitive_msg);
- case GLADEGTK_IMAGE_ICONTHEME:
- glade_gtk_image_disable_filename (gwidget);
- glade_gtk_image_disable_stock (gwidget);
- glade_gtk_image_refresh (gwidget, "icon-name");
+ switch ((type = g_value_get_int (value)))
+ {
+ case GLADE_IMAGE_MODE_STOCK:
+ glade_widget_property_set_sensitive (gwidget, "stock", TRUE, NULL);
break;
-
- case GLADEGTK_IMAGE_FILENAME:
- default:
- glade_gtk_image_disable_stock (gwidget);
- glade_gtk_image_disable_icon_name (gwidget);
- glade_gtk_image_refresh (gwidget, "pixbuf");
+
+ case GLADE_IMAGE_MODE_ICON:
+ glade_widget_property_set_sensitive (gwidget, "icon-name", TRUE, NULL);
break;
- }
-}
-
-/* This basicly just sets the virtual "glade-stock" property
- * based on the image's "stock" property (for glade file loading purposes)
- */
-static void
-glade_gtk_image_set_stock (GObject *object, const GValue *value)
-{
- GladeWidget *gwidget;
- gchar *str;
- gint icon_size;
-
- g_return_if_fail (GTK_IS_IMAGE (object));
- gwidget = glade_widget_get_from_gobject (object);
- g_return_if_fail (GLADE_IS_WIDGET (gwidget));
-
- if ((str = g_value_dup_string (value)) &&
- glade_util_object_is_loading (object))
- {
- GEnumClass *eclass = g_type_class_ref (GLADE_TYPE_STOCK_IMAGE);
- GEnumValue *eval;
- if ((eval = g_enum_get_value_by_nick (eclass, str)) != NULL)
- glade_widget_property_set (gwidget, "glade-stock",
- eval->value);
- g_type_class_unref (eclass);
- }
-
- if (str == NULL && glade_widget_superuser ()) return;
-
- /* Set the real property */
- glade_widget_property_get (gwidget, "icon-size", &icon_size);
- gtk_image_set_from_stock (GTK_IMAGE (object), str, icon_size);
-
- /* Sometimes it gets recursive around here, valgrind says
- * we should dup a string for this purpose ;-)
- */
- g_free (str);
-}
-
-static void
-glade_gtk_image_set_glade_stock (GObject *object, const GValue *value)
-{
- GladeWidget *gwidget;
- GEnumClass *eclass;
- GEnumValue *eval;
- gint val;
-
- g_return_if_fail (GTK_IS_IMAGE (object));
- gwidget = glade_widget_get_from_gobject (object);
- g_return_if_fail (GLADE_IS_WIDGET (gwidget));
-
- /* This is triggered by glade_widget_sync_custom_props () from glade_widget_new_from_widget_info()
- which makes "stock" property to reset */
- if (glade_util_object_is_loading (object)) return;
-
- val = g_value_get_enum (value);
- eclass = g_type_class_ref (G_VALUE_TYPE (value));
- if ((eval = g_enum_get_value (eclass, val)) != NULL)
- {
- if (val == 0)
- glade_widget_property_reset (gwidget, "stock");
- else
- glade_widget_property_set (gwidget, "stock", eval->value_nick);
-
+ case GLADE_IMAGE_MODE_FILENAME:
+ glade_widget_property_set_sensitive (gwidget, "pixbuf", TRUE, NULL);
+ default:
+ break;
}
- g_type_class_unref (eclass);
}
void
@@ -5517,19 +5377,28 @@
const gchar *id,
const GValue *value)
{
- if (!strcmp (id, "glade-type"))
- glade_gtk_image_set_type (object, value);
- else if (!strcmp (id, "stock"))
- glade_gtk_image_set_stock (object, value);
- else if (!strcmp (id, "glade-stock"))
- glade_gtk_image_set_glade_stock (object, value);
- else if (!strcmp (id, "icon-name"))
- glade_gtk_image_set_icon_name (object, value);
+ if (!strcmp (id, "image-mode"))
+ glade_gtk_image_set_image_mode (object, value);
else
GWA_GET_CLASS (GTK_TYPE_WIDGET)->set_property (adaptor, object,
id, value);
}
+GladeEditable *
+glade_gtk_image_create_editable (GladeWidgetAdaptor *adaptor,
+ GladeEditorPageType type)
+{
+ GladeEditable *editable;
+
+ /* Get base editable */
+ editable = GWA_GET_CLASS (GTK_TYPE_CONTAINER)->create_editable (adaptor, type);
+
+ if (type == GLADE_PAGE_GENERAL)
+ return (GladeEditable *)glade_image_editor_new (adaptor, editable);
+
+ return editable;
+}
+
/* ----------------------------- GtkMenu ------------------------------ */
GObject *
glade_gtk_menu_constructor (GType type,
@@ -6691,24 +6560,26 @@
glade_base_editor_add_label (editor, "Properties");
- glade_base_editor_add_properties (editor, gchild, FALSE,
- "visible-horizontal",
- "visible-vertical",
- NULL);
+
+ glade_base_editor_add_editable (editor, gchild);
+/* glade_base_editor_add_properties (editor, gchild, FALSE, */
+/* "visible-horizontal", */
+/* "visible-vertical", */
+/* NULL); */
if (type == GTK_TYPE_SEPARATOR_TOOL_ITEM) return;
- if (GTK_IS_TOOL_BUTTON (child))
- glade_base_editor_add_properties (editor, gchild, FALSE,
- "label",
- "icon",
- "glade-stock",
- "icon-name",
- NULL);
-
- if (type == GTK_TYPE_RADIO_TOOL_BUTTON)
- glade_base_editor_add_properties (editor, gchild, FALSE,
- "group", "active", NULL);
+/* if (GTK_IS_TOOL_BUTTON (child)) */
+/* glade_base_editor_add_properties (editor, gchild, FALSE, */
+/* "label", */
+/* "icon", */
+/* "stock-id", */
+/* "icon-name", */
+/* NULL); */
+
+/* if (type == GTK_TYPE_RADIO_TOOL_BUTTON) */
+/* glade_base_editor_add_properties (editor, gchild, FALSE, */
+/* "group", "active", NULL); */
glade_base_editor_add_label (editor, "Packing");
glade_base_editor_add_properties (editor, gchild, TRUE,
@@ -6821,12 +6692,12 @@
glade_gtk_tool_button_set_image_mode (GObject *object, const GValue *value)
{
GladeWidget *gbutton;
- const gchar *insensitive_msg = _("Property disabled");
+ const gchar *insensitive_msg = _("Property not selected");
g_return_if_fail (GTK_IS_TOOL_BUTTON (object));
gbutton = glade_widget_get_from_gobject (object);
- glade_widget_property_set_sensitive (gbutton, "glade-stock", FALSE, insensitive_msg);
+ glade_widget_property_set_sensitive (gbutton, "stock-id", FALSE, insensitive_msg);
glade_widget_property_set_sensitive (gbutton, "icon-name", FALSE, insensitive_msg);
glade_widget_property_set_sensitive (gbutton, "icon", FALSE, insensitive_msg);
glade_widget_property_set_sensitive (gbutton, "icon-widget", FALSE, insensitive_msg);
@@ -6834,7 +6705,7 @@
switch (g_value_get_int (value))
{
case GLADE_TB_MODE_STOCK:
- glade_widget_property_set_sensitive (gbutton, "glade-stock", TRUE, NULL);
+ glade_widget_property_set_sensitive (gbutton, "stock-id", TRUE, NULL);
break;
case GLADE_TB_MODE_ICON:
glade_widget_property_set_sensitive (gbutton, "icon-name", TRUE, NULL);
@@ -6855,7 +6726,7 @@
glade_gtk_tool_button_set_custom_label (GObject *object, const GValue *value)
{
GladeWidget *gbutton;
- const gchar *insensitive_msg = _("Property disabled");
+ const gchar *insensitive_msg = _("Property not selected");
g_return_if_fail (GTK_IS_TOOL_BUTTON (object));
gbutton = glade_widget_get_from_gobject (object);
@@ -6897,31 +6768,6 @@
gtk_tool_button_set_stock_id (GTK_TOOL_BUTTON (object), stock_id);
}
-static void
-glade_gtk_tool_button_set_glade_stock (GObject *object, const GValue *value)
-{
- GladeWidget *gbutton;
- GEnumClass *eclass;
- GEnumValue *eval;
- gint val;
-
- g_return_if_fail (GTK_IS_TOOL_BUTTON (object));
- gbutton = glade_widget_get_from_gobject (object);
-
- val = g_value_get_enum (value);
-
- if (val)
- {
- eclass = g_type_class_ref (GLADE_TYPE_STOCK_IMAGE);
-
- if ((eval = g_enum_get_value (eclass, val)) != NULL)
- glade_widget_property_set (gbutton, "stock-id", eval->value_nick);
- g_type_class_unref (eclass);
- }
- else
- glade_widget_property_set (gbutton, "stock-id", NULL);
-}
-
/* legacy libglade property */
static void
glade_gtk_tool_button_set_icon (GObject *object, const GValue *value)
@@ -6963,8 +6809,6 @@
{
if (!strcmp (id, "image-mode"))
glade_gtk_tool_button_set_image_mode (object, value);
- else if (!strcmp (id, "glade-stock"))
- glade_gtk_tool_button_set_glade_stock (object, value);
else if (!strcmp (id, "icon-name"))
glade_gtk_tool_button_set_icon_name (object, value);
else if (!strcmp (id, "icon"))
@@ -7017,6 +6861,8 @@
glade_widget_property_set (widget, "image-mode", GLADE_TB_MODE_STOCK);
}
+ else
+ glade_widget_property_set (widget, "image-mode", GLADE_TB_MODE_STOCK);
}
void
Added: trunk/plugins/gtk+/glade-image-editor.c
==============================================================================
--- (empty file)
+++ trunk/plugins/gtk+/glade-image-editor.c Mon Oct 27 17:46:35 2008
@@ -0,0 +1,375 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2008 Tristan Van Berkom.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Authors:
+ * Tristan Van Berkom <tvb gnome org>
+ */
+
+#include <config.h>
+#include <gladeui/glade.h>
+#include <glib/gi18n-lib.h>
+#include <gdk/gdkkeysyms.h>
+
+#include "glade-image-editor.h"
+
+
+static void glade_image_editor_finalize (GObject *object);
+
+static void glade_image_editor_editable_init (GladeEditableIface *iface);
+
+static void glade_image_editor_grab_focus (GtkWidget *widget);
+
+
+G_DEFINE_TYPE_WITH_CODE (GladeImageEditor, glade_image_editor, GTK_TYPE_VBOX,
+ G_IMPLEMENT_INTERFACE (GLADE_TYPE_EDITABLE,
+ glade_image_editor_editable_init));
+
+
+static void
+glade_image_editor_class_init (GladeImageEditorClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ object_class->finalize = glade_image_editor_finalize;
+ widget_class->grab_focus = glade_image_editor_grab_focus;
+}
+
+static void
+glade_image_editor_init (GladeImageEditor *self)
+{
+}
+
+static void
+project_changed (GladeProject *project,
+ GladeCommand *command,
+ gboolean execute,
+ GladeImageEditor *image_editor)
+{
+ if (image_editor->modifying ||
+ !GTK_WIDGET_MAPPED (image_editor))
+ return;
+
+ /* Reload on all commands */
+ glade_editable_load (GLADE_EDITABLE (image_editor), image_editor->loaded_widget);
+}
+
+
+static void
+project_finalized (GladeImageEditor *image_editor,
+ GladeProject *where_project_was)
+{
+ image_editor->loaded_widget = NULL;
+
+ glade_editable_load (GLADE_EDITABLE (image_editor), NULL);
+}
+
+static void
+glade_image_editor_load (GladeEditable *editable,
+ GladeWidget *widget)
+{
+ GladeImageEditor *image_editor = GLADE_IMAGE_EDITOR (editable);
+ GladeImageEditMode image_mode = 0;
+ GList *l;
+
+ image_editor->loading = TRUE;
+
+ /* Since we watch the project*/
+ if (image_editor->loaded_widget)
+ {
+ /* watch custom-child and use-stock properties here for reloads !!! */
+
+ g_signal_handlers_disconnect_by_func (G_OBJECT (image_editor->loaded_widget->project),
+ G_CALLBACK (project_changed), image_editor);
+
+ /* The widget could die unexpectedly... */
+ g_object_weak_unref (G_OBJECT (image_editor->loaded_widget->project),
+ (GWeakNotify)project_finalized,
+ image_editor);
+ }
+
+ /* Mark our widget... */
+ image_editor->loaded_widget = widget;
+
+ if (image_editor->loaded_widget)
+ {
+ /* This fires for undo/redo */
+ g_signal_connect (G_OBJECT (image_editor->loaded_widget->project), "changed",
+ G_CALLBACK (project_changed), image_editor);
+
+ /* The widget/project could die unexpectedly... */
+ g_object_weak_ref (G_OBJECT (image_editor->loaded_widget->project),
+ (GWeakNotify)project_finalized,
+ image_editor);
+ }
+
+ /* load the embedded editable... */
+ glade_editable_load (GLADE_EDITABLE (image_editor->embed), widget);
+
+ for (l = image_editor->properties; l; l = l->next)
+ glade_editor_property_load_by_widget (GLADE_EDITOR_PROPERTY (l->data), widget);
+
+
+ if (widget)
+ {
+ glade_widget_property_get (widget, "image-mode", &image_mode);
+
+ switch (image_mode)
+ {
+ case GLADE_IMAGE_MODE_STOCK:
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (image_editor->stock_radio), TRUE);
+ break;
+ case GLADE_IMAGE_MODE_ICON:
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (image_editor->icon_radio), TRUE);
+ break;
+ case GLADE_IMAGE_MODE_FILENAME:
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (image_editor->file_radio), TRUE);
+ break;
+ default:
+ break;
+ }
+ }
+ image_editor->loading = FALSE;
+}
+
+static void
+glade_image_editor_set_show_name (GladeEditable *editable,
+ gboolean show_name)
+{
+ GladeImageEditor *image_editor = GLADE_IMAGE_EDITOR (editable);
+
+ glade_editable_set_show_name (GLADE_EDITABLE (image_editor->embed), show_name);
+}
+
+static void
+glade_image_editor_editable_init (GladeEditableIface *iface)
+{
+ iface->load = glade_image_editor_load;
+ iface->set_show_name = glade_image_editor_set_show_name;
+}
+
+static void
+glade_image_editor_finalize (GObject *object)
+{
+ GladeImageEditor *image_editor = GLADE_IMAGE_EDITOR (object);
+
+ if (image_editor->properties)
+ g_list_free (image_editor->properties);
+
+ G_OBJECT_CLASS (glade_image_editor_parent_class)->finalize (object);
+}
+
+static void
+glade_image_editor_grab_focus (GtkWidget *widget)
+{
+ GladeImageEditor *image_editor = GLADE_IMAGE_EDITOR (widget);
+
+ gtk_widget_grab_focus (image_editor->embed);
+}
+
+static void
+table_attach (GtkWidget *table,
+ GtkWidget *child,
+ gint pos, gint row)
+{
+ gtk_table_attach (GTK_TABLE (table), child,
+ pos, pos+1, row, row +1,
+ GTK_EXPAND | GTK_FILL,
+ GTK_EXPAND | GTK_FILL,
+ 3, 1);
+}
+
+
+static void
+stock_toggled (GtkWidget *widget,
+ GladeImageEditor *image_editor)
+{
+ GladeProperty *property;
+ GValue value = { 0, };
+
+ if (image_editor->loading || !image_editor->loaded_widget)
+ return;
+
+ if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (image_editor->stock_radio)))
+ return;
+
+ image_editor->modifying = TRUE;
+
+ glade_command_push_group (_("Setting %s to use an image from stock"), image_editor->loaded_widget->name);
+
+ property = glade_widget_get_property (image_editor->loaded_widget, "icon-name");
+ glade_command_set_property (property, NULL);
+ property = glade_widget_get_property (image_editor->loaded_widget, "pixbuf");
+ glade_command_set_property (property, NULL);
+
+ property = glade_widget_get_property (image_editor->loaded_widget, "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");
+ glade_command_set_property (property, GLADE_IMAGE_MODE_STOCK);
+
+ glade_command_pop_group ();
+
+ image_editor->modifying = FALSE;
+
+ /* reload buttons and sensitivity and stuff... */
+ glade_editable_load (GLADE_EDITABLE (image_editor),
+ image_editor->loaded_widget);
+}
+
+
+static void
+icon_toggled (GtkWidget *widget,
+ GladeImageEditor *image_editor)
+{
+ GladeProperty *property;
+
+ if (image_editor->loading || !image_editor->loaded_widget)
+ return;
+
+ if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (image_editor->icon_radio)))
+ return;
+
+ image_editor->modifying = TRUE;
+
+ glade_command_push_group (_("Setting %s to use an image from the icon theme"), image_editor->loaded_widget->name);
+
+ property = glade_widget_get_property (image_editor->loaded_widget, "stock");
+ glade_command_set_property (property, NULL);
+ property = glade_widget_get_property (image_editor->loaded_widget, "pixbuf");
+ glade_command_set_property (property, NULL);
+ property = glade_widget_get_property (image_editor->loaded_widget, "image-mode");
+ glade_command_set_property (property, GLADE_IMAGE_MODE_ICON);
+
+ glade_command_pop_group ();
+
+ image_editor->modifying = FALSE;
+
+ /* reload buttons and sensitivity and stuff... */
+ glade_editable_load (GLADE_EDITABLE (image_editor),
+ image_editor->loaded_widget);
+}
+
+static void
+file_toggled (GtkWidget *widget,
+ GladeImageEditor *image_editor)
+{
+ GladeProperty *property;
+
+ if (image_editor->loading || !image_editor->loaded_widget)
+ return;
+
+ if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (image_editor->file_radio)))
+ return;
+
+ image_editor->modifying = TRUE;
+
+ glade_command_push_group (_("Setting %s to use an image from the icon theme"), image_editor->loaded_widget->name);
+
+ property = glade_widget_get_property (image_editor->loaded_widget, "stock");
+ glade_command_set_property (property, NULL);
+ property = glade_widget_get_property (image_editor->loaded_widget, "icon-name");
+ glade_command_set_property (property, NULL);
+ property = glade_widget_get_property (image_editor->loaded_widget, "image-mode");
+ glade_command_set_property (property, GLADE_IMAGE_MODE_FILENAME);
+
+ glade_command_pop_group ();
+
+ image_editor->modifying = FALSE;
+
+ /* reload buttons and sensitivity and stuff... */
+ glade_editable_load (GLADE_EDITABLE (image_editor),
+ image_editor->loaded_widget);
+}
+
+
+GtkWidget *
+glade_image_editor_new (GladeWidgetAdaptor *adaptor,
+ GladeEditable *embed)
+{
+ GladeImageEditor *image_editor;
+ GladeEditorProperty *eprop;
+ GtkWidget *table, *frame, *alignment, *label;
+ gchar *str;
+
+ g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL);
+ g_return_val_if_fail (GLADE_IS_EDITABLE (embed), NULL);
+
+ image_editor = g_object_new (GLADE_TYPE_IMAGE_EDITOR, NULL);
+ image_editor->embed = GTK_WIDGET (embed);
+
+ /* Pack the parent on top... */
+ gtk_box_pack_start (GTK_BOX (image_editor), GTK_WIDGET (embed), FALSE, FALSE, 0);
+
+ /* Image area frame... */
+ str = g_strdup_printf ("<b>%s</b>", _("Edit Image"));
+ label = gtk_label_new (str);
+ gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
+ g_free (str);
+ frame = gtk_frame_new (NULL);
+ gtk_frame_set_label_widget (GTK_FRAME (frame), label);
+ gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
+ gtk_box_pack_start (GTK_BOX (image_editor), frame, FALSE, FALSE, 8);
+
+ alignment = gtk_alignment_new (0.5F, 0.5F, 1.0F, 1.0F);
+ gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 6, 0, 12, 0);
+ gtk_container_add (GTK_CONTAINER (frame), alignment);
+
+ table = gtk_table_new (0, 0, FALSE);
+ gtk_container_add (GTK_CONTAINER (alignment), table);
+
+ /* Stock image... */
+ eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "stock", FALSE, TRUE);
+ image_editor->stock_radio = gtk_radio_button_new (NULL);
+ gtk_container_add (GTK_CONTAINER (image_editor->stock_radio), eprop->item_label);
+ table_attach (table, image_editor->stock_radio, 0, 0);
+ table_attach (table, GTK_WIDGET (eprop), 1, 0);
+ image_editor->properties = g_list_prepend (image_editor->properties, eprop);
+
+ /* Icon theme image... */
+ eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "icon-name", FALSE, TRUE);
+ image_editor->icon_radio = gtk_radio_button_new_from_widget
+ (GTK_RADIO_BUTTON (image_editor->stock_radio));
+ gtk_container_add (GTK_CONTAINER (image_editor->icon_radio), eprop->item_label);
+ table_attach (table, image_editor->icon_radio, 0, 1);
+ table_attach (table, GTK_WIDGET (eprop), 1, 1);
+ image_editor->properties = g_list_prepend (image_editor->properties, eprop);
+
+ /* Filename... */
+ eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "pixbuf", FALSE, TRUE);
+ image_editor->file_radio = gtk_radio_button_new_from_widget
+ (GTK_RADIO_BUTTON (image_editor->stock_radio));
+ gtk_container_add (GTK_CONTAINER (image_editor->file_radio), eprop->item_label);
+ table_attach (table, image_editor->file_radio, 0, 2);
+ table_attach (table, GTK_WIDGET (eprop), 1, 2);
+ image_editor->properties = g_list_prepend (image_editor->properties, eprop);
+
+ /* Connect radio button signals... */
+ g_signal_connect (G_OBJECT (image_editor->stock_radio), "toggled",
+ G_CALLBACK (stock_toggled), image_editor);
+ g_signal_connect (G_OBJECT (image_editor->icon_radio), "toggled",
+ G_CALLBACK (icon_toggled), image_editor);
+ g_signal_connect (G_OBJECT (image_editor->file_radio), "toggled",
+ G_CALLBACK (file_toggled), image_editor);
+
+ gtk_widget_show_all (GTK_WIDGET (image_editor));
+
+ return GTK_WIDGET (image_editor);
+}
Added: trunk/plugins/gtk+/glade-image-editor.h
==============================================================================
--- (empty file)
+++ trunk/plugins/gtk+/glade-image-editor.h Mon Oct 27 17:46:35 2008
@@ -0,0 +1,74 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2008 Tristan Van Berkom.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Authors:
+ * Tristan Van Berkom <tvb gnome org>
+ */
+#ifndef _GLADE_IMAGE_EDITOR_H_
+#define _GLADE_IMAGE_EDITOR_H_
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define GLADE_TYPE_IMAGE_EDITOR (glade_image_editor_get_type ())
+#define GLADE_IMAGE_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_IMAGE_EDITOR, GladeImageEditor))
+#define GLADE_IMAGE_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_IMAGE_EDITOR, GladeImageEditorClass))
+#define GLADE_IS_IMAGE_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_IMAGE_EDITOR))
+#define GLADE_IS_IMAGE_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GLADE_TYPE_IMAGE_EDITOR))
+#define GLADE_IMAGE_EDITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GLADE_TYPE_IMAGE_EDITOR, GladeImageEditorClass))
+
+typedef struct _GladeImageEditor GladeImageEditor;
+typedef struct _GladeImageEditorClass GladeImageEditorClass;
+
+typedef enum {
+ GLADE_IMAGE_MODE_STOCK = 0, /* default */
+ GLADE_IMAGE_MODE_ICON,
+ GLADE_IMAGE_MODE_FILENAME
+} GladeImageEditMode;
+
+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 */
+ GtkWidget *icon_radio; /* Create the image with the icon theme */
+ GtkWidget *file_radio; /* Create the image from filename (libglade only) */
+
+ GList *properties; /* A list of eprops to update at load() time */
+
+ gboolean loading; /* Loading flag for loading widgets in the editor */
+ gboolean modifying; /* Flag for monitoring project changes */
+};
+
+struct _GladeImageEditorClass
+{
+ GtkVBoxClass parent;
+};
+
+GType glade_image_editor_get_type (void);
+GtkWidget *glade_image_editor_new (GladeWidgetAdaptor *adaptor,
+ GladeEditable *editable);
+
+G_END_DECLS
+
+#endif /* _GLADE_IMAGE_EDITOR_H_ */
Modified: trunk/plugins/gtk+/glade-tool-button-editor.c
==============================================================================
--- trunk/plugins/gtk+/glade-tool-button-editor.c (original)
+++ trunk/plugins/gtk+/glade-tool-button-editor.c Mon Oct 27 17:46:35 2008
@@ -83,18 +83,16 @@
glade_tool_button_editor_load (GladeEditable *editable,
GladeWidget *widget)
{
- GladeToolButtonEditor *button_editor = GLADE_TOOL_BUTTON_EDITOR (editable);
- gboolean custom_label = FALSE;
- gint image_mode = 0;
- GList *l;
+ GladeToolButtonEditor *button_editor = GLADE_TOOL_BUTTON_EDITOR (editable);
+ gboolean custom_label = FALSE;
+ GladeToolButtonImageMode image_mode = 0;
+ GList *l;
button_editor->loading = TRUE;
/* Since we watch the project*/
if (button_editor->loaded_widget)
{
- /* watch custom-child and use-stock properties here for reloads !!! */
-
g_signal_handlers_disconnect_by_func (G_OBJECT (button_editor->loaded_widget->project),
G_CALLBACK (project_changed), button_editor);
@@ -276,8 +274,8 @@
glade_command_push_group (_("Setting %s to use an image from the icon theme"), button_editor->loaded_widget->name);
- property = glade_widget_get_property (button_editor->loaded_widget, "glade-stock");
- glade_command_set_property (property, 0);
+ property = glade_widget_get_property (button_editor->loaded_widget, "stock-id");
+ glade_command_set_property (property, NULL);
property = glade_widget_get_property (button_editor->loaded_widget, "icon");
glade_command_set_property (property, NULL);
property = glade_widget_get_property (button_editor->loaded_widget, "icon-widget");
@@ -310,8 +308,8 @@
glade_command_push_group (_("Setting %s to use an image from the icon theme"), button_editor->loaded_widget->name);
- property = glade_widget_get_property (button_editor->loaded_widget, "glade-stock");
- glade_command_set_property (property, 0);
+ property = glade_widget_get_property (button_editor->loaded_widget, "stock-id");
+ glade_command_set_property (property, NULL);
property = glade_widget_get_property (button_editor->loaded_widget, "icon-name");
glade_command_set_property (property, NULL);
property = glade_widget_get_property (button_editor->loaded_widget, "icon-widget");
@@ -344,8 +342,8 @@
glade_command_push_group (_("Setting %s to use an image from the icon theme"), button_editor->loaded_widget->name);
- property = glade_widget_get_property (button_editor->loaded_widget, "glade-stock");
- glade_command_set_property (property, 0);
+ property = glade_widget_get_property (button_editor->loaded_widget, "stock-id");
+ glade_command_set_property (property, NULL);
property = glade_widget_get_property (button_editor->loaded_widget, "icon-name");
glade_command_set_property (property, NULL);
property = glade_widget_get_property (button_editor->loaded_widget, "icon");
@@ -362,11 +360,20 @@
button_editor->loaded_widget);
}
+static void
+glade_tool_button_editor_set_show_name (GladeEditable *editable,
+ gboolean show_name)
+{
+ GladeToolButtonEditor *button_editor = GLADE_TOOL_BUTTON_EDITOR (editable);
+
+ glade_editable_set_show_name (GLADE_EDITABLE (button_editor->embed), show_name);
+}
static void
glade_tool_button_editor_editable_init (GladeEditableIface *iface)
{
iface->load = glade_tool_button_editor_load;
+ iface->set_show_name = glade_tool_button_editor_set_show_name;
}
static void
@@ -427,7 +434,7 @@
frame = gtk_frame_new (NULL);
gtk_frame_set_label_widget (GTK_FRAME (frame), label);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
- gtk_box_pack_start (GTK_BOX (button_editor), frame, FALSE, FALSE, 8);
+ gtk_box_pack_start (GTK_BOX (button_editor), frame, FALSE, FALSE, 12);
alignment = gtk_alignment_new (0.5F, 0.5F, 1.0F, 1.0F);
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 6, 0, 12, 0);
@@ -473,7 +480,7 @@
gtk_container_add (GTK_CONTAINER (alignment), table);
/* Stock image... */
- eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "glade-stock", FALSE, TRUE);
+ eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "stock-id", FALSE, TRUE);
button_editor->stock_radio = gtk_radio_button_new (NULL);
gtk_container_add (GTK_CONTAINER (button_editor->stock_radio), eprop->item_label);
table_attach (table, button_editor->stock_radio, 0, 0);
@@ -501,7 +508,7 @@
/* Custom embedded image widget... */
eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "icon-widget", FALSE, TRUE);
button_editor->custom_radio = gtk_radio_button_new_from_widget
- (GTK_RADIO_BUTTON (button_editor->stock_radio));
+ (GTK_RADIO_BUTTON (button_editor->stock_radio));
gtk_container_add (GTK_CONTAINER (button_editor->custom_radio), eprop->item_label);
table_attach (table, button_editor->custom_radio, 0, 3);
table_attach (table, GTK_WIDGET (eprop), 1, 3);
Modified: trunk/plugins/gtk+/gtk+.xml.in
==============================================================================
--- trunk/plugins/gtk+/gtk+.xml.in (original)
+++ trunk/plugins/gtk+/gtk+.xml.in Mon Oct 27 17:46:35 2008
@@ -531,9 +531,8 @@
</property>
<!-- Virtual stock comboentry property -->
- <property id="stock-id" visible="False"/>
- <property id="glade-stock" _name="Stock Image" save="False" custom-layout="True">
- <spec>glade_standard_stock_image_spec</spec>
+ <property id="stock-id" visible="False" stock-icon="True" custom-layout="True">
+ <_tooltip>The stock icon displayed on the item (chose an item from gtk+ stock or from an icon factory)</_tooltip>
</property>
<property id="label" translatable="True" default="toolbutton" custom-layout="True"/>
<property id="label-widget" parentless-widget="True" libglade-unsupported="True"
@@ -677,15 +676,15 @@
<property id="label" default="button" translatable="True" custom-layout="True" save="False">
<visible-lines>2</visible-lines>
</property>
- <property id="use-underline" weight="1.5" custom-layout="True"/>
- <property id="stock" _name="Stock Button" save="False" weight="1.6" custom-layout="True">
- <spec>glade_standard_stock_spec</spec>
+ <property id="use-underline" custom-layout="True"/>
+ <property id="stock" _name="Stock Button" stock="True" save="False" custom-layout="True">
+ <spec>glade_standard_string_spec</spec>
<_tooltip>The stock item for this button</_tooltip>
</property>
<property id="custom-child" save="False" custom-layout="True" default="False">
<spec>glade_standard_boolean_spec</spec>
</property>
- <property id="image-position" weight="1.7" custom-layout="True"/>
+ <property id="image-position" custom-layout="True"/>
<property id="response-id" _name="Response ID" default="0" common="False" ignore="True" save-always="True">
<spec>glade_standard_int_spec</spec>
<_tooltip>The response ID of this button in a dialog</_tooltip>
@@ -895,23 +894,20 @@
<glade-widget-class name="GtkImage" generic-name="image" _title="Image">
<post-create-function>glade_gtk_image_post_create</post-create-function>
<set-property-function>glade_gtk_image_set_property</set-property-function>
+ <create-editable-function>glade_gtk_image_create_editable</create-editable-function>
+ <read-widget-function>glade_gtk_image_read_widget</read-widget-function>
<properties>
- <property id="stock" visible="False" default="gtk-missing-image"/>
- <property id="glade-type" _name="Edit Type" save="False" weight="0">
- <spec>glade_gtk_image_type_spec</spec>
+ <property id="image-mode" save="False" visible="False">
+ <spec>glade_standard_int_spec</spec>
</property>
+ <property id="stock" stock-icon="True" custom-layout="True" default="gtk-missing-image"/>
+ <property id="icon-name" _name="Icon Name" themed-icon="True" custom-layout="True" />
+ <property id="pixbuf" _name="File Name" custom-layout="True"/>
<property id="pixbuf-animation" disabled="True"/>
<property id="file" disabled="True"/>
<property id="pixmap" disabled="True"/>
<property id="image" disabled="True"/>
<property id="mask" disabled="True"/>
- <property id="pixbuf" _name="File Name"/>
- <property id="glade-stock" _name="Stock Image" save="False" weight="1.5" default="gtk-missing-image">
- <_tooltip>A builtin stock image</_tooltip>
- <spec>glade_standard_stock_image_spec</spec>
- <_tooltip>The stock item for this image</_tooltip>
- </property>
- <property id="icon-name" _name="Icon Name" themed-icon="True" weight="1.6"/>
</properties>
</glade-widget-class>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]