ui/gtk/window.c

changeset 24
06bceda81a03
parent 21
012418e7dc90
child 28
794a5c91c479
equal deleted inserted replaced
23:decc6bf584aa 24:06bceda81a03
28 28
29 #include <stdio.h> 29 #include <stdio.h>
30 #include <stdlib.h> 30 #include <stdlib.h>
31 31
32 #include "../ui/window.h" 32 #include "../ui/window.h"
33 #include "../ui/properties.h"
33 #include "../common/context.h" 34 #include "../common/context.h"
34 35
35 #include "menu.h" 36 #include "menu.h"
36 #include "toolbar.h" 37 #include "toolbar.h"
37 #include "container.h" 38 #include "container.h"
56 } 57 }
57 58
58 UiObject* ui_window(char *title, void *window_data) { 59 UiObject* ui_window(char *title, void *window_data) {
59 UcxMempool *mp = ucx_mempool_new(256); 60 UcxMempool *mp = ucx_mempool_new(256);
60 UiObject *obj = ucx_mempool_calloc(mp, 1, sizeof(UiObject)); 61 UiObject *obj = ucx_mempool_calloc(mp, 1, sizeof(UiObject));
61 obj->widget = gtk_window_new (GTK_WINDOW_TOPLEVEL); 62 obj->widget = gtk_window_new(GTK_WINDOW_TOPLEVEL);
62 obj->ctx = uic_context(obj, mp); 63 obj->ctx = uic_context(obj, mp);
63 64
64 if(title != NULL) { 65 if(title != NULL) {
65 gtk_window_set_title(GTK_WINDOW(obj->widget), title); 66 gtk_window_set_title(GTK_WINDOW(obj->widget), title);
66 } 67 }
67 gtk_window_set_default_size( 68
68 GTK_WINDOW(obj->widget), 69 char *width = ui_get_property("ui.window.width");
69 window_default_width, 70 char *height = ui_get_property("ui.window.height");
70 window_default_height); 71 if(width && height) {
72 gtk_window_set_default_size(
73 GTK_WINDOW(obj->widget),
74 atoi(width),
75 atoi(height));
76 } else {
77 gtk_window_set_default_size(
78 GTK_WINDOW(obj->widget),
79 window_default_width,
80 window_default_height);
81 }
71 82
72 g_signal_connect( 83 g_signal_connect(
73 obj->widget, 84 obj->widget,
74 "destroy", 85 "destroy",
75 G_CALLBACK(ui_exit_event), 86 G_CALLBACK(ui_exit_event),

mercurial