[libdazzle] panel: avoid extra add/remove of needs-attention class
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libdazzle] panel: avoid extra add/remove of needs-attention class
- Date: Tue, 9 Jul 2019 01:34:36 +0000 (UTC)
commit ee0329baec76e26c96f7bc22f447d6358f03c9c0
Author: Christian Hergert <chergert redhat com>
Date: Mon Jul 8 18:34:26 2019 -0700
panel: avoid extra add/remove of needs-attention class
src/panel/dzl-tab-strip.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/panel/dzl-tab-strip.c b/src/panel/dzl-tab-strip.c
index 75a7ff7..5f892a3 100644
--- a/src/panel/dzl-tab-strip.c
+++ b/src/panel/dzl-tab-strip.c
@@ -453,6 +453,7 @@ dzl_tab_strip_child_needs_attention (DzlTab *tab,
GParamSpec *pspec,
GtkWidget *child)
{
+ GtkStyleContext *style_context;
GtkWidget *parent;
gboolean needs_attention;
@@ -464,10 +465,15 @@ dzl_tab_strip_child_needs_attention (DzlTab *tab,
"needs-attention", &needs_attention,
NULL);
- if (needs_attention)
- dzl_gtk_widget_add_style_class (GTK_WIDGET (tab), "needs-attention");
- else
- dzl_gtk_widget_remove_style_class (GTK_WIDGET (tab), "needs-attention");
+ style_context = gtk_widget_get_style_context (GTK_WIDGET (tab));
+
+ if (needs_attention != gtk_style_context_has_class (style_context, "needs-attention"))
+ {
+ if (needs_attention)
+ gtk_style_context_add_class (style_context, "needs-attention");
+ else
+ gtk_style_context_remove_class (style_context, "needs-attention");
+ }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]