56 obj->ctx->close_callback(&ev, obj->ctx->close_data); |
56 obj->ctx->close_callback(&ev, obj->ctx->close_data); |
57 } |
57 } |
58 // TODO: free UiObject |
58 // TODO: free UiObject |
59 |
59 |
60 nwindows--; |
60 nwindows--; |
|
61 #ifdef GTK2_LEGACY |
61 if(nwindows == 0) { |
62 if(nwindows == 0) { |
62 gtk_main_quit(); |
63 gtk_main_quit(); |
63 } |
64 } |
|
65 #endif |
64 } |
66 } |
65 |
67 |
66 static UiObject* create_window(char *title, void *window_data, UiBool simple) { |
68 static UiObject* create_window(char *title, void *window_data, UiBool simple) { |
67 UcxMempool *mp = ucx_mempool_new(256); |
69 UcxMempool *mp = ucx_mempool_new(256); |
68 UiObject *obj = ucx_mempool_calloc(mp, 1, sizeof(UiObject)); |
70 UiObject *obj = ucx_mempool_calloc(mp, 1, sizeof(UiObject)); |
|
71 |
|
72 #ifndef GTK2_LEGACY |
|
73 obj->widget = gtk_application_window_new(ui_get_application()); |
|
74 #else |
69 obj->widget = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
75 obj->widget = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
|
76 #endif |
|
77 |
|
78 |
70 obj->ctx = uic_context(obj, mp); |
79 obj->ctx = uic_context(obj, mp); |
71 obj->window = window_data; |
80 obj->window = window_data; |
72 |
81 |
73 if(title != NULL) { |
82 if(title != NULL) { |
74 gtk_window_set_title(GTK_WINDOW(obj->widget), title); |
83 gtk_window_set_title(GTK_WINDOW(obj->widget), title); |