[glade3] * gladeui/glade-inspector.c: Updated to use GtkStyleContext to set the italic & insensitive color



commit 528a0975c7d1cb34ae0e9065d53d06817bc66dbe
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Fri Jan 7 18:59:58 2011 +0900

    	* gladeui/glade-inspector.c: Updated to use GtkStyleContext to set the italic &
    	insensitive color for the < search widgets > entry.

 ChangeLog                 |    5 +++++
 gladeui/glade-inspector.c |   22 ++++++++++++++--------
 2 files changed, 19 insertions(+), 8 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 403b206..07e990c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2011-01-06  Tristan Van Berkom <tristanvb openismus com>
 
+	* gladeui/glade-inspector.c: Updated to use GtkStyleContext to set the italic &
+	insensitive color for the < search widgets > entry.
+
+2011-01-06  Tristan Van Berkom <tristanvb openismus com>
+
 	* gladeui/glade-signal.c: Fixed glade_signal_load() careless mistake after GObjectifying.
 
 2011-01-06  Tristan Van Berkom <tristanvb openismus com>
diff --git a/gladeui/glade-inspector.c b/gladeui/glade-inspector.c
index 42ef71c..8787f21 100644
--- a/gladeui/glade-inspector.c
+++ b/gladeui/glade-inspector.c
@@ -349,11 +349,12 @@ search_entry_key_press_event_cb (GtkEntry * entry,
 static void
 widget_font_desc_set_style (GtkWidget * widget, PangoStyle style)
 {
-  PangoFontDescription *font_desc =
-      pango_font_description_copy (gtk_widget_get_style (widget)->font_desc);
+  GtkStyleContext *context = gtk_widget_get_style_context (widget);
+  PangoFontDescription *font_desc = 
+    pango_font_description_copy (gtk_style_context_get_font (context, GTK_STATE_FLAG_NORMAL));
 
   pango_font_description_set_style (font_desc, style);
-  gtk_widget_modify_font (widget, font_desc);
+  gtk_widget_override_font (widget, font_desc);
   pango_font_description_free (font_desc);
 }
 
@@ -373,12 +374,16 @@ search_entry_update (GladeInspector * inspector)
 
   if (str[0] == '\0')
     {
+      GtkStyleContext *context;
+      GdkRGBA          color;
+
       priv->search_disabled = TRUE;
       widget_font_desc_set_style (priv->entry, PANGO_STYLE_ITALIC);
       gtk_entry_set_text (GTK_ENTRY (priv->entry), _("< search widgets >"));
-      gtk_widget_modify_text (priv->entry, GTK_STATE_NORMAL,
-                              &gtk_widget_get_style (priv->entry)->
-                              text[GTK_STATE_INSENSITIVE]);
+
+      context = gtk_widget_get_style_context (priv->entry);
+      gtk_style_context_get_color (context, GTK_STATE_FLAG_INSENSITIVE, &color);
+      gtk_widget_override_color (priv->entry, GTK_STATE_FLAG_NORMAL, &color);
     }
 }
 
@@ -391,8 +396,9 @@ search_entry_focus_in_cb (GtkWidget * entry,
   if (priv->search_disabled)
     {
       gtk_entry_set_text (GTK_ENTRY (priv->entry), "");
-      gtk_widget_modify_text (priv->entry, GTK_STATE_NORMAL, NULL);
-      gtk_widget_modify_font (priv->entry, NULL);
+      gtk_widget_override_color (priv->entry, GTK_STATE_NORMAL, NULL);
+      gtk_widget_override_font (priv->entry, NULL);
+
       priv->search_disabled = FALSE;
     }
 



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