beagle r4833 - in trunk/beagle: conf-data/config-files search/Beagle.Search tools
- From: dbera svn gnome org
- To: svn-commits-list gnome org
- Subject: beagle r4833 - in trunk/beagle: conf-data/config-files search/Beagle.Search tools
- Date: Mon, 14 Jul 2008 21:36:38 +0000 (UTC)
Author: dbera
Date: Mon Jul 14 21:36:38 2008
New Revision: 4833
URL: http://svn.gnome.org/viewvc/beagle?rev=4833&view=rev
Log:
Fix some loose ends in the keygrabber.
Modified:
trunk/beagle/conf-data/config-files/BeagleSearch.xml
trunk/beagle/search/Beagle.Search/Search.cs
trunk/beagle/tools/Settings.cs
trunk/beagle/tools/keygrabber.py
Modified: trunk/beagle/conf-data/config-files/BeagleSearch.xml
==============================================================================
--- trunk/beagle/conf-data/config-files/BeagleSearch.xml (original)
+++ trunk/beagle/conf-data/config-files/BeagleSearch.xml Mon Jul 14 21:36:38 2008
@@ -6,6 +6,7 @@
<BoolOption Name="KeyBinding_Ctrl" Description="Use ctrl as key-modifier">false</BoolOption>
<BoolOption Name="KeyBinding_Alt" Description="Use alt as key-modifier">false</BoolOption>
<StringOption Name="KeyBinding_Key" Description="Shortcut key">F12</StringOption>
+ <!-- Remove the 3 KeyBinding_{Ctrl,Alt,Key} options when releasing 0.4.0 - they are deprecated in favour of KeyBinding -->
<StringOption Name="KeyBinding" Description="Shortcut key (including modifiers)"></StringOption>
<StringOption Name="BeaglePosX" Description=""></StringOption>
<StringOption Name="BeaglePosY" Description=""></StringOption>
Modified: trunk/beagle/search/Beagle.Search/Search.cs
==============================================================================
--- trunk/beagle/search/Beagle.Search/Search.cs (original)
+++ trunk/beagle/search/Beagle.Search/Search.cs Mon Jul 14 21:36:38 2008
@@ -46,7 +46,17 @@
Config config = Conf.Get (Conf.Names.BeagleSearchConfig);
string tip_text = Catalog.GetString ("Desktop Search");
- string binding = config.GetOption ("KeyBinding", "F12");
+ 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);
Modified: trunk/beagle/tools/Settings.cs
==============================================================================
--- trunk/beagle/tools/Settings.cs (original)
+++ trunk/beagle/tools/Settings.cs Mon Jul 14 21:36:38 2008
@@ -719,17 +719,22 @@
if (! File.Exists (keygrabber_file))
throw new Exception ("keygrabber.py not found");
- pc.Arguments = new string[] {"python", keygrabber_file};
+ pc.Arguments = new string[] {"python", keygrabber_file, ExternalStringsHack.LocaleDir};
pc.RedirectStandardError = false;
pc.RedirectStandardOutput = true;
pc.Start ();
- string output;
+ string output = null;
using (StreamReader pout = new StreamReader (pc.StandardOutput))
output = pout.ReadLine ();
pc.Close ();
- Console.WriteLine ("New binding '{0}'", output);
+ // We can't check the return value of the program.
+ // Instead we this to figure out if the program worked correctly.
+ if (output == null)
+ throw new ApplicationException ();
+
+ Console.WriteLine ("New binding from keygrabber '{0}'", output);
return output;
}
Modified: trunk/beagle/tools/keygrabber.py
==============================================================================
--- trunk/beagle/tools/keygrabber.py (original)
+++ trunk/beagle/tools/keygrabber.py Mon Jul 14 21:36:38 2008
@@ -22,6 +22,7 @@
# Christopher Williams (christopherw verizon net)
# Copyright (C) 2007 Quinn Storm
+import sys
import pygtk
import gtk
import gtk.gdk
@@ -29,6 +30,7 @@
pygtk.require('2.0')
import gtk
import time
+import gettext
KeyModifier = ["Shift", "Control", "Mod1", "Mod2", "Mod3", "Mod4",
"Mod5", "Alt", "Meta", "Super", "Hyper", "ModeSwitch"]
@@ -57,6 +59,8 @@
self.button.set_no_show_all(True)
self.button.connect('changed', self.GotKey)
+ self.shortcut = ""
+
# This packs the button into the window (a GTK container).
self.window.add(self.button)
@@ -67,14 +71,13 @@
self.window.show()
def GotKey(self, widget, key, mods):
- new = gtk.accelerator_name (key, mods)
+ self.shortcut = gtk.accelerator_name (key, mods)
for mod in KeyModifier:
- if "%s_L" % mod in new:
- new = new.replace ("%s_L" % mod, "<%s>" % mod)
- if "%s_R" % mod in new:
- new = new.replace ("%s_R" % mod, "<%s>" % mod)
+ if "%s_L" % mod in self.shortcut:
+ self.shortcut = self.shortcut.replace ("%s_L" % mod, "<%s>" % mod)
+ if "%s_R" % mod in self.shortcut:
+ self.shortcut = self.shortcut.replace ("%s_R" % mod, "<%s>" % mod)
- print new
gtk.main_quit()
def main(self):
@@ -194,6 +197,12 @@
gtk.main_iteration ()
if __name__ == "__main__":
- window = GrabberWindow()
- window.main()
+ if len (sys.argv) == 2:
+ gettext.install ('beagle', sys.argv [1])
+ else:
+ gettext.install ('beagle')
+ window = GrabberWindow ()
+ window.main ()
+ # print the shortcut if the program successfully runs
+ print window.shortcut
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]