banshee r4012 - in trunk/banshee: . src/Clients/Nereid/Nereid



Author: gburt
Date: Wed May 28 20:55:42 2008
New Revision: 4012
URL: http://svn.gnome.org/viewvc/banshee?rev=4012&view=rev

Log:
2008-05-28  Gabriel Burt  <gabriel burt gmail com>

	* src/Clients/Nereid/Nereid/PlayerInterface.cs: Add the AccelGroup back as
	soon as the focus leaves the focused Gtk.Entry.  Fixes bug where if you
	searched, then click to select a track, and hit a keybinding, it wouldn't
	work until the second press.  Thanks to Jorge Castro for investigating.


Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Clients/Nereid/Nereid/PlayerInterface.cs

Modified: trunk/banshee/src/Clients/Nereid/Nereid/PlayerInterface.cs
==============================================================================
--- trunk/banshee/src/Clients/Nereid/Nereid/PlayerInterface.cs	(original)
+++ trunk/banshee/src/Clients/Nereid/Nereid/PlayerInterface.cs	Wed May 28 20:55:42 2008
@@ -433,16 +433,31 @@
 #region Gtk.Window Overrides
 
         private bool accel_group_active = true;
+
+        private void OnEntryFocusOutEvent (object o, FocusOutEventArgs args)
+        {
+            if (!accel_group_active) {
+                AddAccelGroup (ActionService.UIManager.AccelGroup);
+                accel_group_active = true;
+            }
+            last_focus_entry.FocusOutEvent -= OnEntryFocusOutEvent;
+            last_focus_entry = null;
+        }
         
+        private Widget last_focus_entry = null;
         protected override bool OnKeyPressEvent (Gdk.EventKey evnt)
         {
             bool focus_search = false;
             
-            if (Focus is Entry && (GtkUtilities.NoImportantModifiersAreSet () && 
+            if (Focus is Gtk.Entry && (GtkUtilities.NoImportantModifiersAreSet () && 
                 evnt.Key != Gdk.Key.Control_L && evnt.Key != Gdk.Key.Control_R)) {
                 if (accel_group_active) {
                     RemoveAccelGroup (ActionService.UIManager.AccelGroup);
                     accel_group_active = false;
+
+                    last_focus_entry = Focus;
+                    // Reinstate the AccelGroup as soon as the focus leaves the entry
+                    last_focus_entry.FocusOutEvent += OnEntryFocusOutEvent;
                  }
             } else {
                 if (!accel_group_active) {



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