82 Commits

Author SHA1 Message Date
59d5665661
Refactor: Simplify #overwritePanelAddToPanelBox heavily
Simplify `#overwritePanelAddToPanelBox` heavily by just calling the
original function in the overwrite and ordering the top bar and handling
new items afterwards.
Note that AppIndicator/KStatusNotifierItems are still not supported with
this refactor.
2023-01-28 00:20:43 +01:00
d51703eb4e
Refactor: Introduce BoxOrderManager
Introduce new `BoxOrderManager` to basically act as a heavy wrapper
around the box orders stored in settings, so that the other extension
code has easy methods to get, set and interact with box orders.
Refactor most of the code initially with it in mind.
Note that `#overwritePanelAddToPanelBox` needs more refactoring to
properly make use of that new idea (and it also needs refactoring in
general).
2023-01-27 23:48:23 +01:00
ba373e9e49
Other: Mark AppIndicator/KStatusNotifierItem addition as broken 2023-01-27 21:44:59 +01:00
7b1c030325
Fix: Don't use globalThis, since it won't get g.c. on window close
Don't use `globalThis`, since it won't get garbage collected on window
close.

See here for the relevant review:
https://extensions.gnome.org/review/38364
And for the relevant documentation:
https://gjs.guide/extensions/review-guidelines/review-guidelines.html#only-use-init-for-initialization
2023-01-26 03:42:56 +01:00
2ef16f310c
Fix: Null out this.settings on extension disable
See here for the relevant review:
https://extensions.gnome.org/review/38364
And for the relevant documentation:
https://gjs.guide/extensions/review-guidelines/review-guidelines.html#destroy-all-objects
2023-01-25 20:40:16 +01:00
93ec247cd3
Other: Bump version to 4 v4 2023-01-25 18:56:59 +01:00
97d8f86372
Feature: Support GNOME version 43 2023-01-25 18:55:08 +01:00
c6fb9a8b8d
Docs: Add newer, cut down and commented panel.js from Gnome Shell 43.2 2023-01-24 20:40:24 +01:00
7970a7c643
Other: Add docs panel code files to .eslintignore 2023-01-24 19:39:07 +01:00
dc7ad73db4
Other: Handle ESLint complaints 2023-01-24 19:33:11 +01:00
062bc9ae26
Other: Allow underscore-prefixed unused arguments in ESLint config 2023-01-24 19:26:08 +01:00
2e5bcd4e81
Other: Move "use strict"; before ESLint config comment everywhere 2023-01-24 19:24:14 +01:00
17d7bd23b4
Other: Set ecmaVersion to 2022 for ESLint to sup. priv. class feat. 2023-01-24 19:12:38 +01:00
7c96867182
Other: Upgrade ESLint to new major version and run npm update 2023-01-24 19:00:48 +01:00
268b9b5c5e
Other: Run npm update 2023-01-24 18:42:34 +01:00
d7ec1156e2
Refactor: Setup and handle all of DND scroll. in #setupDNDScroll func.
Also handle drag events in this function so connecting to "drag-end" in
widgets with "GtkDragSource" and a `globalThis` `ScrollManager` instance
aren't needed.
2023-01-24 18:33:15 +01:00
398793d1a0
Refactor: Simplify box order save code in PrefsBOLEmptyPlaceholder
Do this by simply using the `saveBoxOrderToSettings` method of
`PrefsBoxOrderListBox`.
2023-01-22 21:18:58 +01:00
f7309e7f65
Refactor: Simplify PrefsPage UI file and get rid of InternalChildren 2023-01-22 21:12:05 +01:00
503fdcb90d
Refactor: Build Menu in UI file 2023-01-22 21:02:58 +01:00
e07411f9fd
Refactor: Use private instance methods instead of prefixing with _ 2023-01-22 20:35:13 +01:00
cc118d7796
Refactor: Remove empty constructor 2023-01-22 20:27:57 +01:00
596c8d3cdc
Refactor: Setup Drag Source and Drop Targets in UI files 2023-01-22 20:06:02 +01:00
5362629f94
Refactor: Add PrefsBoxOrderListBoxes via UI file a. let them self-init
Add the `PrefsBoxOrderListBox`es to the `PrefsPage` via the
`PrefsPage`es UI file.
Also let the `PrefsBoxOrderListBox`es initialize themselves based on the
given box order.
2023-01-22 19:28:55 +01:00
c54e24c151
Refactor: Add ScrollManager instance to globalThis
Do this so that we don't have to pass the `ScrollManager` instance to
each `PrefsBoxOrderItemRow` instance. This is useful for future
refactors.
2023-01-22 19:28:49 +01:00
34ba8a58cd
Refactor: Add settings to globalThis
Do this so that we don't have to get them in each class individually.
2023-01-22 15:48:35 +01:00
2f9f4d1a3f
Refactor: Use constructor instead of _init 2023-01-22 15:16:56 +01:00
cda099be24
Refactor: Move PrefsPage class into own file (PrefsPage.js) 2023-01-22 15:10:43 +01:00
7ed9329f2d
Refactor: Move UI files and gschema file to more standard locations 2023-01-22 14:59:40 +01:00
ddd0297868
Build: Use gnome-extensions pack for creating extension zip/bundle 2023-01-15 23:35:36 +01:00
d383908d5f
Other: Remove license notice, since its unnecessary and annoying 2023-01-04 23:57:21 +01:00
3299686041
Update: Show drag icon when reordering PrefsBoxOrderItemRows using DND
The following code from GNOME/gnome-control-center was used as a
reference to make this code work:
- ab7d752de9/panels/search/cc-search-panel-row.c (L96)
- ab7d752de9/panels/search/cc-search-panel-row.c (L84)
2022-10-24 01:07:24 +02:00
249f3554d5
Breaking: Make preferences usable again and support Gnome Shell 42
Make the preferences usable again (and look good) by using an
`AdwPreferencesPage` as well as various other libadwaita features (like
`AdwPreferencesGroup`, style classes, ...).
Also get rid of some code, which now doesn't seem to be necessary
anymore (making sure no horizontal scrollbar shows and setting a default
size for the preferences window).

This change is marked as "Breaking", since I assume `AdwPreferencesPage`
doesn't work in Gnome Shell 40 and because I changed the supported Gnome
Shell version to 42 accordingly.
2022-10-23 22:10:36 +02:00
fd66911ff5
Other: Run npm install and npm update 2022-10-22 20:52:18 +02:00
6b4c75ad83
Docs: Add newer, cut down and commented panel.js from Gnome Shell 42.5 2022-10-22 19:14:54 +02:00
91b472c4fe
Docs: Add doc. holding some setup instructions and tips for a GSE Dev VM
Add this document to provide some setup instructions and tips for making
the most of a Gnome Shell Extensions Development VM.
2022-10-22 01:25:11 +02:00
37ece04211
Rename docs/panel.js to include source branch and date
Do this in preparation for the addition of more `panel.js` files from
other branches/tags and dates.
2022-10-21 19:27:59 +02:00
d4af68313f
Other: Bump version to 3 v3 2021-07-05 11:03:15 +02:00
10b491c252
Update: Handle the Dropbox client better
The Dropbox client appends its PID to the id, which gets used for the
application name in `handleAppIndicatorKStatusNotifierItemItem`. This
resulted in the creation of a new entry for the Dropbox client on
basically every Dropbox client start, which would fill up the extensions
settings and would also result in the user effectively not being able to
set the position for the Dropbox client permanently.
This commit fixes these issues by removing the PID (and the hypen before
it) for the Dropbox client application name.
2021-07-05 10:58:10 +02:00
03fb3355b4
Fix: Extension crashing, when no associatedRole can be found
There are situations, where no `associatedRole` for a given
`indicatorContainer` can be found (e.g. the GameMode GNOME Shell
Extension seems to cause such a situation, when you have it enabled and
lock and unlock GNOME).
Previously this would crash the extension. With this fix, those
`indicatorContainer`s just get ignored.
2021-07-05 10:06:51 +02:00
e76b24e813
Feature: Add forget action for top bar items
This forget action removes the top bar item from the top bar order
representation, which is present in the settings, and then saves the top
bar order.
This action is intended for forgetting top bar items, which aren't
present in the top bar anymore, so that the user can clean up their
settings.
So if an item isn't in the top bar at the time of action activation,
activating the action removes it from the saved top bar order. If an
item is in the top bar at the time of action activation, the item
position just gets lost (since it gets automatically re-added to the top
bar order).
2021-07-05 08:41:08 +02:00
309e2c07b9
Refactor: Let PrefsBoxOrderItemRow handle item association
Let `PrefsBoxOrderItemRow` handle the association of itself with an item
itself.
Doing so makes the code cleaner, since the association isn't done
externally anymore.
2021-07-05 07:58:01 +02:00
bd69f816eb
Refactor: Move logic for saving box order to PrefsBoxOrderListBox
Move the logic for saving the box order represented by a
`PrefsBoxOrderListBox` (and its `PrefsBoxOrderItemRows`) to the
`PrefsBoxOrderListBox` class.
This makes the code cleaner and allows for easy reuse of the logic in
the future.
2021-07-05 07:46:08 +02:00
28fb67ad4d
Refactor: Create custom class for prefs box order GtkListBoxes
Create a custom class (`PrefsBoxOrderListBox`) for GtkListBoxes, which
are used in the preferences window for holding box order settings.
Having a custom class for these GtkListBoxes is useful, since it can
hold logic related to box order settings. Future commits will bring more
of this logic into this class.
2021-07-05 07:22:19 +02:00
edfa50f254
Update: Scroll preferences window content on Drag-and-Drop
Scroll the content of the preferences window on Drag-and-Drop, when the
mouse is in the upper or lower part of the content of the preferences
window.
This helps a user, who has e.g. a lot of items, but the preferences
window with a low height, to easily move any item to any position.
2021-07-04 05:16:32 +02:00
a4ea0c630a
Update: Make the preferences window content scrollable
Previously it could happen that the preferences window got larger than
the height of the screen (e.g. when having a bunch of items and a low
vertical screen resolution).
Fix this, by making the preferences window content scrollable.

Also introduce a nice default window size.
2021-07-04 02:20:56 +02:00
8bda3ea0ab
Other: Bump version to 2 v2 2021-06-22 00:03:37 +02:00
689a8107e2
Fix: Fix incorrect ordering
There was an issue where, when you started Gnome Shell, the icons
weren't corrently ordered. It seems that this issue was caused by a
combination of the following two things:

1. When determining the insertion index in `determineInsertionIndex` (in
   `getPositionAndBoxOverwrite` in `_overwritePanelAddToPanelBox`) the
   `boxOrder` got set to `boxOrders.something`, which doesn't make much
   sense considering that the `index` was determined by using
   `resolvedBoxOrders.something`.
   So set `boxOrder` to `resolvedBoxOrders.something` instead, to obtain
   an `insertionIndex`, which makes sense.
2. Ordering the `right` panel box from right to left (in
   `_orderTopBarItems`) seemed to cause issues (, which are probably
   caused by the indices not making sense with the children box counts
   at insertion time).
   Therefore and also because the regular (left-to-right) ordering seems
   to work just fine even for the case described in the comment (, which
   provides the reason for right-to-left ordering,) just use regular
   ordering for all boxes.

Fixing these two things may also fix other incorrect ordering behaviour
at other times.
2021-06-22 00:00:04 +02:00
0eee0e8ef9
Other: Wrap comments longer than 80 characters at 80 characters 2021-06-21 21:37:58 +02:00
d4514219ed
Fix: Use correct child count when ordering right box
Previously the `panelBoxChildCount` would just be the child count of the
right box before new items got added, which would result in incorrect
indices for new child insertions being used (in
`panel.insert_child_at_index`), since `panelBoxChildCount` would just
account for the current children, not for new ones.

This resulted in the following issue:
When you used the settings to move an item from e.g. the middle box to
the right box, the right box would get ordered incorrectly.

So fix this issue by getting the max of the right boxes current children
and the `validBoxOrder.length`.
2021-06-21 21:26:26 +02:00
65304a9894
Docs: Add documentation on how to create a new tag 2021-06-21 19:32:45 +02:00