[libhandy] header-group: Use any given decoration layout



commit 099c92ea227dc3c5a7952d2a610f6e2ba95c9567
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Tue Jul 7 14:13:40 2020 +0200

    header-group: Use any given decoration layout
    
    Make HdyHeaderGroup hold a layout string and use it instead of the one
    from the settings if it is set. This will be used in a later commit to
    nest header groups.

 src/hdy-header-group.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
---
diff --git a/src/hdy-header-group.c b/src/hdy-header-group.c
index 0a0c5aeb..f2bac5e2 100644
--- a/src/hdy-header-group.c
+++ b/src/hdy-header-group.c
@@ -37,6 +37,7 @@ struct _HdyHeaderGroup
 
   GSList *children;
   gboolean decorate_all;
+  gchar *layout;
 };
 
 static void hdy_header_group_buildable_init (GtkBuildableIface *iface);
@@ -244,7 +245,10 @@ update_decoration_layouts (HdyHeaderGroup *self)
     return;
 
   settings = gtk_settings_get_default ();
-  g_object_get (G_OBJECT (settings), "gtk-decoration-layout", &layout, NULL);
+  if (self->layout)
+    layout = g_strdup (self->layout);
+  else
+    g_object_get (G_OBJECT (settings), "gtk-decoration-layout", &layout, NULL);
   if (layout == NULL)
     layout = g_strdup (":");
 
@@ -408,6 +412,16 @@ hdy_header_group_dispose (GObject *object)
   G_OBJECT_CLASS (hdy_header_group_parent_class)->dispose (object);
 }
 
+static void
+hdy_header_group_finalize (GObject *object)
+{
+  HdyHeaderGroup *self = (HdyHeaderGroup *) object;
+
+  g_free (self->layout);
+
+  G_OBJECT_CLASS (hdy_header_group_parent_class)->finalize (object);
+}
+
 static void
 hdy_header_group_get_property (GObject    *object,
                                guint       prop_id,
@@ -674,6 +688,7 @@ hdy_header_group_class_init (HdyHeaderGroupClass *klass)
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
   object_class->dispose = hdy_header_group_dispose;
+  object_class->finalize = hdy_header_group_finalize;
   object_class->get_property = hdy_header_group_get_property;
   object_class->set_property = hdy_header_group_set_property;
 


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