Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cinnamenu: Update to 1.2.1 #317

Merged
merged 1 commit into from
Apr 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Cinnamenu: Update to 1.2.1
* Fixed the application list view having excessive width.
* Refined the width for the grid at all column counts.
* Fixed the search box height for some themes.
* Made the applet compatible with Cinnamon Git.
  • Loading branch information
jaszhix committed Apr 16, 2017
commit c4dce08dd42018e9c6acacf4595ba55baad23518
7 changes: 7 additions & 0 deletions Cinnamenu@json/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
Changelog

### 1.2.1

* Fixed the application list view having excessive width.
* Refined the width for the grid at all column counts.
* Fixed the search box height for some themes.
* Made the applet compatible for Cinnamon Git.

### 1.2.0

* Added ability to toggle bookmarks
Expand Down
4 changes: 2 additions & 2 deletions Cinnamenu@json/files/Cinnamenu@json/buttons.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,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 @@ -332,7 +332,7 @@ AppListGridButton.prototype = {
this.appListLength = appListLength;
this._stateChangedId = 0;
this.column = null;
let style;
let style = '';

this.appIndex = appIndex;

Expand Down
2 changes: 1 addition & 1 deletion Cinnamenu@json/files/Cinnamenu@json/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Cinnamenu",
"description": "A flexible menu providing formatting options and bookmarks.",
"max-instances": -1,
"version": "1.2.0",
"version": "1.2.1",
"website": "https://github.com/jaszhix/Cinnamenu",
"cinnamon-version": [
"3.2"
Expand Down
73 changes: 41 additions & 32 deletions Cinnamenu@json/files/Cinnamenu@json/panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ const Gtk = imports.gi.Gtk;
const GLib = imports.gi.GLib;
const CMenu = imports.gi.CMenu;
const Clutter = imports.gi.Clutter;
const Cinnamon = imports.gi.Cinnamon;
const St = imports.gi.St;
const Util = imports.misc.util;
const Main = imports.ui.main;
const Mainloop = imports.mainloop;
const Lang = imports.lang;
const GnomeSession = imports.misc.gnomeSession;
const ScreenSaver = imports.misc.screenSaver;
const PanelMenu = imports.ui.panelMenu;
const Signals = imports.signals;
const PopupMenu = imports.ui.popupMenu;

const AppletDir = imports.ui.appletManager.applets['Cinnamenu@json'];
Expand Down Expand Up @@ -63,12 +64,13 @@ function CinnamenuPanel() {
}

CinnamenuPanel.prototype = {
__proto__: PanelMenu.Button.prototype,

_init: function(applet) {
this.launcher = {};
PanelMenu.Button.prototype._init.call(this, applet.orientation)

this.actor = new Cinnamon.GenericContainer({
style_class: 'panel-button'
});
this._applet = applet;
this.orientation = applet.orientation;
this.menu = applet.menu
Expand Down Expand Up @@ -193,8 +195,8 @@ CinnamenuPanel.prototype = {
this.categoriesBox.width = this.groupCategoriesWorkspacesScrollBox.width;
this._widthCategoriesBox = this.groupCategoriesWorkspacesScrollBox.width;

// calculate applications list/grid box width
this._calculateApplicationsBoxWidth(this._applicationsViewMode === ApplicationsViewMode.LIST);
// calculate applications list/grid box width // TBD
//this._calculateApplicationsBoxWidth(this._applicationsViewMode === ApplicationsViewMode.LIST);

// Hide applications list/grid box depending on view mode
if (this._applicationsViewMode === ApplicationsViewMode.LIST) {
Expand Down Expand Up @@ -459,21 +461,23 @@ CinnamenuPanel.prototype = {
},

_clearApplicationSelections: function(selectedApplication) {
this.applicationsListBox.get_children().forEach(function(actor) {
if (selectedApplication && (actor == selectedApplication)) {
actor.add_style_class_name('selected');
let children = this.applicationsListBox.get_children();
for (let i = 0, len = children.length; i < len; i++) {
if (selectedApplication && children[i] === selectedApplication) { // TBD object equality
children[i].add_style_class_name('selected');
} else {
actor.remove_style_class_name('selected');
children[i].remove_style_class_name('selected');
}
});
}
children = this.applicationsGridBox.get_children();

this.applicationsGridBox.get_children().forEach(function(actor) {
if (selectedApplication && (actor == selectedApplication)) {
actor.add_style_class_name('selected');
for (let i = 0, len = children.length; i < len; i++) {
if (selectedApplication && children[i] === selectedApplication) { // TBD object equality
children[i].add_style_class_name('selected');
} else {
actor.remove_style_class_name('selected');
children[i].remove_style_class_name('selected');
}
});
}
},

_clearApplicationsBox: function(selectedCategory, refresh) {
Expand Down Expand Up @@ -707,7 +711,7 @@ CinnamenuPanel.prototype = {
}

// Ignore favorites when sorting
if (category_menu_id != 'favorites') {
if (category_menu_id !== 'favorites') {
if (res === undefined) {
res = [];
}
Expand All @@ -726,7 +730,7 @@ CinnamenuPanel.prototype = {
return res;
},

_calculateApplicationsBoxWidth: function(isListView) {
_calculateApplicationsBoxWidth: function(isListView) { // TBD
// Calculate visible menu boxes and adjust width accordingly
let searchBoxWidth = this.searchBox.width;
let searchBoxMargin = {
Expand Down Expand Up @@ -1577,7 +1581,7 @@ CinnamenuPanel.prototype = {
});

this.toggleListGridView = new GroupButton(this, viewModeButtonIcon, viewModeButtonIconSize, null, null);
this.toggleListGridView.setButtonEnterCallback(Lang.bind(this, function() {
this.toggleListGridView.setButtonEnterCallback(()=>{
this.toggleListGridView.actor.add_style_pseudo_class('hover');
if (this._applicationsViewMode === ApplicationsViewMode.LIST) {
this.selectedAppTitle.set_text(_("Grid View"));
Expand All @@ -1586,16 +1590,16 @@ CinnamenuPanel.prototype = {
this.selectedAppTitle.set_text(_("List View"));
this.selectedAppDescription.set_text('Switch to list view');
}
}));
this.toggleListGridView.setButtonLeaveCallback(Lang.bind(this, function() {
});
this.toggleListGridView.setButtonLeaveCallback(()=>{
this.toggleListGridView.actor.remove_style_pseudo_class('hover');
this.selectedAppTitle.set_text('');
this.selectedAppDescription.set_text('');
}));
this.toggleListGridView.setButtonPressCallback(Lang.bind(this, function() {
});
this.toggleListGridView.setButtonPressCallback(()=>{
this.toggleListGridView.actor.add_style_pseudo_class('pressed');
}));
this.toggleListGridView.setButtonReleaseCallback(Lang.bind(this, function() {
});
this.toggleListGridView.setButtonReleaseCallback(()=>{
this.toggleListGridView.actor.remove_style_pseudo_class('pressed');
this.selectedAppTitle.set_text('');
this.selectedAppDescription.set_text('');
Expand All @@ -1608,10 +1612,10 @@ CinnamenuPanel.prototype = {
this._switchApplicationsView(ApplicationsViewMode.LIST);
this._applet.settings.setValue('startup-view-mode', 0);
}
// Retrigger an app list render until we figure out why its not rendering anything on toggle.
this._calculateApplicationsBoxWidth(this._applicationsViewMode === ApplicationsViewMode.LIST);
// Retrigger an app list render until we figure out why its not rendering anything on toggle. // TBD - causes extra width on lists
//this._calculateApplicationsBoxWidth(this._applicationsViewMode === ApplicationsViewMode.LIST);
this[this._currentSelectKey](this._currentCategoryButton);
}));
});

this.viewModeBox.add(this.toggleListGridView.actor, {
x_fill: false,
Expand All @@ -1635,7 +1639,8 @@ CinnamenuPanel.prototype = {
icon_name: 'edit-clear'
});
this.searchBox = new St.BoxLayout({
style_class: 'menu-search-box'
style_class: 'menu-search-box',
height: 30
});
this.searchEntry = new St.Entry({
name: 'menu-search-entry',
Expand Down Expand Up @@ -1726,7 +1731,7 @@ CinnamenuPanel.prototype = {
let iter = root.iter();
let nextType;

while ((nextType = iter.next()) != CMenu.TreeItemType.INVALID) {
while ((nextType = iter.next()) !== CMenu.TreeItemType.INVALID) {
if (nextType == CMenu.TreeItemType.DIRECTORY) {
dirs.push(iter.get_directory());
}
Expand Down Expand Up @@ -1888,10 +1893,13 @@ CinnamenuPanel.prototype = {
vertical: true,
x_expand: true
});

let widths = [0, 0, 0, 625, 700, 725, 900, 1025];
this.applicationsGridBox = new St.Widget({
layout_manager: new Clutter.TableLayout(),
reactive: true,
style_class: ''
style_class: '',
width: widths[this._applet.appsGridColumnCount]
});
this.applicationsBoxWrapper = new St.BoxLayout({
style_class: 'menu-applications-inner-box',
Expand Down Expand Up @@ -1973,7 +1981,7 @@ CinnamenuPanel.prototype = {
y_align: St.Align.START
});
this.bottomPane.add(bottomPaneSpacer1, {
expand: true,
expand: false,
x_align: St.Align.MIDDLE,
y_align: St.Align.MIDDLE
});
Expand Down Expand Up @@ -2054,4 +2062,5 @@ CinnamenuPanel.prototype = {

this.appButtons = [];
},
};
};
Signals.addSignalMethods(CinnamenuPanel.prototype)