Skip to content

Commit

Permalink
Merge pull request linuxmint#298 from jaszhix/cinnamenu
Browse files Browse the repository at this point in the history
Cinnamenu: Update to 1.2.0
  • Loading branch information
brownsr committed Apr 11, 2017
2 parents d3c20eb + 13d7706 commit 6149db1
Show file tree
Hide file tree
Showing 9 changed files with 121 additions and 63 deletions.
9 changes: 9 additions & 0 deletions Cinnamenu@json/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
Changelog

### 1.2.0

* Added ability to toggle bookmarks
* Increased the resolution of the applet icon
* Category buttons are now deactivated while searching
* Translation file restructuring thanks to [NikoKrause](https://github.com/linuxmint/cinnamon-spices-applets/pull/247)
* Test bug fix for users encountering the menu not displaying when clicked
* Fixed the menu expanding in height and width when toggled open, and expanding beyond its allocated dimensions

### 1.1.0

* Improved the applet's memory consumption.
Expand Down
26 changes: 17 additions & 9 deletions Cinnamenu@json/files/Cinnamenu@json/applet.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,17 @@ const AppletDir = imports.ui.appletManager.applets['Cinnamenu@json'];

// l10n
const Gettext = imports.gettext;
const UUID = "Cinnamenu@json";
Gettext.bindtextdomain(UUID, GLib.get_home_dir() + "/.local/share/locale");
const UUID = 'Cinnamenu@json';
Gettext.bindtextdomain(UUID, GLib.get_home_dir() + '/.local/share/locale');

function _(str) {
let cinnamonTranslation = Gettext.gettext(str);
if(cinnamonTranslation != str) {
return cinnamonTranslation;
}
return Gettext.dgettext(UUID, str);
let cinnamonTranslation = Gettext.gettext(str);
if (cinnamonTranslation !== str) {
return cinnamonTranslation;
}
return Gettext.dgettext(UUID, str);
}


const CinnamenuPanel = AppletDir.panel.CinnamenuPanel;

const PRIVACY_SCHEMA = 'org.cinnamon.desktop.privacy';
Expand Down Expand Up @@ -331,6 +330,15 @@ CinnamenuButton.prototype = {
value: 'enableAutoScroll',
cb: null
},
{
key: 'enable-bookmarks',
value: 'enableBookmarks',
cb: Lang.bind(this, function() {
if (this.cinnamenuPanel) {
this.cinnamenuPanel.refresh();
}
})
},
{
key: 'menu-label',
value: 'menuLabel',
Expand Down Expand Up @@ -431,4 +439,4 @@ CinnamenuButton.prototype = {

function main(metadata, orientation, panel_height, instance_id) {
return new CinnamenuButton(metadata, orientation, panel_height, instance_id);
}
}
52 changes: 38 additions & 14 deletions Cinnamenu@json/files/Cinnamenu@json/buttons.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const Main = imports.ui.main;
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
const Clutter = imports.gi.Clutter;
const St = imports.gi.St;
const Cinnamon = imports.gi.Cinnamon;
Expand All @@ -15,14 +16,14 @@ const AppletDir = imports.ui.appletManager.applets['Cinnamenu@json'];

// l10n
const Gettext = imports.gettext;
const UUID = "Cinnamenu@json";
const UUID = 'Cinnamenu@json';

function _(str) {
let cinnamonTranslation = Gettext.gettext(str);
if(cinnamonTranslation != str) {
return cinnamonTranslation;
}
return Gettext.dgettext(UUID, str);
let cinnamonTranslation = Gettext.gettext(str);
if (cinnamonTranslation !== str) {
return cinnamonTranslation;
}
return Gettext.dgettext(UUID, str);
}

const Chromium = AppletDir.webChromium;
Expand Down Expand Up @@ -104,6 +105,7 @@ CategoryListButton.prototype = {
let iconSize = _parent._applet.categoryIconSize;

this._dir = dir;
this.disabled = false;
let categoryNameText = '';
//let categoryIconName = null;

Expand All @@ -121,7 +123,7 @@ CategoryListButton.prototype = {
if (this.icon_name) {
this.icon = St.TextureCache.get_default().load_gicon(null, icon, iconSize);
} else {
icon = dir.get_icon() ? dir.get_icon().get_names().toString() : 'error';
icon = dir.get_icon() && typeof dir.get_icon().get_names === 'function' ? dir.get_icon().get_names().toString() : 'error';
this.icon = new St.Icon({
icon_name: icon,
icon_size: iconSize
Expand Down Expand Up @@ -154,6 +156,10 @@ CategoryListButton.prototype = {
},

handleEnter: function() {
if (this.disabled) {
return false;
}

this.actor.add_style_class_name('menu-category-button-selected');
this._parent.selectedAppTitle.set_text(this.categoryNameText);
this._parent.selectedAppDescription.set_text('');
Expand All @@ -175,11 +181,29 @@ CategoryListButton.prototype = {
},

handleButtonRelease: function() {
if (this.disabled) {
return false;
}

this._parent.selectedAppTitle.set_text(this.categoryNameText);
this._parent.selectedAppDescription.set_text('');
this._parent._selectCategory(this);
},

disable: function() {
if (this.actor.has_style_class_name('menu-category-button-greyed')) {
return false;
}

this.actor.set_style_class_name('menu-category-button-greyed');
this.disabled = true;
},

enable: function () {
this.actor.set_style_class_name('menu-category-button');
this.disabled = false;
},

destroy: function(actor) {
this._parent = null;
this.actor._delegate = null;
Expand Down Expand Up @@ -264,7 +288,7 @@ ApplicationContextMenuItem.prototype = {
this._appButton._parent.menuIsOpen = false;
break;
case 'uninstall':
Util.spawnCommandLine('gksu -m \'' + _("Please provide your password to uninstall this application")
Util.spawnCommandLine('gksu -m \'' + _('Please provide your password to uninstall this application')
+ '\' /usr/bin/cinnamon-remove-application \'' + this._appButton.app.get_app_info().get_filename() + '\'');
this._appButton._parent.menu.close();
break;
Expand Down Expand Up @@ -604,24 +628,24 @@ AppListGridButton.prototype = {
this._parent.menuIsOpen = this.appIndex;

let menuItem;
menuItem = new ApplicationContextMenuItem(this, _("Add to panel"), 'add_to_panel', 'list-add');
menuItem = new ApplicationContextMenuItem(this, _('Add to panel'), 'add_to_panel', 'list-add');
this.menu.addMenuItem(menuItem);
if (USER_DESKTOP_PATH) {
menuItem = new ApplicationContextMenuItem(this, _("Add to desktop"), 'add_to_desktop', 'computer');
menuItem = new ApplicationContextMenuItem(this, _('Add to desktop'), 'add_to_desktop', 'computer');
this.menu.addMenuItem(menuItem);
}
if (this._parent._applet.appFavorites.isFavorite(this.app.get_id())) {
menuItem = new ApplicationContextMenuItem(this, _("Remove from favorites"), 'remove_from_favorites',
menuItem = new ApplicationContextMenuItem(this, _('Remove from favorites'), 'remove_from_favorites',
'starred');
this.menu.addMenuItem(menuItem);
} else {
menuItem = new ApplicationContextMenuItem(this, _("Add to favorites"), 'add_to_favorites', 'non-starred');
menuItem = new ApplicationContextMenuItem(this, _('Add to favorites'), 'add_to_favorites', 'non-starred');
this.menu.addMenuItem(menuItem);
}
menuItem = new ApplicationContextMenuItem(this, _("Uninstall"), 'uninstall', 'edit-delete');
menuItem = new ApplicationContextMenuItem(this, _('Uninstall'), 'uninstall', 'edit-delete');
this.menu.addMenuItem(menuItem);
if (this._parent._isBumblebeeInstalled) {
menuItem = new ApplicationContextMenuItem(this, _("Run with NVIDIA GPU"), 'run_with_nvidia_gpu', 'cpu');
menuItem = new ApplicationContextMenuItem(this, _('Run with NVIDIA GPU'), 'run_with_nvidia_gpu', 'cpu');
this.menu.addMenuItem(menuItem);
}
this.actor.add_style_class_name('menu-application-button-selected');
Expand Down
Binary file modified Cinnamenu@json/files/Cinnamenu@json/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions Cinnamenu@json/files/Cinnamenu@json/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"name": "Cinnamenu",
"description": "A flexible menu providing formatting options and bookmarks.",
"max-instances": -1,
"version": "1.1.0",
"version": "1.2.0",
"website": "https://github.com/jaszhix/Cinnamenu",
"cinnamon-version": [
"3.2"
]
}
}
Loading

0 comments on commit 6149db1

Please sign in to comment.