Skip to content

Commit

Permalink
appIcons/prefs: Follow upstream terminology for Favorite or Pinned apps
Browse files Browse the repository at this point in the history
We use the same upstream wording here, to avoid having to change it in
multiple places, so it has to be dynamic. Depending on the version we're
running on.

Fixes micheleg#1697
  • Loading branch information
3v1n0 committed Apr 28, 2022
1 parent ae11cb7 commit d378382
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Settings.ui
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@
<property name="can_focus">0</property>
<property name="hexpand">1</property>
<property name="halign">start</property>
<property name="label" translatable="yes">Show favorite applications</property>
<property name="label" translatable="yes">Show pinned applications</property>

<layout>
<property name="column">0</property>
Expand Down
11 changes: 9 additions & 2 deletions appIcons.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ const Gettext = imports.gettext.domain('dashtodock');
const __ = Gettext.gettext;
const N__ = function(e) { return e };

const Config = imports.misc.config;

const AppDisplay = imports.ui.appDisplay;
const AppFavorites = imports.ui.appFavorites;
const BoxPointer = imports.ui.boxpointer;
Expand Down Expand Up @@ -1041,15 +1043,20 @@ const DockAppIconMenu = class DockAppIconMenu extends PopupMenu.PopupMenu {
this._appendSeparator();

let isFavorite = AppFavorites.getAppFavorites().isFavorite(this._source.app.get_id());
const [majorVersion] = Config.PACKAGE_VERSION.split('.');

if (isFavorite) {
let item = this._appendMenuItem(_('Remove from Favorites'));
const label = majorVersion >= 42 ? _('Unpin') :
_('Remove from Favorites');
let item = this._appendMenuItem(label);
item.connect('activate', () => {
let favs = AppFavorites.getAppFavorites();
favs.removeFavorite(this._source.app.get_id());
});
} else {
let item = this._appendMenuItem(_('Add to Favorites'));
const label = majorVersion >= 42 ? _('Pin to Dash') :
_('Add to Favorites');
let item = this._appendMenuItem(label);
item.connect('activate', () => {
let favs = AppFavorites.getAppFavorites();
favs.addFavorite(this._source.app.get_id());
Expand Down
6 changes: 6 additions & 0 deletions prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,12 @@ var Settings = GObject.registerClass({
this._icon_size_timeout = 0;
this._opacity_timeout = 0;

if (Config.PACKAGE_VERSION.split('.')[0] < 42) {
// Remove this when we won't support earlier versions
this._builder.get_object('shrink_dash_label1').label =
__('Show favorite applications');
}

this._monitorsConfig = new MonitorsConfig();
this._bindSettings();
}
Expand Down

0 comments on commit d378382

Please sign in to comment.