Replace 'enable-app-monitoring' setting

The org.gnome.desktop.privacy schema gained a 'remember-app-usage'
key, use that instead of our own preference.

https://bugzilla.gnome.org/show_bug.cgi?id=699714
This commit is contained in:
Florian Müllner
2013-03-02 00:56:18 +01:00
parent f88d9c06f5
commit 731e8bfe2b
3 changed files with 14 additions and 26 deletions

View File

@ -39,7 +39,8 @@
* minutes to signify idle.
*/
#define ENABLE_MONITORING_KEY "enable-app-monitoring"
#define PRIVACY_SCHEMA "org.gnome.desktop.privacy"
#define ENABLE_MONITORING_KEY "remember-app-usage"
#define FOCUS_TIME_MIN_SECONDS 7 /* Need 7 continuous seconds of focus */
@ -82,10 +83,10 @@ struct _ShellAppUsage
GFile *configfile;
GDBusProxy *session_proxy;
GdkDisplay *display;
GSettings *privacy_settings;
gulong last_idle;
guint idle_focus_change_id;
guint save_id;
guint settings_notify;
gboolean currently_idle;
gboolean enable_monitoring;
@ -426,25 +427,23 @@ shell_app_usage_init (ShellAppUsage *self)
restore_from_file (self);
self->settings_notify = g_signal_connect (shell_global_get_settings (global),
"changed::" ENABLE_MONITORING_KEY,
G_CALLBACK (on_enable_monitoring_key_changed),
self);
self->privacy_settings = g_settings_new(PRIVACY_SCHEMA);
g_signal_connect (self->privacy_settings,
"changed::" ENABLE_MONITORING_KEY,
G_CALLBACK (on_enable_monitoring_key_changed),
self);
update_enable_monitoring (self);
}
static void
shell_app_usage_finalize (GObject *object)
{
ShellGlobal *global;
ShellAppUsage *self = SHELL_APP_USAGE (object);
if (self->save_id > 0)
g_source_remove (self->save_id);
global = shell_global_get ();
g_signal_handler_disconnect (shell_global_get_settings (global),
self->settings_notify);
g_object_unref (self->privacy_settings);
g_object_unref (self->configfile);
@ -956,11 +955,9 @@ out:
static void
update_enable_monitoring (ShellAppUsage *self)
{
ShellGlobal *global;
gboolean enable;
global = shell_global_get ();
enable = g_settings_get_boolean (shell_global_get_settings (global),
enable = g_settings_get_boolean (self->privacy_settings,
ENABLE_MONITORING_KEY);
/* Be sure not to start the timers if they were already set */