From 60560a030fda3c539ff9dc1563b9926414a193da Mon Sep 17 00:00:00 2001 From: Alessandro Ghedini Date: Sat, 21 Jan 2012 19:07:09 +0100 Subject: Imported Upstream version 0.4.0 --- src/utilities/trigger.vala | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) (limited to 'src/utilities/trigger.vala') diff --git a/src/utilities/trigger.vala b/src/utilities/trigger.vala index 1f6fcfe..4b6167b 100644 --- a/src/utilities/trigger.vala +++ b/src/utilities/trigger.vala @@ -80,6 +80,12 @@ public class Trigger : GLib.Object { public bool delayed { get; private set; default=false; } + ///////////////////////////////////////////////////////////////////// + /// True if the pie opens in the middle of the screen. + ///////////////////////////////////////////////////////////////////// + + public bool centered { get; private set; default=false; } + ///////////////////////////////////////////////////////////////////// /// C'tor, creates a new, "unbound" Trigger. ///////////////////////////////////////////////////////////////////// @@ -93,7 +99,7 @@ public class Trigger : GLib.Object { /// in this format: "[option(s)]button" where /// "" is something like "" or "", "button" /// something like "s", "F4" or "button0" and "[option]" is either - /// "[turbo]" or "["delayed"]". + /// "[turbo]", "[centered]" or "["delayed"]". ///////////////////////////////////////////////////////////////////// public Trigger.from_string(string trigger) { @@ -105,9 +111,12 @@ public class Trigger : GLib.Object { ///////////////////////////////////////////////////////////////////// public Trigger.from_values(uint key_sym, Gdk.ModifierType modifiers, - bool with_mouse, bool turbo, bool delayed ) { + bool with_mouse, bool turbo, bool delayed, + bool centered ) { - string trigger = (turbo ? "[turbo]" : "") + (delayed ? "[delayed]" : ""); + string trigger = (turbo ? "[turbo]" : "") + + (delayed ? "[delayed]" : "") + + (centered ? "[centered]" : ""); if (with_mouse) { trigger += Gtk.accelerator_name(0, modifiers) + "button%u".printf(key_sym); @@ -123,7 +132,7 @@ public class Trigger : GLib.Object { /// in this format: "[option(s)]button" where /// "" is something like "" or "", "button" /// something like "s", "F4" or "button0" and "[option]" is either - /// "[turbo]" or "["delayed"]". + /// "[turbo]", "[centered]" or "["delayed"]". ///////////////////////////////////////////////////////////////////// public void parse_string(string trigger) { @@ -135,10 +144,12 @@ public class Trigger : GLib.Object { this.turbo = check_string.contains("[turbo]"); this.delayed = check_string.contains("[delayed]"); + this.centered = check_string.contains("[centered]"); // remove optional arguments check_string = check_string.replace("[turbo]", ""); check_string = check_string.replace("[delayed]", ""); + check_string = check_string.replace("[centered]", ""); int button = this.get_mouse_button(check_string); if (button > 0) { @@ -177,12 +188,20 @@ public class Trigger : GLib.Object { this.label_with_specials = this.label; - if (this.turbo && this.delayed) - this.label_with_specials += ("\n" + _("Turbo") + " | " + _("Delayed") + ""); + if (this.turbo && this.delayed && this.centered) + this.label_with_specials += (" [ " + _("Turbo") + " | " + _("Delayed") + " | " + _("Centered") + " ]"); + else if (this.turbo && this.centered) + this.label_with_specials += (" [ " + _("Turbo") + " | " + _("Centered") + " ]"); + else if (this.turbo && this.delayed) + this.label_with_specials += (" [ " + _("Turbo") + " | " + _("Delayed") + " ]"); + else if (this.centered && this.delayed) + this.label_with_specials += (" [ " + _("Delayed") + " | " + _("Centered") + " ]"); else if (this.turbo) - this.label_with_specials += ("\n" + _("Turbo") + ""); + this.label_with_specials += (" [ " + _("Turbo") + " ]"); else if (this.delayed) - this.label_with_specials += ("\n" + _("Delayed") + ""); + this.label_with_specials += (" [ " + _("Delayed") + " ]"); + else if (this.centered) + this.label_with_specials += (" [ " + _("Centered") + " ]"); } else { this.set_unbound(); @@ -216,6 +235,7 @@ public class Trigger : GLib.Object { // remove optional arguments check_string = check_string.replace("[turbo]", ""); check_string = check_string.replace("[delayed]", ""); + check_string = check_string.replace("[centered]", ""); if (this.get_mouse_button(check_string) > 0) { // it seems to be a valid mouse-trigger so replace button part, -- cgit v1.2.3