[glade] * plugins/gtk+/glade-gtk.c, plugins/gtk+/glade-cell-renderer-editor.c, plugins/gtk+/gtk+.xml.in:
- From: Juan Pablo Ugarte <jpu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade] * plugins/gtk+/glade-gtk.c, plugins/gtk+/glade-cell-renderer-editor.c, plugins/gtk+/gtk+.xml.in:
- Date: Fri, 1 Apr 2011 22:49:41 +0000 (UTC)
commit edb4857b9b25e7ed5ce1856cdade49238553a3b4
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date: Fri Apr 1 19:48:39 2011 -0300
* plugins/gtk+/glade-gtk.c,
plugins/gtk+/glade-cell-renderer-editor.c,
plugins/gtk+/gtk+.xml.in:
Added support to edit cell renderers in GtkEntryCompletion
ChangeLog | 7 +++
plugins/gtk+/glade-cell-renderer-editor.c | 58 ++++++++++++++---------------
plugins/gtk+/glade-gtk.c | 32 ++++++++-------
plugins/gtk+/gtk+.xml.in | 19 ++++++++-
4 files changed, 69 insertions(+), 47 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f40ecb5..b6599ee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-04-01 Juan Pablo Ugarte <juanpablougarte gmail com>
+
+ * plugins/gtk+/glade-gtk.c,
+ plugins/gtk+/glade-cell-renderer-editor.c,
+ plugins/gtk+/gtk+.xml.in:
+ Added support to edit cell renderers in GtkEntryCompletion
+
2011-03-31 Juan Pablo Ugarte <juanpablougarte gmail com>
* gladeui/glade-base-editor.c,
diff --git a/plugins/gtk+/glade-cell-renderer-editor.c b/plugins/gtk+/glade-cell-renderer-editor.c
index 8371bca..71f8de7 100644
--- a/plugins/gtk+/glade-cell-renderer-editor.c
+++ b/plugins/gtk+/glade-cell-renderer-editor.c
@@ -429,45 +429,43 @@ GLADE_MAKE_EPROP (GladeEPropCellAttribute, glade_eprop_cell_attribute)
G_OBJECT_CLASS (parent_class)->finalize (object);
}
+static GladeWidget *
+glade_cell_renderer_parent_get_model (GladeWidget *widget)
+{
+ GtkTreeModel *real_model = NULL;
+
+ glade_widget_property_get (widget, "model", &real_model);
+
+ if (real_model)
+ return glade_widget_get_from_gobject (real_model);
+
+ return NULL;
+}
+
GladeWidget *
glade_cell_renderer_get_model (GladeWidget * renderer)
{
- GladeWidget *model = NULL;
- GladeWidget *parent = glade_widget_get_parent (renderer);
+ GladeWidget *gparent;
+ GObject *parent;
+ if ((gparent = glade_widget_get_parent (renderer)) == NULL)
+ return NULL;
+
+ parent = glade_widget_get_object (gparent);
+
/* Keep inline with all new cell layouts !!! */
- if (parent && GTK_IS_TREE_VIEW_COLUMN (glade_widget_get_object (parent)))
+ if (GTK_IS_TREE_VIEW_COLUMN (parent))
{
- GladeWidget *column = parent;
- GladeWidget *column_parent = glade_widget_get_parent (column);
+ GladeWidget *treeview = glade_widget_get_parent (gparent);
- if (column_parent && GTK_IS_TREE_VIEW (glade_widget_get_object (column_parent)))
- {
- GladeWidget *view = column_parent;
- GtkTreeModel *real_model = NULL;
- glade_widget_property_get (view, "model", &real_model);
- if (real_model)
- model = glade_widget_get_from_gobject (real_model);
- }
- }
- else if (parent && GTK_IS_ICON_VIEW (glade_widget_get_object (parent)))
- {
- GladeWidget *view = parent;
- GtkTreeModel *real_model = NULL;
- glade_widget_property_get (view, "model", &real_model);
- if (real_model)
- model = glade_widget_get_from_gobject (real_model);
- }
- else if (parent && GTK_IS_COMBO_BOX (glade_widget_get_object (parent)))
- {
- GladeWidget *combo = parent;
- GtkTreeModel *real_model = NULL;
- glade_widget_property_get (combo, "model", &real_model);
- if (real_model)
- model = glade_widget_get_from_gobject (real_model);
+ if (treeview && GTK_IS_TREE_VIEW (glade_widget_get_object (treeview)))
+ return glade_cell_renderer_parent_get_model (treeview);
}
+ else if (GTK_IS_ICON_VIEW (parent) || GTK_IS_COMBO_BOX (parent) ||
+ GTK_IS_ENTRY_COMPLETION (parent))
+ return glade_cell_renderer_parent_get_model (gparent);
- return model;
+ return NULL;
}
static void
diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c
index 7216261..ae578bb 100644
--- a/plugins/gtk+/glade-gtk.c
+++ b/plugins/gtk+/glade-gtk.c
@@ -10559,7 +10559,7 @@ glade_gtk_cell_layout_move_child (GladeBaseEditor * editor,
}
static void
-glade_gtk_cell_layout_launch_editor (GObject * layout)
+glade_gtk_cell_layout_launch_editor (GObject *layout, gchar *window_name)
{
GladeWidget *widget = glade_widget_get_from_gobject (layout);
GladeWidgetAdaptor *adaptor = glade_widget_get_adaptor (widget);
@@ -10573,14 +10573,14 @@ glade_gtk_cell_layout_launch_editor (GObject * layout)
/* Editor */
editor = glade_base_editor_new (layout, layout_editor,
_("Text"), GTK_TYPE_CELL_RENDERER_TEXT,
- _("Accelerator"),
- GTK_TYPE_CELL_RENDERER_ACCEL, _("Combo"),
- GTK_TYPE_CELL_RENDERER_COMBO, _("Spin"),
- GTK_TYPE_CELL_RENDERER_SPIN, _("Pixbuf"),
- GTK_TYPE_CELL_RENDERER_PIXBUF, _("Progress"),
- GTK_TYPE_CELL_RENDERER_PROGRESS, _("Toggle"),
- GTK_TYPE_CELL_RENDERER_TOGGLE, _("Spinner"),
- GTK_TYPE_CELL_RENDERER_SPINNER, NULL);
+ _("Accelerator"), GTK_TYPE_CELL_RENDERER_ACCEL,
+ _("Combo"), GTK_TYPE_CELL_RENDERER_COMBO,
+ _("Spin"), GTK_TYPE_CELL_RENDERER_SPIN,
+ _("Pixbuf"), GTK_TYPE_CELL_RENDERER_PIXBUF,
+ _("Progress"), GTK_TYPE_CELL_RENDERER_PROGRESS,
+ _("Toggle"), GTK_TYPE_CELL_RENDERER_TOGGLE,
+ _("Spinner"), GTK_TYPE_CELL_RENDERER_SPINNER,
+ NULL);
g_signal_connect (editor, "get-display-name",
G_CALLBACK (glade_gtk_cell_layout_get_display_name), NULL);
@@ -10591,10 +10591,7 @@ glade_gtk_cell_layout_launch_editor (GObject * layout)
gtk_widget_show (GTK_WIDGET (editor));
- window = glade_base_editor_pack_new_window (editor,
- GTK_IS_ICON_VIEW (layout) ?
- _("Icon View Editor") :
- _("Combo Editor"), NULL);
+ window = glade_base_editor_pack_new_window (editor, window_name, NULL);
gtk_widget_show (window);
}
@@ -10615,12 +10612,17 @@ glade_gtk_cell_layout_launch_editor_action (GObject * object)
}
else if (GTK_IS_ICON_VIEW (obj))
{
- glade_gtk_cell_layout_launch_editor (obj);
+ glade_gtk_cell_layout_launch_editor (obj, _("Icon View Editor"));
break;
}
else if (GTK_IS_COMBO_BOX (obj))
{
- glade_gtk_cell_layout_launch_editor (obj);
+ glade_gtk_cell_layout_launch_editor (obj, _("Combo Editor"));
+ break;
+ }
+ else if (GTK_IS_ENTRY_COMPLETION (obj))
+ {
+ glade_gtk_cell_layout_launch_editor (obj, _("Entry Completion Editor"));
break;
}
}
diff --git a/plugins/gtk+/gtk+.xml.in b/plugins/gtk+/gtk+.xml.in
index 6aa444d..8ae2497 100644
--- a/plugins/gtk+/gtk+.xml.in
+++ b/plugins/gtk+/gtk+.xml.in
@@ -961,6 +961,8 @@ embedded in another object</_tooltip>
<property id="im-module" disabled="True"/>
+ <property id="completion" since="3.2"/>
+
<!-- Virtual edit mode properties -->
<property id="use-entry-buffer" visible="False" save="False" default="False">
<parameter-spec>
@@ -2099,8 +2101,21 @@ embedded in another object</_tooltip>
</actions>
</glade-widget-class>
- <glade-widget-class name="GtkEntryCompletion" generic-name="entrycompletion" _title="Entry Completion"
- toplevel="True"/>
+ <glade-widget-class name="GtkEntryCompletion" generic-name="entrycompletion" _title="Entry Completion" toplevel="True">
+ <add-child-verify-function>glade_gtk_cell_layout_add_verify</add-child-verify-function>
+ <add-child-function>glade_gtk_cell_layout_add_child</add-child-function>
+ <remove-child-function>glade_gtk_cell_layout_remove_child</remove-child-function>
+ <get-children-function>glade_gtk_cell_layout_get_children</get-children-function>
+ <read-child-function>glade_gtk_cell_layout_read_child</read-child-function>
+ <write-child-function>glade_gtk_cell_layout_write_child</write-child-function>
+ <action-activate-function>glade_gtk_cell_layout_action_activate</action-activate-function>
+ <child-set-property-function>glade_gtk_cell_layout_set_child_property</child-set-property-function>
+ <child-get-property-function>glade_gtk_cell_layout_get_child_property</child-get-property-function>
+
+ <actions>
+ <action id="launch_editor" _name="Edit…" stock="gtk-edit" important="True"/>
+ </actions>
+ </glade-widget-class>
<glade-widget-class name="GtkIconFactory" generic-name="iconfactory" _title="Icon Factory"
toplevel="True">
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]