Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
DISCONTINUED:openSUSE:11.1:Update
beagle
beagle-hotkey-instant.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File beagle-hotkey-instant.patch of Package beagle
Index: search/Beagle.Search.Tray/TrayIcon.cs =================================================================== --- search/Beagle.Search.Tray/TrayIcon.cs (revision 4861) +++ search/Beagle.Search.Tray/TrayIcon.cs (revision 4862) @@ -27,6 +27,7 @@ public event EventHandler Clicked; public SearchDelegate Search; + public event EventHandler Quit; public TrayIcon () { @@ -124,7 +125,8 @@ private void OnQuit (object sender, EventArgs args) { - Application.Quit (); + if (Quit != null) + Quit (sender, args); } private void OnClear (object sender, EventArgs args) Index: search/Beagle.Search/Search.cs =================================================================== --- search/Beagle.Search/Search.cs (revision 4861) +++ search/Beagle.Search/Search.cs (revision 4862) @@ -21,7 +21,7 @@ // The reference count is only valid when // we don't run in icon mode. - private uint ref_count = 0; + private int ref_count = 0; private bool icon_enabled = false; private bool docs_enabled = false; @@ -42,29 +42,15 @@ tray = new TrayIcon (); tray.Clicked += OnTrayActivated; tray.Search += OnTraySearch; + tray.Quit += OnTrayQuit; Config config = Conf.Get (Conf.Names.BeagleSearchConfig); + keybinder = new XKeybinder (); + SetKeyBindings (config); - string tip_text = Catalog.GetString ("Desktop Search"); - string binding = config.GetOption ("KeyBinding", null); - - if (String.IsNullOrEmpty (binding)) { - // Move old preference value to new - bool binding_ctrl = config.GetOption (Conf.Names.KeyBinding_Ctrl, false); - bool binding_alt = config.GetOption (Conf.Names.KeyBinding_Alt, false); - string binding_key = config.GetOption (Conf.Names.KeyBinding_Key, "F12"); - KeyBinding show_binding = new KeyBinding (binding_key, binding_ctrl, binding_alt); - - binding = show_binding.ToString (); - } - - if (!String.IsNullOrEmpty (binding)) { - tip_text += String.Format (" ({0})", binding); - keybinder = new XKeybinder (); - keybinder.Bind (binding, OnTrayActivated); - } - - tray.TooltipText = tip_text; + Inotify.Start (); + Conf.WatchForUpdates(); + Conf.Subscribe (Conf.Names.BeagleSearchConfig, OnConfigurationChanged); } } @@ -87,12 +73,51 @@ } } + private void SetKeyBindings (Config config) + { + string tip_text = Catalog.GetString ("Desktop Search"); + string binding = config.GetOption ("KeyBinding", null); + Console.WriteLine ("new binding {0}", binding); + + if (String.IsNullOrEmpty (binding)) { + // Move old preference value to new + bool binding_ctrl = config.GetOption (Conf.Names.KeyBinding_Ctrl, false); + bool binding_alt = config.GetOption (Conf.Names.KeyBinding_Alt, false); + string binding_key = config.GetOption (Conf.Names.KeyBinding_Key, "F12"); + KeyBinding show_binding = new KeyBinding (binding_key, binding_ctrl, binding_alt); + + binding = show_binding.ToString (); + } + + if (!String.IsNullOrEmpty (binding)) { + tip_text += String.Format (" ({0})", binding); + keybinder.UnbindAll (); + keybinder.Bind (binding, OnTrayActivated); + } + + tray.TooltipText = tip_text; + } + private void OnWindowDeleteEvent (object o, Gtk.DeleteEventArgs args) { - if (--ref_count < 1) - Gtk.Application.Quit (); + Quit (); } + private void OnTrayQuit (object o, EventArgs args) + { + Quit (); + } + + private void Quit () + { + Console.WriteLine (ref_count); + if (--ref_count >= 1) + return; + + Inotify.Stop (); + Gtk.Application.Quit (); + } + private void OnTrayActivated (object o, EventArgs args) { if (! icon_window.Visible) { @@ -120,6 +145,11 @@ tray.AddSearch (query); } + private void OnConfigurationChanged (Config config) + { + SetKeyBindings (config); + } + public bool IconEnabled { get { return icon_enabled; } }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor