Make ShellAppMonitor and ShellAppSystem singletons
This commit is contained in:
parent
275eba17db
commit
d7dcfe6a06
@ -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:
|
||||
*
|
||||
|
@ -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,
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user