[glade3] * plugins/gtk+/gtk+.xml.in, plugins/gtk+/glade-gtk.c: Added glade_gtk_treeview_replace_child(),



commit 28dcb008c808d23618a913ac852c221e978dd74b
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Thu Dec 23 12:28:10 2010 +0900

    	* plugins/gtk+/gtk+.xml.in, plugins/gtk+/glade-gtk.c: Added glade_gtk_treeview_replace_child(),
    	  this was never needed before since treeview columns did not have construct-only properties
    	  (so they did not hit "rebuild" codepaths).

 plugins/gtk+/glade-gtk.c |   37 +++++++++++++++++++++++++++++++++++++
 plugins/gtk+/gtk+.xml.in |    1 +
 2 files changed, 38 insertions(+), 0 deletions(-)
---
diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c
index 16efc29..59617f3 100644
--- a/plugins/gtk+/glade-gtk.c
+++ b/plugins/gtk+/glade-gtk.c
@@ -11549,6 +11549,43 @@ glade_gtk_treeview_remove_child (GladeWidgetAdaptor *adaptor,
 	gtk_tree_view_remove_column (view, column);
 }
 
+void
+glade_gtk_treeview_replace_child (GladeWidgetAdaptor *adaptor,
+				  GObject            *container,
+				  GObject            *current,
+				  GObject            *new_column)
+{
+	GtkTreeView *view = GTK_TREE_VIEW (container);
+	GList             *columns;
+	GtkTreeViewColumn *column;
+	GladeWidget       *gcolumn;
+	gint               index;
+
+	if (!GTK_IS_TREE_VIEW_COLUMN (current))
+		return;
+
+	column = GTK_TREE_VIEW_COLUMN (current);
+
+	columns = gtk_tree_view_get_columns (view);
+	index   = g_list_index (columns, column);
+	g_list_free (columns);
+
+	gtk_tree_view_remove_column (view, column);
+	column = GTK_TREE_VIEW_COLUMN (new_column);
+
+	gtk_tree_view_insert_column (view, column, index);
+
+	if (gtk_tree_view_get_fixed_height_mode (view))
+	{
+		gcolumn = glade_widget_get_from_gobject (column);
+		glade_widget_property_set (gcolumn, "sizing", GTK_TREE_VIEW_COLUMN_FIXED);
+		glade_widget_property_set_sensitive (gcolumn, "sizing", FALSE,
+						     INSENSITIVE_COLUMN_SIZING_MSG);
+	}
+
+	glade_gtk_cell_layout_sync_attributes (G_OBJECT (column));
+}
+
 gboolean
 glade_gtk_treeview_depends (GladeWidgetAdaptor *adaptor,
 			    GladeWidget        *widget,
diff --git a/plugins/gtk+/gtk+.xml.in b/plugins/gtk+/gtk+.xml.in
index c874890..79226da 100644
--- a/plugins/gtk+/gtk+.xml.in
+++ b/plugins/gtk+/gtk+.xml.in
@@ -1957,6 +1957,7 @@ embedded in another object</_tooltip>
       <child-get-property-function>glade_gtk_treeview_get_child_property</child-get-property-function>
       <get-children-function>glade_gtk_treeview_get_children</get-children-function>
       <add-child-function>glade_gtk_treeview_add_child</add-child-function>
+      <replace-child-function>glade_gtk_treeview_replace_child</replace-child-function>
       <remove-child-function>glade_gtk_treeview_remove_child</remove-child-function>
       <action-activate-function>glade_gtk_treeview_action_activate</action-activate-function>
       <depends-function>glade_gtk_treeview_depends</depends-function>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]