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/actionGroups/groupRegistry.vala | 86 ++++++++++++++++++------------------- 1 file changed, 43 insertions(+), 43 deletions(-) (limited to 'src/actionGroups/groupRegistry.vala') diff --git a/src/actionGroups/groupRegistry.vala b/src/actionGroups/groupRegistry.vala index a9f8d06..7510a03 100644 --- a/src/actionGroups/groupRegistry.vala +++ b/src/actionGroups/groupRegistry.vala @@ -27,67 +27,67 @@ public class GroupRegistry : GLib.Object { /// A list containing all available ActionGroup types. ///////////////////////////////////////////////////////////////////// - public static Gee.ArrayList types { get; private set; } + public static Gee.ArrayList types { get; private set; } ///////////////////////////////////////////////////////////////////// - /// Three maps associating a displayable name for each ActionGroup, + /// A map associating a displayable name for each ActionGroup, /// an icon name and a name for the pies.conf file with it's type. ///////////////////////////////////////////////////////////////////// - public static Gee.HashMap names { get; private set; } - public static Gee.HashMap icons { get; private set; } - public static Gee.HashMap settings_names { get; private set; } + public static Gee.HashMap descriptions { get; private set; } + + public class TypeDescription { + public string name { get; set; default=""; } + public string icon { get; set; default=""; } + public string description { get; set; default=""; } + public string id { get; set; default=""; } + } ///////////////////////////////////////////////////////////////////// /// Registers all ActionGroup types. ///////////////////////////////////////////////////////////////////// public static void init() { - types = new Gee.ArrayList(); + types = new Gee.ArrayList(); + descriptions = new Gee.HashMap(); - names = new Gee.HashMap(); - icons = new Gee.HashMap(); - settings_names = new Gee.HashMap(); - - string name = ""; - string icon = ""; - string settings_name = ""; + TypeDescription type_description; - BookmarkGroup.register(out name, out icon, out settings_name); - types.add(typeof(BookmarkGroup)); - names.set(typeof(BookmarkGroup), name); - icons.set(typeof(BookmarkGroup), icon); - settings_names.set(typeof(BookmarkGroup), settings_name); + type_description = BookmarkGroup.register(); + types.add(typeof(BookmarkGroup).name()); + descriptions.set(typeof(BookmarkGroup).name(), type_description); - DevicesGroup.register(out name, out icon, out settings_name); - types.add(typeof(DevicesGroup)); - names.set(typeof(DevicesGroup), name); - icons.set(typeof(DevicesGroup), icon); - settings_names.set(typeof(DevicesGroup), settings_name); + type_description = DevicesGroup.register(); + types.add(typeof(DevicesGroup).name()); + descriptions.set(typeof(DevicesGroup).name(), type_description); - MenuGroup.register(out name, out icon, out settings_name); - types.add(typeof(MenuGroup)); - names.set(typeof(MenuGroup), name); - icons.set(typeof(MenuGroup), icon); - settings_names.set(typeof(MenuGroup), settings_name); + type_description = MenuGroup.register(); + types.add(typeof(MenuGroup).name()); + descriptions.set(typeof(MenuGroup).name(), type_description); - SessionGroup.register(out name, out icon, out settings_name); - types.add(typeof(SessionGroup)); - names.set(typeof(SessionGroup), name); - icons.set(typeof(SessionGroup), icon); - settings_names.set(typeof(SessionGroup), settings_name); + type_description = SessionGroup.register(); + types.add(typeof(SessionGroup).name()); + descriptions.set(typeof(SessionGroup).name(), type_description); - WindowListGroup.register(out name, out icon, out settings_name); - types.add(typeof(WindowListGroup)); - names.set(typeof(WindowListGroup), name); - icons.set(typeof(WindowListGroup), icon); - settings_names.set(typeof(WindowListGroup), settings_name); + type_description = WindowListGroup.register(); + types.add(typeof(WindowListGroup).name()); + descriptions.set(typeof(WindowListGroup).name(), type_description); + } + + ///////////////////////////////////////////////////////////////////// + /// Creates a Group for a given type name. + ///////////////////////////////////////////////////////////////////// + + public static ActionGroup? create_group(string type_id, string parent_id) { + switch (type_id) { + case "bookmarks": return new BookmarkGroup(parent_id); + case "devices": return new DevicesGroup(parent_id); + case "menu": return new MenuGroup(parent_id); + case "session": return new SessionGroup(parent_id); + case "window_list": return new WindowListGroup(parent_id); + } -// ClipboardGroup.register(out name, out icon, out settings_name); -// types.add(typeof(ClipboardGroup)); -// names.set(typeof(ClipboardGroup), name); -// icons.set(typeof(ClipboardGroup), icon); -// settings_names.set(typeof(ClipboardGroup), settings_name); + return null; } } -- cgit v1.2.3