ui/gtk/window.c

changeset 24
06bceda81a03
parent 21
012418e7dc90
child 28
794a5c91c479
--- a/ui/gtk/window.c	Fri Apr 04 11:29:17 2014 +0200
+++ b/ui/gtk/window.c	Fri Apr 04 17:45:36 2014 +0200
@@ -30,6 +30,7 @@
 #include <stdlib.h>
 
 #include "../ui/window.h"
+#include "../ui/properties.h"
 #include "../common/context.h"
 
 #include "menu.h"
@@ -58,16 +59,26 @@
 UiObject* ui_window(char *title, void *window_data) {
     UcxMempool *mp = ucx_mempool_new(256);
     UiObject *obj = ucx_mempool_calloc(mp, 1, sizeof(UiObject));  
-    obj->widget = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+    obj->widget = gtk_window_new(GTK_WINDOW_TOPLEVEL);
     obj->ctx = uic_context(obj, mp);
     
     if(title != NULL) {
         gtk_window_set_title(GTK_WINDOW(obj->widget), title);
     }
-    gtk_window_set_default_size(
-            GTK_WINDOW(obj->widget),
-            window_default_width,
-            window_default_height);
+    
+    char *width = ui_get_property("ui.window.width");
+    char *height = ui_get_property("ui.window.height");
+    if(width && height) {
+        gtk_window_set_default_size(
+                GTK_WINDOW(obj->widget),
+                atoi(width),
+                atoi(height));
+    } else {
+        gtk_window_set_default_size(
+                GTK_WINDOW(obj->widget),
+                window_default_width,
+                window_default_height);
+    }
     
     g_signal_connect(
             obj->widget,

mercurial