ui/gtk/window.c

branch
newapi
changeset 302
b00cbbfeec7a
parent 297
a73c60adf188
child 306
d02e1149cdb9
equal deleted inserted replaced
301:f9e7c57e1e2f 302:b00cbbfeec7a
70 } 70 }
71 71
72 static UiObject* create_window(const char *title, void *window_data, UiBool simple) { 72 static UiObject* create_window(const char *title, void *window_data, UiBool simple) {
73 CxMempool *mp = cxBasicMempoolCreate(256); 73 CxMempool *mp = cxBasicMempoolCreate(256);
74 UiObject *obj = cxCalloc(mp->allocator, 1, sizeof(UiObject)); 74 UiObject *obj = cxCalloc(mp->allocator, 1, sizeof(UiObject));
75 75
76 #ifndef UI_GTK2 76 #ifdef UI_LIBADWAITA
77 obj->widget = adw_application_window_new(ui_get_application());
78 #elif !defined(UI_GTK2)
77 obj->widget = gtk_application_window_new(ui_get_application()); 79 obj->widget = gtk_application_window_new(ui_get_application());
78 #else 80 #else
79 obj->widget = gtk_window_new(GTK_WINDOW_TOPLEVEL); 81 obj->widget = gtk_window_new(GTK_WINDOW_TOPLEVEL);
80 #endif 82 #endif
81 83
106 "destroy", 108 "destroy",
107 G_CALLBACK(ui_exit_event), 109 G_CALLBACK(ui_exit_event),
108 obj); 110 obj);
109 111
110 GtkWidget *vbox = ui_gtk_vbox_new(0); 112 GtkWidget *vbox = ui_gtk_vbox_new(0);
111 #if GTK_MAJOR_VERSION >= 4 113 #ifdef UI_LIBADWAITA
114 GtkWidget *toolbar_view = adw_toolbar_view_new();
115 adw_application_window_set_content(ADW_APPLICATION_WINDOW(obj->widget), toolbar_view);
116 adw_toolbar_view_set_content(ADW_TOOLBAR_VIEW(toolbar_view), vbox);
117
118 GtkWidget *headerbar = adw_header_bar_new();
119 adw_toolbar_view_add_top_bar(ADW_TOOLBAR_VIEW(toolbar_view), headerbar);
120 #elif GTK_MAJOR_VERSION >= 4
112 WINDOW_SET_CONTENT(obj->widget, vbox); 121 WINDOW_SET_CONTENT(obj->widget, vbox);
113 #else 122 #else
114 gtk_container_add(GTK_CONTAINER(obj->widget), vbox); 123 gtk_container_add(GTK_CONTAINER(obj->widget), vbox);
115 124
116 if(!simple) { 125 if(!simple) {

mercurial