From abc8877d1134fe9bdc6680829324ff45f56ee0c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 7 Feb 2019 17:44:44 +0100 Subject: [PATCH 01/33] Update sass submodule --- data/gnome-shell-sass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/gnome-shell-sass b/data/gnome-shell-sass index 2080f27d..985ca1f7 160000 --- a/data/gnome-shell-sass +++ b/data/gnome-shell-sass @@ -1 +1 @@ -Subproject commit 2080f27d67e96b383ce0c2b169ee6b275177e75f +Subproject commit 985ca1f7cb7dd3856c5a60189d284c8aad562592 From 434185ba03726f785633611ae9b93efa1042bb3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Urban=C4=8Di=C4=8D?= Date: Tue, 12 Feb 2019 20:52:31 +0100 Subject: [PATCH 02/33] Added Slovenian translation --- po/sl.po | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/po/sl.po b/po/sl.po index 91f0cc86..c751dac1 100644 --- a/po/sl.po +++ b/po/sl.po @@ -2,7 +2,7 @@ # Copyright (C) 2011 gnome-shell-extensions's COPYRIGHT HOLDER # This file is distributed under the same license as the gnome-shell-extensions package. # -# Matej Urbančič , + 2011–2017. +# Matej Urbančič , + 2011–2019. # msgid "" msgstr "" @@ -10,7 +10,7 @@ msgstr "" "Report-Msgid-Bugs-To: https://bugzilla.gnome.org/enter_bug.cgi?product=gnome-" "shell&keywords=I18N+L10N&component=extensions\n" "POT-Creation-Date: 2017-07-07 10:35+0200\n" -"PO-Revision-Date: 2017-07-07 10:36+0200\n" +"PO-Revision-Date: 2019-02-12 20:43+0100\n" "Last-Translator: Matej Urbančič \n" "Language-Team: Slovenian GNOME Translation Team \n" "Language: sl_SI\n" @@ -20,7 +20,7 @@ msgstr "" "Plural-Forms: nplurals=4; plural=(n%100==1 ? 1 : n%100==2 ? 2 : n%100==3 || n" "%100==4 ? 3 : 0);\n" "X-Poedit-SourceCharset: utf-8\n" -"X-Generator: Poedit 2.0.1\n" +"X-Generator: Poedit 2.1.1\n" #: data/gnome-classic.desktop.in:3 data/gnome-classic.session.desktop.in:3 msgid "GNOME Classic" @@ -32,7 +32,7 @@ msgstr "Seja omogoča prijavo v običajno namizje GNOME." #: data/org.gnome.shell.extensions.classic-overrides.gschema.xml:7 msgid "Attach modal dialog to the parent window" -msgstr "Priponi modalno pogovorno okno nadrejenemu oknu" +msgstr "Pripni modalno pogovorno okno nadrejenemu oknu" #: data/org.gnome.shell.extensions.classic-overrides.gschema.xml:8 #: data/org.gnome.shell.extensions.classic-overrides.gschema.xml:25 @@ -41,8 +41,8 @@ msgstr "Priponi modalno pogovorno okno nadrejenemu oknu" msgid "" "This key overrides the key in org.gnome.mutter when running GNOME Shell." msgstr "" -"Možnost prepiše ključ med nastavitvami org.gnome.mutter med zagonom lupine " -"GNOME." +"Možnost med zagonom lupine GNOME prepiše ključ med nastavitvami org.gnome." +"mutter." #: data/org.gnome.shell.extensions.classic-overrides.gschema.xml:16 msgid "Arrangement of buttons on the titlebar" @@ -53,8 +53,8 @@ msgid "" "This key overrides the key in org.gnome.desktop.wm.preferences when running " "GNOME Shell." msgstr "" -"Možnost prepiše ključ med nastavitvami org.gnome.desktop.wm med zagonom " -"lupine GNOME." +"Možnost med zagonom lupine GNOME prepiše ključ med nastavitvami org.gnome." +"desktop.wm." #: data/org.gnome.shell.extensions.classic-overrides.gschema.xml:24 msgid "Enable edge tiling when dropping windows on screen edges" @@ -111,8 +111,8 @@ msgid "" "A list of strings, each containing an application id (desktop file name), " "followed by a colon and the workspace number" msgstr "" -"Seznam nizov z določilom ID programa (ime programa), ki mu sledi " -"dvopičje in nato številka delovne površine." +"Seznam nizov z določilom ID programa (ime programa), ki mu sledi dvopičje in " +"nato številka delovne površine." #: extensions/auto-move-windows/prefs.js:60 msgid "Application" @@ -174,8 +174,8 @@ msgid "" "as such it has little functionality on its own.\n" "Nevertheless it’s possible to customize the greeting message." msgstr "" -"Primer je oblikovan kot predloga za izgradnjo kakovostnih razširitev " -"za lupino, zato je delovanje deloma prilagojeno.\n" +"Primer je oblikovan kot predloga za izgradnjo kakovostnih razširitev za " +"lupino, zato je delovanje deloma prilagojeno.\n" "Kljub vsemu je mogoče prilagajati pozdravno sporočilo." #: extensions/native-window-placement/org.gnome.shell.extensions.native-window-placement.gschema.xml:5 @@ -202,9 +202,9 @@ msgid "" "shell default of placing it at the bottom. Changing this setting requires " "restarting the shell to have any effect." msgstr "" -"Izbrana možnost določi postavitev nazivov oken na vrh posamezne sličice" -"in s tem prepiše privzeti izpis pod sličico. Za uveljavitev sprememb je " -"treba lupino ponovno zagnati." +"Izbrana možnost določi postavitev nazivov oken na vrh posamezne sličice in s " +"tem prepiše privzeti izpis pod sličico. Za uveljavitev sprememb je treba " +"lupino ponovno zagnati." #: extensions/places-menu/extension.js:78 #: extensions/places-menu/extension.js:81 From cbd981351e4987f0e9f6dc5e356c8fd353045ec8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Fri, 15 Feb 2019 23:59:36 +0100 Subject: [PATCH 03/33] ci: Check for issue/MR URLs in commit messages Commit messages should include the full URL to an issue or merge request to keep associated information easily available in future log digging. Jonas came up with a script to enforce that policy for mutter and gnome-shell. It's an excellent idea, so adopt it here as well. https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/52 --- .gitlab-ci.yml | 17 +++++++++++++++++ .gitlab-ci/check-commit-log.sh | 31 +++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100755 .gitlab-ci/check-commit-log.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index af003a1c..72c42e0b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,15 +1,31 @@ stages: + - commit_check - source_check - build variables: LINT_LOG: "eslint-report.txt" +.only_default: &only_default + only: + - branches + - tags + - merge_requests + +check_commit_log: + image: registry.gitlab.gnome.org/gnome/gjs:fedora.static-analysis + stage: commit_check + script: + - ./.gitlab-ci/check-commit-log.sh + only: + - merge_requests + eslint: image: registry.gitlab.gnome.org/gnome/gjs:fedora.static-analysis stage: source_check script: - sh lint/generate-report.sh -o $LINT_LOG || { cat $LINT_LOG; false; } + <<: *only_default artifacts: paths: - ${LINT_LOG} @@ -23,3 +39,4 @@ build-shell-extensions: script: - meson _build . - ninja -C _build test install + <<: *only_default diff --git a/.gitlab-ci/check-commit-log.sh b/.gitlab-ci/check-commit-log.sh new file mode 100755 index 00000000..cc3bcee6 --- /dev/null +++ b/.gitlab-ci/check-commit-log.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +if [ -z "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" ]; then + echo Cannot review non-merge request + exit 1 +fi + +git fetch $CI_MERGE_REQUEST_PROJECT_URL.git $CI_MERGE_REQUEST_TARGET_BRANCH_NAME + +branch_point=$(git merge-base HEAD FETCH_HEAD) + +commits=$(git log --format='format:%H' $branch_point..$CI_COMMIT_SHA) + +if [ -z "$commits" ]; then + echo Commit range empty + exit 1 +fi + +function commit_message_has_url() { + commit=$1 + commit_message=$(git show -s --format='format:%b' $commit) + echo "$commit_message" | grep -qe "\($CI_MERGE_REQUEST_PROJECT_URL/\(issues\|merge_requests\)/[0-9]\+\|https://bugzilla.gnome.org/show_bug.cgi?id=[0-9]\+\)" + return $? +} + +for commit in $commits; do + if ! commit_message_has_url $commit; then + echo "Missing merge request or issue URL on commit $(echo $commit | cut -c -8)" + exit 1 + fi +done From d8f7d70c10265d2914eb6c673d5fa55c036dfb26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Tue, 12 Feb 2019 01:04:58 +0100 Subject: [PATCH 04/33] apps-menu: Remove outdated legacy-tray handling The tray is long gone, so trying to access it will result in warnings. https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/53 --- extensions/apps-menu/extension.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js index 845149af..ad25a59a 100644 --- a/extensions/apps-menu/extension.js +++ b/extensions/apps-menu/extension.js @@ -74,13 +74,6 @@ class ApplicationMenuItem extends PopupMenu.PopupBaseMenuItem { return maybeStartDrag.call(draggable, event); return false; }; - - draggable.connect('drag-begin', () => { - Shell.util_set_hidden_from_pick(Main.legacyTray.actor, true); - }); - draggable.connect('drag-end', () => { - Shell.util_set_hidden_from_pick(Main.legacyTray.actor, false); - }); } activate(event) { From 0d4164386690608869407717782fa0740ea2c0f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Fri, 15 Feb 2019 23:48:24 +0100 Subject: [PATCH 05/33] cleanup: Use destructuring for imports from GI This is *much* nicer than repetitive "imports.gi" lines ... https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/54 --- extensions/apps-menu/extension.js | 12 ++---------- extensions/auto-move-windows/prefs.js | 4 +--- extensions/drive-menu/extension.js | 5 +---- extensions/places-menu/extension.js | 4 +--- extensions/places-menu/placeDisplay.js | 4 +--- extensions/screenshot-window-sizer/extension.js | 4 +--- extensions/user-theme/extension.js | 3 +-- extensions/window-list/extension.js | 9 +-------- extensions/window-list/prefs.js | 4 +--- extensions/windowsNavigator/extension.js | 3 +-- extensions/workspace-indicator/extension.js | 6 +----- extensions/workspace-indicator/prefs.js | 4 +--- 12 files changed, 13 insertions(+), 49 deletions(-) diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js index ad25a59a..171b788c 100644 --- a/extensions/apps-menu/extension.js +++ b/extensions/apps-menu/extension.js @@ -1,20 +1,12 @@ /* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */ /* exported init enable disable */ -const Atk = imports.gi.Atk; +const { Atk, Clutter, Gio, GLib, GMenu, + GObject, Gtk, Meta, Shell, St } = imports.gi; const DND = imports.ui.dnd; -const GMenu = imports.gi.GMenu; -const GObject = imports.gi.GObject; -const Shell = imports.gi.Shell; -const St = imports.gi.St; -const Clutter = imports.gi.Clutter; const Main = imports.ui.main; -const Meta = imports.gi.Meta; const PanelMenu = imports.ui.panelMenu; const PopupMenu = imports.ui.popupMenu; -const Gtk = imports.gi.Gtk; -const GLib = imports.gi.GLib; -const Gio = imports.gi.Gio; const Signals = imports.signals; const Gettext = imports.gettext.domain('gnome-shell-extensions'); diff --git a/extensions/auto-move-windows/prefs.js b/extensions/auto-move-windows/prefs.js index e0aa3b37..fd448f0b 100644 --- a/extensions/auto-move-windows/prefs.js +++ b/extensions/auto-move-windows/prefs.js @@ -2,9 +2,7 @@ // Start apps on custom workspaces /* exported init buildPrefsWidget */ -const Gio = imports.gi.Gio; -const GObject = imports.gi.GObject; -const Gtk = imports.gi.Gtk; +const { Gio, GObject, Gtk } = imports.gi; const Gettext = imports.gettext.domain('gnome-shell-extensions'); const _ = Gettext.gettext; diff --git a/extensions/drive-menu/extension.js b/extensions/drive-menu/extension.js index 89747ec9..4c1fdbf1 100644 --- a/extensions/drive-menu/extension.js +++ b/extensions/drive-menu/extension.js @@ -1,9 +1,6 @@ /* exported init enable disable */ // Drive menu extension -const Gio = imports.gi.Gio; -const GObject = imports.gi.GObject; -const St = imports.gi.St; -const Shell = imports.gi.Shell; +const { Gio, GObject, Shell, St } = imports.gi; const Gettext = imports.gettext.domain('gnome-shell-extensions'); const _ = Gettext.gettext; diff --git a/extensions/places-menu/extension.js b/extensions/places-menu/extension.js index 9fced354..b98d3857 100644 --- a/extensions/places-menu/extension.js +++ b/extensions/places-menu/extension.js @@ -1,9 +1,7 @@ /* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */ /* exported init enable disable */ -const Clutter = imports.gi.Clutter; -const GObject = imports.gi.GObject; -const St = imports.gi.St; +const { Clutter, GObject, St } = imports.gi; const Main = imports.ui.main; const PanelMenu = imports.ui.panelMenu; diff --git a/extensions/places-menu/placeDisplay.js b/extensions/places-menu/placeDisplay.js index 133e7784..dd00bbf6 100644 --- a/extensions/places-menu/placeDisplay.js +++ b/extensions/places-menu/placeDisplay.js @@ -1,8 +1,6 @@ // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- -const GLib = imports.gi.GLib; -const Gio = imports.gi.Gio; -const Shell = imports.gi.Shell; +const { Gio, GLib, Shell } = imports.gi; const Mainloop = imports.mainloop; const Signals = imports.signals; diff --git a/extensions/screenshot-window-sizer/extension.js b/extensions/screenshot-window-sizer/extension.js index c00fb994..bf31f815 100644 --- a/extensions/screenshot-window-sizer/extension.js +++ b/extensions/screenshot-window-sizer/extension.js @@ -19,9 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -const Meta = imports.gi.Meta; -const Shell = imports.gi.Shell; -const St = imports.gi.St; +const { Meta, Shell, St } = imports.gi; const Main = imports.ui.main; const Tweener = imports.ui.tweener; diff --git a/extensions/user-theme/extension.js b/extensions/user-theme/extension.js index 9ffaf6fa..98497312 100644 --- a/extensions/user-theme/extension.js +++ b/extensions/user-theme/extension.js @@ -2,8 +2,7 @@ // Load shell theme from ~/.themes/name/gnome-shell /* exported init */ -const GLib = imports.gi.GLib; -const Gio = imports.gi.Gio; +const { Gio, GLib } = imports.gi; const Main = imports.ui.main; const SETTINGS_KEY = 'name'; diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js index e4633e21..cb2edb05 100644 --- a/extensions/window-list/extension.js +++ b/extensions/window-list/extension.js @@ -1,12 +1,5 @@ /* exported init */ -const Clutter = imports.gi.Clutter; -const GLib = imports.gi.GLib; -const Gio = imports.gi.Gio; -const GObject = imports.gi.GObject; -const Gtk = imports.gi.Gtk; -const Meta = imports.gi.Meta; -const Shell = imports.gi.Shell; -const St = imports.gi.St; +const { Clutter, Gio, GLib, GObject, Gtk, Meta, Shell, St } = imports.gi; const DND = imports.ui.dnd; const Main = imports.ui.main; diff --git a/extensions/window-list/prefs.js b/extensions/window-list/prefs.js index 639ec56b..59fd6975 100644 --- a/extensions/window-list/prefs.js +++ b/extensions/window-list/prefs.js @@ -1,9 +1,7 @@ // -*- mode: js2; indent-tabs-mode: nil; js2-basic-offset: 4 -*- /* exported init buildPrefsWidget */ -const Gio = imports.gi.Gio; -const GObject = imports.gi.GObject; -const Gtk = imports.gi.Gtk; +const { Gio, GObject, Gtk } = imports.gi; const Gettext = imports.gettext.domain('gnome-shell-extensions'); const _ = Gettext.gettext; diff --git a/extensions/windowsNavigator/extension.js b/extensions/windowsNavigator/extension.js index a4d74740..13de1bc3 100644 --- a/extensions/windowsNavigator/extension.js +++ b/extensions/windowsNavigator/extension.js @@ -1,7 +1,6 @@ /* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */ /* exported enable disable */ -const Clutter = imports.gi.Clutter; -const St = imports.gi.St; +const { Clutter, St } = imports.gi; const Main = imports.ui.main; const Workspace = imports.ui.workspace; diff --git a/extensions/workspace-indicator/extension.js b/extensions/workspace-indicator/extension.js index ea891e07..9e1dfd70 100644 --- a/extensions/workspace-indicator/extension.js +++ b/extensions/workspace-indicator/extension.js @@ -1,11 +1,7 @@ // -*- mode: js2; indent-tabs-mode: nil; js2-basic-offset: 4 -*- /* exported init enable disable */ -const Gio = imports.gi.Gio; -const GObject = imports.gi.GObject; -const Meta = imports.gi.Meta; -const Clutter = imports.gi.Clutter; -const St = imports.gi.St; +const { Clutter, Gio, GObject, Meta, St } = imports.gi; const PanelMenu = imports.ui.panelMenu; const PopupMenu = imports.ui.popupMenu; diff --git a/extensions/workspace-indicator/prefs.js b/extensions/workspace-indicator/prefs.js index dae2e957..64a64fdc 100644 --- a/extensions/workspace-indicator/prefs.js +++ b/extensions/workspace-indicator/prefs.js @@ -1,9 +1,7 @@ // -*- mode: js2; indent-tabs-mode: nil; js2-basic-offset: 4 -*- /* exported init buildPrefsWidget */ -const Gio = imports.gi.Gio; -const GObject = imports.gi.GObject; -const Gtk = imports.gi.Gtk; +const { Gio, GObject, Gtk } = imports.gi; const Gettext = imports.gettext.domain('gnome-shell-extensions'); const _ = Gettext.gettext; From 4671c24b7806800f4f09f7ef9203ecd224cb2531 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Fri, 15 Feb 2019 23:51:27 +0100 Subject: [PATCH 06/33] places-menu: Stop using deprecated Mainloop module Just use the underlying GLib functions directly. https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/54 --- extensions/places-menu/placeDisplay.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/extensions/places-menu/placeDisplay.js b/extensions/places-menu/placeDisplay.js index dd00bbf6..dbd3308c 100644 --- a/extensions/places-menu/placeDisplay.js +++ b/extensions/places-menu/placeDisplay.js @@ -1,7 +1,6 @@ // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- const { Gio, GLib, Shell } = imports.gi; -const Mainloop = imports.mainloop; const Signals = imports.signals; const Main = imports.ui.main; @@ -286,11 +285,12 @@ var PlacesManager = class { if (this._bookmarkTimeoutId > 0) return; /* Defensive event compression */ - this._bookmarkTimeoutId = Mainloop.timeout_add(100, () => { - this._bookmarkTimeoutId = 0; - this._reloadBookmarks(); - return false; - }); + this._bookmarkTimeoutId = GLib.timeout_add( + GLib.PRIORITY_DEFAULT, 100, () => { + this._bookmarkTimeoutId = 0; + this._reloadBookmarks(); + return false; + }); }); this._reloadBookmarks(); @@ -321,7 +321,7 @@ var PlacesManager = class { if (this._monitor) this._monitor.cancel(); if (this._bookmarkTimeoutId) - Mainloop.source_remove(this._bookmarkTimeoutId); + GLib.source_remove(this._bookmarkTimeoutId); } _updateSpecials() { From 5a06de606d0f08eef800f70c8a6ffe4c600a4475 Mon Sep 17 00:00:00 2001 From: Gun Chleoc Date: Sat, 16 Feb 2019 09:34:41 +0000 Subject: [PATCH 07/33] Update Scottish Gaelic translation (cherry picked from commit c394dbefba216e685fb01c4268c7bb0db93728ff) --- po/gd.po | 253 ++++++++++++++++++++++++------------------------------- 1 file changed, 109 insertions(+), 144 deletions(-) diff --git a/po/gd.po b/po/gd.po index de073009..c5497507 100644 --- a/po/gd.po +++ b/po/gd.po @@ -5,9 +5,9 @@ msgid "" msgstr "" "Project-Id-Version: gnome-shell-extensions master\n" -"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/gnome-shell-" -"extensions/issues\n" -"POT-Creation-Date: 2017-12-18 18:40+0000\n" +"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/gnome-shell-extensions/" +"issues\n" +"POT-Creation-Date: 2018-11-13 00:23+0000\n" "PO-Revision-Date: 2018-02-26 12:52+0100\n" "Last-Translator: GunChleoc \n" "Language-Team: Fòram na Gàidhlig\n" @@ -29,126 +29,81 @@ msgstr "GNOME clasaigeach" msgid "This session logs you into GNOME Classic" msgstr "Clàraidh an seisean seo a-steach gu GNOME clasaigeach thu" -#: data/org.gnome.shell.extensions.classic-overrides.gschema.xml:7 -msgid "Attach modal dialog to the parent window" -msgstr "Ceangail còmhradh mòdach ris an uinneag-pàraint" - -#: data/org.gnome.shell.extensions.classic-overrides.gschema.xml:8 -#: data/org.gnome.shell.extensions.classic-overrides.gschema.xml:25 -#: data/org.gnome.shell.extensions.classic-overrides.gschema.xml:33 -#: data/org.gnome.shell.extensions.classic-overrides.gschema.xml:41 -msgid "" -"This key overrides the key in org.gnome.mutter when running GNOME Shell." -msgstr "" -"Tar-àithnidh an iuchair seo an iuchair ann an org.gnome.mutter nuair a thèid " -"Slige GNOME a ruith." - -#: data/org.gnome.shell.extensions.classic-overrides.gschema.xml:16 -msgid "Arrangement of buttons on the titlebar" -msgstr "Seòrsachadh nam putanan air a’ bhàr-tiotail" - -#: data/org.gnome.shell.extensions.classic-overrides.gschema.xml:17 -msgid "" -"This key overrides the key in org.gnome.desktop.wm.preferences when running " -"GNOME Shell." -msgstr "" -"Tar-àithnidh an iuchair seo an iuchair ann an org.gnome.desktop.wm." -"preferences nuair a thèid Slige GNOME a ruith." - -#: data/org.gnome.shell.extensions.classic-overrides.gschema.xml:24 -msgid "Enable edge tiling when dropping windows on screen edges" -msgstr "" -"Cuir leacadh nan oirean an comas nuair a thèid uinneagan a leigeil às aig " -"oir na sgrìn" - -#: data/org.gnome.shell.extensions.classic-overrides.gschema.xml:32 -msgid "Workspaces only on primary monitor" -msgstr "Rumannan-obrach air a’ phrìomh-sgrìn a-mhàin" - -#: data/org.gnome.shell.extensions.classic-overrides.gschema.xml:40 -msgid "Delay focus changes in mouse mode until the pointer stops moving" -msgstr "" -"Cuir dàil air atharraichean an fòcais ann am modh luchaige gus an sguir an " -"tomhaire air gluasad" +#: extensions/alternate-tab/prefs.js:19 +msgid "Thumbnail only" +msgstr "Dealbhag a-mhàin" #: extensions/alternate-tab/prefs.js:20 -msgid "Thumbnail only" -msgstr "Dealbhagan a-mhàin" - -#: extensions/alternate-tab/prefs.js:21 msgid "Application icon only" msgstr "Ìomhaigheag na h-aplacaid a-mhàin" -#: extensions/alternate-tab/prefs.js:22 +#: extensions/alternate-tab/prefs.js:21 msgid "Thumbnail and application icon" msgstr "Dealbhag is ìomhaigheag na h-aplacaid" -#: extensions/alternate-tab/prefs.js:38 +#: extensions/alternate-tab/prefs.js:34 msgid "Present windows as" msgstr "Seall uinneagan mar" -#: extensions/alternate-tab/prefs.js:69 +#: extensions/alternate-tab/prefs.js:65 msgid "Show only windows in the current workspace" -msgstr "Na seall ach na h-uinneagan san rum-obrach làithreach" +msgstr "Na seall ach na h-uinneagan san rùm-obrach làithreach" -#: extensions/apps-menu/extension.js:41 +#: extensions/apps-menu/extension.js:37 msgid "Activities Overview" msgstr "Foir-shealladh nan gnìomhachdan" -#: extensions/apps-menu/extension.js:141 +#: extensions/apps-menu/extension.js:130 msgid "Favorites" msgstr "Annsachdan" -#: extensions/apps-menu/extension.js:436 +#: extensions/apps-menu/extension.js:417 msgid "Applications" msgstr "Aplacaidean" #: extensions/auto-move-windows/org.gnome.shell.extensions.auto-move-windows.gschema.xml:6 msgid "Application and workspace list" -msgstr "Ìomhaigheag na h-aplacaid is liosta nan rumannan-obrach" +msgstr "Liosta nan aplacaidean is rumannan-obrach" #: extensions/auto-move-windows/org.gnome.shell.extensions.auto-move-windows.gschema.xml:7 msgid "" "A list of strings, each containing an application id (desktop file name), " "followed by a colon and the workspace number" -msgstr "" -"Liosta dhe shreangan le id aplacaid (ainm faidhle desktop) aig gach tè air a " -"leantainn le còilean is àireamh an ruim-obrach" +msgstr "Liosta dhe shreangan le id aplacaid (ainm faidhle desktop) aig gach tè ’ga leantainn le còilean is àireamh an ruim-obrach" -#: extensions/auto-move-windows/prefs.js:56 +#: extensions/auto-move-windows/prefs.js:53 msgid "Application" msgstr "Aplacaid" -#: extensions/auto-move-windows/prefs.js:65 -#: extensions/auto-move-windows/prefs.js:123 +#: extensions/auto-move-windows/prefs.js:62 +#: extensions/auto-move-windows/prefs.js:117 msgid "Workspace" -msgstr "Rum-obrach" +msgstr "Rùm-obrach" -#: extensions/auto-move-windows/prefs.js:81 +#: extensions/auto-move-windows/prefs.js:78 msgid "Add Rule" msgstr "Cuir riaghailt ris" -#: extensions/auto-move-windows/prefs.js:102 +#: extensions/auto-move-windows/prefs.js:98 msgid "Create new matching rule" msgstr "Cruthaich riaghailt maidsidh ùr" -#: extensions/auto-move-windows/prefs.js:107 +#: extensions/auto-move-windows/prefs.js:103 msgid "Add" msgstr "Cuir ris" #. TRANSLATORS: %s is the filesystem name -#: extensions/drive-menu/extension.js:107 +#: extensions/drive-menu/extension.js:103 +#: extensions/places-menu/placeDisplay.js:225 #, javascript-format -#| msgid "Ejecting drive '%s' failed:" msgid "Ejecting drive “%s” failed:" msgstr "Cha deach leinn draibh “%s” a ghluasad a-mach:" -#: extensions/drive-menu/extension.js:125 +#: extensions/drive-menu/extension.js:118 msgid "Removable devices" -msgstr "Draibhean so-ghiùlain" +msgstr "Uidheaman so-ghiùlain" -#: extensions/drive-menu/extension.js:150 -#| msgid "Open File" +#: extensions/drive-menu/extension.js:143 msgid "Open Files" msgstr "Fosgail faidhlichean" @@ -164,86 +119,68 @@ msgstr "Teacsa fàilteachaidh eile." msgid "" "If not empty, it contains the text that will be shown when clicking on the " "panel." -msgstr "" -"Mur eil seo falamh, tha an teacsa ’na bhroinn a thèid a shealltainn le " -"briogadh air a’ phanail." +msgstr "Mur eil seo falamh, tha an teacsa ’na bhroinn a thèid a shealltainn le briogadh air a’ phanail." -#: extensions/example/prefs.js:30 +#: extensions/example/prefs.js:27 msgid "Message" msgstr "Teachdaireachd" #. TRANSLATORS: Example is the name of the extension, should not be #. translated -#: extensions/example/prefs.js:43 -#| msgid "" -#| "Example aims to show how to build well behaved extensions for the Shell " -#| "and as such it has little functionality on its own.\n" -#| "Nevertheless it's possible to customize the greeting message." +#: extensions/example/prefs.js:40 msgid "" "Example aims to show how to build well behaved extensions for the Shell and " "as such it has little functionality on its own.\n" "Nevertheless it’s possible to customize the greeting message." -msgstr "" -"Tha am ball-eisimpleir airson sealltainn dhut mar a thogas tu leudachain le " -"deagh-ghiùlan airson na Slige agus mar sin cha dèan e fhèin mòran.\n" -"’S urrainn dhut an teachdaireachd fàilteachaidh a ghnàthachadh co-dhiù." +msgstr "Tha am ball-eisimpleir airson sealltainn dhut mar a thogas tu leudachain le deagh-ghiùlan airson na Slige agus mar sin cha dèan e fhèin mòran.\n’S urrainn dhut an teachdaireachd fàilteachaidh a ghnàthachadh co-dhiù." #: extensions/native-window-placement/org.gnome.shell.extensions.native-window-placement.gschema.xml:5 msgid "Use more screen for windows" -msgstr "Cleachd cuid nas motha dhen sgrìn airson uinneagan" +msgstr "Cleachd barrachd dhen sgrìn airson uinneagan" #: extensions/native-window-placement/org.gnome.shell.extensions.native-window-placement.gschema.xml:6 msgid "" "Try to use more screen for placing window thumbnails by adapting to screen " "aspect ratio, and consolidating them further to reduce the bounding box. " "This setting applies only with the natural placement strategy." -msgstr "" -"Feuch barrachd rum air an sgrìn a chleachdadh nuair a thèid dealbhagan nan " -"uinneagan a chur ann le gleusadh a-rèir co-mheas deilbh na sgrìn agus le " -"barrachd co-dhaingneachaidh ach am bi am bogsa-iadhaidh nas lugha. Cha bhi " -"an roghainn seo an sàs ach leis an ro-innleachd suidheachaidh nàdarra." +msgstr "Feuch barrachd rùm air an sgrìn a chleachdadh nuair a thèid dealbhagan nan uinneagan a chur ann le gleusadh a-rèir co-mheas deilbh na sgrìn agus le barrachd co-dhaingneachaidh ach am bi am bogsa-iadhaidh nas lugha. Cha bhi an roghainn seo an sàs ach leis an ro-innleachd suidheachaidh nàdarra." #: extensions/native-window-placement/org.gnome.shell.extensions.native-window-placement.gschema.xml:11 msgid "Place window captions on top" -msgstr "Cuir caipseanan nan uinneagan air a’ bharr" +msgstr "Cuir caipseanan nan uinneagan air a’ bhàrr" #: extensions/native-window-placement/org.gnome.shell.extensions.native-window-placement.gschema.xml:12 msgid "" "If true, place window captions on top the respective thumbnail, overriding " "shell default of placing it at the bottom. Changing this setting requires " "restarting the shell to have any effect." -msgstr "" -"Mas e true a th’ ann, thèid caipseanan nan uinneagan a chur ri barr nan " -"dealbhagan, a’ tar-àithneadh bun-roghainn na slige a chuireas aig a’ bhonn " -"iad. Ma dh’atharraicheas tu an roghainn seo, feumaidh tu an t-slige a " -"thòiseachadh às ùr gus an dèid a cur an sàs." +msgstr "Mas e true a th’ ann, thèid caipseanan nan uinneagan a chur ri bàrr nan dealbhagan, a’ tar-àithneadh bun-roghainn na slige a chuireas aig a’ bhonn iad. Ma dh’atharraicheas tu an roghainn seo, feumaidh tu an t-slige ath-thòiseachadh gus an dèid a cur an sàs." -#: extensions/places-menu/extension.js:78 -#: extensions/places-menu/extension.js:81 +#: extensions/places-menu/extension.js:79 +#: extensions/places-menu/extension.js:82 msgid "Places" msgstr "Ionadan" -#: extensions/places-menu/placeDisplay.js:65 +#: extensions/places-menu/placeDisplay.js:67 #, javascript-format msgid "Failed to mount volume for “%s”" msgstr "Cha b’ urrainn dhuinn an t-iom-dhraibh airson “%s” a mhunntachadh" -#: extensions/places-menu/placeDisplay.js:78 +#: extensions/places-menu/placeDisplay.js:80 #, javascript-format -#| msgid "Failed to launch \"%s\"" msgid "Failed to launch “%s”" msgstr "Cha b’ urrainn dhuinn “%s” a chur gu dol" -#: extensions/places-menu/placeDisplay.js:137 -#: extensions/places-menu/placeDisplay.js:160 +#: extensions/places-menu/placeDisplay.js:141 +#: extensions/places-menu/placeDisplay.js:164 msgid "Computer" msgstr "Coimpiutair" -#: extensions/places-menu/placeDisplay.js:303 +#: extensions/places-menu/placeDisplay.js:342 msgid "Home" msgstr "Dachaigh" -#: extensions/places-menu/placeDisplay.js:347 +#: extensions/places-menu/placeDisplay.js:386 msgid "Browse Network" msgstr "Brabhsaich an lìonra" @@ -252,7 +189,6 @@ msgid "Cycle Screenshot Sizes" msgstr "Cuartaich meudan nan glacaidhean-sgrìn" #: extensions/screenshot-window-sizer/org.gnome.shell.extensions.screenshot-window-sizer.gschema.xml:11 -#| msgid "Cycle Screenshot Sizes" msgid "Cycle Screenshot Sizes Backward" msgstr "Cuartaich meudan nan glacaidhean-sgrìn gu contrarra" @@ -264,115 +200,143 @@ msgstr "Ainm an ùrlair" msgid "The name of the theme, to be loaded from ~/.themes/name/gnome-shell" msgstr "Ainm an ùrlair a thèid a luchdadh o ~/.themes/name/gnome-shell" -#: extensions/window-list/extension.js:110 +#: extensions/window-list/extension.js:106 msgid "Close" msgstr "Dùin" -#: extensions/window-list/extension.js:129 +#: extensions/window-list/extension.js:125 msgid "Unminimize" msgstr "Neo-fhìor-lùghdaich" -#: extensions/window-list/extension.js:130 +#: extensions/window-list/extension.js:126 msgid "Minimize" msgstr "Fìor-lùghdaich" -#: extensions/window-list/extension.js:136 +#: extensions/window-list/extension.js:132 msgid "Unmaximize" msgstr "Neo-làn-mheudaich" -#: extensions/window-list/extension.js:137 +#: extensions/window-list/extension.js:133 msgid "Maximize" msgstr "Làn-mheudaich" -#: extensions/window-list/extension.js:420 +#: extensions/window-list/extension.js:408 msgid "Minimize all" msgstr "Fìor-lùghdaich na h-uile" -#: extensions/window-list/extension.js:428 +#: extensions/window-list/extension.js:414 msgid "Unminimize all" msgstr "Neo-fhìor-lùghdaich na h-uile" -#: extensions/window-list/extension.js:436 +#: extensions/window-list/extension.js:420 msgid "Maximize all" msgstr "Làn-mheudaich na h-uile" -#: extensions/window-list/extension.js:445 +#: extensions/window-list/extension.js:429 msgid "Unmaximize all" msgstr "Neo-làn-mheudaich na h-uile" -#: extensions/window-list/extension.js:454 +#: extensions/window-list/extension.js:438 msgid "Close all" msgstr "Dùin na h-uile" -#: extensions/window-list/extension.js:678 -#: extensions/workspace-indicator/extension.js:30 +#: extensions/window-list/extension.js:646 +#: extensions/workspace-indicator/extension.js:26 msgid "Workspace Indicator" -msgstr "Taisbeanair ruim-obrach" +msgstr "Taisbeanair rùim-obrach" -#: extensions/window-list/extension.js:842 +#: extensions/window-list/extension.js:816 msgid "Window List" msgstr "Liosta nan uinneagan" #: extensions/window-list/org.gnome.shell.extensions.window-list.gschema.xml:12 msgid "When to group windows" -msgstr "Cuin a thèid na h-uinneagan a bhuidhneachadh" +msgstr "Cuin a thèid uinneagan a bhuidhneachadh" #: extensions/window-list/org.gnome.shell.extensions.window-list.gschema.xml:13 -#| msgid "" -#| "Decides when to group windows from the same application on the window " -#| "list. Possible values are \"never\", \"auto\" and \"always\"." msgid "" "Decides when to group windows from the same application on the window list. " "Possible values are “never”, “auto” and “always”." -msgstr "" -"Mìnichidh seo cuin a thèid uinneagan aig an aon aplacaid a bhuidhneachadh " -"air liosta nan uinneagan. ’S e “never”, “auto” agus “always” a tha sna " -"roghainnean dligheach." +msgstr "Taghaidh seo cuin a thèid na h-uinneagan aig aplacaid a bhuidhneachadh air liosta nan uinneagan. ’S e “never”, “auto” agus “always” a tha sna roghainnean dligheach." #: extensions/window-list/org.gnome.shell.extensions.window-list.gschema.xml:20 msgid "Show the window list on all monitors" -msgstr "Seall liosta nan uinneagan air a h-uile sgrìn" +msgstr "Seall liosta nan uinneagan air a h-uile monatair" #: extensions/window-list/org.gnome.shell.extensions.window-list.gschema.xml:21 msgid "" "Whether to show the window list on all connected monitors or only on the " "primary one." -msgstr "" -"Co-dhiù an dèid liosta nan uinneagan a shealltainn air gach sgrìn " -"cheangailte no air a’ phrìomh-thè a-mhàin." +msgstr "Co-dhiù an dèid liosta nan uinneagan a shealltainn air gach monatair ceangailte no air a’ phrìomh-fhear a-mhàin." -#: extensions/window-list/prefs.js:32 +#: extensions/window-list/prefs.js:28 msgid "Window Grouping" msgstr "Buidhneachadh nan uinneagan" -#: extensions/window-list/prefs.js:50 +#: extensions/window-list/prefs.js:46 msgid "Never group windows" msgstr "Na buidhnich na h-uinneagan idir" -#: extensions/window-list/prefs.js:51 +#: extensions/window-list/prefs.js:47 msgid "Group windows when space is limited" -msgstr "Buidhnich na h-uinneagan nuair a bhios an rum gann" +msgstr "Buidhnich na h-uinneagan nuair a bhios an rùm gann" -#: extensions/window-list/prefs.js:52 +#: extensions/window-list/prefs.js:48 msgid "Always group windows" msgstr "Buidhnich na h-uinneagan an-còmhnaidh" -#: extensions/window-list/prefs.js:75 +#: extensions/window-list/prefs.js:71 msgid "Show on all monitors" -msgstr "Seall air a h-uile sgrìn" +msgstr "Seall air a h-uile monatair" -#: extensions/workspace-indicator/prefs.js:141 +#: extensions/workspace-indicator/prefs.js:134 msgid "Workspace Names" msgstr "Ainmean nan rumannan-obrach" -#: extensions/workspace-indicator/prefs.js:157 +#: extensions/workspace-indicator/prefs.js:150 msgid "Name" msgstr "Ainm" -#: extensions/workspace-indicator/prefs.js:198 +#: extensions/workspace-indicator/prefs.js:190 #, javascript-format msgid "Workspace %d" -msgstr "Rum-obrach %d" +msgstr "Rùm-obrach %d" + +#~ msgid "Attach modal dialog to the parent window" +#~ msgstr "Ceangail còmhradh mòdach ris an uinneag-pàraint" + +#~ msgid "" +#~ "This key overrides the key in org.gnome.mutter when running GNOME Shell." +#~ msgstr "" + +#~ "Tar-àithnidh an iuchair seo an iuchair ann an org.gnome.mutter nuair a " +#~ "thèid Slige GNOME a ruith." + +#~ msgid "Arrangement of buttons on the titlebar" +#~ msgstr "Seòrsachadh nam putanan air a’ bhàr-tiotail" + +#~ msgid "" +#~ "This key overrides the key in org.gnome.desktop.wm.preferences when " +#~ "running GNOME Shell." +#~ msgstr "" + +#~ "Tar-àithnidh an iuchair seo an iuchair ann an org.gnome.desktop.wm." +#~ "preferences nuair a thèid Slige GNOME a ruith." + +#~ msgid "Enable edge tiling when dropping windows on screen edges" +#~ msgstr "" + +#~ "Cuir leacadh nan oirean an comas nuair a thèid uinneagan a leigeil às aig " +#~ "oir na sgrìn" + +#~ msgid "Workspaces only on primary monitor" +#~ msgstr "Rumannan-obrach air a’ phrìomh-sgrìn a-mhàin" + +#~ msgid "Delay focus changes in mouse mode until the pointer stops moving" +#~ msgstr "" + +#~ "Cuir dàil air atharraichean an fòcais ann am modh luchaige gus an sguir " +#~ "an tomhaire air gluasad" #~ msgid "Notifications" #~ msgstr "Brathan" @@ -427,6 +391,7 @@ msgstr "Rum-obrach %d" #~ "Clicking \n" #~ " native switches the Alternate Tab extension off. \n" #~ msgstr "" + #~ "Seo a' chiad turas a chì thu leudachan Alt Taba chaochlaidich. \n" #~ "Tagh an giùlan as fhearr leat:\n" #~ "\n" From 2582ab4fd03a6a078a3ba2556e250bfdb64308b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20G=C4=85sior?= Date: Wed, 20 Feb 2019 01:02:50 +0100 Subject: [PATCH 08/33] User theme: compatibility with XDG Base Directory See https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/55 --- extensions/user-theme/extension.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/extensions/user-theme/extension.js b/extensions/user-theme/extension.js index 98497312..d9d5b388 100644 --- a/extensions/user-theme/extension.js +++ b/extensions/user-theme/extension.js @@ -1,5 +1,5 @@ // -*- mode: js2; indent-tabs-mode: nil; js2-basic-offset: 4 -*- -// Load shell theme from ~/.themes/name/gnome-shell +// Load shell theme from ~/.local/share/themes/name/gnome-shell /* exported init */ const { Gio, GLib } = imports.gi; @@ -34,11 +34,17 @@ class ThemeManager { let _themeName = this._settings.get_string(SETTINGS_KEY); if (_themeName) { - let _userCssStylesheet = GLib.build_filenamev([ + let _userCssStylesheetCompat = GLib.build_filenamev([ GLib.get_home_dir(), '.themes', _themeName, 'gnome-shell', 'gnome-shell.css' ]); + let fileCompat = Gio.file_new_for_path(_userCssStylesheetCompat); + let _userCssStylesheet = GLib.build_filenamev([ + GLib.get_user_data_dir(), 'themes', _themeName, 'gnome-shell', 'gnome-shell.css' + ]); let file = Gio.file_new_for_path(_userCssStylesheet); - if (file.query_exists(null)) + if (fileCompat.query_exists(null)) + _stylesheet = _userCssStylesheetCompat; + else if (file.query_exists(null)) _stylesheet = _userCssStylesheet; else { let sysdirs = GLib.get_system_data_dirs(); From 11cad1f3b31dc67c40741b18712486589bb46d72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 21 Feb 2019 21:55:36 +0100 Subject: [PATCH 09/33] Update sass submodule https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/56 --- data/gnome-shell-sass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/gnome-shell-sass b/data/gnome-shell-sass index 985ca1f7..055fefe5 160000 --- a/data/gnome-shell-sass +++ b/data/gnome-shell-sass @@ -1 +1 @@ -Subproject commit 985ca1f7cb7dd3856c5a60189d284c8aad562592 +Subproject commit 055fefe597605cec6de6899667d4ff45f83a5857 From d5a1044244865ffb188cd31a72eea92d5abf3f5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 21 Feb 2019 22:41:20 +0100 Subject: [PATCH 10/33] Bump version to 3.31.91 Update NEWS. --- NEWS | 12 ++++++++++++ meson.build | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 829f2b3d..4e653e98 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,15 @@ +3.31.91 +======= +* apps-menu: Remove outdated legacy-tray handling [Florian; !53] +* user-theme: Allow using XDG user data dir [Tomasz; !55] +* Misc. bug fixes and cleanups [Florian; !52, !54, !56] + +Contributors: + Tomasz Gąsior, Florian Müllner + +Translators: + Matej Urbančič [sl], Gun Chleoc [gd] + 3.31.90 ======= * Misc. bug fixes and cleanups [Florian; !49, !50, !51] diff --git a/meson.build b/meson.build index 0115562f..7e5fdd3c 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('gnome-shell-extensions', - version: '3.31.90', + version: '3.31.91', meson_version: '>= 0.44.0', license: 'GPL2+' ) From b50074fd3736efdabf18d16a45da1597541505bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Tue, 12 Feb 2019 11:09:02 +0100 Subject: [PATCH 11/33] lint: Restrict deprecated Lang API Now that we moved to ES standard replacements, let's make sure they don't creep back in accidentally. https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/57 --- lint/eslintrc-shell.json | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lint/eslintrc-shell.json b/lint/eslintrc-shell.json index 198a7509..9546626b 100644 --- a/lint/eslintrc-shell.json +++ b/lint/eslintrc-shell.json @@ -35,6 +35,19 @@ "afterColon": true } ], + "no-restricted-properties": [ + "error", + { + "object": "Lang", + "property": "bind", + "message": "Please use arrow notation or Function.prototype.bind()." + }, + { + "object": "Lang", + "property": "Class", + "message": "Please use ES6 classes." + } + ], "no-unused-vars": [ "error", { From 78580bc3a84786896b2653287dd9ff04496a2a1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 28 Feb 2019 18:26:00 +0100 Subject: [PATCH 12/33] lint: Remove unused rules We picked those up from Polari, which had those for - object arrays: let foo = [ { bar: 42, quz: true }, { bar: 23, quz: false } ]; - "enums": let Options = { ONE: 0, TWO: 1, THREE: 2 }; We don't have either of those, so drop the rules to minimise divergence with gjs. https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/57 --- lint/eslintrc-shell.json | 9 --------- 1 file changed, 9 deletions(-) diff --git a/lint/eslintrc-shell.json b/lint/eslintrc-shell.json index 9546626b..1c602580 100644 --- a/lint/eslintrc-shell.json +++ b/lint/eslintrc-shell.json @@ -20,21 +20,12 @@ 4, { "ignoredNodes": [ - "ArrayExpression > ObjectExpression", "CallExpression[callee.object.name=GObject][callee.property.name=registerClass] > ClassExpression:first-child", "ConditionalExpression" ], "MemberExpression": "off" } ], - "key-spacing": [ - "error", - { - "mode": "minimum", - "beforeColon": false, - "afterColon": true - } - ], "no-restricted-properties": [ "error", { From 9b25a227c62e92f93b913502f3abe2aad78ec78f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 28 Feb 2019 18:26:39 +0100 Subject: [PATCH 13/33] style: Don't exempt ternary expressions from indent rule It turns out we can comply with gjs' coding style and still align the branches if line breaks are required, so do that to reduce diversion from the canonical GNOME style. https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/57 --- extensions/apps-menu/extension.js | 10 +++++----- extensions/window-list/extension.js | 8 ++++---- lint/eslintrc-legacy.json | 1 - lint/eslintrc-shell.json | 3 +-- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js index 171b788c..fb335ccf 100644 --- a/extensions/apps-menu/extension.js +++ b/extensions/apps-menu/extension.js @@ -470,12 +470,12 @@ class ApplicationsButton extends PanelMenu.Button { this._tree.disconnect(this._treeChangedId); this._tree = null; + let handler = Main.sessionMode.hasOverview ? + Main.overview.toggle.bind(Main.overview) : null; Main.wm.setCustomKeybindingHandler('panel-main-menu', Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW, - Main.sessionMode.hasOverview ? - Main.overview.toggle.bind(Main.overview) : - null); + handler); this._desktopTarget.destroy(); } @@ -491,8 +491,8 @@ class ApplicationsButton extends PanelMenu.Button { _onMenuKeyPress(actor, event) { let symbol = event.get_key_symbol(); if (symbol == Clutter.KEY_Left || symbol == Clutter.KEY_Right) { - let direction = symbol == Clutter.KEY_Left ? Gtk.DirectionType.LEFT - : Gtk.DirectionType.RIGHT; + let direction = symbol == Clutter.KEY_Left ? + Gtk.DirectionType.LEFT : Gtk.DirectionType.RIGHT; if (this.menu.actor.navigate_focus(global.stage.key_focus, direction, false)) return true; } diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js index cb2edb05..493970a4 100644 --- a/extensions/window-list/extension.js +++ b/extensions/window-list/extension.js @@ -116,15 +116,15 @@ class WindowContextMenu extends PopupMenu.PopupMenu { } _updateMinimizeItem() { - this._minimizeItem.label.text = this._metaWindow.minimized ? _("Unminimize") - : _("Minimize"); + this._minimizeItem.label.text = this._metaWindow.minimized ? + _("Unminimize") : _("Minimize"); } _updateMaximizeItem() { let maximized = this._metaWindow.maximized_vertically && this._metaWindow.maximized_horizontally; - this._maximizeItem.label.text = maximized ? _("Unmaximize") - : _("Maximize"); + this._maximizeItem.label.text = maximized ? + _("Unmaximize") : _("Maximize"); } _onDestroy() { diff --git a/lint/eslintrc-legacy.json b/lint/eslintrc-legacy.json index 0bbbff18..e4b2fb0e 100644 --- a/lint/eslintrc-legacy.json +++ b/lint/eslintrc-legacy.json @@ -5,7 +5,6 @@ 4, { "ignoredNodes": [ - "ConditionalExpression", "CallExpression > ArrowFunctionExpression", "CallExpression[callee.object.name=GObject][callee.property.name=registerClass] > ClassExpression:first-child" ], diff --git a/lint/eslintrc-shell.json b/lint/eslintrc-shell.json index 1c602580..9821bf4a 100644 --- a/lint/eslintrc-shell.json +++ b/lint/eslintrc-shell.json @@ -20,8 +20,7 @@ 4, { "ignoredNodes": [ - "CallExpression[callee.object.name=GObject][callee.property.name=registerClass] > ClassExpression:first-child", - "ConditionalExpression" + "CallExpression[callee.object.name=GObject][callee.property.name=registerClass] > ClassExpression:first-child" ], "MemberExpression": "off" } From 7f8f1234ae16c633a1ed8a2aba56e7a998b5b9ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 28 Feb 2019 18:34:24 +0100 Subject: [PATCH 14/33] style: Stop using braces for single-line arrow functions Braces are optional for single-line arrow functions, but there's a subtle difference: Without braces, the expression is implicitly used as return value; with braces, the function returns nothing unless there's an explicit return. We currently reflect that in our style by only omitting braces when the function is expected to have a return value, but that's not very obvious, not an important differentiation to make, and not easy to express in an automatic rule. So just omit braces consistently as mandated by gjs' coding style. https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/57 --- extensions/apps-menu/extension.js | 6 +++--- extensions/auto-move-windows/extension.js | 4 ++-- extensions/places-menu/placeDisplay.js | 8 ++++---- extensions/window-list/extension.js | 8 ++++---- lint/eslintrc-shell.json | 7 ------- 5 files changed, 13 insertions(+), 20 deletions(-) diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js index fb335ccf..9e78933a 100644 --- a/extensions/apps-menu/extension.js +++ b/extensions/apps-menu/extension.js @@ -529,7 +529,7 @@ class ApplicationsButton extends PanelMenu.Button { Main.wm.setCustomKeybindingHandler('panel-main-menu', Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW, - () => { this.menu.toggle(); }); + () => this.menu.toggle()); } _redisplay() { @@ -616,8 +616,8 @@ class ApplicationsButton extends PanelMenu.Button { style_class: 'vfade' }); this.categoriesScrollBox.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC); vscroll = this.categoriesScrollBox.get_vscroll_bar(); - vscroll.connect('scroll-start', () => { this.menu.passEvents = true; }); - vscroll.connect('scroll-stop', () => { this.menu.passEvents = false; }); + vscroll.connect('scroll-start', () => this.menu.passEvents = true); + vscroll.connect('scroll-stop', () => this.menu.passEvents = false); this.leftBox.add(this.categoriesScrollBox, { expand: true, x_fill: true, y_fill: true, y_align: St.Align.START }); diff --git a/extensions/auto-move-windows/extension.js b/extensions/auto-move-windows/extension.js index 35979971..646156aa 100644 --- a/extensions/auto-move-windows/extension.js +++ b/extensions/auto-move-windows/extension.js @@ -125,9 +125,9 @@ function myCheckWorkspaces() { } // make sure the original method only removes empty workspaces at the end - keepAliveWorkspaces.forEach(ws => { ws._keepAliveId = 1; }); + keepAliveWorkspaces.forEach(ws => ws._keepAliveId = 1); prevCheckWorkspaces.call(this); - keepAliveWorkspaces.forEach(ws => { delete ws._keepAliveId; }); + keepAliveWorkspaces.forEach(ws => delete ws._keepAliveId); return false; } diff --git a/extensions/places-menu/placeDisplay.js b/extensions/places-menu/placeDisplay.js index dbd3308c..c1302118 100644 --- a/extensions/places-menu/placeDisplay.js +++ b/extensions/places-menu/placeDisplay.js @@ -45,7 +45,7 @@ class PlaceInfo { } catch (e) { if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_MOUNTED)) { let source = { - get_icon: () => { return this.icon; } + get_icon: () => this.icon }; let op = new ShellMountOperation.ShellMountOperation(source); this.file.mount_enclosing_volume(0, op.mountOp, null, (file, result) => { @@ -325,7 +325,7 @@ var PlacesManager = class { } _updateSpecials() { - this._places.special.forEach(p => { p.destroy(); }); + this._places.special.forEach(p => p.destroy()); this._places.special = []; let homePath = GLib.get_home_dir(); @@ -367,9 +367,9 @@ var PlacesManager = class { let networkMounts = []; let networkVolumes = []; - this._places.devices.forEach(p => { p.destroy(); }); + this._places.devices.forEach(p => p.destroy()); this._places.devices = []; - this._places.network.forEach(p => { p.destroy(); }); + this._places.network.forEach(p => p.destroy()); this._places.network = []; /* Add standard places */ diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js index 493970a4..ff7e774b 100644 --- a/extensions/window-list/extension.js +++ b/extensions/window-list/extension.js @@ -401,13 +401,13 @@ class AppContextMenu extends PopupMenu.PopupMenu { this._minimizeItem = new PopupMenu.PopupMenuItem(_("Minimize all")); this._minimizeItem.connect('activate', () => { - this._appButton.getWindowList().forEach(w => { w.minimize(); }); + this._appButton.getWindowList().forEach(w => w.minimize()); }); this.addMenuItem(this._minimizeItem); this._unminimizeItem = new PopupMenu.PopupMenuItem(_("Unminimize all")); this._unminimizeItem.connect('activate', () => { - this._appButton.getWindowList().forEach(w => { w.unminimize(); }); + this._appButton.getWindowList().forEach(w => w.unminimize()); }); this.addMenuItem(this._unminimizeItem); @@ -538,7 +538,7 @@ class AppButton extends BaseButton { let rect = this._getIconGeometry(); let windows = this.app.get_windows(); - windows.forEach(w => { w.set_icon_geometry(rect); }); + windows.forEach(w => w.set_icon_geometry(rect)); } getWindowList() { @@ -1205,7 +1205,7 @@ class Extension { } _buildWindowLists() { - this._windowLists.forEach(list => { list.actor.destroy(); }); + this._windowLists.forEach(list => list.actor.destroy()); this._windowLists = []; let showOnAllMonitors = this._settings.get_boolean('show-on-all-monitors'); diff --git a/lint/eslintrc-shell.json b/lint/eslintrc-shell.json index 9821bf4a..eb96266a 100644 --- a/lint/eslintrc-shell.json +++ b/lint/eslintrc-shell.json @@ -1,13 +1,6 @@ { "rules": { "arrow-spacing": "error", - "brace-style": [ - "error", - "1tbs", - { - "allowSingleLine": true - } - ], "camelcase": [ "error", { From d34b5030b9b318fcffe38dfc0278d24f0969087b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 28 Feb 2019 18:38:10 +0100 Subject: [PATCH 15/33] style: Use a consistent style for array literals Most array literals already use a four-space indent, except the ones in GObject metainfo and function parameters. Reindent those as well to make the style consistent and bring it closer to gjs' coding style. https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/57 --- extensions/auto-move-windows/prefs.js | 9 +++++++-- extensions/places-menu/placeDisplay.js | 14 +++++++++++--- lint/eslintrc-legacy.json | 1 - 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/extensions/auto-move-windows/prefs.js b/extensions/auto-move-windows/prefs.js index fd448f0b..92c3b053 100644 --- a/extensions/auto-move-windows/prefs.js +++ b/extensions/auto-move-windows/prefs.js @@ -34,8 +34,13 @@ const Widget = GObject.registerClass({ this._changedPermitted = false; this._store = new Gtk.ListStore(); - this._store.set_column_types([Gio.AppInfo, GObject.TYPE_STRING, Gio.Icon, GObject.TYPE_INT, - Gtk.Adjustment]); + this._store.set_column_types([ + Gio.AppInfo, + GObject.TYPE_STRING, + Gio.Icon, + GObject.TYPE_INT, + Gtk.Adjustment + ]); let scrolled = new Gtk.ScrolledWindow({ shadow_type: Gtk.ShadowType.IN }); scrolled.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC); diff --git a/extensions/places-menu/placeDisplay.js b/extensions/places-menu/placeDisplay.js index c1302118..79d401de 100644 --- a/extensions/places-menu/placeDisplay.js +++ b/extensions/places-menu/placeDisplay.js @@ -298,9 +298,17 @@ var PlacesManager = class { } _connectVolumeMonitorSignals() { - const signals = ['volume-added', 'volume-removed', 'volume-changed', - 'mount-added', 'mount-removed', 'mount-changed', - 'drive-connected', 'drive-disconnected', 'drive-changed']; + const signals = [ + 'volume-added', + 'volume-removed', + 'volume-changed', + 'mount-added', + 'mount-removed', + 'mount-changed', + 'drive-connected', + 'drive-disconnected', + 'drive-changed' + ]; this._volumeMonitorSignals = []; let func = this._updateMounts.bind(this); diff --git a/lint/eslintrc-legacy.json b/lint/eslintrc-legacy.json index e4b2fb0e..8b716511 100644 --- a/lint/eslintrc-legacy.json +++ b/lint/eslintrc-legacy.json @@ -9,7 +9,6 @@ "CallExpression[callee.object.name=GObject][callee.property.name=registerClass] > ClassExpression:first-child" ], "CallExpression": { "arguments": "first" }, - "ArrayExpression": "first", "ObjectExpression": "first", "MemberExpression": "off" } From db35d7ae7cbfd6bba13ca45cf25841fb098bd102 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 28 Feb 2019 19:05:48 +0100 Subject: [PATCH 16/33] style: Change indentation style of object literals Instead of keeping the first property on the same line as the opening brace and aligning the properties, use a four-space indent. This brings us closer to gjs' coding style, and as a bonus helps keeping lines in the soft 80 character limit. https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/57 --- extensions/apps-menu/extension.js | 74 +++++++++----- extensions/auto-move-windows/prefs.js | 88 +++++++++++------ extensions/drive-menu/extension.js | 12 ++- extensions/places-menu/extension.js | 20 ++-- .../screenshot-window-sizer/extension.js | 11 ++- extensions/window-list/extension.js | 99 ++++++++++++------- extensions/window-list/prefs.js | 28 ++++-- extensions/windowsNavigator/extension.js | 6 +- extensions/workspace-indicator/extension.js | 6 +- extensions/workspace-indicator/prefs.js | 22 +++-- lint/eslintrc-legacy.json | 1 - 11 files changed, 236 insertions(+), 131 deletions(-) diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js index 9e78933a..fb5d6fd3 100644 --- a/extensions/apps-menu/extension.js +++ b/extensions/apps-menu/extension.js @@ -1,8 +1,9 @@ /* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */ /* exported init enable disable */ -const { Atk, Clutter, Gio, GLib, GMenu, - GObject, Gtk, Meta, Shell, St } = imports.gi; +const { + Atk, Clutter, Gio, GLib, GMenu, GObject, Gtk, Meta, Shell, St +} = imports.gi; const DND = imports.ui.dnd; const Main = imports.ui.main; const PanelMenu = imports.ui.panelMenu; @@ -44,8 +45,11 @@ class ApplicationMenuItem extends PopupMenu.PopupBaseMenuItem { this._iconBin = new St.Bin(); this.actor.add_child(this._iconBin); - let appLabel = new St.Label({ text: app.get_name(), y_expand: true, - y_align: Clutter.ActorAlign.CENTER }); + let appLabel = new St.Label({ + text: app.get_name(), + y_expand: true, + y_align: Clutter.ActorAlign.CENTER + }); this.actor.add_child(appLabel); this.actor.label_actor = appLabel; @@ -399,9 +403,11 @@ class ApplicationsButton extends PanelMenu.Button { let hbox = new St.BoxLayout({ style_class: 'panel-status-menu-box' }); - this._label = new St.Label({ text: _("Applications"), - y_expand: true, - y_align: Clutter.ActorAlign.CENTER }); + this._label = new St.Label({ + text: _("Applications"), + y_expand: true, + y_align: Clutter.ActorAlign.CENTER + }); hbox.add_child(this._label); hbox.add_child(PopupMenu.arrowIcon(St.Side.BOTTOM)); @@ -457,8 +463,10 @@ class ApplicationsButton extends PanelMenu.Button { } _createVertSeparator() { - let separator = new St.DrawingArea({ style_class: 'calendar-vertical-separator', - pseudo_class: 'highlighted' }); + let separator = new St.DrawingArea({ + style_class: 'calendar-vertical-separator', + pseudo_class: 'highlighted' + }); separator.connect('repaint', this._onVertSepRepaint.bind(this)); return separator; } @@ -600,9 +608,12 @@ class ApplicationsButton extends PanelMenu.Button { this.menu.addMenuItem(section); this.mainBox = new St.BoxLayout({ vertical: false }); this.leftBox = new St.BoxLayout({ vertical: true }); - this.applicationsScrollBox = new St.ScrollView({ x_fill: true, y_fill: false, - y_align: St.Align.START, - style_class: 'apps-menu vfade' }); + this.applicationsScrollBox = new St.ScrollView({ + x_fill: true, + y_fill: false, + y_align: St.Align.START, + style_class: 'apps-menu vfade' + }); this.applicationsScrollBox.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC); let vscroll = this.applicationsScrollBox.get_vscroll_bar(); vscroll.connect('scroll-start', () => { @@ -611,21 +622,30 @@ class ApplicationsButton extends PanelMenu.Button { vscroll.connect('scroll-stop', () => { this.menu.passEvents = false; }); - this.categoriesScrollBox = new St.ScrollView({ x_fill: true, y_fill: false, - y_align: St.Align.START, - style_class: 'vfade' }); + this.categoriesScrollBox = new St.ScrollView({ + x_fill: true, + y_fill: false, + y_align: St.Align.START, + style_class: 'vfade' + }); this.categoriesScrollBox.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC); vscroll = this.categoriesScrollBox.get_vscroll_bar(); vscroll.connect('scroll-start', () => this.menu.passEvents = true); vscroll.connect('scroll-stop', () => this.menu.passEvents = false); - this.leftBox.add(this.categoriesScrollBox, { expand: true, - x_fill: true, y_fill: true, - y_align: St.Align.START }); + this.leftBox.add(this.categoriesScrollBox, { + expand: true, + x_fill: true, + y_fill: true, + y_align: St.Align.START + }); let activities = new ActivitiesMenuItem(this); - this.leftBox.add(activities.actor, { expand: false, - x_fill: true, y_fill: false, - y_align: St.Align.START }); + this.leftBox.add(activities.actor, { + expand: false, + x_fill: true, + y_fill: false, + y_align: St.Align.START + }); this.applicationsBox = new St.BoxLayout({ vertical: true }); this.applicationsScrollBox.add_actor(this.applicationsBox); @@ -633,8 +653,16 @@ class ApplicationsButton extends PanelMenu.Button { this.categoriesScrollBox.add_actor(this.categoriesBox); this.mainBox.add(this.leftBox); - this.mainBox.add(this._createVertSeparator(), { expand: false, x_fill: false, y_fill: true }); - this.mainBox.add(this.applicationsScrollBox, { expand: true, x_fill: true, y_fill: true }); + this.mainBox.add(this._createVertSeparator(), { + expand: false, + x_fill: false, + y_fill: true + }); + this.mainBox.add(this.applicationsScrollBox, { + expand: true, + x_fill: true, + y_fill: true + }); section.actor.add_actor(this.mainBox); } diff --git a/extensions/auto-move-windows/prefs.js b/extensions/auto-move-windows/prefs.js index 92c3b053..3b3a70e6 100644 --- a/extensions/auto-move-windows/prefs.js +++ b/extensions/auto-move-windows/prefs.js @@ -47,12 +47,18 @@ const Widget = GObject.registerClass({ this.add(scrolled); - this._treeView = new Gtk.TreeView({ model: this._store, - hexpand: true, vexpand: true }); + this._treeView = new Gtk.TreeView({ + model: this._store, + hexpand: true, + vexpand: true + }); this._treeView.get_selection().set_mode(Gtk.SelectionMode.SINGLE); - let appColumn = new Gtk.TreeViewColumn({ expand: true, sort_column_id: Columns.DISPLAY_NAME, - title: _("Application") }); + let appColumn = new Gtk.TreeViewColumn({ + expand: true, + sort_column_id: Columns.DISPLAY_NAME, + title: _("Application") + }); let iconRenderer = new Gtk.CellRendererPixbuf; appColumn.pack_start(iconRenderer, false); appColumn.add_attribute(iconRenderer, "gicon", Columns.ICON); @@ -61,8 +67,10 @@ const Widget = GObject.registerClass({ appColumn.add_attribute(nameRenderer, "text", Columns.DISPLAY_NAME); this._treeView.append_column(appColumn); - let workspaceColumn = new Gtk.TreeViewColumn({ title: _("Workspace"), - sort_column_id: Columns.WORKSPACE }); + let workspaceColumn = new Gtk.TreeViewColumn({ + title: _("Workspace"), + sort_column_id: Columns.WORKSPACE + }); let workspaceRenderer = new Gtk.CellRendererSpin({ editable: true }); workspaceRenderer.connect('edited', this._workspaceEdited.bind(this)); workspaceColumn.pack_start(workspaceRenderer, true); @@ -76,13 +84,15 @@ const Widget = GObject.registerClass({ toolbar.get_style_context().add_class(Gtk.STYLE_CLASS_INLINE_TOOLBAR); this.add(toolbar); - let newButton = new Gtk.ToolButton({ icon_name: 'bookmark-new-symbolic', - label: _("Add Rule"), - is_important: true }); + let newButton = new Gtk.ToolButton({ + icon_name: 'bookmark-new-symbolic', + label: _("Add Rule"), + is_important: true + }); newButton.connect('clicked', this._createNew.bind(this)); toolbar.add(newButton); - let delButton = new Gtk.ToolButton({ icon_name: 'edit-delete-symbolic' }); + let delButton = new Gtk.ToolButton({ icon_name: 'edit-delete-symbolic' }); delButton.connect('clicked', this._deleteSelected.bind(this)); toolbar.add(delButton); @@ -97,17 +107,21 @@ const Widget = GObject.registerClass({ } _createNew() { - let dialog = new Gtk.Dialog({ title: _("Create new matching rule"), - transient_for: this.get_toplevel(), - use_header_bar: true, - modal: true }); + let dialog = new Gtk.Dialog({ + title: _("Create new matching rule"), + transient_for: this.get_toplevel(), + use_header_bar: true, + modal: true + }); dialog.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL); let addButton = dialog.add_button(_("Add"), Gtk.ResponseType.OK); dialog.set_default_response(Gtk.ResponseType.OK); - let grid = new Gtk.Grid({ column_spacing: 10, - row_spacing: 15, - margin: 10 }); + let grid = new Gtk.Grid({ + column_spacing: 10, + row_spacing: 15, + margin: 10 + }); dialog._appChooser = new Gtk.AppChooserWidget({ show_all: true }); dialog._appChooser.connect('application-selected', (w, appInfo) => { addButton.sensitive = appInfo && this._checkId(appInfo.get_id()); @@ -116,13 +130,19 @@ const Widget = GObject.registerClass({ addButton.sensitive = appInfo && this._checkId(appInfo.get_id()); grid.attach(dialog._appChooser, 0, 0, 2, 1); - grid.attach(new Gtk.Label({ label: _("Workspace"), - halign: Gtk.Align.END }), 0, 1, 1, 1); - let adjustment = new Gtk.Adjustment({ lower: 1, - upper: WORKSPACE_MAX, - step_increment: 1 }); - dialog._spin = new Gtk.SpinButton({ adjustment: adjustment, - snap_to_ticks: true }); + grid.attach(new Gtk.Label({ + label: _("Workspace"), + halign: Gtk.Align.END + }), 0, 1, 1, 1); + let adjustment = new Gtk.Adjustment({ + lower: 1, + upper: WORKSPACE_MAX, + step_increment: 1 + }); + dialog._spin = new Gtk.SpinButton({ + adjustment: adjustment, + snap_to_ticks: true + }); dialog._spin.set_value(1); grid.attach(dialog._spin, 1, 1, 1, 1); dialog.get_content_area().add(grid); @@ -145,10 +165,12 @@ const Widget = GObject.registerClass({ this._changedPermitted = true; let iter = this._store.append(); - let adj = new Gtk.Adjustment({ lower: 1, - upper: WORKSPACE_MAX, - step_increment: 1, - value: index }); + let adj = new Gtk.Adjustment({ + lower: 1, + upper: WORKSPACE_MAX, + step_increment: 1, + value: index + }); this._store.set(iter, [Columns.APPINFO, Columns.ICON, Columns.DISPLAY_NAME, Columns.WORKSPACE, Columns.ADJUSTMENT], [appInfo, appInfo.get_icon(), appInfo.get_display_name(), index, adj]); @@ -202,10 +224,12 @@ const Widget = GObject.registerClass({ validItems.push(currentItems[i]); let iter = this._store.append(); - let adj = new Gtk.Adjustment({ lower: 1, - upper: WORKSPACE_MAX, - step_increment: 1, - value: index }); + let adj = new Gtk.Adjustment({ + lower: 1, + upper: WORKSPACE_MAX, + step_increment: 1, + value: index + }); this._store.set(iter, [Columns.APPINFO, Columns.ICON, Columns.DISPLAY_NAME, Columns.WORKSPACE, Columns.ADJUSTMENT], [appInfo, appInfo.get_icon(), appInfo.get_display_name(), parseInt(index), adj]); diff --git a/extensions/drive-menu/extension.js b/extensions/drive-menu/extension.js index 4c1fdbf1..47537f5e 100644 --- a/extensions/drive-menu/extension.js +++ b/extensions/drive-menu/extension.js @@ -22,8 +22,10 @@ class MountMenuItem extends PopupMenu.PopupBaseMenuItem { this.mount = mount; - let ejectIcon = new St.Icon({ icon_name: 'media-eject-symbolic', - style_class: 'popup-menu-icon ' }); + let ejectIcon = new St.Icon({ + icon_name: 'media-eject-symbolic', + style_class: 'popup-menu-icon' + }); let ejectButton = new St.Button({ child: ejectIcon }); ejectButton.connect('clicked', this._eject.bind(this)); this.actor.add(ejectButton); @@ -114,8 +116,10 @@ class DriveMenu extends PanelMenu.Button { super._init(0.0, _("Removable devices")); let hbox = new St.BoxLayout({ style_class: 'panel-status-menu-box' }); - let icon = new St.Icon({ icon_name: 'media-eject-symbolic', - style_class: 'system-status-icon' }); + let icon = new St.Icon({ + icon_name: 'media-eject-symbolic', + style_class: 'system-status-icon' + }); hbox.add_child(icon); hbox.add_child(PopupMenu.arrowIcon(St.Side.BOTTOM)); diff --git a/extensions/places-menu/extension.js b/extensions/places-menu/extension.js index b98d3857..11090e18 100644 --- a/extensions/places-menu/extension.js +++ b/extensions/places-menu/extension.js @@ -22,16 +22,20 @@ class PlaceMenuItem extends PopupMenu.PopupBaseMenuItem { super(); this._info = info; - this._icon = new St.Icon({ gicon: info.icon, - icon_size: PLACE_ICON_SIZE }); + this._icon = new St.Icon({ + gicon: info.icon, + icon_size: PLACE_ICON_SIZE + }); this.actor.add_child(this._icon); this._label = new St.Label({ text: info.name, x_expand: true }); this.actor.add_child(this._label); if (info.isRemovable()) { - this._ejectIcon = new St.Icon({ icon_name: 'media-eject-symbolic', - style_class: 'popup-menu-icon ' }); + this._ejectIcon = new St.Icon({ + icon_name: 'media-eject-symbolic', + style_class: 'popup-menu-icon' + }); this._ejectButton = new St.Button({ child: this._ejectIcon }); this._ejectButton.connect('clicked', info.eject.bind(info)); this.actor.add_child(this._ejectButton); @@ -75,9 +79,11 @@ class PlacesMenu extends PanelMenu.Button { super._init(0.0, _("Places")); let hbox = new St.BoxLayout({ style_class: 'panel-status-menu-box' }); - let label = new St.Label({ text: _("Places"), - y_expand: true, - y_align: Clutter.ActorAlign.CENTER }); + let label = new St.Label({ + text: _("Places"), + y_expand: true, + y_align: Clutter.ActorAlign.CENTER + }); hbox.add_child(label); hbox.add_child(PopupMenu.arrowIcon(St.Side.BOTTOM)); this.add_actor(hbox); diff --git a/extensions/screenshot-window-sizer/extension.js b/extensions/screenshot-window-sizer/extension.js index bf31f815..13d29f7c 100644 --- a/extensions/screenshot-window-sizer/extension.js +++ b/extensions/screenshot-window-sizer/extension.js @@ -50,11 +50,12 @@ function flashMessage(message) { text.set_position(monitor.x + Math.floor(monitor.width / 2 - text.width / 2), monitor.y + Math.floor(monitor.height / 2 - text.height / 2)); - Tweener.addTween(text, - { opacity: 0, - time: MESSAGE_FADE_TIME, - transition: 'easeOutQuad', - onComplete: hideMessage }); + Tweener.addTween(text, { + opacity: 0, + time: MESSAGE_FADE_TIME, + transition: 'easeOutQuad', + onComplete: hideMessage + }); } let SIZES = [ diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js index ff7e774b..24cd2334 100644 --- a/extensions/window-list/extension.js +++ b/extensions/window-list/extension.js @@ -137,8 +137,11 @@ class WindowContextMenu extends PopupMenu.PopupMenu { class WindowTitle { constructor(metaWindow) { this._metaWindow = metaWindow; - this.actor = new St.BoxLayout({ style_class: 'window-button-box', - x_expand: true, y_expand: true }); + this.actor = new St.BoxLayout({ + style_class: 'window-button-box', + x_expand: true, + y_expand: true + }); this._icon = new St.Bin({ style_class: 'window-button-icon' }); this.actor.add(this._icon); @@ -188,8 +191,10 @@ class WindowTitle { if (app) this._icon.child = app.create_icon_texture(ICON_TEXTURE_SIZE); else - this._icon.child = new St.Icon({ icon_name: 'icon-missing', - icon_size: ICON_TEXTURE_SIZE }); + this._icon.child = new St.Icon({ + icon_name: 'icon-missing', + icon_size: ICON_TEXTURE_SIZE + }); } _onDestroy() { @@ -210,12 +215,13 @@ class BaseButton { this._perMonitor = perMonitor; this._monitorIndex = monitorIndex; - this.actor = new St.Button({ style_class: 'window-button', - x_fill: true, - y_fill: true, - can_focus: true, - button_mask: St.ButtonMask.ONE | - St.ButtonMask.THREE }); + this.actor = new St.Button({ + style_class: 'window-button', + x_fill: true, + y_fill: true, + can_focus: true, + button_mask: St.ButtonMask.ONE | St.ButtonMask.THREE + }); this.actor._delegate = this; this.actor.connect('allocation-changed', @@ -463,21 +469,29 @@ class AppButton extends BaseButton { let stack = new St.Widget({ layout_manager: new Clutter.BinLayout() }); this.actor.set_child(stack); - this._singleWindowTitle = new St.Bin({ x_expand: true, - y_fill: true, - x_align: St.Align.START }); + this._singleWindowTitle = new St.Bin({ + x_expand: true, + y_fill: true, + x_align: St.Align.START + }); stack.add_actor(this._singleWindowTitle); - this._multiWindowTitle = new St.BoxLayout({ style_class: 'window-button-box', - x_expand: true }); + this._multiWindowTitle = new St.BoxLayout({ + style_class: 'window-button-box', + x_expand: true + }); stack.add_actor(this._multiWindowTitle); - this._icon = new St.Bin({ style_class: 'window-button-icon', - child: app.create_icon_texture(ICON_TEXTURE_SIZE) }); + this._icon = new St.Bin({ + style_class: 'window-button-icon', + child: app.create_icon_texture(ICON_TEXTURE_SIZE) + }); this._multiWindowTitle.add(this._icon); - let label = new St.Label({ text: app.get_name(), - y_align: Clutter.ActorAlign.CENTER }); + let label = new St.Label({ + text: app.get_name(), + y_align: Clutter.ActorAlign.CENTER + }); this._multiWindowTitle.add(label); this._multiWindowTitle.label_actor = label; @@ -643,16 +657,21 @@ class WorkspaceIndicator extends PanelMenu.Button { this.add_style_class_name('window-list-workspace-indicator'); this.menu.actor.remove_style_class_name('panel-menu'); - let container = new St.Widget({ layout_manager: new Clutter.BinLayout(), - x_expand: true, y_expand: true }); + let container = new St.Widget({ + layout_manager: new Clutter.BinLayout(), + x_expand: true, + y_expand: true + }); this.add_actor(container); let workspaceManager = global.workspace_manager; this._currentWorkspace = workspaceManager.get_active_workspace().index(); - this.statusLabel = new St.Label({ text: this._getStatusText(), - x_align: Clutter.ActorAlign.CENTER, - y_align: Clutter.ActorAlign.CENTER }); + this.statusLabel = new St.Label({ + text: this._getStatusText(), + x_align: Clutter.ActorAlign.CENTER, + y_align: Clutter.ActorAlign.CENTER + }); container.add_actor(this.statusLabel); this.workspacesItems = []; @@ -761,23 +780,27 @@ class WindowList { this._perMonitor = perMonitor; this._monitor = monitor; - this.actor = new St.Widget({ name: 'panel', - style_class: 'bottom-panel solid', - reactive: true, - track_hover: true, - layout_manager: new Clutter.BinLayout() }); + this.actor = new St.Widget({ + name: 'panel', + style_class: 'bottom-panel solid', + reactive: true, + track_hover: true, + layout_manager: new Clutter.BinLayout() + }); this.actor.connect('destroy', this._onDestroy.bind(this)); let box = new St.BoxLayout({ x_expand: true, y_expand: true }); this.actor.add_actor(box); let layout = new Clutter.BoxLayout({ homogeneous: true }); - this._windowList = new St.Widget({ style_class: 'window-list', - reactive: true, - layout_manager: layout, - x_align: Clutter.ActorAlign.START, - x_expand: true, - y_expand: true }); + this._windowList = new St.Widget({ + style_class: 'window-list', + reactive: true, + layout_manager: layout, + x_align: Clutter.ActorAlign.START, + x_expand: true, + y_expand: true + }); box.add(this._windowList, { expand: true }); this._windowList.connect('style-changed', () => { @@ -805,8 +828,10 @@ class WindowList { this._menuManager = new PopupMenu.PopupMenuManager(this); this._menuManager.addMenu(this._workspaceIndicator.menu); - Main.layoutManager.addChrome(this.actor, { affectsStruts: true, - trackFullscreen: true }); + Main.layoutManager.addChrome(this.actor, { + affectsStruts: true, + trackFullscreen: true + }); Main.uiGroup.set_child_above_sibling(this.actor, Main.layoutManager.panelBox); Main.ctrlAltTabManager.addGroup(this.actor, _("Window List"), 'start-here-symbolic'); diff --git a/extensions/window-list/prefs.js b/extensions/window-list/prefs.js index 59fd6975..3c2960a6 100644 --- a/extensions/window-list/prefs.js +++ b/extensions/window-list/prefs.js @@ -23,15 +23,19 @@ class WindowListPrefsWidget extends Gtk.Grid { this.orientation = Gtk.Orientation.VERTICAL; let groupingLabel = '%s'.format(_("Window Grouping")); - this.add(new Gtk.Label({ label: groupingLabel, use_markup: true, - halign: Gtk.Align.START })); + this.add(new Gtk.Label({ + label: groupingLabel, use_markup: true, + halign: Gtk.Align.START + })); let align = new Gtk.Alignment({ left_padding: 12 }); this.add(align); - let grid = new Gtk.Grid({ orientation: Gtk.Orientation.VERTICAL, - row_spacing: 6, - column_spacing: 6 }); + let grid = new Gtk.Grid({ + orientation: Gtk.Orientation.VERTICAL, + row_spacing: 6, + column_spacing: 6 + }); align.add(grid); this._settings = ExtensionUtils.getSettings(); @@ -54,9 +58,11 @@ class WindowListPrefsWidget extends Gtk.Grid { continue; } - radio = new Gtk.RadioButton({ active: currentMode == mode, - label: label, - group: radio }); + radio = new Gtk.RadioButton({ + active: currentMode == mode, + label: label, + group: radio + }); grid.add(radio); radio.connect('toggled', button => { @@ -65,8 +71,10 @@ class WindowListPrefsWidget extends Gtk.Grid { }); } - let check = new Gtk.CheckButton({ label: _("Show on all monitors"), - margin_top: 6 }); + let check = new Gtk.CheckButton({ + label: _("Show on all monitors"), + margin_top: 6 + }); this._settings.bind('show-on-all-monitors', check, 'active', Gio.SettingsBindFlags.DEFAULT); this.add(check); } diff --git a/extensions/windowsNavigator/extension.js b/extensions/windowsNavigator/extension.js index 13de1bc3..7d58ebe2 100644 --- a/extensions/windowsNavigator/extension.js +++ b/extensions/windowsNavigator/extension.js @@ -229,8 +229,10 @@ function enable() { workspaceInjections['_init'] = injectToFunction(Workspace.Workspace.prototype, '_init', function(metaWorkspace) { if (metaWorkspace && metaWorkspace.index() < 9) { - createdActors.push(this._tip = new St.Label({ style_class: 'extension-windowsNavigator-window-tooltip', - visible: false })); + createdActors.push(this._tip = new St.Label({ + style_class: 'extension-windowsNavigator-window-tooltip', + visible: false + })); this.actor.add_actor(this._tip); let signalId = this.actor.connect('notify::scale-x', () => { diff --git a/extensions/workspace-indicator/extension.js b/extensions/workspace-indicator/extension.js index 9e1dfd70..38ed8703 100644 --- a/extensions/workspace-indicator/extension.js +++ b/extensions/workspace-indicator/extension.js @@ -23,8 +23,10 @@ class WorkspaceIndicator extends PanelMenu.Button { let workspaceManager = global.workspace_manager; this._currentWorkspace = workspaceManager.get_active_workspace().index(); - this.statusLabel = new St.Label({ y_align: Clutter.ActorAlign.CENTER, - text: this._labelText() }); + this.statusLabel = new St.Label({ + y_align: Clutter.ActorAlign.CENTER, + text: this._labelText() + }); this.add_actor(this.statusLabel); diff --git a/extensions/workspace-indicator/prefs.js b/extensions/workspace-indicator/prefs.js index 64a64fdc..ed5c4785 100644 --- a/extensions/workspace-indicator/prefs.js +++ b/extensions/workspace-indicator/prefs.js @@ -127,20 +127,26 @@ class WorkspaceSettingsWidget extends Gtk.Grid { this.margin = 12; this.orientation = Gtk.Orientation.VERTICAL; - this.add(new Gtk.Label({ label: '%s'.format(_("Workspace Names")), - use_markup: true, margin_bottom: 6, - hexpand: true, halign: Gtk.Align.START })); + this.add(new Gtk.Label({ + label: '%s'.format(_("Workspace Names")), + use_markup: true, + margin_bottom: 6, + hexpand: true, + halign: Gtk.Align.START + })); let scrolled = new Gtk.ScrolledWindow({ shadow_type: Gtk.ShadowType.IN }); scrolled.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC); this.add(scrolled); this._store = new WorkspaceNameModel(); - this._treeView = new Gtk.TreeView({ model: this._store, - headers_visible: false, - reorderable: true, - hexpand: true, - vexpand: true }); + this._treeView = new Gtk.TreeView({ + model: this._store, + headers_visible: false, + reorderable: true, + hexpand: true, + vexpand: true + }); let column = new Gtk.TreeViewColumn({ title: _("Name") }); let renderer = new Gtk.CellRendererText({ editable: true }); diff --git a/lint/eslintrc-legacy.json b/lint/eslintrc-legacy.json index 8b716511..1c57f080 100644 --- a/lint/eslintrc-legacy.json +++ b/lint/eslintrc-legacy.json @@ -9,7 +9,6 @@ "CallExpression[callee.object.name=GObject][callee.property.name=registerClass] > ClassExpression:first-child" ], "CallExpression": { "arguments": "first" }, - "ObjectExpression": "first", "MemberExpression": "off" } ], From d83d6e857a2b644b3d9b49e41faa808672807859 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 28 Feb 2019 19:18:53 +0100 Subject: [PATCH 17/33] style: Use single-quotes for translated strings The coding style of using double quotes for translatable strings and single quotes otherwise is unnecessarily complex and cannot be enforced with an eslint rule. Simply use single quotes consistently for all strings. https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/57 --- extensions/apps-menu/extension.js | 6 +++--- extensions/auto-move-windows/prefs.js | 20 ++++++++++---------- extensions/drive-menu/extension.js | 6 +++--- extensions/places-menu/extension.js | 4 ++-- extensions/places-menu/placeDisplay.js | 14 +++++++------- extensions/window-list/extension.js | 20 ++++++++++---------- extensions/window-list/prefs.js | 10 +++++----- extensions/workspace-indicator/extension.js | 2 +- extensions/workspace-indicator/prefs.js | 6 +++--- lint/eslintrc-legacy.json | 3 +-- 10 files changed, 45 insertions(+), 46 deletions(-) diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js index fb5d6fd3..0c991231 100644 --- a/extensions/apps-menu/extension.js +++ b/extensions/apps-menu/extension.js @@ -26,7 +26,7 @@ class ActivitiesMenuItem extends PopupMenu.PopupBaseMenuItem { constructor(button) { super(); this._button = button; - this.actor.add_child(new St.Label({ text: _("Activities Overview") })); + this.actor.add_child(new St.Label({ text: _('Activities Overview') })); } activate(event) { @@ -115,7 +115,7 @@ class CategoryMenuItem extends PopupMenu.PopupBaseMenuItem { if (this._category) name = this._category.get_name(); else - name = _("Favorites"); + name = _('Favorites'); this.actor.add_child(new St.Label({ text: name })); this.actor.connect('motion-event', this._onMotionEvent.bind(this)); @@ -404,7 +404,7 @@ class ApplicationsButton extends PanelMenu.Button { let hbox = new St.BoxLayout({ style_class: 'panel-status-menu-box' }); this._label = new St.Label({ - text: _("Applications"), + text: _('Applications'), y_expand: true, y_align: Clutter.ActorAlign.CENTER }); diff --git a/extensions/auto-move-windows/prefs.js b/extensions/auto-move-windows/prefs.js index 3b3a70e6..f808347c 100644 --- a/extensions/auto-move-windows/prefs.js +++ b/extensions/auto-move-windows/prefs.js @@ -57,25 +57,25 @@ const Widget = GObject.registerClass({ let appColumn = new Gtk.TreeViewColumn({ expand: true, sort_column_id: Columns.DISPLAY_NAME, - title: _("Application") + title: _('Application') }); let iconRenderer = new Gtk.CellRendererPixbuf; appColumn.pack_start(iconRenderer, false); - appColumn.add_attribute(iconRenderer, "gicon", Columns.ICON); + appColumn.add_attribute(iconRenderer, 'gicon', Columns.ICON); let nameRenderer = new Gtk.CellRendererText; appColumn.pack_start(nameRenderer, true); - appColumn.add_attribute(nameRenderer, "text", Columns.DISPLAY_NAME); + appColumn.add_attribute(nameRenderer, 'text', Columns.DISPLAY_NAME); this._treeView.append_column(appColumn); let workspaceColumn = new Gtk.TreeViewColumn({ - title: _("Workspace"), + title: _('Workspace'), sort_column_id: Columns.WORKSPACE }); let workspaceRenderer = new Gtk.CellRendererSpin({ editable: true }); workspaceRenderer.connect('edited', this._workspaceEdited.bind(this)); workspaceColumn.pack_start(workspaceRenderer, true); - workspaceColumn.add_attribute(workspaceRenderer, "adjustment", Columns.ADJUSTMENT); - workspaceColumn.add_attribute(workspaceRenderer, "text", Columns.WORKSPACE); + workspaceColumn.add_attribute(workspaceRenderer, 'adjustment', Columns.ADJUSTMENT); + workspaceColumn.add_attribute(workspaceRenderer, 'text', Columns.WORKSPACE); this._treeView.append_column(workspaceColumn); scrolled.add(this._treeView); @@ -86,7 +86,7 @@ const Widget = GObject.registerClass({ let newButton = new Gtk.ToolButton({ icon_name: 'bookmark-new-symbolic', - label: _("Add Rule"), + label: _('Add Rule'), is_important: true }); newButton.connect('clicked', this._createNew.bind(this)); @@ -108,13 +108,13 @@ const Widget = GObject.registerClass({ _createNew() { let dialog = new Gtk.Dialog({ - title: _("Create new matching rule"), + title: _('Create new matching rule'), transient_for: this.get_toplevel(), use_header_bar: true, modal: true }); dialog.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL); - let addButton = dialog.add_button(_("Add"), Gtk.ResponseType.OK); + let addButton = dialog.add_button(_('Add'), Gtk.ResponseType.OK); dialog.set_default_response(Gtk.ResponseType.OK); let grid = new Gtk.Grid({ @@ -131,7 +131,7 @@ const Widget = GObject.registerClass({ grid.attach(dialog._appChooser, 0, 0, 2, 1); grid.attach(new Gtk.Label({ - label: _("Workspace"), + label: _('Workspace'), halign: Gtk.Align.END }), 0, 1, 1, 1); let adjustment = new Gtk.Adjustment({ diff --git a/extensions/drive-menu/extension.js b/extensions/drive-menu/extension.js index 47537f5e..51b4aa67 100644 --- a/extensions/drive-menu/extension.js +++ b/extensions/drive-menu/extension.js @@ -97,7 +97,7 @@ class MountMenuItem extends PopupMenu.PopupBaseMenuItem { _reportFailure(exception) { // TRANSLATORS: %s is the filesystem name - let msg = _("Ejecting drive “%s” failed:").format(this.mount.get_name()); + let msg = _('Ejecting drive “%s” failed:').format(this.mount.get_name()); Main.notifyError(msg, exception.message); } @@ -113,7 +113,7 @@ class MountMenuItem extends PopupMenu.PopupBaseMenuItem { let DriveMenu = GObject.registerClass( class DriveMenu extends PanelMenu.Button { _init() { - super._init(0.0, _("Removable devices")); + super._init(0.0, _('Removable devices')); let hbox = new St.BoxLayout({ style_class: 'panel-status-menu-box' }); let icon = new St.Icon({ @@ -140,7 +140,7 @@ class DriveMenu extends PanelMenu.Button { this._monitor.get_mounts().forEach(this._addMount.bind(this)); this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem()); - this.menu.addAction(_("Open Files"), event => { + this.menu.addAction(_('Open Files'), event => { let appSystem = Shell.AppSystem.get_default(); let app = appSystem.lookup_app('org.gnome.Nautilus.desktop'); app.activate_full(-1, event.get_time()); diff --git a/extensions/places-menu/extension.js b/extensions/places-menu/extension.js index 11090e18..c477a4ac 100644 --- a/extensions/places-menu/extension.js +++ b/extensions/places-menu/extension.js @@ -76,11 +76,11 @@ const SECTIONS = [ let PlacesMenu = GObject.registerClass( class PlacesMenu extends PanelMenu.Button { _init() { - super._init(0.0, _("Places")); + super._init(0.0, _('Places')); let hbox = new St.BoxLayout({ style_class: 'panel-status-menu-box' }); let label = new St.Label({ - text: _("Places"), + text: _('Places'), y_expand: true, y_align: Clutter.ActorAlign.CENTER }); diff --git a/extensions/places-menu/placeDisplay.js b/extensions/places-menu/placeDisplay.js index 79d401de..037a3394 100644 --- a/extensions/places-menu/placeDisplay.js +++ b/extensions/places-menu/placeDisplay.js @@ -56,7 +56,7 @@ class PlaceInfo { if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.FAILED_HANDLED)) // e.g. user canceled the password dialog return; - Main.notifyError(_("Failed to mount volume for “%s”").format(this.name), e.message); + Main.notifyError(_('Failed to mount volume for “%s”').format(this.name), e.message); return; } @@ -69,7 +69,7 @@ class PlaceInfo { } }); } else { - Main.notifyError(_("Failed to launch “%s”").format(this.name), e.message); + Main.notifyError(_('Failed to launch “%s”').format(this.name), e.message); } } }; @@ -130,7 +130,7 @@ Signals.addSignalMethods(PlaceInfo.prototype); class RootInfo extends PlaceInfo { _init() { - super._init('devices', Gio.File.new_for_path('/'), _("Computer")); + super._init('devices', Gio.File.new_for_path('/'), _('Computer')); let busName = 'org.freedesktop.hostname1'; let objPath = '/org/freedesktop/hostname1'; @@ -153,7 +153,7 @@ class RootInfo extends PlaceInfo { // GDBusProxy will emit a g-properties-changed when hostname1 goes down // ignore it if (proxy.g_name_owner) { - this.name = proxy.PrettyHostname || _("Computer"); + this.name = proxy.PrettyHostname || _('Computer'); this.emit('changed'); } } @@ -214,7 +214,7 @@ class PlaceDeviceInfo extends PlaceInfo { } _reportFailure(exception) { - let msg = _("Ejecting drive “%s” failed:").format(this._mount.get_name()); + let msg = _('Ejecting drive “%s” failed:').format(this._mount.get_name()); Main.notifyError(msg, exception.message); } } @@ -340,7 +340,7 @@ var PlacesManager = class { this._places.special.push(new PlaceInfo('special', Gio.File.new_for_path(homePath), - _("Home"))); + _('Home'))); let specials = []; let dirs = DEFAULT_DIRECTORIES.slice(); @@ -384,7 +384,7 @@ var PlacesManager = class { this._places.devices.push(new RootInfo()); this._places.network.push(new PlaceInfo('network', Gio.File.new_for_uri('network:///'), - _("Browse Network"), + _('Browse Network'), 'network-workgroup-symbolic')); /* first go through all connected drives */ diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js index 24cd2334..9e2ee94c 100644 --- a/extensions/window-list/extension.js +++ b/extensions/window-list/extension.js @@ -97,7 +97,7 @@ class WindowContextMenu extends PopupMenu.PopupMenu { this._updateMaximizeItem.bind(this)); this._updateMaximizeItem(); - this._closeItem = new PopupMenu.PopupMenuItem(_("Close")); + this._closeItem = new PopupMenu.PopupMenuItem(_('Close')); this._closeItem.connect('activate', () => { this._metaWindow.delete(global.get_current_time()); }); @@ -117,14 +117,14 @@ class WindowContextMenu extends PopupMenu.PopupMenu { _updateMinimizeItem() { this._minimizeItem.label.text = this._metaWindow.minimized ? - _("Unminimize") : _("Minimize"); + _('Unminimize') : _('Minimize'); } _updateMaximizeItem() { let maximized = this._metaWindow.maximized_vertically && this._metaWindow.maximized_horizontally; this._maximizeItem.label.text = maximized ? - _("Unmaximize") : _("Maximize"); + _('Unmaximize') : _('Maximize'); } _onDestroy() { @@ -405,19 +405,19 @@ class AppContextMenu extends PopupMenu.PopupMenu { this._appButton = appButton; - this._minimizeItem = new PopupMenu.PopupMenuItem(_("Minimize all")); + this._minimizeItem = new PopupMenu.PopupMenuItem(_('Minimize all')); this._minimizeItem.connect('activate', () => { this._appButton.getWindowList().forEach(w => w.minimize()); }); this.addMenuItem(this._minimizeItem); - this._unminimizeItem = new PopupMenu.PopupMenuItem(_("Unminimize all")); + this._unminimizeItem = new PopupMenu.PopupMenuItem(_('Unminimize all')); this._unminimizeItem.connect('activate', () => { this._appButton.getWindowList().forEach(w => w.unminimize()); }); this.addMenuItem(this._unminimizeItem); - this._maximizeItem = new PopupMenu.PopupMenuItem(_("Maximize all")); + this._maximizeItem = new PopupMenu.PopupMenuItem(_('Maximize all')); this._maximizeItem.connect('activate', () => { this._appButton.getWindowList().forEach(w => { w.maximize(Meta.MaximizeFlags.HORIZONTAL | @@ -426,7 +426,7 @@ class AppContextMenu extends PopupMenu.PopupMenu { }); this.addMenuItem(this._maximizeItem); - this._unmaximizeItem = new PopupMenu.PopupMenuItem(_("Unmaximize all")); + this._unmaximizeItem = new PopupMenu.PopupMenuItem(_('Unmaximize all')); this._unmaximizeItem.connect('activate', () => { this._appButton.getWindowList().forEach(w => { w.unmaximize(Meta.MaximizeFlags.HORIZONTAL | @@ -435,7 +435,7 @@ class AppContextMenu extends PopupMenu.PopupMenu { }); this.addMenuItem(this._unmaximizeItem); - let item = new PopupMenu.PopupMenuItem(_("Close all")); + let item = new PopupMenu.PopupMenuItem(_('Close all')); item.connect('activate', () => { this._appButton.getWindowList().forEach(w => { w.delete(global.get_current_time()); @@ -652,7 +652,7 @@ class AppButton extends BaseButton { let WorkspaceIndicator = GObject.registerClass( class WorkspaceIndicator extends PanelMenu.Button { _init() { - super._init(0.0, _("Workspace Indicator"), true); + super._init(0.0, _('Workspace Indicator'), true); this.setMenu(new PopupMenu.PopupMenu(this, 0.0, St.Side.BOTTOM)); this.add_style_class_name('window-list-workspace-indicator'); this.menu.actor.remove_style_class_name('panel-menu'); @@ -833,7 +833,7 @@ class WindowList { trackFullscreen: true }); Main.uiGroup.set_child_above_sibling(this.actor, Main.layoutManager.panelBox); - Main.ctrlAltTabManager.addGroup(this.actor, _("Window List"), 'start-here-symbolic'); + Main.ctrlAltTabManager.addGroup(this.actor, _('Window List'), 'start-here-symbolic'); this.actor.width = this._monitor.width; this.actor.connect('notify::height', this._updatePosition.bind(this)); diff --git a/extensions/window-list/prefs.js b/extensions/window-list/prefs.js index 3c2960a6..78792b5a 100644 --- a/extensions/window-list/prefs.js +++ b/extensions/window-list/prefs.js @@ -22,7 +22,7 @@ class WindowListPrefsWidget extends Gtk.Grid { this.row_spacing = 6; this.orientation = Gtk.Orientation.VERTICAL; - let groupingLabel = '%s'.format(_("Window Grouping")); + let groupingLabel = '%s'.format(_('Window Grouping')); this.add(new Gtk.Label({ label: groupingLabel, use_markup: true, halign: Gtk.Align.START @@ -44,9 +44,9 @@ class WindowListPrefsWidget extends Gtk.Grid { let modes = range.deep_unpack()[1].deep_unpack(); let modeLabels = { - 'never': _("Never group windows"), - 'auto': _("Group windows when space is limited"), - 'always': _("Always group windows") + 'never': _('Never group windows'), + 'auto': _('Group windows when space is limited'), + 'always': _('Always group windows') }; let radio = null; @@ -72,7 +72,7 @@ class WindowListPrefsWidget extends Gtk.Grid { } let check = new Gtk.CheckButton({ - label: _("Show on all monitors"), + label: _('Show on all monitors'), margin_top: 6 }); this._settings.bind('show-on-all-monitors', check, 'active', Gio.SettingsBindFlags.DEFAULT); diff --git a/extensions/workspace-indicator/extension.js b/extensions/workspace-indicator/extension.js index 38ed8703..3be12686 100644 --- a/extensions/workspace-indicator/extension.js +++ b/extensions/workspace-indicator/extension.js @@ -18,7 +18,7 @@ const WORKSPACE_KEY = 'workspace-names'; let WorkspaceIndicator = GObject.registerClass( class WorkspaceIndicator extends PanelMenu.Button { _init() { - super._init(0.0, _("Workspace Indicator")); + super._init(0.0, _('Workspace Indicator')); let workspaceManager = global.workspace_manager; diff --git a/extensions/workspace-indicator/prefs.js b/extensions/workspace-indicator/prefs.js index ed5c4785..d8640559 100644 --- a/extensions/workspace-indicator/prefs.js +++ b/extensions/workspace-indicator/prefs.js @@ -128,7 +128,7 @@ class WorkspaceSettingsWidget extends Gtk.Grid { this.orientation = Gtk.Orientation.VERTICAL; this.add(new Gtk.Label({ - label: '%s'.format(_("Workspace Names")), + label: '%s'.format(_('Workspace Names')), use_markup: true, margin_bottom: 6, hexpand: true, @@ -148,7 +148,7 @@ class WorkspaceSettingsWidget extends Gtk.Grid { vexpand: true }); - let column = new Gtk.TreeViewColumn({ title: _("Name") }); + let column = new Gtk.TreeViewColumn({ title: _('Name') }); let renderer = new Gtk.CellRendererText({ editable: true }); renderer.connect('edited', this._cellEdited.bind(this)); column.pack_start(renderer, true); @@ -188,7 +188,7 @@ class WorkspaceSettingsWidget extends Gtk.Grid { let iter = this._store.append(); let index = this._store.get_path(iter).get_indices()[0]; - let label = _("Workspace %d").format(index + 1); + let label = _('Workspace %d').format(index + 1); this._store.set(iter, [this._store.Columns.LABEL], [label]); } diff --git a/lint/eslintrc-legacy.json b/lint/eslintrc-legacy.json index 1c57f080..aca79adf 100644 --- a/lint/eslintrc-legacy.json +++ b/lint/eslintrc-legacy.json @@ -11,7 +11,6 @@ "CallExpression": { "arguments": "first" }, "MemberExpression": "off" } - ], - "quotes": "off" + ] } } From 55ecd3939e18d15bf3920de4a5e44b276a4e0834 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 28 Feb 2019 23:33:49 +0100 Subject: [PATCH 18/33] ci: Switch to extension-ci image gnome-shell now provides a docker image with useful tools for extension CI; as it contains everything we need, we can speed up CI by not running the package manager. https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/58 --- .gitlab-ci.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 72c42e0b..9bd1f9d9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -21,7 +21,7 @@ check_commit_log: - merge_requests eslint: - image: registry.gitlab.gnome.org/gnome/gjs:fedora.static-analysis + image: registry.gitlab.gnome.org/gnome/gnome-shell/extension-ci:v1 stage: source_check script: - sh lint/generate-report.sh -o $LINT_LOG || { cat $LINT_LOG; false; } @@ -32,10 +32,8 @@ eslint: when: on_failure build-shell-extensions: - image: fedora:latest + image: registry.gitlab.gnome.org/gnome/gnome-shell/extension-ci:v1 stage: build - before_script: - - dnf install -y meson gettext mozjs60-devel script: - meson _build . - ninja -C _build test install From 6e63edd7378874048e9e8870cd5e2616fde9f88b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Fri, 1 Mar 2019 02:41:12 +0100 Subject: [PATCH 19/33] lint: Sync with gjs Some of our custom rules have been upstreamed[0], update the rule sets accordingly. [0] https://gitlab.gnome.org/GNOME/gjs/merge_requests/272 https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/59 --- lint/eslintrc-gjs.json | 17 +++++++++++++++++ lint/eslintrc-shell.json | 24 ------------------------ 2 files changed, 17 insertions(+), 24 deletions(-) diff --git a/lint/eslintrc-gjs.json b/lint/eslintrc-gjs.json index b4672991..74cadf26 100644 --- a/lint/eslintrc-gjs.json +++ b/lint/eslintrc-gjs.json @@ -12,6 +12,7 @@ "error", "never" ], + "arrow-spacing": "error", "brace-style": "error", "comma-spacing": [ "error", @@ -24,6 +25,9 @@ "error", 4, { + "ignoredNodes": [ + "CallExpression[callee.object.name=GObject][callee.property.name=registerClass] > ClassExpression:first-child" + ], "MemberExpression": "off" } ], @@ -57,6 +61,19 @@ "allow": ["!!"] } ], + "no-restricted-properties": [ + "error", + { + "object": "Lang", + "property": "bind", + "message": "Use arrow notation or Function.prototype.bind()" + }, + { + "object": "Lang", + "property": "Class", + "message": "Use ES6 classes" + } + ], "nonblock-statement-body-position": [ "error", "below" diff --git a/lint/eslintrc-shell.json b/lint/eslintrc-shell.json index eb96266a..fc6f5819 100644 --- a/lint/eslintrc-shell.json +++ b/lint/eslintrc-shell.json @@ -1,6 +1,5 @@ { "rules": { - "arrow-spacing": "error", "camelcase": [ "error", { @@ -8,29 +7,6 @@ "allow": ["^vfunc_"] } ], - "indent": [ - "error", - 4, - { - "ignoredNodes": [ - "CallExpression[callee.object.name=GObject][callee.property.name=registerClass] > ClassExpression:first-child" - ], - "MemberExpression": "off" - } - ], - "no-restricted-properties": [ - "error", - { - "object": "Lang", - "property": "bind", - "message": "Please use arrow notation or Function.prototype.bind()." - }, - { - "object": "Lang", - "property": "Class", - "message": "Please use ES6 classes." - } - ], "no-unused-vars": [ "error", { From fb039c0fb5318c1c1891c23faad3d0a008d28155 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sat, 2 Mar 2019 23:07:15 +0100 Subject: [PATCH 20/33] cleanup: Use Meta.MaximizeFlags.BOTH This shorthand has been around for a long time, use it make (un)maximize code more readable. https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/60 --- .../screenshot-window-sizer/extension.js | 4 ++-- extensions/window-list/extension.js | 19 +++++++------------ 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/extensions/screenshot-window-sizer/extension.js b/extensions/screenshot-window-sizer/extension.js index 13d29f7c..41c4c853 100644 --- a/extensions/screenshot-window-sizer/extension.js +++ b/extensions/screenshot-window-sizer/extension.js @@ -73,8 +73,8 @@ function cycleScreenshotSizes(display, window, binding) { let backwards = (modifiers & Meta.VirtualModifier.SHIFT_MASK) != 0; // Unmaximize first - if (window.maximized_horizontally || window.maximizedVertically) - window.unmaximize(Meta.MaximizeFlags.HORIZONTAL | Meta.MaximizeFlags.VERTICAL); + if (window.get_maximized() != 0) + window.unmaximize(Meta.MaximizeFlags.BOTH); let workArea = window.get_work_area_current_monitor(); let outerRect = window.get_frame_rect(); diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js index 9e2ee94c..e1ea742e 100644 --- a/extensions/window-list/extension.js +++ b/extensions/window-list/extension.js @@ -79,13 +79,10 @@ class WindowContextMenu extends PopupMenu.PopupMenu { this._maximizeItem = new PopupMenu.PopupMenuItem(''); this._maximizeItem.connect('activate', () => { - if (this._metaWindow.maximized_vertically && - this._metaWindow.maximized_horizontally) - this._metaWindow.unmaximize(Meta.MaximizeFlags.HORIZONTAL | - Meta.MaximizeFlags.VERTICAL); + if (this._metaWindow.get_maximized() == Meta.MaximizeFlags.BOTH) + this._metaWindow.unmaximize(Meta.MaximizeFlags.BOTH); else - this._metaWindow.maximize(Meta.MaximizeFlags.HORIZONTAL | - Meta.MaximizeFlags.VERTICAL); + this._metaWindow.maximize(Meta.MaximizeFlags.BOTH); }); this.addMenuItem(this._maximizeItem); @@ -420,8 +417,7 @@ class AppContextMenu extends PopupMenu.PopupMenu { this._maximizeItem = new PopupMenu.PopupMenuItem(_('Maximize all')); this._maximizeItem.connect('activate', () => { this._appButton.getWindowList().forEach(w => { - w.maximize(Meta.MaximizeFlags.HORIZONTAL | - Meta.MaximizeFlags.VERTICAL); + w.maximize(Meta.MaximizeFlags.BOTH); }); }); this.addMenuItem(this._maximizeItem); @@ -429,8 +425,7 @@ class AppContextMenu extends PopupMenu.PopupMenu { this._unmaximizeItem = new PopupMenu.PopupMenuItem(_('Unmaximize all')); this._unmaximizeItem.connect('activate', () => { this._appButton.getWindowList().forEach(w => { - w.unmaximize(Meta.MaximizeFlags.HORIZONTAL | - Meta.MaximizeFlags.VERTICAL); + w.unmaximize(Meta.MaximizeFlags.BOTH); }); }); this.addMenuItem(this._unmaximizeItem); @@ -449,10 +444,10 @@ class AppContextMenu extends PopupMenu.PopupMenu { this._minimizeItem.actor.visible = windows.some(w => !w.minimized); this._unminimizeItem.actor.visible = windows.some(w => w.minimized); this._maximizeItem.actor.visible = windows.some(w => { - return !(w.maximized_horizontally && w.maximized_vertically); + return w.get_maximized() != Meta.MaximizeFlags.BOTH; }); this._unmaximizeItem.actor.visible = windows.some(w => { - return w.maximized_horizontally && w.maximized_vertically; + return w.get_maximized() == Meta.MaximizeFlags.BOTH; }); super.open(animate); From 1f1f9664a6aa271bce4b2fde8da5ee60124d4eba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sat, 2 Mar 2019 23:22:42 +0100 Subject: [PATCH 21/33] cleanup: Share unmount/eject arugments Besides the callback, eject and unmount share the same arguments. Make this explicit by sharing the common arguments between branches. https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/60 --- extensions/drive-menu/extension.js | 14 +++++++------- extensions/places-menu/placeDisplay.js | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/extensions/drive-menu/extension.js b/extensions/drive-menu/extension.js index 51b4aa67..7c8e36cf 100644 --- a/extensions/drive-menu/extension.js +++ b/extensions/drive-menu/extension.js @@ -65,17 +65,17 @@ class MountMenuItem extends PopupMenu.PopupBaseMenuItem { } _eject() { - let mountOp = new ShellMountOperation.ShellMountOperation(this.mount); + let unmountArgs = [ + Gio.MountUnmountFlags.NONE, + (new ShellMountOperation.ShellMountOperation(this.mount)).mountOp, + null // Gio.Cancellable + ]; if (this.mount.can_eject()) - this.mount.eject_with_operation(Gio.MountUnmountFlags.NONE, - mountOp.mountOp, - null, // Gio.Cancellable + this.mount.eject_with_operation(...unmountArgs, this._ejectFinish.bind(this)); else - this.mount.unmount_with_operation(Gio.MountUnmountFlags.NONE, - mountOp.mountOp, - null, // Gio.Cancellable + this.mount.unmount_with_operation(...unmountArgs, this._unmountFinish.bind(this)); } diff --git a/extensions/places-menu/placeDisplay.js b/extensions/places-menu/placeDisplay.js index 037a3394..16f54172 100644 --- a/extensions/places-menu/placeDisplay.js +++ b/extensions/places-menu/placeDisplay.js @@ -183,17 +183,17 @@ class PlaceDeviceInfo extends PlaceInfo { } eject() { - let mountOp = new ShellMountOperation.ShellMountOperation(this._mount); + let unmountArgs = [ + Gio.MountUnmountFlags.NONE, + (new ShellMountOperation.ShellMountOperation(this._mount)).mountOp, + null // Gio.Cancellable + ]; if (this._mount.can_eject()) - this._mount.eject_with_operation(Gio.MountUnmountFlags.NONE, - mountOp.mountOp, - null, // Gio.Cancellable + this._mount.eject_with_operation(...unmountArgs, this._ejectFinish.bind(this)); else - this._mount.unmount_with_operation(Gio.MountUnmountFlags.NONE, - mountOp.mountOp, - null, // Gio.Cancellable + this._mount.unmount_with_operation(...unmountArgs, this._unmountFinish.bind(this)); } From 599428d29202792638707afedc864d23b2573bc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sat, 2 Mar 2019 23:47:30 +0100 Subject: [PATCH 22/33] auto-move-windows: De-duplicate row appending https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/60 --- extensions/auto-move-windows/prefs.js | 35 ++++++++++++--------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/extensions/auto-move-windows/prefs.js b/extensions/auto-move-windows/prefs.js index f808347c..57628097 100644 --- a/extensions/auto-move-windows/prefs.js +++ b/extensions/auto-move-windows/prefs.js @@ -164,16 +164,7 @@ const Widget = GObject.registerClass({ this._appendItem(appInfo.get_id(), index); this._changedPermitted = true; - let iter = this._store.append(); - let adj = new Gtk.Adjustment({ - lower: 1, - upper: WORKSPACE_MAX, - step_increment: 1, - value: index - }); - this._store.set(iter, - [Columns.APPINFO, Columns.ICON, Columns.DISPLAY_NAME, Columns.WORKSPACE, Columns.ADJUSTMENT], - [appInfo, appInfo.get_icon(), appInfo.get_display_name(), index, adj]); + this._appendRow(appInfo, index); dialog.destroy(); }); @@ -223,22 +214,26 @@ const Widget = GObject.registerClass({ continue; validItems.push(currentItems[i]); - let iter = this._store.append(); - let adj = new Gtk.Adjustment({ - lower: 1, - upper: WORKSPACE_MAX, - step_increment: 1, - value: index - }); - this._store.set(iter, - [Columns.APPINFO, Columns.ICON, Columns.DISPLAY_NAME, Columns.WORKSPACE, Columns.ADJUSTMENT], - [appInfo, appInfo.get_icon(), appInfo.get_display_name(), parseInt(index), adj]); + this._appendRow(appInfo, parseInt(index)); } if (validItems.length != currentItems.length) // some items were filtered out this._settings.set_strv(SETTINGS_KEY, validItems); } + _appendRow(appInfo, index) { + let iter = this._store.append(); + let adj = new Gtk.Adjustment({ + lower: 1, + upper: WORKSPACE_MAX, + step_increment: 1, + value: index + }); + this._store.set(iter, + [Columns.APPINFO, Columns.ICON, Columns.DISPLAY_NAME, Columns.WORKSPACE, Columns.ADJUSTMENT], + [appInfo, appInfo.get_icon(), appInfo.get_display_name(), index, adj]); + } + _checkId(id) { let items = this._settings.get_strv(SETTINGS_KEY); return !items.some(i => i.startsWith(`${id}:`)); From a071685c1336538e888e643b7f3f9b2ae7e73bec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sun, 3 Mar 2019 00:07:42 +0100 Subject: [PATCH 23/33] auto-move-windows: Clarify some code Apply some tricks to align column numbers with their corresponding values for better legibility. https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/60 --- extensions/auto-move-windows/prefs.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/extensions/auto-move-windows/prefs.js b/extensions/auto-move-windows/prefs.js index 57628097..f9c4699e 100644 --- a/extensions/auto-move-windows/prefs.js +++ b/extensions/auto-move-windows/prefs.js @@ -221,17 +221,20 @@ const Widget = GObject.registerClass({ this._settings.set_strv(SETTINGS_KEY, validItems); } - _appendRow(appInfo, index) { + _appendRow(appInfo, workspace) { let iter = this._store.append(); + let icon = appInfo.get_icon(); + let displayName = appInfo.get_display_name(); let adj = new Gtk.Adjustment({ lower: 1, upper: WORKSPACE_MAX, step_increment: 1, - value: index + value: workspace }); + let { APPINFO, ICON, DISPLAY_NAME, WORKSPACE, ADJUSTMENT } = Columns; this._store.set(iter, - [Columns.APPINFO, Columns.ICON, Columns.DISPLAY_NAME, Columns.WORKSPACE, Columns.ADJUSTMENT], - [appInfo, appInfo.get_icon(), appInfo.get_display_name(), index, adj]); + [APPINFO, ICON, DISPLAY_NAME, WORKSPACE, ADJUSTMENT], + [appInfo, icon, displayName, workspace, adj]); } _checkId(id) { From 56d19ad4808b448553a886dc5405677b987b3b1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sun, 3 Mar 2019 00:19:15 +0100 Subject: [PATCH 24/33] placesMenu: Add early return to reduce indentation level https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/60 --- extensions/places-menu/placeDisplay.js | 53 +++++++++++++------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/extensions/places-menu/placeDisplay.js b/extensions/places-menu/placeDisplay.js index 16f54172..991dae8f 100644 --- a/extensions/places-menu/placeDisplay.js +++ b/extensions/places-menu/placeDisplay.js @@ -43,34 +43,35 @@ class PlaceInfo { try { Gio.AppInfo.launch_default_for_uri_finish(result); } catch (e) { - if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_MOUNTED)) { - let source = { - get_icon: () => this.icon - }; - let op = new ShellMountOperation.ShellMountOperation(source); - this.file.mount_enclosing_volume(0, op.mountOp, null, (file, result) => { - try { - op.close(); - file.mount_enclosing_volume_finish(result); - } catch (e) { - if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.FAILED_HANDLED)) - // e.g. user canceled the password dialog - return; - Main.notifyError(_('Failed to mount volume for “%s”').format(this.name), e.message); - return; - } - - if (tryMount) { - let callback = this._createLaunchCallback(launchContext, false); - Gio.AppInfo.launch_default_for_uri_async(file.get_uri(), - launchContext, - null, - callback); - } - }); - } else { + if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_MOUNTED)) { Main.notifyError(_('Failed to launch “%s”').format(this.name), e.message); + return; } + + let source = { + get_icon: () => this.icon + }; + let op = new ShellMountOperation.ShellMountOperation(source); + this.file.mount_enclosing_volume(0, op.mountOp, null, (file, result) => { + try { + op.close(); + file.mount_enclosing_volume_finish(result); + } catch (e) { + if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.FAILED_HANDLED)) + // e.g. user canceled the password dialog + return; + Main.notifyError(_('Failed to mount volume for “%s”').format(this.name), e.message); + return; + } + + if (tryMount) { + let callback = this._createLaunchCallback(launchContext, false); + Gio.AppInfo.launch_default_for_uri_async(file.get_uri(), + launchContext, + null, + callback); + } + }); } }; } From a378e5fc3416a9a301dfa1d76c3cb4f584a2d71a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sun, 3 Mar 2019 01:34:44 +0100 Subject: [PATCH 25/33] placesDisplay: Promisify launching Use async/await to make nested async operations easier to read. https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/60 --- extensions/places-menu/placeDisplay.js | 91 +++++++++++++++----------- 1 file changed, 51 insertions(+), 40 deletions(-) diff --git a/extensions/places-menu/placeDisplay.js b/extensions/places-menu/placeDisplay.js index 991dae8f..e97cef4f 100644 --- a/extensions/places-menu/placeDisplay.js +++ b/extensions/places-menu/placeDisplay.js @@ -38,51 +38,36 @@ class PlaceInfo { return false; } - _createLaunchCallback(launchContext, tryMount) { - return (_ignored, result) => { - try { - Gio.AppInfo.launch_default_for_uri_finish(result); - } catch (e) { - if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_MOUNTED)) { - Main.notifyError(_('Failed to launch “%s”').format(this.name), e.message); - return; - } - - let source = { - get_icon: () => this.icon - }; - let op = new ShellMountOperation.ShellMountOperation(source); - this.file.mount_enclosing_volume(0, op.mountOp, null, (file, result) => { - try { - op.close(); - file.mount_enclosing_volume_finish(result); - } catch (e) { - if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.FAILED_HANDLED)) - // e.g. user canceled the password dialog - return; - Main.notifyError(_('Failed to mount volume for “%s”').format(this.name), e.message); - return; - } - - if (tryMount) { - let callback = this._createLaunchCallback(launchContext, false); - Gio.AppInfo.launch_default_for_uri_async(file.get_uri(), - launchContext, - null, - callback); - } - }); + async _ensureMountAndLaunch(context, tryMount) { + try { + await this._launchDefaultForUri(this.file.get_uri(), context, null); + } catch (e) { + if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_MOUNTED)) { + Main.notifyError(_('Failed to launch “%s”').format(this.name), e.message); + return; } - }; + + let source = { + get_icon: () => this.icon + }; + let op = new ShellMountOperation.ShellMountOperation(source); + try { + await this._mountEnclosingVolume(0, op.mountOp, null); + + if (tryMount) + this._ensureMountAndLaunch(context, false); + } catch (e) { + if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.FAILED_HANDLED)) + Main.notifyError(_('Failed to mount volume for “%s”').format(this.name), e.message); + } finally { + op.close(); + } + } } launch(timestamp) { let launchContext = global.create_app_launch_context(timestamp, -1); - let callback = this._createLaunchCallback(launchContext, true); - Gio.AppInfo.launch_default_for_uri_async(this.file.get_uri(), - launchContext, - null, - callback); + this._ensureMountAndLaunch(launchContext, true); } getIcon() { @@ -126,6 +111,32 @@ class PlaceInfo { throw e; } } + + _launchDefaultForUri(uri, context, cancel) { + return new Promise((resolve, reject) => { + Gio.AppInfo.launch_default_for_uri_async(uri, context, cancel, (o, res) => { + try { + Gio.AppInfo.launch_default_for_uri_finish(res); + resolve(); + } catch (e) { + reject(e); + } + }); + }); + } + + _mountEnclosingVolume(flags, mountOp, cancel) { + return new Promise((resolve, reject) => { + this.file.mount_enclosing_volume(flags, mountOp, cancel, (o, res) => { + try { + this.file.mount_enclosing_volume_finish(res); + resolve(); + } catch (e) { + reject(e); + } + }); + }); + } } Signals.addSignalMethods(PlaceInfo.prototype); From 81548ced6929617b85adc25edf1bc29a0170ba62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sun, 3 Mar 2019 02:22:37 +0100 Subject: [PATCH 26/33] native-window-placement: Clarify some code Add some intermediate variables for better legibility. https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/60 --- extensions/native-window-placement/extension.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/extensions/native-window-placement/extension.js b/extensions/native-window-placement/extension.js index faf7fab5..8a8b0937 100644 --- a/extensions/native-window-placement/extension.js +++ b/extensions/native-window-placement/extension.js @@ -112,10 +112,11 @@ class NaturalLayoutStrategy extends Workspace.LayoutStrategy { overlap = false; for (let i = 0; i < rects.length; i++) { for (let j = 0; j < rects.length; j++) { - if (i != j && rects[i].adjusted(-WINDOW_PLACEMENT_NATURAL_GAPS, -WINDOW_PLACEMENT_NATURAL_GAPS, - WINDOW_PLACEMENT_NATURAL_GAPS, WINDOW_PLACEMENT_NATURAL_GAPS) - .overlap(rects[j].adjusted(-WINDOW_PLACEMENT_NATURAL_GAPS, -WINDOW_PLACEMENT_NATURAL_GAPS, - WINDOW_PLACEMENT_NATURAL_GAPS, WINDOW_PLACEMENT_NATURAL_GAPS))) { + let adjustments = [-1, -1, 1, 1] + .map(v => v *= WINDOW_PLACEMENT_NATURAL_GAPS); + let iAdjusted = rects[i].adjusted(...adjustments); + let jAdjusted = rects[j].adjusted(...adjustments); + if (i != j && iAdjusted.overlap(jAdjusted)) { loopCounter++; overlap = true; From bd9f1cfd918eb18e7394946e11f6737d01e6fd3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sun, 3 Mar 2019 04:16:35 +0100 Subject: [PATCH 27/33] apps-menu: Avoid deep nesting https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/60 --- extensions/apps-menu/extension.js | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js index 0c991231..b3c3cff7 100644 --- a/extensions/apps-menu/extension.js +++ b/extensions/apps-menu/extension.js @@ -680,17 +680,19 @@ class ApplicationsButton extends PanelMenu.Button { let iter = root.iter(); let nextType; while ((nextType = iter.next()) != GMenu.TreeItemType.INVALID) { - if (nextType == GMenu.TreeItemType.DIRECTORY) { - let dir = iter.get_directory(); - if (!dir.get_is_nodisplay()) { - let categoryId = dir.get_menu_id(); - this.applicationsByCategory[categoryId] = []; - this._loadCategory(categoryId, dir); - if (this.applicationsByCategory[categoryId].length > 0) { - let categoryMenuItem = new CategoryMenuItem(this, dir); - this.categoriesBox.add_actor(categoryMenuItem.actor); - } - } + if (nextType != GMenu.TreeItemType.DIRECTORY) + continue; + + let dir = iter.get_directory(); + if (dir.get_is_nodisplay()) + continue; + + let categoryId = dir.get_menu_id(); + this.applicationsByCategory[categoryId] = []; + this._loadCategory(categoryId, dir); + if (this.applicationsByCategory[categoryId].length > 0) { + let categoryMenuItem = new CategoryMenuItem(this, dir); + this.categoriesBox.add_actor(categoryMenuItem.actor); } } From 95b40069bf0c8d57fe90419453ba31a7c5711db9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sun, 3 Mar 2019 04:17:05 +0100 Subject: [PATCH 28/33] apps-menu: Remove unnecessary check The function is always called with an array parameter (albeit it may be empty), so remove the unnecessary check and cut down on indentation. https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/60 --- extensions/apps-menu/extension.js | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js index b3c3cff7..0a3b24aa 100644 --- a/extensions/apps-menu/extension.js +++ b/extensions/apps-menu/extension.js @@ -721,22 +721,20 @@ class ApplicationsButton extends PanelMenu.Button { } _displayButtons(apps) { - if (apps) { - for (let i = 0; i < apps.length; i++) { - let app = apps[i]; - let item; - if (app instanceof Shell.App) - item = this._applicationsButtons.get(app); - else - item = new PopupMenu.PopupSeparatorMenuItem(); - if (!item) { - item = new ApplicationMenuItem(this, app); - item.setDragEnabled(this._desktopTarget.hasDesktop); - this._applicationsButtons.set(app, item); - } - if (!item.actor.get_parent()) - this.applicationsBox.add_actor(item.actor); + for (let i = 0; i < apps.length; i++) { + let app = apps[i]; + let item; + if (app instanceof Shell.App) + item = this._applicationsButtons.get(app); + else + item = new PopupMenu.PopupSeparatorMenuItem(); + if (!item) { + item = new ApplicationMenuItem(this, app); + item.setDragEnabled(this._desktopTarget.hasDesktop); + this._applicationsButtons.set(app, item); } + if (!item.actor.get_parent()) + this.applicationsBox.add_actor(item.actor); } } From 7e5726e63271a19a669a443a8adb168801e85f55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sun, 3 Mar 2019 04:21:41 +0100 Subject: [PATCH 29/33] apps-menu: Promisify marking file as trusted Use async/await to make nested operations easier to read. https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/60 --- extensions/apps-menu/extension.js | 57 ++++++++++++------------------- 1 file changed, 22 insertions(+), 35 deletions(-) diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js index 0a3b24aa..d7ba570a 100644 --- a/extensions/apps-menu/extension.js +++ b/extensions/apps-menu/extension.js @@ -22,6 +22,9 @@ const HORIZ_FACTOR = 5; const MENU_HEIGHT_OFFSET = 132; const NAVIGATION_REGION_OVERSHOOT = 50; +Gio._promisify(Gio._LocalFilePrototype, 'query_info_async', 'query_info_finish'); +Gio._promisify(Gio._LocalFilePrototype, 'set_attributes_async', 'set_attributes_finish'); + class ActivitiesMenuItem extends PopupMenu.PopupBaseMenuItem { constructor(button) { super(); @@ -303,48 +306,32 @@ class DesktopTarget { return source._app.app_info; } - _touchFile(file) { - let queryFlags = Gio.FileQueryInfoFlags.NONE; - let ioPriority = GLib.PRIORITY_DEFAULT; - - let info = new Gio.FileInfo(); - info.set_attribute_uint64(Gio.FILE_ATTRIBUTE_TIME_ACCESS, - GLib.get_real_time()); - file.set_attributes_async (info, queryFlags, ioPriority, null, - (o, res) => { - try { - o.set_attributes_finish(res); - } catch (e) { - log(`Failed to update access time: ${e.message}`); - } - }); - } - - _markTrusted(file) { + async _markTrusted(file) { let modeAttr = Gio.FILE_ATTRIBUTE_UNIX_MODE; let trustedAttr = 'metadata::trusted'; let queryFlags = Gio.FileQueryInfoFlags.NONE; let ioPriority = GLib.PRIORITY_DEFAULT; - file.query_info_async(modeAttr, queryFlags, ioPriority, null, - (o, res) => { - try { - let info = o.query_info_finish(res); - let mode = info.get_attribute_uint32(modeAttr) | 0o100; + try { + let info = await file.query_info_async(modeAttr, queryFlags, ioPriority, null); - info.set_attribute_uint32(modeAttr, mode); - info.set_attribute_string(trustedAttr, 'yes'); - file.set_attributes_async (info, queryFlags, ioPriority, null, - (o, res) => { - o.set_attributes_finish(res); + let mode = info.get_attribute_uint32(modeAttr) | 0o100; + info.set_attribute_uint32(modeAttr, mode); + info.set_attribute_string(trustedAttr, 'yes'); + await file.set_attributes_async(info, queryFlags, ioPriority, null); - // Hack: force nautilus to reload file info - this._touchFile(file); - }); - } catch (e) { - log(`Failed to mark file as trusted: ${e.message}`); - } - }); + // Hack: force nautilus to reload file info + info = new Gio.FileInfo(); + info.set_attribute_uint64(Gio.FILE_ATTRIBUTE_TIME_ACCESS, + GLib.get_real_time()); + try { + await file.set_attributes_async(info, queryFlags, ioPriority, null); + } catch (e) { + log(`Failed to update access time: ${e.message}`); + } + } catch (e) { + log(`Failed to mark file as trusted: ${e.message}`); + } } destroy() { From ab334d95e0f5841875739f3632fd99e74c8fb9d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sun, 3 Mar 2019 05:34:46 +0100 Subject: [PATCH 30/33] Revert "User theme: compatibility with XDG Base Directory" We already handled themes in XDG_DATA_HOME before commit 2582ab by prepending it to the system dirs. This reverts commit 2582ab4fd03a6a078a3ba2556e250bfdb64308b7. https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/60 --- extensions/user-theme/extension.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/extensions/user-theme/extension.js b/extensions/user-theme/extension.js index d9d5b388..1a718d19 100644 --- a/extensions/user-theme/extension.js +++ b/extensions/user-theme/extension.js @@ -34,17 +34,11 @@ class ThemeManager { let _themeName = this._settings.get_string(SETTINGS_KEY); if (_themeName) { - let _userCssStylesheetCompat = GLib.build_filenamev([ + let _userCssStylesheet = GLib.build_filenamev([ GLib.get_home_dir(), '.themes', _themeName, 'gnome-shell', 'gnome-shell.css' ]); - let fileCompat = Gio.file_new_for_path(_userCssStylesheetCompat); - let _userCssStylesheet = GLib.build_filenamev([ - GLib.get_user_data_dir(), 'themes', _themeName, 'gnome-shell', 'gnome-shell.css' - ]); let file = Gio.file_new_for_path(_userCssStylesheet); - if (fileCompat.query_exists(null)) - _stylesheet = _userCssStylesheetCompat; - else if (file.query_exists(null)) + if (file.query_exists(null)) _stylesheet = _userCssStylesheet; else { let sysdirs = GLib.get_system_data_dirs(); From a26380d56e0f73bd34bf18c7e17f3fc9dbbbd7fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sun, 3 Mar 2019 05:34:17 +0100 Subject: [PATCH 31/33] user-theme: Clarify some code Commit 2582ab accidentally pointed out that the current theme loading code obfuscates which directories are searched for themes. Rewrite it with modern JS features to make it more obvious. https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/60 --- extensions/user-theme/extension.js | 44 ++++++++++++------------------ 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/extensions/user-theme/extension.js b/extensions/user-theme/extension.js index 1a718d19..d00c0774 100644 --- a/extensions/user-theme/extension.js +++ b/extensions/user-theme/extension.js @@ -30,37 +30,29 @@ class ThemeManager { } _changeTheme() { - let _stylesheet = null; - let _themeName = this._settings.get_string(SETTINGS_KEY); + let stylesheet = null; + let themeName = this._settings.get_string(SETTINGS_KEY); - if (_themeName) { - let _userCssStylesheet = GLib.build_filenamev([ - GLib.get_home_dir(), '.themes', _themeName, 'gnome-shell', 'gnome-shell.css' - ]); - let file = Gio.file_new_for_path(_userCssStylesheet); - if (file.query_exists(null)) - _stylesheet = _userCssStylesheet; - else { - let sysdirs = GLib.get_system_data_dirs(); - sysdirs.unshift(GLib.get_user_data_dir()); - for (let i = 0; i < sysdirs.length; i++) { - _userCssStylesheet = GLib.build_filenamev([ - sysdirs[i], 'themes', _themeName, 'gnome-shell', 'gnome-shell.css' - ]); - let file = Gio.file_new_for_path(_userCssStylesheet); - if (file.query_exists(null)) { - _stylesheet = _userCssStylesheet; - break; - } - } - } + if (themeName) { + let stylesheetPaths = [ + [GLib.get_home_dir(), '.themes'], + [GLib.get_user_data_dir(), 'themes'], + ...GLib.get_system_data_dirs().map(dir => [dir, 'themes']) + ].map(themeDir => GLib.build_filenamev([ + ...themeDir, themeName, 'gnome-shell', 'gnome-shell.css' + ])); + + stylesheet = stylesheetPaths.find(path => { + let file = Gio.file_new_for_path(path); + return file.query_exists(null); + }); } - if (_stylesheet) - global.log(`loading user theme: ${_stylesheet}`); + if (stylesheet) + global.log(`loading user theme: ${stylesheet}`); else global.log('loading default theme (Adwaita)'); - Main.setThemeStylesheet(_stylesheet); + Main.setThemeStylesheet(stylesheet); Main.loadTheme(); } } From 53f92f2910b1eb468aa68c6fc697f6e01fd4298e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Tue, 5 Mar 2019 06:05:05 +0100 Subject: [PATCH 32/33] Update sass submodule --- data/gnome-shell-sass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/gnome-shell-sass b/data/gnome-shell-sass index 055fefe5..8d1ee96f 160000 --- a/data/gnome-shell-sass +++ b/data/gnome-shell-sass @@ -1 +1 @@ -Subproject commit 055fefe597605cec6de6899667d4ff45f83a5857 +Subproject commit 8d1ee96f2f8df85d13508ac6b64e50e32c886db7 From e7e6b882a34a00432e0345bf1004b79aa391ec48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Tue, 5 Mar 2019 06:07:01 +0100 Subject: [PATCH 33/33] Bump version to 3.31.92 Update NEWS. --- NEWS | 7 +++++++ meson.build | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 4e653e98..34d13c1d 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,10 @@ +3.31.92 +======= +* Misc. bug fixes and cleanups [Florian; !57, !58, !59, !60] + +Contributors: + Florian Müllner + 3.31.91 ======= * apps-menu: Remove outdated legacy-tray handling [Florian; !53] diff --git a/meson.build b/meson.build index 7e5fdd3c..ed228fe9 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('gnome-shell-extensions', - version: '3.31.91', + version: '3.31.92', meson_version: '>= 0.44.0', license: 'GPL2+' )