[gtk+] notebook: add a style for prelighted labels



commit 3437f83ff3bfb256f69122c6de1e24dd8424a60f
Author: William Jon McCann <william jon mccann gmail com>
Date:   Fri Jan 24 12:50:19 2014 -0500

    notebook: add a style for prelighted labels

 gtk/gtknotebook.c |   28 ++++++++++++++++++++++++++--
 1 files changed, 26 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 0a53236..0b0791d 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -3267,6 +3267,26 @@ gtk_notebook_button_release (GtkWidget      *widget,
 }
 
 static void
+update_prelight_tab (GtkNotebook     *notebook,
+                     GtkNotebookPage *page)
+{
+  GtkNotebookPrivate *priv = notebook->priv;
+
+  if (priv->prelight_tab == page)
+    return;
+
+  if (priv->prelight_tab && priv->prelight_tab->tab_label)
+    gtk_style_context_remove_class (gtk_widget_get_style_context (priv->prelight_tab->tab_label),
+                                    "prelight-page");
+
+  if (page && page->tab_label)
+    gtk_style_context_add_class (gtk_widget_get_style_context (page->tab_label),
+                                 "prelight-page");
+
+  priv->prelight_tab = page;
+}
+
+static void
 tab_prelight (GtkNotebook *notebook,
               GdkEvent    *event)
 {
@@ -3280,7 +3300,7 @@ tab_prelight (GtkNotebook *notebook,
       if ((tab == NULL && priv->prelight_tab != NULL) ||
           (tab != NULL && tab->data != priv->prelight_tab))
         {
-          priv->prelight_tab = tab == NULL ? NULL : tab->data;
+          update_prelight_tab (notebook, tab == NULL ? NULL : tab->data);
           gtk_notebook_redraw_tabs (notebook);
        }
     }
@@ -5034,7 +5054,7 @@ gtk_notebook_real_remove (GtkNotebook *notebook,
   if (priv->detached_tab == list->data)
     priv->detached_tab = NULL;
   if (priv->prelight_tab == list->data)
-    priv->prelight_tab = NULL;
+    update_prelight_tab (notebook, NULL);
   if (priv->switch_tab == list)
     priv->switch_tab = NULL;
 
@@ -7858,6 +7878,10 @@ gtk_notebook_set_tab_label (GtkNotebook *notebook,
     gtk_style_context_add_class (gtk_widget_get_style_context (page->tab_label),
                                 "active-page");
 
+  if (priv->prelight_tab == page)
+    gtk_style_context_add_class (gtk_widget_get_style_context (page->tab_label),
+                                 "prelight-page");
+
   if (priv->show_tabs && gtk_widget_get_visible (child))
     {
       gtk_widget_show (page->tab_label);


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