[libhandy/wip/exalm/titlebar] header-bar: Add .titlebar style class by default



commit 04cea2ebb6c4af1c1e6a8dbeb7cd66aeef5c9e30
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Sat May 23 17:30:20 2020 +0500

    header-bar: Add .titlebar style class by default
    
    Remove it from HdyPreferencesWindow and the demo.
    
    Fixes https://gitlab.gnome.org/GNOME/libhandy/-/issues/247
    
    Signed-off-by: Alexander Mikhaylenko <alexm gnome org>

 examples/hdy-view-switcher-demo-window.ui | 3 ---
 src/hdy-header-bar.c                      | 5 +++++
 src/hdy-preferences-window.ui             | 3 ---
 3 files changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/examples/hdy-view-switcher-demo-window.ui b/examples/hdy-view-switcher-demo-window.ui
index 2ff813a2..d6cc82e9 100644
--- a/examples/hdy-view-switcher-demo-window.ui
+++ b/examples/hdy-view-switcher-demo-window.ui
@@ -19,9 +19,6 @@
             <property name="can_focus">False</property>
             <property name="show_close_button">True</property>
             <property name="title">HdyViewSwitcher Demo</property>
-            <style>
-              <class name="titlebar"/>
-            </style>
             <child type="title">
               <object class="HdyViewSwitcherTitle" id="switcher_title">
                 <property name="visible">True</property>
diff --git a/src/hdy-header-bar.c b/src/hdy-header-bar.c
index aceedda3..10b94b65 100644
--- a/src/hdy-header-bar.c
+++ b/src/hdy-header-bar.c
@@ -2248,6 +2248,7 @@ static void
 hdy_header_bar_init (HdyHeaderBar *self)
 {
   HdyHeaderBarPrivate *priv;
+  GtkStyleContext *context;
 
   priv = hdy_header_bar_get_instance_private (self);
 
@@ -2265,6 +2266,10 @@ hdy_header_bar_init (HdyHeaderBar *self)
   construct_label_box (self);
 
   priv->controller = hdy_window_handle_controller_new (GTK_WIDGET (self));
+
+  context = gtk_widget_get_style_context (GTK_WIDGET (self));
+  /* Ensure the widget has the titlebar style class. */
+  gtk_style_context_add_class (context, "titlebar");
 }
 
 static void
diff --git a/src/hdy-preferences-window.ui b/src/hdy-preferences-window.ui
index f8a87ed6..d43c6faf 100644
--- a/src/hdy-preferences-window.ui
+++ b/src/hdy-preferences-window.ui
@@ -19,9 +19,6 @@
             <property name="show_close_button">True</property>
             <property name="visible">True</property>
             <signal name="size-allocate" handler="header_bar_size_allocate_cb" swapped="yes"/>
-            <style>
-              <class name="titlebar"/>
-            </style>
             <child type="title">
               <object class="GtkStack" id="title_stack">
                 <property name="transition-type">crossfade</property>


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