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

@ -21,16 +21,6 @@
EnableExtension and DisableExtension DBus methods on org.gnome.Shell.
</_description>
</key>
<key name="enable-app-monitoring" type="b">
<default>true</default>
<_summary>Whether to collect stats about applications usage</_summary>
<_description>
The shell normally monitors active applications in order to present
the most used ones (e.g. in launchers). While this data will be
kept private, you may want to disable this for privacy reasons.
Please note that doing so won't remove already saved data.
</_description>
</key>
<key name="favorite-apps" type="as">
<default>[ 'epiphany.desktop', 'evolution.desktop', 'empathy.desktop', 'rhythmbox.desktop', 'shotwell.desktop', 'libreoffice-writer.desktop', 'nautilus.desktop', 'gnome-documents.desktop' ]</default>
<_summary>List of desktop file IDs for favorite applications</_summary>

View File

@ -343,8 +343,9 @@ const AppDisplay = new Lang.Class({
global.settings.connect('changed::app-folder-categories', Lang.bind(this, function() {
Main.queueDeferredWork(this._allAppsWorkId);
}));
global.settings.connect('changed::enable-app-monitoring',
Lang.bind(this, this._updateFrequentVisibility));
this._privacySettings = new Gio.Settings({ schema: 'org.gnome.desktop.privacy' });
this._privacySettings.connect('changed::remember-app-usage',
Lang.bind(this, this._updateFrequentVisibility));
this._views = [];
@ -419,7 +420,7 @@ const AppDisplay = new Lang.Class({
},
_updateFrequentVisibility: function() {
let enabled = global.settings.get_boolean('enable-app-monitoring');
let enabled = this._privacySettings.get_boolean('remember-app-usage');
this._views[Views.FREQUENT].control.visible = enabled;
let visibleViews = this._views.filter(function(v) {

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 */