diff --git a/src/shell-app-monitor.c b/src/shell-app-monitor.c index 2a5f439ef..9573cde82 100644 --- a/src/shell-app-monitor.c +++ b/src/shell-app-monitor.c @@ -260,6 +260,22 @@ shell_app_monitor_finalize (GObject *object) G_OBJECT_CLASS (shell_app_monitor_parent_class)->finalize(object); } +/** + * shell_app_monitor_get_default: + * + * Return Value: (transfer none): The global #ShellAppMonitor singleton + */ +ShellAppMonitor * +shell_app_monitor_get_default () +{ + static ShellAppMonitor *instance = NULL; + + if (instance == NULL) + instance = g_object_new (SHELL_TYPE_APP_Monitor, NULL); + + return instance; +} + /** * shell_app_monitor_get_most_used_apps: * diff --git a/src/shell-app-monitor.h b/src/shell-app-monitor.h index 7a808f1a0..f0cf8917e 100644 --- a/src/shell-app-monitor.h +++ b/src/shell-app-monitor.h @@ -33,7 +33,7 @@ struct _ShellAppMonitorClass GType shell_app_monitor_get_type (void) G_GNUC_CONST; -ShellAppMonitor* shell_app_monitor_new(void); +ShellAppMonitor* shell_app_monitor_get_default(void); /* Get the most popular applications for a given activity */ GSList *shell_app_monitor_get_most_used_apps (ShellAppMonitor *monitor, diff --git a/src/shell-app-system.c b/src/shell-app-system.c index 882938922..6ba92fb8e 100644 --- a/src/shell-app-system.c +++ b/src/shell-app-system.c @@ -115,6 +115,22 @@ shell_app_system_finalize (GObject *object) G_OBJECT_CLASS (shell_app_system_parent_class)->finalize(object); } +/** + * shell_app_system_get_default: + * + * Return Value: (transfer none): The global #ShellAppSystem singleton + */ +ShellAppSystem * +shell_app_system_get_default () +{ + static ShellAppSystem *instance = NULL; + + if (instance == NULL) + instance = g_object_new (SHELL_TYPE_APP_SYSTEM, NULL); + + return instance; +} + static void reread_directories (ShellAppSystem *self, GSList **cache, GMenuTree *tree) { diff --git a/src/shell-app-system.h b/src/shell-app-system.h index cbd2d2e37..2bdd5971d 100644 --- a/src/shell-app-system.h +++ b/src/shell-app-system.h @@ -29,7 +29,7 @@ struct _ShellAppSystemClass }; GType shell_app_system_get_type (void) G_GNUC_CONST; -ShellAppSystem* shell_app_system_new(void); +ShellAppSystem* shell_app_system_get_default(void); GSList *shell_app_system_get_applications_for_menu (ShellAppSystem *system, const char *menu);