diff options
author | Alessandro Ghedini <al3xbio@gmail.com> | 2012-01-21 19:14:06 +0100 |
---|---|---|
committer | Alessandro Ghedini <al3xbio@gmail.com> | 2012-01-21 19:19:46 +0100 |
commit | c05883f47c498be4e11893e5178c5bc37ffd9f4a (patch) | |
tree | dbd3cd7ad3d7771405ad63af2f1e9d14d4ae5a35 /src/actionGroups/groupRegistry.vala | |
parent | 31539042f11bc210a29e923f45586779c3ad46b2 (diff) | |
parent | 60560a030fda3c539ff9dc1563b9926414a193da (diff) |
Merge commit 'upstream/0.4.0'
Diffstat (limited to 'src/actionGroups/groupRegistry.vala')
-rw-r--r-- | src/actionGroups/groupRegistry.vala | 86 |
1 files changed, 43 insertions, 43 deletions
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<Type> types { get; private set; } + public static Gee.ArrayList<string> 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<Type, string> names { get; private set; } - public static Gee.HashMap<Type, string> icons { get; private set; } - public static Gee.HashMap<Type, string> settings_names { get; private set; } + public static Gee.HashMap<string, TypeDescription?> 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<Type>(); + types = new Gee.ArrayList<string>(); + descriptions = new Gee.HashMap<string, TypeDescription?>(); - names = new Gee.HashMap<Type, string>(); - icons = new Gee.HashMap<Type, string>(); - settings_names = new Gee.HashMap<Type, string>(); - - 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; } } |