78 |
78 |
79 static gboolean ui_window_close_request(UiObject *obj) { |
79 static gboolean ui_window_close_request(UiObject *obj) { |
80 uic_context_prepare_close(obj->ctx); |
80 uic_context_prepare_close(obj->ctx); |
81 obj->ref--; |
81 obj->ref--; |
82 if(obj->ref > 0) { |
82 if(obj->ref > 0) { |
|
83 #if GTK_CHECK_VERSION(2, 18, 0) |
|
84 gtk_widget_set_visible(obj->widget, FALSE); |
|
85 #else |
83 gtk_widget_hide(obj->widget); |
86 gtk_widget_hide(obj->widget); |
|
87 #endif |
84 return TRUE; |
88 return TRUE; |
85 } else { |
89 } else { |
86 return FALSE; |
90 return FALSE; |
87 } |
91 } |
88 } |
92 } |
98 #endif |
102 #endif |
99 |
103 |
100 static UiObject* create_window(const char *title, void *window_data, UiBool simple) { |
104 static UiObject* create_window(const char *title, void *window_data, UiBool simple) { |
101 CxMempool *mp = cxBasicMempoolCreate(256); |
105 CxMempool *mp = cxBasicMempoolCreate(256); |
102 UiObject *obj = cxCalloc(mp->allocator, 1, sizeof(UiObject)); |
106 UiObject *obj = cxCalloc(mp->allocator, 1, sizeof(UiObject)); |
103 obj->ref = 1; |
107 obj->ref = 0; |
104 |
108 |
105 #ifdef UI_LIBADWAITA |
109 #ifdef UI_LIBADWAITA |
106 obj->widget = adw_application_window_new(ui_get_application()); |
110 obj->widget = adw_application_window_new(ui_get_application()); |
107 #elif !defined(UI_GTK2) |
111 #elif !defined(UI_GTK2) |
108 obj->widget = gtk_application_window_new(ui_get_application()); |
112 obj->widget = gtk_application_window_new(ui_get_application()); |