[yelp/wip/cdavis/hdywindow: 28/29] window: Always use headerbar




commit 6e9a451ef425037516feb6df36ec1e1bf2420975
Author: Christopher Davis <christopherdavis gnome org>
Date:   Wed Feb 17 12:33:17 2021 -0800

    window: Always use headerbar
    
    GNOME apps should generally always use the headerbar.

 src/yelp-window.c | 32 ++------------------------------
 1 file changed, 2 insertions(+), 30 deletions(-)
---
diff --git a/src/yelp-window.c b/src/yelp-window.c
index 0891ca45..3bf44d0e 100644
--- a/src/yelp-window.c
+++ b/src/yelp-window.c
@@ -181,8 +181,6 @@ struct _YelpWindowPrivate {
     gint height;
 
     gboolean configured;
-
-    gboolean use_header;
 };
 
 G_DEFINE_TYPE_WITH_PRIVATE (YelpWindow, yelp_window, GTK_TYPE_APPLICATION_WINDOW)
@@ -314,7 +312,6 @@ window_construct (YelpWindow *window)
     GtkSizeGroup *size_group;
     GMenu *menu, *section;
     YelpWindowPrivate *priv = yelp_window_get_instance_private (window);
-    GtkStyleContext *headerbar_context;
 
     const GActionEntry entries[] = {
         { "yelp-window-new",    action_new_window,   NULL, NULL, NULL },
@@ -327,10 +324,6 @@ window_construct (YelpWindow *window)
 
     gtk_window_set_icon_name (GTK_WINDOW (window), "org.gnome.Yelp");
 
-    g_object_get (gtk_settings_get_default (),
-                  "gtk-dialogs-use-header", &priv->use_header,
-                  NULL);
-
     priv->view = (YelpView *) yelp_view_new ();
 
     g_action_map_add_action_entries (G_ACTION_MAP (window),
@@ -341,16 +334,8 @@ window_construct (YelpWindow *window)
     gtk_container_add (GTK_CONTAINER (window), priv->vbox_full);
 
     priv->header = gtk_header_bar_new ();
-    if (priv->use_header) {
-        gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (priv->header), TRUE);
-        gtk_window_set_titlebar (GTK_WINDOW (window), priv->header);
-    } else {
-        headerbar_context = gtk_widget_get_style_context (GTK_WIDGET (priv->header));
-        gtk_container_add (GTK_CONTAINER (priv->vbox_full), GTK_WIDGET (priv->header));
-        gtk_style_context_remove_class (headerbar_context, "header-bar");
-        gtk_style_context_add_class (headerbar_context, GTK_STYLE_CLASS_TOOLBAR);
-        gtk_style_context_add_class (headerbar_context, GTK_STYLE_CLASS_PRIMARY_TOOLBAR);
-    }
+    gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (priv->header), TRUE);
+    gtk_window_set_titlebar (GTK_WINDOW (window), priv->header);
 
     /** Back/Forward **/
     box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
@@ -1201,15 +1186,6 @@ view_root_title (YelpView    *view,
     gchar *root_title, *page_title;
     g_object_get (view, "root-title", &root_title, "page-title", &page_title, NULL);
 
-    if (!priv->use_header) {
-        if (root_title)
-            gtk_window_set_title (GTK_WINDOW (window), root_title);
-        else
-            gtk_window_set_title (GTK_WINDOW (window), _("Help"));
-
-        goto out;
-    }
-
     if (page_title)
         gtk_header_bar_set_title (GTK_HEADER_BAR (priv->header), page_title);
     else
@@ -1219,10 +1195,6 @@ view_root_title (YelpView    *view,
         gtk_header_bar_set_subtitle (GTK_HEADER_BAR (priv->header), root_title);
     else
         gtk_header_bar_set_subtitle (GTK_HEADER_BAR (priv->header), NULL);
-
-out:
-    g_free (root_title);
-    g_free (page_title);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]