Skip to content

Commit

Permalink
Menu applet: don't show recent if it's disabled in privacy settings
Browse files Browse the repository at this point in the history
  • Loading branch information
clefebvre committed Nov 19, 2014
1 parent be778cb commit 249c626
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 91 deletions.
44 changes: 17 additions & 27 deletions cinnamon.pot
Expand Up @@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-11-18 15:22+0100\n"
"POT-Creation-Date: 2014-11-19 10:07+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -610,48 +610,38 @@ msgstr ""
msgid "Menu"
msgstr ""

#: files/usr/share/cinnamon/applets/menu@cinnamon.org/applet.js:1672
#: files/usr/share/cinnamon/applets/recent@cinnamon.org/applet.js:69
msgid "Recent file tracking is currently disabled system-wide."
msgstr ""

#: files/usr/share/cinnamon/applets/menu@cinnamon.org/applet.js:1683
#: files/usr/share/cinnamon/applets/recent@cinnamon.org/applet.js:74
msgid "Click here to enable"
msgstr ""

#: files/usr/share/cinnamon/applets/menu@cinnamon.org/applet.js:1732
#: files/usr/share/cinnamon/applets/menu@cinnamon.org/applet.js:1702
#: files/usr/share/cinnamon/applets/recent@cinnamon.org/applet.js:95
msgid "No recent documents"
msgstr ""

#: files/usr/share/cinnamon/applets/menu@cinnamon.org/applet.js:1945
#: files/usr/share/cinnamon/applets/menu@cinnamon.org/applet.js:1915
#: files/usr/lib/cinnamon-settings/modules/cs_keyboard.py:141
msgid "Lock screen"
msgstr ""

#: files/usr/share/cinnamon/applets/menu@cinnamon.org/applet.js:1946
#: files/usr/share/cinnamon/applets/menu@cinnamon.org/applet.js:1916
#: files/usr/lib/cinnamon-settings/modules/cs_power.py:9
msgid "Lock the screen"
msgstr ""

#: files/usr/share/cinnamon/applets/menu@cinnamon.org/applet.js:1973
#: files/usr/share/cinnamon/applets/menu@cinnamon.org/applet.js:1943
msgid "Logout"
msgstr ""

#: files/usr/share/cinnamon/applets/menu@cinnamon.org/applet.js:1974
#: files/usr/share/cinnamon/applets/menu@cinnamon.org/applet.js:1944
msgid "Leave the session"
msgstr ""

#: files/usr/share/cinnamon/applets/menu@cinnamon.org/applet.js:1988
#: files/usr/share/cinnamon/applets/menu@cinnamon.org/applet.js:1958
msgid "Quit"
msgstr ""

#: files/usr/share/cinnamon/applets/menu@cinnamon.org/applet.js:1989
#: files/usr/share/cinnamon/applets/menu@cinnamon.org/applet.js:1959
msgid "Shutdown the computer"
msgstr ""

#: files/usr/share/cinnamon/applets/menu@cinnamon.org/applet.js:2112
#: files/usr/share/cinnamon/applets/menu@cinnamon.org/applet.js:2082
msgid "Type to search..."
msgstr ""

Expand Down Expand Up @@ -968,6 +958,14 @@ msgstr[1] ""
msgid "Recent documents"
msgstr ""

#: files/usr/share/cinnamon/applets/recent@cinnamon.org/applet.js:69
msgid "Recent file tracking is currently disabled."
msgstr ""

#: files/usr/share/cinnamon/applets/recent@cinnamon.org/applet.js:74
msgid "Click here to enable it"
msgstr ""

#: files/usr/share/cinnamon/applets/removable-drives@cinnamon.org/applet.js:53
msgid "Removable drives"
msgstr ""
Expand Down Expand Up @@ -4690,14 +4688,6 @@ msgstr ""
msgid "Unchecking this allows the theme to set the icon"
msgstr ""

#. menu@cinnamon.org->settings-schema.json->show-recent->description
msgid "Show recent files"
msgstr ""

#. menu@cinnamon.org->settings-schema.json->show-recent->tooltip
msgid "Choose whether or not to show a recent file list in the menu."
msgstr ""

