ui/gtk/window.c

changeset 441
752bd110375e
parent 435
883a569cc9a3
--- a/ui/gtk/window.c	Sun Jan 05 22:00:39 2025 +0100
+++ b/ui/gtk/window.c	Wed Jan 08 20:35:24 2025 +0100
@@ -168,13 +168,14 @@
     GtkWidget *content_box = ui_gtk_vbox_new(0);
     BOX_ADD_EXPAND(GTK_BOX(vbox), content_box);
     
+    GtkWidget *sidebar_headerbar = NULL; 
     if(sidebar) {
         GtkWidget *splitview = adw_overlay_split_view_new();
         adw_application_window_set_content(ADW_APPLICATION_WINDOW(obj->widget), splitview);
         
         GtkWidget *sidebar_toolbar_view = adw_toolbar_view_new();
         adw_overlay_split_view_set_sidebar(ADW_OVERLAY_SPLIT_VIEW(splitview), sidebar_toolbar_view);
-        GtkWidget *sidebar_headerbar = adw_header_bar_new();
+        sidebar_headerbar = adw_header_bar_new();
         adw_toolbar_view_add_top_bar(ADW_TOOLBAR_VIEW(sidebar_toolbar_view), sidebar_headerbar);
         
         adw_overlay_split_view_set_content(ADW_OVERLAY_SPLIT_VIEW(splitview), toolbar_view);
@@ -184,8 +185,25 @@
         adw_application_window_set_content(ADW_APPLICATION_WINDOW(obj->widget), toolbar_view);
     }
     
-
     GtkWidget *headerbar = adw_header_bar_new();
+    
+    const char *show_title = ui_get_property("ui.gtk.window.showtitle");
+    if(show_title) {
+        if(!strcmp(show_title, "main") && sidebar) {
+            adw_header_bar_set_show_title(ADW_HEADER_BAR(sidebar_headerbar), FALSE);
+        } else if(!strcmp(show_title, "sidebar")) {
+            adw_header_bar_set_show_title(ADW_HEADER_BAR(headerbar), FALSE);
+        } else if(!strcmp(show_title, "false")) {
+            adw_header_bar_set_show_title(ADW_HEADER_BAR(sidebar_headerbar), FALSE);
+            adw_header_bar_set_show_title(ADW_HEADER_BAR(headerbar), FALSE);
+        } else {
+            fprintf(stderr, "Unknown value '%s' for property ui.gtk.window.showtitle\n", show_title);
+            adw_header_bar_set_show_title(ADW_HEADER_BAR(sidebar_headerbar), FALSE);
+        }
+    } else {
+        adw_header_bar_set_show_title(ADW_HEADER_BAR(headerbar), FALSE);
+    }
+    
     adw_toolbar_view_add_top_bar(ADW_TOOLBAR_VIEW(toolbar_view), headerbar);
     g_object_set_data(G_OBJECT(obj->widget), "ui_headerbar", headerbar);
     

mercurial