Skip to content

Commit

Permalink
Replace misc/util.js polyfills with js natives... (#11865)
Browse files Browse the repository at this point in the history
+add brackets accidentally omitted in commit 975bb2c

+remove 2 unused imports and one unused constant
  • Loading branch information
fredcw authored Sep 26, 2023
1 parent 315801a commit d04f6c3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
const Cinnamon = imports.gi.Cinnamon;
const CMenu = imports.gi.CMenu;

const Util = imports.misc.util;

let appsys = Cinnamon.AppSystem.get_default();

function decomp_string(s) {
Expand Down
21 changes: 10 additions & 11 deletions files/usr/share/cinnamon/applets/menu@cinnamon.org/applet.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const AppFavorites = imports.ui.appFavorites;
const Gtk = imports.gi.Gtk;
const Atk = imports.gi.Atk;
const Gio = imports.gi.Gio;
const GObject = imports.gi.GObject
const XApp = imports.gi.XApp;
const GnomeSession = imports.misc.gnomeSession;
const ScreenSaver = imports.misc.screenSaver;
Expand All @@ -28,7 +27,6 @@ const SignalManager = imports.misc.signalManager;
const Params = imports.misc.params;

const INITIAL_BUTTON_LOAD = 30;
const NUM_SYSTEM_BUTTONS = 3;

const USER_DESKTOP_PATH = FileUtils.getUserDesktopDir();

Expand Down Expand Up @@ -1293,13 +1291,13 @@ class CinnamonMenuApplet extends Applet.TextIconApplet {
}

_updateShowIcons(container, show) {
Util.each(container.get_children(), c => {
container.get_children().forEach( c => {
let b = c._delegate;
if (!(b instanceof SimpleMenuItem))
return;
if (b.icon)
b.icon.visible = show;
})
});
}

_onBoxResized(width, height) {
Expand All @@ -1317,11 +1315,12 @@ class CinnamonMenuApplet extends Applet.TextIconApplet {

_updateKeybinding() {
Main.keybindingManager.addHotKey("overlay-key-" + this.instance_id, this.overlayKey, Lang.bind(this, function() {
if (!Main.overview.visible && !Main.expo.visible)
if (!Main.overview.visible && !Main.expo.visible) {
if (this.forceShowPanel && !this.isOpen) {
this.panel.peekPanel();
}
this.menu.toggle_with_options(this.enableAnimation);
}
}));
}

Expand Down Expand Up @@ -2449,7 +2448,7 @@ class CinnamonMenuApplet extends Applet.TextIconApplet {
let recents = this.RecentManager._infosByTimestamp.filter(info => !info.name.startsWith("."));
if (recents.length > 0) {
this.noRecentDocuments = false;
Util.each(recents, (info) => {
recents.forEach( info => {
let button = new RecentButton(this, info);
this._recentButtons.push(button);
this.applicationsBox.add_actor(button.actor);
Expand Down Expand Up @@ -2516,7 +2515,7 @@ class CinnamonMenuApplet extends Applet.TextIconApplet {
this.categoriesBox.add_actor(this.favoriteDocsButton.actor);
}

Util.each(favorite_infos, (info) => {
favorite_infos.forEach( info => {
let button = new FavoriteButton(this, info);
this._favoriteDocButtons.push(button);
this.applicationsBox.add_actor(button.actor);
Expand Down Expand Up @@ -2549,7 +2548,7 @@ class CinnamonMenuApplet extends Applet.TextIconApplet {
let [apps, dirs] = AppUtils.getApps();

// generate all category buttons from top-level directories
Util.each(dirs, (d) => {
dirs.forEach( d => {
let categoryButton = new CategoryButton(this, d.get_menu_id(), d.get_name(), d.get_icon());
this._categoryButtons.push(categoryButton);
this.categoriesBox.add_actor(categoryButton.actor);
Expand Down Expand Up @@ -2906,7 +2905,7 @@ class CinnamonMenuApplet extends Applet.TextIconApplet {
this.orderDirty = false;
}

Util.each(this.applicationsBox.get_children(), c => {
this.applicationsBox.get_children().forEach( c => {
let b = c._delegate;
if (!(b instanceof SimpleMenuItem))
return;
Expand All @@ -2922,7 +2921,7 @@ class CinnamonMenuApplet extends Applet.TextIconApplet {
} else {
this.orderDirty = true;

Util.each(this.applicationsBox.get_children(), c => {
this.applicationsBox.get_children().forEach( c => {
let b = c._delegate;
if (!(b instanceof SimpleMenuItem))
return;
Expand Down Expand Up @@ -2958,7 +2957,7 @@ class CinnamonMenuApplet extends Applet.TextIconApplet {
this._searchProviderButtons = [];

if (autoCompletes) {
Util.each(autoCompletes, item => {
autoCompletes.forEach( item => {
let button = new TransientButton(this, item);
this._transientButtons.push(button);
this.applicationsBox.add_actor(button.actor);
Expand Down

0 comments on commit d04f6c3

Please sign in to comment.