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), |