[gtk+/gtk-3-0] notebook: Only reset style on tab labels when it actually changes
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-0] notebook: Only reset style on tab labels when it actually changes
- Date: Sun, 27 Mar 2011 00:16:59 +0000 (UTC)
commit 5d3c52c60e2a3369b362c266be161b1062194add
Author: Benjamin Otte <otte redhat com>
Date: Sat Mar 26 17:00:36 2011 +0100
notebook: Only reset style on tab labels when it actually changes
gtk/gtknotebook.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 9158788..5f7bddf 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -6286,6 +6286,9 @@ gtk_notebook_update_tab_states (GtkNotebook *notebook)
{
GtkNotebookPrivate *priv = notebook->priv;
GList *list;
+ int pos;
+
+ pos = gtk_widget_path_length (gtk_widget_get_path (GTK_WIDGET (notebook))) - 1;
for (list = priv->children; list != NULL; list = list->next)
{
@@ -6293,12 +6296,21 @@ gtk_notebook_update_tab_states (GtkNotebook *notebook)
if (page->tab_label)
{
+ GtkRegionFlags current_flags;
+
if (page == priv->cur_page)
gtk_widget_set_state_flags (page->tab_label, GTK_STATE_FLAG_ACTIVE, FALSE);
else
gtk_widget_unset_state_flags (page->tab_label, GTK_STATE_FLAG_ACTIVE);
- gtk_widget_reset_style (page->tab_label);
+ /* FIXME: We should store these flags somewhere instead of poking
+ * the widget's path */
+ if (!gtk_widget_path_iter_has_region (gtk_widget_get_path (page->tab_label),
+ pos,
+ GTK_STYLE_REGION_TAB,
+ ¤t_flags)
+ || current_flags != _gtk_notebook_get_tab_flags (notebook, page))
+ gtk_widget_reset_style (page->tab_label);
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]