| 42 #include "menu.h" |
42 #include "menu.h" |
| 43 #include "toolbar.h" |
43 #include "toolbar.h" |
| 44 #include "container.h" |
44 #include "container.h" |
| 45 #include "headerbar.h" |
45 #include "headerbar.h" |
| 46 #include "button.h" |
46 #include "button.h" |
| |
47 #include "window.h" |
| 47 |
48 |
| 48 static int nwindows = 0; |
49 static int nwindows = 0; |
| 49 |
50 |
| 50 static int window_default_width = 650; |
51 static int window_default_width = 650; |
| 51 static int window_default_height = 550; |
52 static int window_default_height = 550; |
| 78 void ui_exit_event(GtkWidget *widget, gpointer data) { |
79 void ui_exit_event(GtkWidget *widget, gpointer data) { |
| 79 // delay exit handler |
80 // delay exit handler |
| 80 g_idle_add(ui_window_destroy, data); |
81 g_idle_add(ui_window_destroy, data); |
| 81 } |
82 } |
| 82 |
83 |
| 83 static gboolean ui_window_close_request(UiObject *obj) { |
84 gboolean ui_window_close_request(UiObject *obj) { |
| 84 if(obj->widget) { |
85 if(obj->widget) { |
| 85 void *appwindow = g_object_get_data(G_OBJECT(obj->widget), "ui.appwindow"); |
86 void *appwindow = g_object_get_data(G_OBJECT(obj->widget), "ui.appwindow"); |
| 86 if(appwindow) { |
87 if(appwindow) { |
| 87 int width = 0; |
88 int width = 0; |
| 88 int height = 0; |
89 int height = 0; |
| 109 ui_set_property("ui.window.height", height_str); |
110 ui_set_property("ui.window.height", height_str); |
| 110 } |
111 } |
| 111 } |
112 } |
| 112 } |
113 } |
| 113 |
114 |
| 114 uic_context_prepare_close(obj->ctx); |
|
| 115 obj->ref--; |
115 obj->ref--; |
| 116 if(obj->ref > 0) { |
116 if(obj->ref > 0) { |
| 117 #if GTK_CHECK_VERSION(2, 18, 0) |
117 #if GTK_CHECK_VERSION(2, 18, 0) |
| 118 gtk_widget_set_visible(obj->widget, FALSE); |
118 gtk_widget_set_visible(obj->widget, FALSE); |
| 119 #else |
119 #else |
| 120 gtk_widget_hide(obj->widget); |
120 gtk_widget_hide(obj->widget); |
| 121 #endif |
121 #endif |
| 122 return TRUE; |
122 return TRUE; |
| 123 } else { |
123 } else { |
| |
124 uic_context_prepare_close(obj->ctx); |
| 124 return FALSE; |
125 return FALSE; |
| 125 } |
126 } |
| 126 } |
127 } |
| 127 |
128 |
| 128 #if GTK_MAJOR_VERSION >= 4 |
129 #if GTK_MAJOR_VERSION >= 4 |