[glade] * gladeui/glade-editor.c: Optimize window resizing by hiding inner notebook pages when those pag



commit 186816fd26655e05e9e7feff08002358456c7188
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Thu Feb 24 15:54:57 2011 +0900

    	* gladeui/glade-editor.c: Optimize window resizing by hiding inner notebook pages
    	  when those pages are not shown

 ChangeLog              |    5 +++++
 gladeui/glade-editor.c |   32 ++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4d49125..58c97ec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-02-24  Tristan Van Berkom <tristanvb openismus com>
+
+	* gladeui/glade-editor.c: Optimize window resizing by hiding inner notebook pages
+	  when those pages are not shown
+
 2011-02-17  Tristan Van Berkom <tristanvb openismus com>
 
 	* plugins/gtk+/glade-gtk.c, plugins/gtk+/glade-gtk-table.c, plugins/gtk+/Makefile.am:
diff --git a/gladeui/glade-editor.c b/gladeui/glade-editor.c
index 25f19ff..8cf4c90 100644
--- a/gladeui/glade-editor.c
+++ b/gladeui/glade-editor.c
@@ -441,6 +441,35 @@ glade_editor_setup_class_field (GladeEditor * editor)
   return hbox;
 }
 
+
+static void
+glade_editor_switch_page (GtkNotebook     *notebook,
+			  GtkWidget       *page,
+			  guint            page_num,
+			  GladeEditor     *editor)
+{
+  gtk_widget_hide (editor->priv->page_widget);
+  gtk_widget_hide (editor->priv->page_packing);
+  gtk_widget_hide (editor->priv->page_common);
+  gtk_widget_hide (editor->priv->page_atk);
+
+  switch (page_num)
+    {
+    case 0:
+      gtk_widget_show (editor->priv->page_widget);
+      break;
+    case 1:
+      gtk_widget_show (editor->priv->page_packing);
+      break;
+    case 2:
+      gtk_widget_show (editor->priv->page_common);
+      break;
+    case 4:
+      gtk_widget_show (editor->priv->page_atk);
+      break;
+    }
+}
+
 static void
 glade_editor_init (GladeEditor * editor)
 {
@@ -459,6 +488,9 @@ glade_editor_init (GladeEditor * editor)
   editor->priv->editables = NULL;
   editor->priv->loading = FALSE;
 
+  g_signal_connect (G_OBJECT (editor->priv->notebook), "switch-page",
+		    G_CALLBACK (glade_editor_switch_page), editor);
+
   editor->priv->class_field = glade_editor_setup_class_field (editor);
 
   gtk_container_set_border_width (GTK_CONTAINER (editor->priv->notebook), 0);



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