[glom/glom-1-26] UiUtils: Add container_remove_all() to fix the build.



commit c2f396af416f4b7f827b2bb16fa52904a760d986
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Feb 9 14:38:57 2015 +0100

    UiUtils: Add container_remove_all() to fix the build.
    
    This is from this commit in master:
    https://git.gnome.org/browse/glom/commit/glom/utils_ui.cc?id=c63417df4bff43afe5c2b0b8336bf9ee1c6bfe9b

 glom/utils_ui.cc |   13 +++++++++++++
 glom/utils_ui.h  |    2 ++
 2 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/glom/utils_ui.cc b/glom/utils_ui.cc
index 76958ca..06965c0 100644
--- a/glom/utils_ui.cc
+++ b/glom/utils_ui.cc
@@ -582,4 +582,17 @@ void UiUtils::treeview_delete_all_columns(Gtk::TreeView* treeview)
   }
 }
 
+void UiUtils::container_remove_all(Gtk::Container& container)
+{
+  //Remove all (usally just one) widgets from m_vbox_parent:
+  //Gtk::Bin::remove() is easier but after GtkAlignment was deprecated, there is no suitable widget.
+  const std::vector<Gtk::Widget*> children = container.get_children();
+  for(std::vector<Gtk::Widget*>::const_iterator iter = children.begin(); iter != children.end(); ++iter)
+  {
+    Gtk::Widget* child = *iter;
+    if(child)
+      container.remove(*(*iter));
+  }
+}
+
 } //namespace Glom
diff --git a/glom/utils_ui.h b/glom/utils_ui.h
index e7918e7..cfd8630 100644
--- a/glom/utils_ui.h
+++ b/glom/utils_ui.h
@@ -105,6 +105,8 @@ bool script_check_for_pygtk2_with_warning(const Glib::ustring& script, Gtk::Wind
 
 void treeview_delete_all_columns(Gtk::TreeView* treeview);
 
+void container_remove_all(Gtk::Container& container);
+
 } //namespace UiUtils
 
 } //namespace Glom


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