Skip to content

Commit

Permalink
Fix: extensions review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jmmaranan committed Sep 19, 2023
1 parent 64fdaf6 commit 11a6f36
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 34 deletions.
24 changes: 4 additions & 20 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,9 @@ import { FeatureIndicator, FeatureMenuToggle } from "./lib/extension/indicator.j
import { ExtensionThemeManager } from "./lib/extension/extension-theme-manager.js";

export default class ForgeExtension extends Extension {
settings = this.getSettings();

kbdSettings = this.getSettings("org.gnome.shell.extensions.forge.keybindings");

sameSession = false;

enable() {
this.settings = this.getSettings();
this.kbdSettings = this.getSettings("org.gnome.shell.extensions.forge.keybindings");
Logger.init(this.settings);
Logger.info("enable");

Expand All @@ -51,27 +47,13 @@ export default class ForgeExtension extends Extension {

this.theme.patchCss();
this.theme.reloadStylesheet();

if (this.sameSession) {
Logger.debug(`enable: still in same session`);
this.sameSession = false;
return;
}

this.extWm.enable();
this.keybindings.enable();
Logger.info(`enable: finalized vars`);
}

disable() {
Logger.info("disable");

if (Main.sessionMode.isLocked) {
this.sameSession = true;
Logger.debug(`disable: still in same session`);
return;
}

this.extWm.disable();
this.keybindings.disable();
this.indicator?.quickSettingsItems.forEach((item) => item.destroy());
Expand All @@ -81,5 +63,7 @@ export default class ForgeExtension extends Extension {
this.extWm = null;
this.themeWm = null;
this.configMgr = null;
this.settings = null;
this.kbdSettings = null;
}
}
6 changes: 3 additions & 3 deletions lib/extension/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,15 @@ export function resolveDirection(directionString) {
return null;
}

export function directionFrom(position, orientaton) {
export function directionFrom(position, orientation) {
if (position === POSITION.AFTER) {
if (orientaton === ORIENTATION_TYPES.HORIZONTAL) {
if (orientation === ORIENTATION_TYPES.HORIZONTAL) {
return Meta.DisplayDirection.RIGHT;
} else {
return Meta.DisplayDirection.DOWN;
}
} else if (position === POSITION.BEFORE) {
if (orientaton === ORIENTATION_TYPES.HORIZONTAL) {
if (orientation === ORIENTATION_TYPES.HORIZONTAL) {
return Meta.DisplayDirection.LEFT;
} else {
return Meta.DisplayDirection.UP;
Expand Down
2 changes: 1 addition & 1 deletion lib/prefs/appearance.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Gnome imports
import Adw from "gi://Adw";
import GObject from "gi://GObject";
import Gdk from "gi://Gdk?version=4.0";
import Gdk from "gi://Gdk";

// Extension imports
import { gettext as _ } from "resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js";
Expand Down
2 changes: 1 addition & 1 deletion lib/prefs/keyboard.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Gnome imports
import Adw from "gi://Adw";
import GObject from "gi://GObject";
import Gtk from "gi://Gtk?version=4.0";
import Gtk from "gi://Gtk";

// Extension Imports
import { gettext as _ } from "resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js";
Expand Down
4 changes: 2 additions & 2 deletions lib/prefs/settings.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Gnome imports
import Adw from "gi://Adw";
import Gtk from "gi://Gtk?version=4.0";
import Gtk from "gi://Gtk";
import GObject from "gi://GObject";

// Shared state
Expand Down Expand Up @@ -98,7 +98,7 @@ export class SettingsPage extends PreferencesPage {
new DropDownRow({
title: _("Default Drag-and-Drop Center Layout"),
settings,
type: 's',
type: "s",
bind: "dnd-center-layout",
items: [
{ id: "tabbed", name: _("Tabbed") },
Expand Down
7 changes: 3 additions & 4 deletions lib/prefs/widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import Adw from "gi://Adw";
import Gio from "gi://Gio";
import Gdk from "gi://Gdk?version=4.0";
import Gtk from "gi://Gtk?version=4.0";
import Gdk from "gi://Gdk";
import Gtk from "gi://Gtk";
import GObject from "gi://GObject";

// GNOME imports
Expand Down Expand Up @@ -174,7 +174,7 @@ export class DropDownRow extends Adw.ActionRow {
#onSelected() {
this.selected = this.dropdown.selected;
const { id } = this.items[this.selected];
Logger.debug('setting', id, this.selected);
Logger.debug("setting", id, this.selected);
this.#set(this.bind, id);
}

Expand Down Expand Up @@ -291,4 +291,3 @@ export class RadioRow extends Adw.ActionRow {
this.add_suffix(hbox);
}
}

6 changes: 3 additions & 3 deletions prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
*/

// Gnome imports
import Gdk from "gi://Gdk?version=4.0";
import Gtk from "gi://Gtk?version=4.0";
import Gdk from "gi://Gdk";
import Gtk from "gi://Gtk";

import { ExtensionPreferences } from "resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js";

Expand All @@ -27,7 +27,7 @@ import { AppearancePage } from "./lib/prefs/appearance.js";
import { WorkspacePage } from "./lib/prefs/workspace.js";
import { SettingsPage } from "./lib/prefs/settings.js";

export default class ForgeExtentionPreferences extends ExtensionPreferences {
export default class ForgeExtensionPreferences extends ExtensionPreferences {
settings = this.getSettings();

kbdSettings = this.getSettings("org.gnome.shell.extensions.forge.keybindings");
Expand Down

0 comments on commit 11a6f36

Please sign in to comment.