[glade] Revert GtkEntryCompletion support removal



commit 4b3035c38c5899ef71f01b12634177025a949976
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date:   Wed Apr 6 12:05:19 2011 -0300

    Revert GtkEntryCompletion support removal
    
    This reverts commit b95c6ad7e2ffe1aa84fa9af94e3beed3ce0c45e6.

 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 60ef5bf..9ec1180 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -69,6 +69,13 @@
 2011-04-03  Cosimo Cecchi <cosimoc gnome org>
 	* doc/Makefile.am: don't use gtk+-2.0 for scanning the docs
 
+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 0f3f8ba..dbb6d70 100644
--- a/plugins/gtk+/glade-gtk.c
+++ b/plugins/gtk+/glade-gtk.c
@@ -10130,7 +10130,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);
@@ -10144,14 +10144,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);
@@ -10162,10 +10162,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);
 }
 
@@ -10186,12 +10183,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 0b6e5a1..f3ab4a6 100644
--- a/plugins/gtk+/gtk+.xml.in
+++ b/plugins/gtk+/gtk+.xml.in
@@ -960,6 +960,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>
@@ -2152,8 +2154,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&#8230;" 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]