[Xfce4-commits] <postler:master> Fix HintedEntry to no longer use modify_font in gtk3
Christian Dywan
noreply at xfce.org
Fri Jul 8 21:46:01 CEST 2011
Updating branch refs/heads/master
to d8c96225879852f0e368eecde435520f5e9b6d7b (commit)
from a36a9df5ab8e0b440b914ee6f1836fbb8210dcdc (commit)
commit d8c96225879852f0e368eecde435520f5e9b6d7b
Author: Lucas Baudin <xapantu at gmail.com>
Date: Fri Jul 8 12:30:53 2011 +0200
Fix HintedEntry to no longer use modify_font in gtk3
It's not only deprecated but actually stopped working.
Fixes: https://bugs.launchpad.net/postler/+bug/807451
postler/elementary-entry.vala | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/postler/elementary-entry.vala b/postler/elementary-entry.vala
index f6e4b5f..08070b1 100644
--- a/postler/elementary-entry.vala
+++ b/postler/elementary-entry.vala
@@ -14,9 +14,17 @@ namespace Elementary {
public class Entry : Gtk.Entry {
public string hint_string;
+#if HAVE_GTK3
+ Gdk.RGBA color_normal;
+ Gdk.RGBA color_grey;
+#endif
public Entry (string hint_string="") {
-
+#if HAVE_GTK3
+ color_normal = get_style_context ().get_color (Gtk.StateFlags.NORMAL);
+ color_grey = get_style_context ().get_color (Gtk.StateFlags.INSENSITIVE);
+ /* FIXME: connect to style change and update the colors */
+#endif
this.hint_string = hint_string;
this.hint ();
@@ -66,17 +74,23 @@ public class Entry : Gtk.Entry {
}
private void grey_out () {
-
+#if HAVE_GTK3
+ override_color (Gtk.StateFlags.NORMAL, color_grey);
+#else
var color = Gdk.Color ();
Gdk.Color.parse ("#999", out color);
this.modify_text (Gtk.StateType.NORMAL, color);
+#endif
this.modify_font (Pango.FontDescription.from_string ("italic"));
}
private void reset_font () {
-
+#if HAVE_GTK3
+ override_color (Gtk.StateFlags.NORMAL, color_normal);
+#else
this.modify_text (Gtk.StateType.NORMAL, null);
+#endif
this.modify_font (Pango.FontDescription.from_string ("normal"));
}
More information about the Xfce4-commits
mailing list