[tomboy] Fix background rendering of the Text menu, mainly for Windows



commit fe1317e852491a92bf1a026f558d74c0702d0470
Author: Aaron Bockover <abockover novell com>
Date:   Fri Apr 24 18:09:38 2009 -0400

    Fix background rendering of the Text menu, mainly for Windows
    
    This patch introduces an internal Gtk.Menu and listens to its StyleSet event, setting the internal Gtk.Menu background style to the derived Text Menu, working around a Gtk bug that results in improper styling of derived Menu and MenuItem classes.
---
 Tomboy/NoteWindow.cs |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/Tomboy/NoteWindow.cs b/Tomboy/NoteWindow.cs
index 7001f15..d103691 100644
--- a/Tomboy/NoteWindow.cs
+++ b/Tomboy/NoteWindow.cs
@@ -1184,6 +1184,12 @@ namespace Tomboy
 		Gtk.ImageMenuItem increase_indent;
 		Gtk.ImageMenuItem decrease_indent;
 
+		// There is a bug in GTK+ that lends to improperly themed Menus
+		// and MenuItems when you derive from one of those classes; this
+		// is an internal Menu that sits around to provide proper theme
+		// information to override on this derived Menu
+		Gtk.Menu theme_hack_menu;
+
 		// Active when the text size is indeterminable, such as when in
 		// the note's title line.
 		Gtk.RadioMenuItem hidden_no_size;
@@ -1363,6 +1369,12 @@ namespace Tomboy
 			Append (increase_indent);
 			Append (decrease_indent);
 			ShowAll ();
+
+			theme_hack_menu = new Menu ();
+			theme_hack_menu.Realize ();
+			theme_hack_menu.StyleSet += delegate {
+				ModifyBg (StateType.Normal, theme_hack_menu.Style.Background (StateType.Normal));
+			};
 		}
 
 		protected override void OnShown ()



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