]> git.tdb.fi Git - ext/subsurface.git/commitdiff
Divide the panes evenly in view_three
authorMikko Rasa <tdb@tdb.fi>
Sun, 29 Jul 2012 09:13:36 +0000 (12:13 +0300)
committerMikko Rasa <tdb@tdb.fi>
Tue, 31 Jul 2012 18:11:58 +0000 (21:11 +0300)
There was a note by Linus that he doesn't know how to get the size, so
I'm fixing that.

Signed-off-by: Mikko Rasa <tdb@tdb.fi>
gtk-gui.c

index 45aa212638716e4550aa3c399436af1cfb7464dd..bdf2952f074faf5a7c2efaf767f3696421dad7a7 100644 (file)
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -609,11 +609,13 @@ static void view_info(GtkWidget *w, gpointer data)
        gtk_paned_set_position(GTK_PANED(hpane), 65535);
 }
 
-/* Ooh. I don't know how to get the half-way size. So I'm just using random numbers */
 static void view_three(GtkWidget *w, gpointer data)
 {
-       gtk_paned_set_position(GTK_PANED(hpane), 400);
-       gtk_paned_set_position(GTK_PANED(vpane), 200);
+       GtkAllocation alloc;
+       gtk_widget_get_allocation(hpane, &alloc);
+       gtk_paned_set_position(GTK_PANED(hpane), alloc.width/2);
+       gtk_widget_get_allocation(vpane, &alloc);
+       gtk_paned_set_position(GTK_PANED(vpane), alloc.height/2);
 }
 
 static GtkActionEntry menu_items[] = {