From d6b2677825cbb423e2099563c16321c3e23d7899 Mon Sep 17 00:00:00 2001 From: Alessandro Ghedini Date: Sun, 20 Nov 2011 15:50:38 +0100 Subject: Imported Upstream version 0.3.1 --- src/pies/defaultConfig.vala | 12 ++++++------ src/pies/load.vala | 2 +- src/pies/pieManager.vala | 21 +++++++++++++++++++-- 3 files changed, 26 insertions(+), 9 deletions(-) (limited to 'src/pies') diff --git a/src/pies/defaultConfig.vala b/src/pies/defaultConfig.vala index bd981b5..87fd30d 100644 --- a/src/pies/defaultConfig.vala +++ b/src/pies/defaultConfig.vala @@ -26,14 +26,14 @@ namespace Pies { public void create_default_config() { // add a pie with playback controls - var multimedia = PieManager.create_persistent_pie(_("Multimedia"), "stock_media-play", "m"); + var multimedia = PieManager.create_persistent_pie(_("Multimedia"), "stock_media-play", new Trigger.from_string("m")); multimedia.add_action(new KeyAction(_("Next Track"), "stock_media-next", "XF86AudioNext", true)); multimedia.add_action(new KeyAction(_("Stop"), "stock_media-stop", "XF86AudioStop")); multimedia.add_action(new KeyAction(_("Previous Track"), "stock_media-prev", "XF86AudioPrev")); multimedia.add_action(new KeyAction(_("Play/Pause"), "stock_media-play", "XF86AudioPlay")); // add a pie with the users default applications - var apps = PieManager.create_persistent_pie(_("Applications"), "applications-accessories", "a"); + var apps = PieManager.create_persistent_pie(_("Applications"), "applications-accessories", new Trigger.from_string("a")); apps.add_action(ActionRegistry.default_for_mime_type("text/plain")); apps.add_action(ActionRegistry.default_for_mime_type("audio/ogg")); apps.add_action(ActionRegistry.default_for_mime_type("video/ogg")); @@ -42,20 +42,20 @@ namespace Pies { apps.add_action(ActionRegistry.default_for_uri("mailto")); // add a pie with the users bookmarks and devices - var bookmarks = PieManager.create_persistent_pie(_("Bookmarks"), "user-bookmarks", "b"); + var bookmarks = PieManager.create_persistent_pie(_("Bookmarks"), "user-bookmarks", new Trigger.from_string("b")); bookmarks.add_group(new BookmarkGroup(bookmarks.id)); bookmarks.add_group(new DevicesGroup(bookmarks.id)); // add a pie with session controls - var session = PieManager.create_persistent_pie(_("Session"), "gnome-session-halt", "q"); + var session = PieManager.create_persistent_pie(_("Session"), "gnome-session-halt", new Trigger.from_string("q")); session.add_group(new SessionGroup(session.id)); // add a pie with a main menu - var menu = PieManager.create_persistent_pie(_("Main Menu"), "alacarte", "space"); + var menu = PieManager.create_persistent_pie(_("Main Menu"), "alacarte", new Trigger.from_string("space")); menu.add_group(new MenuGroup(menu.id)); // add a pie with window controls - var window = PieManager.create_persistent_pie(_("Window"), "gnome-window-manager", "w"); + var window = PieManager.create_persistent_pie(_("Window"), "gnome-window-manager", new Trigger.from_string("w")); window.add_action(new KeyAction(_("Scale"), "top", "s")); window.add_action(new KeyAction(_("Minimize"), "bottom", "F9", true)); window.add_action(new KeyAction(_("Close"), "window-close", "F4")); diff --git a/src/pies/load.vala b/src/pies/load.vala index 912ddf0..98fd72f 100644 --- a/src/pies/load.vala +++ b/src/pies/load.vala @@ -115,7 +115,7 @@ namespace Pies { } // add a new Pie with the loaded properties - var pie = PieManager.create_persistent_pie(name, icon, hotkey, id); + var pie = PieManager.create_persistent_pie(name, icon, new Trigger.from_string(hotkey), id); // and parse all child elements for (Xml.Node* slice = node->children; slice != null; slice = slice->next) { diff --git a/src/pies/pieManager.vala b/src/pies/pieManager.vala index eb031d0..5f84ea0 100644 --- a/src/pies/pieManager.vala +++ b/src/pies/pieManager.vala @@ -102,6 +102,14 @@ public class PieManager : GLib.Object { return bindings.get_accelerator_label_of(id); } + ///////////////////////////////////////////////////////////////////// + /// Returns true if the pie with the given id is in turbo mode. + ///////////////////////////////////////////////////////////////////// + + public static bool get_is_turbo(string id) { + return bindings.get_is_turbo(id); + } + ///////////////////////////////////////////////////////////////////// /// Returns the name of the Pie with the given ID. ///////////////////////////////////////////////////////////////////// @@ -112,15 +120,24 @@ public class PieManager : GLib.Object { else return pie.name; } + ///////////////////////////////////////////////////////////////////// + /// Returns the name ID of the Pie bound to the given Trigger. + /// Returns "" if there is nothing bound to this trigger. + ///////////////////////////////////////////////////////////////////// + + public static string get_assigned_id(Trigger trigger) { + return bindings.get_assigned_id(trigger); + } + ///////////////////////////////////////////////////////////////////// /// Creates a new Pie which is displayed in the configuration dialog /// and gets saved. ///////////////////////////////////////////////////////////////////// - public static Pie create_persistent_pie(string name, string icon_name, string hotkey, string? desired_id = null) { + public static Pie create_persistent_pie(string name, string icon_name, Trigger? hotkey, string? desired_id = null) { Pie pie = create_pie(name, icon_name, 100, 999, desired_id); - if (hotkey != "") bindings.bind(hotkey, pie.id); + if (hotkey != null) bindings.bind(hotkey, pie.id); create_launcher(pie.id); -- cgit v1.2.3