Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
[geeqie.git] / src / layout.c
index c696e21..a38ab2b 100644 (file)
@@ -1599,10 +1599,16 @@ static gint layout_delete_cb(GtkWidget *widget, GdkEventAny *event, gpointer dat
 }
 
 LayoutWindow *layout_new(const gchar *path, gint popped, gint hidden)
+{
+       return layout_new_with_geometry(path, popped, hidden, NULL);
+}
+
+LayoutWindow *layout_new_with_geometry(const gchar *path, gint popped, gint hidden,
+                                      const gchar *geometry)
 {
        LayoutWindow *lw;
-       GdkGeometry geometry;
-       GdkWindowHints hints;
+       GdkGeometry hint;
+       GdkWindowHints hint_mask;
 
        lw = g_new0(LayoutWindow, 1);
 
@@ -1661,19 +1667,19 @@ LayoutWindow *layout_new(const gchar *path, gint popped, gint hidden)
 
        if (save_window_positions)
                {
-               hints = GDK_HINT_USER_POS;
+               hint_mask = GDK_HINT_USER_POS;
                }
        else
                {
-               hints = 0;
+               hint_mask = 0;
                }
 
-       geometry.min_width = 32;
-       geometry.min_height = 32;
-       geometry.base_width = MAINWINDOW_DEF_WIDTH;
-       geometry.base_height = MAINWINDOW_DEF_HEIGHT;
-       gtk_window_set_geometry_hints(GTK_WINDOW(lw->window), NULL, &geometry,
-                                     GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE | hints);
+       hint.min_width = 32;
+       hint.min_height = 32;
+       hint.base_width = 0;
+       hint.base_height = 0;
+       gtk_window_set_geometry_hints(GTK_WINDOW(lw->window), NULL, &hint,
+                                     GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE | hint_mask);
 
        if (save_window_positions)
                {
@@ -1721,6 +1727,14 @@ LayoutWindow *layout_new(const gchar *path, gint popped, gint hidden)
        lw->last_time = 0;
        lw->last_time_id = g_timeout_add(5000, layout_check_for_update_cb, lw);
 
+       if (geometry)
+               {
+               if (!gtk_window_parse_geometry(GTK_WINDOW(lw->window), geometry))
+                       {
+                       print_term(_("Invalid geometry\n"));
+                       }
+               }
+
        gtk_widget_show(lw->window);
        layout_tools_hide(lw, lw->tools_hidden);