From e2b2f125b408fc789e8b0cb11059f407c10e0c07 Mon Sep 17 00:00:00 2001 From: Giovanni Campagna Date: Sun, 18 Aug 2013 19:28:34 +0200 Subject: [PATCH] Remove the xrandr extension This can't work without a significant rework (because we can't use GnomeRR in the mutter process, now that's DBus API implemented by mutter itself, and the monitor config API is private to mutter for now), and I doubt it's really useful to anyone. Also, we have an orientation lock button, which kind of serves a similar purpose --- README | 6 - configure.ac | 8 +- extensions/xrandr-indicator/Makefile.am | 3 - extensions/xrandr-indicator/extension.js | 158 ------------------- extensions/xrandr-indicator/metadata.json.in | 10 -- extensions/xrandr-indicator/stylesheet.css | 3 - 6 files changed, 1 insertion(+), 187 deletions(-) delete mode 100644 extensions/xrandr-indicator/Makefile.am delete mode 100644 extensions/xrandr-indicator/extension.js delete mode 100644 extensions/xrandr-indicator/metadata.json.in delete mode 100644 extensions/xrandr-indicator/stylesheet.css diff --git a/README b/README index d96ff6c2..bc36eb57 100644 --- a/README +++ b/README @@ -71,12 +71,6 @@ windowsNavigator Allow keyboard selection of windows and workspaces in overlay mode. -xrandr-indicator - - Replace the GTK+ based indicator from gnome-settings-daemon with -a native one. Lets the user rotate the laptop monitor and open -display preferences quickly. - License ======= GNOME Shell Extensions are distributed under the terms of the GNU General Public License, diff --git a/configure.ac b/configure.ac index 75bacdb2..714a2e7e 100644 --- a/configure.ac +++ b/configure.ac @@ -29,7 +29,7 @@ AC_SUBST([SHELL_VERSION]) dnl keep this in alphabetic order CLASSIC_EXTENSIONS="apps-menu places-menu alternate-tab launch-new-instance window-list" DEFAULT_EXTENSIONS="$CLASSIC_EXTENSIONS drive-menu windowsNavigator workspace-indicator" -ALL_EXTENSIONS="$DEFAULT_EXTENSIONS auto-move-windows example native-window-placement systemMonitor user-theme xrandr-indicator" +ALL_EXTENSIONS="$DEFAULT_EXTENSIONS auto-move-windows example native-window-placement systemMonitor user-theme" AC_SUBST(CLASSIC_EXTENSIONS, [$CLASSIC_EXTENSIONS]) AC_SUBST(ALL_EXTENSIONS, [$ALL_EXTENSIONS]) AC_ARG_ENABLE([extensions], @@ -65,11 +65,6 @@ for e in $enable_extensions; do [ENABLED_EXTENSIONS="$ENABLED_EXTENSIONS $e"], [AC_MSG_WARN([libgtop-2.0 not found, disabling systemMonitor])]) ;; - xrandr-indicator) - PKG_CHECK_MODULES(GNOME_DESKTOP, gnome-desktop-3.0 >= 2.91.6, - [ENABLED_EXTENSIONS="$ENABLED_EXTENSIONS $e"], - [AC_MSG_WARN([gnome-desktop-3.0 not found, disabling xrandr-indicator])]) - ;; dnl keep this in alphabetic order alternate-tab|apps-menu|auto-move-windows|drive-menu|example|launch-new-instance|native-window-placement|places-menu|user-theme|window-list|windowsNavigator|workspace-indicator) ENABLED_EXTENSIONS="$ENABLED_EXTENSIONS $e" @@ -97,7 +92,6 @@ AC_CONFIG_FILES([ extensions/window-list/Makefile extensions/windowsNavigator/Makefile extensions/workspace-indicator/Makefile - extensions/xrandr-indicator/Makefile extensions/Makefile Makefile po/Makefile.in diff --git a/extensions/xrandr-indicator/Makefile.am b/extensions/xrandr-indicator/Makefile.am deleted file mode 100644 index 56abe216..00000000 --- a/extensions/xrandr-indicator/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -EXTENSION_ID = xrandr-indicator - -include ../../extension.mk diff --git a/extensions/xrandr-indicator/extension.js b/extensions/xrandr-indicator/extension.js deleted file mode 100644 index b38e676e..00000000 --- a/extensions/xrandr-indicator/extension.js +++ /dev/null @@ -1,158 +0,0 @@ -/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */ - -const Gdk = imports.gi.Gdk; -const Gio = imports.gi.Gio; -const GLib = imports.gi.GLib; -const GnomeDesktop = imports.gi.GnomeDesktop; -const Lang = imports.lang; -const Shell = imports.gi.Shell; -const St = imports.gi.St; - -const Main = imports.ui.main; -const PanelMenu = imports.ui.panelMenu; -const PopupMenu = imports.ui.popupMenu; -const Panel = imports.ui.panel; - -const Gettext = imports.gettext.domain('gnome-shell-extensions'); -const _ = Gettext.gettext; -const N_ = function(e) { return e }; - -const ExtensionUtils = imports.misc.extensionUtils; -const Me = ExtensionUtils.getCurrentExtension(); -const Convenience = Me.imports.convenience; - -const possibleRotations = [ GnomeDesktop.RRRotation.ROTATION_0, - GnomeDesktop.RRRotation.ROTATION_90, - GnomeDesktop.RRRotation.ROTATION_180, - GnomeDesktop.RRRotation.ROTATION_270 - ]; - -let rotations = [ [ GnomeDesktop.RRRotation.ROTATION_0, N_("Normal") ], - [ GnomeDesktop.RRRotation.ROTATION_90, N_("Left") ], - [ GnomeDesktop.RRRotation.ROTATION_270, N_("Right") ], - [ GnomeDesktop.RRRotation.ROTATION_180, N_("Upside-down") ] - ]; - -const XRandr2Iface = - - - - -; - -const XRandr2 = Gio.DBusProxy.makeProxyWrapper(XRandr2Iface); - -const Indicator = new Lang.Class({ - Name: 'XRandRIndicator', - Extends: PanelMenu.SystemStatusButton, - - _init: function() { - this.parent('preferences-desktop-display-symbolic', _("Display")); - - this._proxy = new XRandr2(Gio.DBus.session, 'org.gnome.SettingsDaemon', '/org/gnome/SettingsDaemon/XRANDR'); - - try { - this._screen = new GnomeDesktop.RRScreen({ gdk_screen: Gdk.Screen.get_default() }); - this._screen.init(null); - } catch(e) { - // an error means there is no XRandR extension - this.actor.hide(); - return; - } - - this._createMenu(); - this._screen.connect('changed', Lang.bind(this, this._randrEvent)); - }, - - destroy: function() { - if (this._screen) - this._screen.run_dispose(); - - this.parent(); - }, - - _randrEvent: function() { - this.menu.removeAll(); - this._createMenu(); - }, - - _createMenu: function() { - let config = GnomeDesktop.RRConfig.new_current(this._screen); - let outputs = config.get_outputs(); - for (let i = 0; i < outputs.length; i++) { - if (outputs[i].is_connected()) - this._addOutputItem(config, outputs[i]); - } - this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem()); - this.menu.addSettingsAction(_("Display Settings"), 'gnome-display-panel.desktop'); - }, - - _addOutputItem: function(config, output) { - let item = new PopupMenu.PopupMenuItem(output.get_display_name()); - item.label.add_style_class_name('display-subtitle'); - item.actor.reactive = false; - item.actor.can_focus = false; - this.menu.addMenuItem(item); - - let allowedRotations = this._getAllowedRotations(config, output); - let currentRotation = output.get_rotation(); - for (let i = 0; i < rotations.length; i++) { - let [bitmask, name] = rotations[i]; - if (bitmask & allowedRotations) { - let item = new PopupMenu.PopupMenuItem(Gettext.gettext(name)); - if (bitmask & currentRotation) - item.setOrnament(PopupMenu.Ornament.DOT); - item.connect('activate', Lang.bind(this, function(item, event) { - /* ensure config is saved so we get a backup if anything goes wrong */ - config.save(); - - output.set_rotation(bitmask); - try { - config.save(); - this._proxy.ApplyConfigurationRemote(0, event.get_time()); - } catch (e) { - log ('Could not save monitor configuration: ' + e); - } - })); - this.menu.addMenuItem(item); - } - } - }, - - _getAllowedRotations: function(config, output) { - let retval = 0; - - let current = output.get_rotation(); - - for (let i = 0; i < possibleRotations.length; i++) { - output.set_rotation(possibleRotations[i]); - if (config.applicable(this._screen)) { - retval |= possibleRotations[i]; - } - } - - output.set_rotation(current); - - if (retval.lenght == 0) { - // what, no rotation? - // what's current then? - retval = current; - } - return retval; - } -}); - -function init(metadata) { - Convenience.initTranslations(); -} - -let _indicator; - -function enable() { - _indicator = new Indicator(); - Main.panel.addToStatusArea('display', _indicator); -} - -function disable() { - _indicator.destroy(); -} diff --git a/extensions/xrandr-indicator/metadata.json.in b/extensions/xrandr-indicator/metadata.json.in deleted file mode 100644 index 5d99e084..00000000 --- a/extensions/xrandr-indicator/metadata.json.in +++ /dev/null @@ -1,10 +0,0 @@ -{ -"extension-id": "@extension_id@", -"uuid": "@uuid@", -"settings-schema": "@gschemaname@", -"gettext-domain": "@gettext_domain@", -"name": "Monitor Status Indicator", -"description": "Add a system status menu for rotating monitors.", -"shell-version": [ "@shell_current@" ], -"url": "@url@" -} diff --git a/extensions/xrandr-indicator/stylesheet.css b/extensions/xrandr-indicator/stylesheet.css deleted file mode 100644 index e263d705..00000000 --- a/extensions/xrandr-indicator/stylesheet.css +++ /dev/null @@ -1,3 +0,0 @@ -.display-subtitle { - font-weight: bold; -}