#. menu@cinnamon.org->settings-schema.json->hover-delay->description
msgid "Menu hover delay:"
msgstr ""
Expand Down
82 changes: 26 additions & 56 deletions files/usr/share/cinnamon/applets/menu@cinnamon.org/applet.js
Expand Up @@ -1027,7 +1027,6 @@ MyApplet.prototype = {

this.settings = new Settings.AppletSettings(this, "menu@cinnamon.org", instance_id);

this.settings.bindProperty(Settings.BindingDirection.IN, "show-recent", "showRecent", this._refreshPlacesAndRecent, null);
this.settings.bindProperty(Settings.BindingDirection.IN, "show-places", "showPlaces", this._refreshPlacesAndRecent, null);

this.settings.bindProperty(Settings.BindingDirection.IN, "activate-on-hover", "activateOnHover", this._updateActivateOnHover, null);
Expand Down Expand Up @@ -1621,7 +1620,7 @@ MyApplet.prototype = {
}
}
// Now generate recent category and recent files buttons and add to the list
if (this.showRecent) {
if (this.privacy_settings.get_boolean(REMEMBER_RECENT_KEY)) {
this.recentButton = new RecentCategoryButton();
this._addEnterEvent(this.recentButton, Lang.bind(this, function() {
if (!this.searchActive) {
Expand Down Expand Up @@ -1667,24 +1666,28 @@ MyApplet.prototype = {
}));
this.categoriesBox.add_actor(this.recentButton.actor);
this._categoryButtons.push(this.recentButton);

if (this.RecentManager._infosByTimestamp.length > 0) {
for (let id = 0; id < MAX_RECENT_FILES && id < this.RecentManager._infosByTimestamp.length; id++) {
let button = new RecentButton(this, this.RecentManager._infosByTimestamp[id]);
this._addEnterEvent(button, Lang.bind(this, function() {
this._clearPrevSelection(button.actor);
button.actor.style_class = "menu-application-button-selected";
this.selectedAppTitle.set_text("");
this.selectedAppDescription.set_text(button.file.uri.slice(7).replace(/%20/g, ' '));
}));
button.actor.connect('leave-event', Lang.bind(this, function() {
button.actor.style_class = "menu-application-button";
this._previousSelectedActor = button.actor;
this.selectedAppTitle.set_text("");
this.selectedAppDescription.set_text("");
}));
this._recentButtons.push(button);
this.applicationsBox.add_actor(button.actor);
this.applicationsBox.add_actor(button.menu.actor);
}

if (!this.privacy_settings.get_boolean(REMEMBER_RECENT_KEY)) {
let button = new GenericButton(_("Recent file tracking is currently disabled system-wide."), null, false, null);
this._recentButtons.push(button);
this.applicationsBox.add_actor(button.actor);

this._addEnterEvent(button, Lang.bind(this, function() {
this._clearPrevSelection(button.actor);
}));
button.actor.connect('leave-event', Lang.bind(this, function() {
this._previousSelectedActor = button.actor;
}));

button = new GenericButton(_("Click here to enable"), "ok", true, Lang.bind(this, function () {
this.menu.close()
this.privacy_settings.set_boolean(REMEMBER_RECENT_KEY, true);
}));

let button = new RecentClearButton(this);
this._addEnterEvent(button, Lang.bind(this, function() {
this._clearPrevSelection(button.actor);
button.actor.style_class = "menu-application-button-selected";
Expand All @@ -1693,47 +1696,14 @@ MyApplet.prototype = {
button.actor.style_class = "menu-application-button";
this._previousSelectedActor = button.actor;
}));

this._recentButtons.push(button);
this.applicationsBox.add_actor(button.actor);
} else {
if (this.RecentManager._infosByTimestamp.length > 0) {
for (let id = 0; id < MAX_RECENT_FILES && id < this.RecentManager._infosByTimestamp.length; id++) {
let button = new RecentButton(this, this.RecentManager._infosByTimestamp[id]);
this._addEnterEvent(button, Lang.bind(this, function() {
this._clearPrevSelection(button.actor);
button.actor.style_class = "menu-application-button-selected";
this.selectedAppTitle.set_text("");
this.selectedAppDescription.set_text(button.file.uri.slice(7).replace(/%20/g, ' '));
}));
button.actor.connect('leave-event', Lang.bind(this, function() {
button.actor.style_class = "menu-application-button";
this._previousSelectedActor = button.actor;
this.selectedAppTitle.set_text("");
this.selectedAppDescription.set_text("");
}));
this._recentButtons.push(button);
this.applicationsBox.add_actor(button.actor);
this.applicationsBox.add_actor(button.menu.actor);
}

let button = new RecentClearButton(this);
this._addEnterEvent(button, Lang.bind(this, function() {
this._clearPrevSelection(button.actor);
button.actor.style_class = "menu-application-button-selected";
}));
button.actor.connect('leave-event', Lang.bind(this, function() {
button.actor.style_class = "menu-application-button";
this._previousSelectedActor = button.actor;
}));
this._recentButtons.push(button);
this.applicationsBox.add_actor(button.actor);
} else {
let button = new GenericButton(_("No recent documents"), null, false, null);
this._recentButtons.push(button);
this.applicationsBox.add_actor(button.actor);
}
let button = new GenericButton(_("No recent documents"), null, false, null);
this._recentButtons.push(button);
this.applicationsBox.add_actor(button.actor);
}

}

this._setCategoriesButtonActive(!this.searchActive);
Expand Down
Expand Up @@ -23,12 +23,6 @@
"default" : "Menu",
"description" : "Text",
"tooltip" : "Enter custom text to show in the panel."
},
"show-recent" : {
"type" : "checkbox",
"default" : true,
"description": "Show recent files",
"tooltip": "Choose whether or not to show a recent file list in the menu."
},
"show-places" : {
"type" : "checkbox",
Expand Down
Expand Up @@ -66,12 +66,12 @@ MyApplet.prototype = {

_display: function() {
if (!this.privacy_settings.get_boolean(REMEMBER_RECENT_KEY)) {
let item = new PopupMenu.PopupMenuItem(_("Recent file tracking is currently disabled system-wide."));
let item = new PopupMenu.PopupMenuItem(_("Recent file tracking is currently disabled."));
item.actor.reactive = false;
this.menu.addMenuItem(item);

let icon = new St.Icon({ icon_name: 'ok', icon_type: St.IconType.FULLCOLOR, icon_size: 16 });
item = new MyPopupMenuItem(icon, _("Click here to enable"), {});
item = new MyPopupMenuItem(icon, _("Click here to enable it"), {});
item.connect("activate", Lang.bind(this, function () {
this.privacy_settings.set_boolean(REMEMBER_RECENT_KEY, true);
}))
Expand Down

0 comments on commit 249c626

Please sign in to comment.