ui/gtk/window.c

changeset 986
6f7600c2b9e1
parent 977
006d8f70467e
equal deleted inserted replaced
985:93f07ccfd997 986:6f7600c2b9e1
140 char buf[32]; 140 char buf[32];
141 snprintf(buf, 32, "%d", pos); 141 snprintf(buf, 32, "%d", pos);
142 ui_set_property("ui.window.splitview.pos", buf); 142 ui_set_property("ui.window.splitview.pos", buf);
143 } 143 }
144 144
145 static UiObject* create_window(const char *title, void *window_data, UiBool sidebar, UiBool splitview, UiBool simple) { 145 static UiObject* create_window(const char *title, UiBool sidebar, UiBool splitview, UiBool simple) {
146 UiObject *obj = uic_object_new_toplevel(); 146 UiObject *obj = uic_object_new_toplevel();
147 147
148 #ifdef UI_LIBADWAITA 148 #ifdef UI_LIBADWAITA
149 obj->widget = adw_application_window_new(ui_get_application()); 149 obj->widget = adw_application_window_new(ui_get_application());
150 #elif !defined(UI_GTK2) 150 #elif !defined(UI_GTK2)
151 obj->widget = gtk_application_window_new(ui_get_application()); 151 obj->widget = gtk_application_window_new(ui_get_application());
152 #else 152 #else
153 obj->widget = gtk_window_new(GTK_WINDOW_TOPLEVEL); 153 obj->widget = gtk_window_new(GTK_WINDOW_TOPLEVEL);
154 #endif 154 #endif
155
156 obj->window = window_data;
157 155
158 #if GTK_CHECK_VERSION(4, 0, 0) 156 #if GTK_CHECK_VERSION(4, 0, 0)
159 obj->ctx->action_map = G_ACTION_MAP(obj->widget); 157 obj->ctx->action_map = G_ACTION_MAP(obj->widget);
160 #endif 158 #endif
161 159
392 nwindows++; 390 nwindows++;
393 return obj; 391 return obj;
394 } 392 }
395 393
396 394
397 UiObject* ui_window(const char *title, void *window_data) { 395 UiObject* ui_window(const char *title) {
398 return create_window(title, window_data, FALSE, FALSE, FALSE); 396 return create_window(title, FALSE, FALSE, FALSE);
399 } 397 }
400 398
401 UiObject *ui_sidebar_window(const char *title, void *window_data) { 399 UiObject *ui_sidebar_window(const char *title) {
402 return create_window(title, window_data, TRUE, FALSE, FALSE); 400 return create_window(title, TRUE, FALSE, FALSE);
403 } 401 }
404 402
405 UiObject *ui_splitview_window(const char *title, UiBool sidebar) { 403 UiObject *ui_splitview_window(const char *title, UiBool sidebar) {
406 return create_window(title, NULL, sidebar, TRUE, FALSE); 404 return create_window(title, sidebar, TRUE, FALSE);
407 } 405 }
408 406
409 UiObject* ui_simple_window(const char *title, void *window_data) { 407 UiObject* ui_simple_window(const char *title) {
410 return create_window(title, window_data, FALSE, FALSE, TRUE); 408 return create_window(title, FALSE, FALSE, TRUE);
411 } 409 }
412 410
413 void ui_window_size(UiObject *obj, int width, int height) { 411 void ui_window_size(UiObject *obj, int width, int height) {
414 gtk_window_set_default_size( 412 gtk_window_set_default_size(
415 GTK_WINDOW(obj->widget), 413 GTK_WINDOW(obj->widget),

mercurial