Make ShellAppMonitor and ShellAppSystem singletons, remove unused code in appDisplay
We shouldn't create multiple instances of either. Also remove a bit of unused code in appDisplay.
This commit is contained in:
@ -912,3 +912,19 @@ on_enable_monitoring_key_changed (GConfClient *client,
|
||||
{
|
||||
update_enable_monitoring ((ShellAppMonitor *) monitor);
|
||||
}
|
||||
|
||||
/**
|
||||
* shell_app_monitor_get_default:
|
||||
*
|
||||
* Return Value: (transfer none): The global #ShellAppMonitor instance
|
||||
*/
|
||||
ShellAppMonitor *
|
||||
shell_app_monitor_get_default ()
|
||||
{
|
||||
static ShellAppMonitor *instance;
|
||||
|
||||
if (instance == NULL)
|
||||
instance = g_object_new (SHELL_TYPE_APP_MONITOR, NULL);
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -299,3 +299,19 @@ shell_app_system_get_all_settings (ShellAppSystem *monitor)
|
||||
{
|
||||
return monitor->priv->cached_setting_ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user