[gimp] app: Make created GtkPaned subclass depend on GimpPanedBox orientation



commit b700f219de861b56b15dc298ec6ab44a78a61be5
Author: Martin Nordholts <martinn src gnome org>
Date:   Sat Oct 24 20:08:08 2009 +0200

    app: Make created GtkPaned subclass depend on GimpPanedBox orientation

 app/widgets/gimppanedbox.c |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/app/widgets/gimppanedbox.c b/app/widgets/gimppanedbox.c
index c1b4da5..5d93391 100644
--- a/app/widgets/gimppanedbox.c
+++ b/app/widgets/gimppanedbox.c
@@ -158,9 +158,10 @@ gimp_paned_box_add_widget (GimpPanedBox *paned_box,
     }
   else
     {
-      GtkWidget *old_widget;
-      GtkWidget *parent;
-      GtkWidget *paned;
+      GtkWidget      *old_widget;
+      GtkWidget      *parent;
+      GtkWidget      *paned;
+      GtkOrientation  orientation;
 
       /* Figure out what widget to detach */
       if (index == 0)
@@ -186,8 +187,13 @@ gimp_paned_box_add_widget (GimpPanedBox *paned_box,
       g_object_ref (old_widget);
       gtk_container_remove (GTK_CONTAINER (parent), old_widget);
 
-      paned = gtk_vpaned_new ();
-      if (GTK_IS_VPANED (parent))
+      /* GtkPaned is abstract :( */
+      orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (paned_box));
+      paned = (orientation == GTK_ORIENTATION_VERTICAL ?
+               gtk_vpaned_new () :
+               gtk_hpaned_new ());
+
+      if (GTK_IS_PANED (parent))
         {
           gtk_paned_pack1 (GTK_PANED (parent), paned, TRUE, FALSE);
         }
@@ -268,7 +274,7 @@ gimp_paned_box_remove_widget (GimpPanedBox *paned_box,
 
       gtk_container_remove (GTK_CONTAINER (grandparent), parent);
 
-      if (GTK_IS_VPANED (grandparent))
+      if (GTK_IS_PANED (grandparent))
         gtk_paned_pack1 (GTK_PANED (grandparent), other_widget, TRUE, FALSE);
       else
         gtk_box_pack_start (GTK_BOX (paned_box), other_widget, TRUE, TRUE, 0);



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