166 adw_toolbar_view_set_content(ADW_TOOLBAR_VIEW(toolbar_view), vbox); |
166 adw_toolbar_view_set_content(ADW_TOOLBAR_VIEW(toolbar_view), vbox); |
167 |
167 |
168 GtkWidget *content_box = ui_gtk_vbox_new(0); |
168 GtkWidget *content_box = ui_gtk_vbox_new(0); |
169 BOX_ADD_EXPAND(GTK_BOX(vbox), content_box); |
169 BOX_ADD_EXPAND(GTK_BOX(vbox), content_box); |
170 |
170 |
|
171 GtkWidget *sidebar_headerbar = NULL; |
171 if(sidebar) { |
172 if(sidebar) { |
172 GtkWidget *splitview = adw_overlay_split_view_new(); |
173 GtkWidget *splitview = adw_overlay_split_view_new(); |
173 adw_application_window_set_content(ADW_APPLICATION_WINDOW(obj->widget), splitview); |
174 adw_application_window_set_content(ADW_APPLICATION_WINDOW(obj->widget), splitview); |
174 |
175 |
175 GtkWidget *sidebar_toolbar_view = adw_toolbar_view_new(); |
176 GtkWidget *sidebar_toolbar_view = adw_toolbar_view_new(); |
176 adw_overlay_split_view_set_sidebar(ADW_OVERLAY_SPLIT_VIEW(splitview), sidebar_toolbar_view); |
177 adw_overlay_split_view_set_sidebar(ADW_OVERLAY_SPLIT_VIEW(splitview), sidebar_toolbar_view); |
177 GtkWidget *sidebar_headerbar = adw_header_bar_new(); |
178 sidebar_headerbar = adw_header_bar_new(); |
178 adw_toolbar_view_add_top_bar(ADW_TOOLBAR_VIEW(sidebar_toolbar_view), sidebar_headerbar); |
179 adw_toolbar_view_add_top_bar(ADW_TOOLBAR_VIEW(sidebar_toolbar_view), sidebar_headerbar); |
179 |
180 |
180 adw_overlay_split_view_set_content(ADW_OVERLAY_SPLIT_VIEW(splitview), toolbar_view); |
181 adw_overlay_split_view_set_content(ADW_OVERLAY_SPLIT_VIEW(splitview), toolbar_view); |
181 |
182 |
182 g_object_set_data(G_OBJECT(obj->widget), "ui_sidebar", sidebar_toolbar_view); |
183 g_object_set_data(G_OBJECT(obj->widget), "ui_sidebar", sidebar_toolbar_view); |
183 } else { |
184 } else { |
184 adw_application_window_set_content(ADW_APPLICATION_WINDOW(obj->widget), toolbar_view); |
185 adw_application_window_set_content(ADW_APPLICATION_WINDOW(obj->widget), toolbar_view); |
185 } |
186 } |
186 |
187 |
187 |
|
188 GtkWidget *headerbar = adw_header_bar_new(); |
188 GtkWidget *headerbar = adw_header_bar_new(); |
|
189 |
|
190 const char *show_title = ui_get_property("ui.gtk.window.showtitle"); |
|
191 if(show_title) { |
|
192 if(!strcmp(show_title, "main") && sidebar) { |
|
193 adw_header_bar_set_show_title(ADW_HEADER_BAR(sidebar_headerbar), FALSE); |
|
194 } else if(!strcmp(show_title, "sidebar")) { |
|
195 adw_header_bar_set_show_title(ADW_HEADER_BAR(headerbar), FALSE); |
|
196 } else if(!strcmp(show_title, "false")) { |
|
197 adw_header_bar_set_show_title(ADW_HEADER_BAR(sidebar_headerbar), FALSE); |
|
198 adw_header_bar_set_show_title(ADW_HEADER_BAR(headerbar), FALSE); |
|
199 } else { |
|
200 fprintf(stderr, "Unknown value '%s' for property ui.gtk.window.showtitle\n", show_title); |
|
201 adw_header_bar_set_show_title(ADW_HEADER_BAR(sidebar_headerbar), FALSE); |
|
202 } |
|
203 } else { |
|
204 adw_header_bar_set_show_title(ADW_HEADER_BAR(headerbar), FALSE); |
|
205 } |
|
206 |
189 adw_toolbar_view_add_top_bar(ADW_TOOLBAR_VIEW(toolbar_view), headerbar); |
207 adw_toolbar_view_add_top_bar(ADW_TOOLBAR_VIEW(toolbar_view), headerbar); |
190 g_object_set_data(G_OBJECT(obj->widget), "ui_headerbar", headerbar); |
208 g_object_set_data(G_OBJECT(obj->widget), "ui_headerbar", headerbar); |
191 |
209 |
192 if(!simple) { |
210 if(!simple) { |
193 ui_fill_headerbar(obj, headerbar); |
211 ui_fill_headerbar(obj, headerbar); |