Skip to content

Commit

Permalink
Cinnamenu@json: Fix emoji categories (linuxmint#5213)
Browse files Browse the repository at this point in the history
  • Loading branch information
fredcw authored Dec 9, 2023
1 parent b2c02d9 commit 7523ec4
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 59 deletions.
15 changes: 8 additions & 7 deletions Cinnamenu@json/files/Cinnamenu@json/4.0/applet.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ const St = imports.gi.St;
const Meta = imports.gi.Meta;
const Main = imports.ui.main;
const Util = imports.misc.util;
const AppletManager = imports.ui.appletManager; //
//const {SessionManager} = imports.misc.gnomeSession;
const AppletManager = imports.ui.appletManager;
const {ScreenSaverProxy} = imports.misc.screenSaver;
const {PopupMenuManager, PopupIconMenuItem} = imports.ui.popupMenu;
const {getAppFavorites} = imports.ui.appFavorites;
Expand Down Expand Up @@ -176,7 +175,7 @@ class CinnamenuApplet extends TextIconApplet {
};

this.settings = {};
this.settingsObj = new AppletSettings(this.settings, __meta.uuid, this.instance_id);
this.appletSettings = new AppletSettings(this.settings, __meta.uuid, this.instance_id);
[
{ key: 'categories', value: 'categories', cb: null },
{ key: 'custom-menu-height', value: 'customMenuHeight', cb: null },
Expand Down Expand Up @@ -230,7 +229,7 @@ class CinnamenuApplet extends TextIconApplet {
{ key: 'sidebar-icon-size', value: 'sidebarIconSize', cb: refreshDisplay },
{ key: 'use-box-style', value: 'useBoxStyle', cb: refreshDisplay },
{ key: 'use-tile-style', value: 'useTileStyle', cb: refreshDisplay }
].forEach(setting => this.settingsObj.bind(
].forEach(setting => this.appletSettings.bind(
setting.key,
setting.value,
setting.cb ? (...args) => setting.cb.call(this, ...args) : null ) );
Expand Down Expand Up @@ -266,10 +265,10 @@ class CinnamenuApplet extends TextIconApplet {
on_applet_removed_from_panel() {
this.willUnmount = true;
Main.keybindingManager.removeHotKey('overlay-key-' + this.instance_id);
if (!this.settingsObj) {
if (!this.appletSettings) {
return;
}
this.settingsObj.finalize();
this.appletSettings.finalize();
this.signals.disconnectAllSignals();
this.display.destroy();
this.menu.destroy();
Expand Down Expand Up @@ -407,7 +406,9 @@ class CinnamenuApplet extends TextIconApplet {
}

addFolderCategory(path) {
this.settings.folderCategories.push(path);
const folderCategories = this.settings.folderCategories.slice();
folderCategories.push(path);
this.settings.folderCategories = folderCategories;
}

removeFolderCategory(path) {
Expand Down
4 changes: 4 additions & 0 deletions Cinnamenu@json/files/Cinnamenu@json/4.0/contextmenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ class ContextMenu {
() => {
if (categoryId === GLib.get_home_dir()) {
this.appThis.settings.showHomeFolder = false;
this.appThis._onShowHomeFolderChange();
} else {
this.appThis.removeFolderCategory(categoryId);
}
Expand Down Expand Up @@ -388,6 +389,9 @@ class ContextMenu {
this.menu.addMenuItem(new PopupSeparatorMenuItem(this.appThis));
addMenuItem(new ContextMenuItem(this.appThis, _('Add folder as category'), 'list-add',
() => {
if (path === GLib.get_home_dir()) {
this.appThis.settings.showHomeFolder = true;
}
this.appThis.addFolderCategory(path);
this.appThis.display.categoriesView.update();
this.close();
Expand Down
15 changes: 8 additions & 7 deletions Cinnamenu@json/files/Cinnamenu@json/5.8/applet.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ const Meta = imports.gi.Meta;
const Main = imports.ui.main;
const Util = imports.misc.util;
const GnomeSession = imports.misc.gnomeSession;
const AppletManager = imports.ui.appletManager; //
//const {SessionManager} = imports.misc.gnomeSession;
const AppletManager = imports.ui.appletManager;
const {ScreenSaverProxy} = imports.misc.screenSaver;
const {PopupMenuManager, PopupIconMenuItem} = imports.ui.popupMenu;
const {getAppFavorites} = imports.ui.appFavorites;
Expand Down Expand Up @@ -181,7 +180,7 @@ class CinnamenuApplet extends TextIconApplet {
};

this.settings = {};
this.settingsObj = new AppletSettings(this.settings, __meta.uuid, this.instance_id);
this.appletSettings = new AppletSettings(this.settings, __meta.uuid, this.instance_id);
[
{ key: 'categories', value: 'categories', cb: null },
{ key: 'custom-menu-height', value: 'customMenuHeight', cb: null },
Expand Down Expand Up @@ -235,7 +234,7 @@ class CinnamenuApplet extends TextIconApplet {
{ key: 'sidebar-icon-size', value: 'sidebarIconSize', cb: refreshDisplay },
{ key: 'use-box-style', value: 'useBoxStyle', cb: refreshDisplay },
{ key: 'use-tile-style', value: 'useTileStyle', cb: refreshDisplay }
].forEach(setting => this.settingsObj.bind(
].forEach(setting => this.appletSettings.bind(
setting.key,
setting.value,
setting.cb ? (...args) => setting.cb.call(this, ...args) : null ) );
Expand Down Expand Up @@ -271,10 +270,10 @@ class CinnamenuApplet extends TextIconApplet {
on_applet_removed_from_panel() {
this.willUnmount = true;
Main.keybindingManager.removeHotKey('overlay-key-' + this.instance_id);
if (!this.settingsObj) {
if (!this.appletSettings) {
return;
}
this.settingsObj.finalize();
this.appletSettings.finalize();
this.signals.disconnectAllSignals();
this.display.destroy();
this.menu.destroy();
Expand Down Expand Up @@ -412,7 +411,9 @@ class CinnamenuApplet extends TextIconApplet {
}

addFolderCategory(path) {
this.settings.folderCategories.push(path);
const folderCategories = this.settings.folderCategories.slice();
folderCategories.push(path);
this.settings.folderCategories = folderCategories;
}

removeFolderCategory(path) {
Expand Down
4 changes: 4 additions & 0 deletions Cinnamenu@json/files/Cinnamenu@json/5.8/contextmenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ class ContextMenu {
() => {
if (categoryId === GLib.get_home_dir()) {
this.appThis.settings.showHomeFolder = false;
this.appThis._onShowHomeFolderChange();
} else {
this.appThis.removeFolderCategory(categoryId);
}
Expand Down Expand Up @@ -382,6 +383,9 @@ class ContextMenu {
this.menu.addMenuItem(new PopupSeparatorMenuItem(this.appThis));
addMenuItem(new ContextMenuItem(this.appThis, _('Add folder as category'), 'list-add',
() => {
if (path === GLib.get_home_dir()) {
this.appThis.settings.showHomeFolder = true;
}
this.appThis.addFolderCategory(path);
this.appThis.display.categoriesView.update();
this.close();
Expand Down
Loading

0 comments on commit 7523ec4

Please sign in to comment.