Commit d3b2c48a authored by Adrien Plazas's avatar Adrien Plazas
Browse files

header-group: Guard the focused header bar setter

Better guard the focused header bar setter by checking that the set
header bar actually is one and is part of the group.
parent 598ae218
......@@ -41,6 +41,22 @@ enum {
static GParamSpec *props [N_PROPS];
static gboolean
contains (HdyHeaderGroup *self,
GtkHeaderBar *header_bar)
HdyHeaderGroupPrivate *priv;
GSList *header_bars;
priv = hdy_header_group_get_instance_private (self);
for (header_bars = priv->header_bars; header_bars != NULL; header_bars = header_bars->next)
if (header_bars->data == header_bar)
return TRUE;
return FALSE;
static void
update_decoration_layouts (HdyHeaderGroup *self)
......@@ -165,6 +181,8 @@ hdy_header_group_set_focus (HdyHeaderGroup *self,
HdyHeaderGroupPrivate *priv;
g_return_if_fail (HDY_IS_HEADER_GROUP (self));
g_return_if_fail (header_bar == NULL || GTK_IS_HEADER_BAR (header_bar));
g_return_if_fail (header_bar == NULL || contains (self, header_bar));
priv = hdy_header_group_get_instance_private (self);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment