Last active
September 23, 2017 22:25
-
-
Save ferdnyc/21e7e717fa04e5d4c296f94202a986f9 to your computer and use it in GitHub Desktop.
patch to remove custom prefs dialog from frippery-applications Gnome Shell extension
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 496f721fca02925cb488190474e4cb56417a540e Mon Sep 17 00:00:00 2001 | |
From: "FeRD (Frank Dana)" <ferdnyc@gmail.com> | |
Date: Sat, 23 Sep 2017 18:15:16 -0400 | |
Subject: [PATCH] Remove custom prefs dialog | |
This does away with the secondary, custom preferences dialog | |
displayed on right-click (which was no longer formatting correctly) | |
in favor of just using Util.spawn() to launch the standard | |
gnome-shell-extension-prefs dialog for this extension. | |
(An idea shamelessly stolen from openweather-extension@jenslody.de) | |
--- | |
extension.js | 90 ++---------------------------------------------------------- | |
1 file changed, 2 insertions(+), 88 deletions(-) | |
diff --git a/extension.js b/extension.js | |
index b270180..560c461 100644 | |
--- a/extension.js | |
+++ b/extension.js | |
@@ -11,7 +11,7 @@ const St = imports.gi.St; | |
const Layout = imports.ui.layout; | |
const Main = imports.ui.main; | |
-const ModalDialog = imports.ui.modalDialog; | |
+const Util = imports.misc.util; | |
const Panel = imports.ui.panel; | |
const PanelMenu = imports.ui.panelMenu; | |
const PopupMenu = imports.ui.popupMenu; | |
@@ -148,91 +148,6 @@ const ShowHideSwitch = new Lang.Class({ | |
} | |
}); | |
-const ApplicationsMenuDialog = new Lang.Class({ | |
- Name: 'ApplicationsMenuDialog', | |
- Extends: ModalDialog.ModalDialog, | |
- | |
- _init: function(button) { | |
- ModalDialog.ModalDialog.prototype._init.call(this, | |
- { styleClass: 'applications-menu-dialog' }); | |
- | |
- this.button = button; | |
- | |
- let layout= new Clutter.TableLayout(); | |
- let table = new St.Widget({reactive: true, | |
- layout_manager: layout, | |
- styleClass: 'applications-menu-dialog-table'}); | |
- layout.hookup_style(table); | |
- this.contentLayout.add(table, { y_align: St.Align.START }); | |
- | |
- let label = new St.Label( | |
- { style_class: 'applications-menu-dialog-label', | |
- text: _f('Icon') }); | |
- layout.pack(label, 0, 0); | |
- | |
- this.iconSwitch = new ShowHideSwitch(button._iconBox, true); | |
- this.iconSwitch.actor.set_accessible_name(_f('Icon')); | |
- layout.pack(this.iconSwitch.actor, 1, 0); | |
- | |
- label = new St.Label( | |
- { style_class: 'applications-menu-dialog-label', | |
- text: _f('Text') }); | |
- layout.pack(label, 0, 1); | |
- | |
- this.labelSwitch = new ShowHideSwitch(button._label, true); | |
- this.labelSwitch.actor.set_accessible_name(_f('Text')); | |
- layout.pack(this.labelSwitch.actor, 1, 1); | |
- | |
- label = new St.Label({ style_class: 'applications-menu-dialog-label', | |
- text: _f('Hot corner') }); | |
- layout.pack(label, 0, 2); | |
- | |
- this.tlcSwitch = new ToggleSwitch(true); | |
- this.tlcSwitch.actor.set_accessible_name(_f('Hot corner')); | |
- this.tlcSwitch.toggle = Lang.bind(this.tlcSwitch, function() { | |
- PopupMenu.Switch.prototype.toggle.call(this); | |
- Main.layoutManager._setHotCornerState(this.getState()); | |
- }); | |
- layout.pack(this.tlcSwitch.actor, 1, 2); | |
- | |
- let buttons = [{ action: Lang.bind(this, this.close), | |
- label: _("Close"), | |
- default: true }]; | |
- | |
- this.setButtons(buttons); | |
- | |
- this._buttonKeys[Clutter.Escape] = this._buttonKeys[Clutter.Return]; | |
- }, | |
- | |
- open: function() { | |
- let state = this.button._settings.get_boolean(SETTINGS_SHOW_ICON); | |
- this.iconSwitch.setToggleState(state); | |
- | |
- state = this.button._settings.get_boolean(SETTINGS_SHOW_TEXT); | |
- this.labelSwitch.setToggleState(state); | |
- | |
- state = this.button._settings.get_boolean(SETTINGS_ENABLE_HOT_CORNER); | |
- this.tlcSwitch.setToggleState(state); | |
- | |
- ModalDialog.ModalDialog.prototype.open.call(this, | |
- global.get_current_time()); | |
- }, | |
- | |
- close: function() { | |
- let state = this.iconSwitch.getState(); | |
- this.button._settings.set_boolean(SETTINGS_SHOW_ICON, state); | |
- | |
- state = this.labelSwitch.getState(); | |
- this.button._settings.set_boolean(SETTINGS_SHOW_TEXT, state); | |
- | |
- state = this.tlcSwitch.getState(); | |
- this.button._settings.set_boolean(SETTINGS_ENABLE_HOT_CORNER, state); | |
- | |
- ModalDialog.ModalDialog.prototype.close.call(this, | |
- global.get_current_time()); | |
- } | |
-}); | |
- | |
const ApplicationsMenuButton = new Lang.Class({ | |
Name: 'ApplicationsMenuButton', | |
Extends: PanelMenu.Button, | |
@@ -412,8 +327,7 @@ const ApplicationsMenuButton = new Lang.Class({ | |
_showDialog: function(actor, event) { | |
if ( event.get_button() == 3 ) { | |
- let applicationsMenuDialog = new ApplicationsMenuDialog(this); | |
- applicationsMenuDialog.open(); | |
+ Util.spawn(["gnome-shell-extension-prefs", "Applications_Menu@rmy.pobox.com"]); | |
return true; | |
} | |
return false; | |
-- | |
2.13.5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment