Commit 2e66f420 authored by Matthias Clasen's avatar Matthias Clasen

Propagate needs-attention

Add the .needs-attention style class to tabs whose pages have
GtkStack::needs-attention set to TRUE.
parent e82f0f51
......@@ -382,6 +382,34 @@ gtk_tab_strip_child_position_changed (GtkTabStrip *self,
NULL);
}
static void
gtk_tab_strip_child_needs_attention_changed (GtkTabStrip *self,
GParamSpec *pspec,
GtkWidget *child)
{
GtkWidget *parent;
GtkWidget *tab;
gboolean needs_attention;
GtkStyleContext *context;
tab = g_object_get_data (G_OBJECT (child), "GTK_TAB");
if (!tab || !GTK_IS_TAB (tab))
return;
parent = gtk_widget_get_parent (child);
gtk_container_child_get (GTK_CONTAINER (parent), GTK_WIDGET (child),
"needs-attention", &needs_attention,
NULL);
context = gtk_widget_get_style_context (tab);
if (needs_attention)
gtk_style_context_add_class (context, GTK_STYLE_CLASS_NEEDS_ATTENTION);
else
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_NEEDS_ATTENTION);
}
static void
gtk_tab_strip_child_title_changed (GtkTabStrip *self,
GParamSpec *pspec,
......@@ -522,6 +550,10 @@ gtk_tab_strip_stack_add (GtkTabStrip *self,
G_CALLBACK (gtk_tab_strip_child_title_changed), self,
G_CONNECT_SWAPPED);
g_signal_connect_object (widget, "child-notify::needs-attention",
G_CALLBACK (gtk_tab_strip_child_needs_attention_changed), self,
G_CONNECT_SWAPPED);
gtk_box_pack_start (GTK_BOX (priv->tabs), GTK_WIDGET (tab), TRUE, TRUE, 0);
g_object_bind_property (widget, "visible", tab, "visible", G_BINDING_SYNC_CREATE);
......
Markdown is supported
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