Compare commits

...

23 Commits

Author SHA1 Message Date
Florian Müllner
0e3d6465eb Tag release 40.alpha.1
Update NEWS.
2021-01-14 19:02:07 +01:00
Florian Müllner
d381a0b89b auto-move-windows: Use Gtk.Button.icon_name property
Image buttons are a very common pattern, so GTK4 added some
convenience API we can use to construct them.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/148>
2021-01-14 14:40:55 +01:00
Florian Müllner
5df0fa145b workspace-indicator: Use Gtk.Button.icon_name property
Image buttons are a very common pattern, so GTK4 added some
convenience API we can use to construct them.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/148>
2021-01-14 14:40:55 +01:00
Florian Müllner
f0ff0e1400 workspace-indicator: Stop using header func for separators
GTK4 added built-in support for this common pattern, so use that
instead.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/148>
2021-01-14 14:40:55 +01:00
Florian Müllner
53f5a92dc8 user-theme: Stop using header func for separators
GTK4 provides built-in support for this common pattern, so use
that instead.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/148>
2021-01-14 14:40:55 +01:00
Florian Müllner
d5c31273ee auto-move-windows: Stop using header func for separators
GTK4 added built-in support for this common pattern, so use that
instead.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/148>
2021-01-14 14:40:55 +01:00
Florian Müllner
22ea58a849 workspace-indicator: Port to GTK4
With this port, all extensions now use GTK4 for their preferences.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/148>
2021-01-14 14:40:55 +01:00
Florian Müllner
67d96993ce auto-move-windows: Port to GTK4
Just like the previous ports, this consists mostly of
replacing the old Gtk.Container methods.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/148>
2021-01-14 14:40:55 +01:00
Florian Müllner
96dd4f9835 window-list: Port to GTK4
Another easy port:
 - replace Gtk.Container methods
 - stop using show_all()
 - Gtk.CheckButton now provides the
   Gtk.RadioButton functionality as well

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/148>
2021-01-14 14:40:55 +01:00
Florian Müllner
3bef6be7c1 user-theme: Port to GTK4
With the previous preparations in place, the actual GTK4 port is
now trivial:
 - replace Gtk.Container methods with widget-specific methods
 - stop using show_all()

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/148>
2021-01-14 14:40:55 +01:00
Florian Müllner
b83d38a72e user-theme: Track GSettings to sync checkmark
GTK4 removes the generic GtkWidget API for accessing an inserted
action group, so we need an alternative for tracking the currently
selected theme.

Using the underlying GSettings object looks like the easiest option,
so do that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/148>
2021-01-14 14:40:54 +01:00
Florian Müllner
5b73960f34 extensions: Stop using :margin shortcut
The property has been removed in GTK4, so prepare for a port by
setting the four individual margin properties instead.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/148>
2021-01-14 14:40:54 +01:00
Jonas Dreßler
505a7f4ac9 classic: Fixup panel styling after gnome-shell changes
We don't want a transparent panel in the classic session (this is
already taken care of by the existing panel background-color overrides),
and we want to avoid the new pill-shaped hover/focus indicators in the
classic session.

For the gnome-shell changes, see
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1397.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/153>
2021-01-14 00:25:47 +01:00
Florian Müllner
e8acfb2b51 Update sass submodule
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/153>
2021-01-14 00:25:47 +01:00
Florian Müllner
dcd5dc4c7f ci: Add back commit-rules file
Somehow git-mv ended up as git-rm without me noticing, whoops.
2021-01-11 14:17:04 +01:00
Florian Müllner
2702cdf889 ci: Update ci-fairy image
The default rules file name has changed from commitrules.yml to
commit-rules.yml, adjust to that change.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/151>
2021-01-11 14:03:44 +01:00
Florian Müllner
669e7c32a2 classic: Pre-generate stylesheet
We follow the rule of not putting generated files under version
control, but that means drawing in additional build-time dependencies.
We can reduce those when building from a released tarball by
generating the stylesheets at dist time though, so do that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/150>
2020-12-29 00:27:07 +01:00
Florian Müllner
294eb0feb5 data: Update list of theme dependencies
The scss sources were split up in gnome-shell last cycle, catch
up with that change.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/150>
2020-12-29 00:16:16 +01:00
Florian Müllner
a7ddbd0d53 Change upcoming version (again)
The extension website doesn't handle the chosen scheme correctly,
so use 40.alpha.1 instead.
2020-12-25 23:29:06 +01:00
Florian Müllner
c745dd6362 build: Change upcoming version to 40.alpha2
I messed up and released 40.alpha at the same time as 3.38.2, when it's
supposed to be in January. In order to re-align with the schedule, change
the upcoming version to 40.alpha2 so we don't have to skip a release and
will be back on track in time of 40.beta.
2020-12-22 01:33:44 +01:00
Florian Müllner
a4cf9f956e ci: Add some more commit message rules
Now that we have the ability to easily define custom rules, add some
more to enforce the existing commit message style.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/149>
2020-12-18 19:26:50 +01:00
Florian Müllner
02aa68b24a ci: Replace custom commit-log script with ci-fairy
ci-fairy now supports checking commit messages for required/disallowed
patterns. Use that to replace our custom commit-log script.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/149>
2020-12-18 19:26:42 +01:00
Florian Müllner
4e731e1dce Post-release version bump 2020-12-02 20:40:19 +01:00
13 changed files with 210 additions and 239 deletions

View File

@@ -1,5 +1,5 @@
include:
- remote: "https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/8445ff7af2a68795afb98f486251f2ef8f90621c/templates/ci-fairy.yml"
- remote: "https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/6f86b8bcb0cd5168c32779c4fea9a893c4a0c046/templates/ci-fairy.yml"
image: registry.gitlab.gnome.org/gnome/gnome-shell/fedora/33:2020-11-17.0
@@ -43,7 +43,12 @@ check_commit_log:
- .fdo.ci-fairy
stage: pre_review
script:
- ./.gitlab-ci/check-commit-log.sh
- if [[ x"$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" != "x" ]] ;
then
ci-fairy check-commits --junit-xml=commit-message-junit-report.xml ;
else
echo "Not a merge request" ;
fi
<<: *pipeline_guard
artifacts:
expire_in: 1 week

View File

@@ -1,74 +0,0 @@
#!/usr/bin/env bash
if [ -z "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" ]; then
echo This is not a merge request, skipping
exit 0
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
JUNIT_REPORT_TESTS_FILE=$(mktemp)
function append_failed_test_case() {
test_name="$1"
commit="$2"
test_message="$3"
commit_short=${commit:0:8}
echo "<testcase name=\"$test_name: $commit_short\"><failure message=\"$commit_short: $test_message\"/></testcase>" >> $JUNIT_REPORT_TESTS_FILE
echo &>2 "Commit check failed: $commit_short: $test_message"
}
function append_passed_test_case() {
test_name="$1"
commit="$2"
commit_short=${commit:0:8}
echo "<testcase name=\"$test_name: $commit_short\"></testcase>" >> $JUNIT_REPORT_TESTS_FILE
}
function generate_junit_report() {
junit_report_file="$1"
num_tests=$(cat "$JUNIT_REPORT_TESTS_FILE" | wc -l)
num_failures=$(grep '<failure />' "$JUNIT_REPORT_TESTS_FILE" | wc -l )
echo Generating JUnit report \"$(pwd)/$junit_report_file\" with $num_tests tests and $num_failures failures.
cat > $junit_report_file << __EOF__
<?xml version="1.0" encoding="utf-8"?>
<testsuites tests="$num_tests" errors="0" failures="$num_failures">
<testsuite name="commit-review" tests="$num_tests" errors="0" failures="$num_failures" skipped="0">
$(< $JUNIT_REPORT_TESTS_FILE)
</testsuite>
</testsuites>
__EOF__
}
function commit_message_has_mr_url() {
commit=$1
commit_message=$(git show -s --format='format:%b' $commit)
echo "$commit_message" | grep -qe "^$CI_MERGE_REQUEST_PROJECT_URL\/\(-\/\)\?merge_requests\/$CI_MERGE_REQUEST_IID$"
return $?
}
for commit in $commits; do
if commit_message_has_mr_url $commit; then
append_failed_test_case superfluous_url $commit \
"Commit message must not contain a link to its own merge request"
else
append_passed_test_case superfluous_url $commit
fi
done
generate_junit_report commit-message-junit-report.xml
! grep -q '<failure' commit-message-junit-report.xml
exit $?

View File

@@ -0,0 +1,13 @@
patterns:
deny:
- regex: '^$CI_MERGE_REQUEST_PROJECT_URL/(-/)?merge_requests/$CI_MERGE_REQUEST_IID$'
message: Commit message must not contain a link to its own merge request
- regex: '^extensions/'
message: Commit message subject should not be prefixed with 'extensions/', use the extension name instead
where: subject
- regex: '^[^:]+: [a-z]'
message: "Commit message subject should be properly Capitalized. E.g. 'window: Marginalize extradicity'"
where: subject
- regex: '^\S*\.js:'
message: Commit message subject prefix should not include .js
where: subject

9
NEWS
View File

@@ -1,3 +1,12 @@
40.alpha.1
==========
* Don't depend on sassc when building from tarball [Florian; !150]
* Port extensions preferences to GTK4 [Florian; !148]
* Misc. bug fixes and cleanups [Florian, Jonas; !149, !151, !153]
Contributors:
Jonas Dreßler, Florian Müllner
40.alpha
========
* window-list: Honor changes in skip-taskbar property [Sergio; !130]

View File

@@ -33,6 +33,18 @@ $variant: 'light';
font-weight: normal;
color: $fg_color;
text-shadow: none;
transition-duration: 0ms;
border: 0;
border-radius: 0px;
&.clock-display {
.clock {
transition-duration: 0ms;
border: 0;
border-radius: 0px;
}
}
&:hover {
color: lighten($fg_color,10%);
text-shadow: none;

View File

@@ -28,7 +28,42 @@ theme_sources = files(
'gnome-shell-sass/_colors.scss',
'gnome-shell-sass/_common.scss',
'gnome-shell-sass/_drawing.scss',
'gnome-shell-sass/_high-contrast-colors.scss'
'gnome-shell-sass/_high-contrast-colors.scss',
'gnome-shell-sass/_widgets.scss',
'gnome-shell-sass/widgets/_a11y.scss',
'gnome-shell-sass/widgets/_app-grid.scss',
'gnome-shell-sass/widgets/_base.scss',
'gnome-shell-sass/widgets/_buttons.scss',
'gnome-shell-sass/widgets/_calendar.scss',
'gnome-shell-sass/widgets/_check-box.scss',
'gnome-shell-sass/widgets/_corner-ripple.scss',
'gnome-shell-sass/widgets/_dash.scss',
'gnome-shell-sass/widgets/_dialogs.scss',
'gnome-shell-sass/widgets/_entries.scss',
'gnome-shell-sass/widgets/_hotplug.scss',
'gnome-shell-sass/widgets/_ibus-popup.scss',
'gnome-shell-sass/widgets/_keyboard.scss',
'gnome-shell-sass/widgets/_login-dialog.scss',
'gnome-shell-sass/widgets/_looking-glass.scss',
'gnome-shell-sass/widgets/_message-list.scss',
'gnome-shell-sass/widgets/_misc.scss',
'gnome-shell-sass/widgets/_network-dialog.scss',
'gnome-shell-sass/widgets/_notifications.scss',
'gnome-shell-sass/widgets/_osd.scss',
'gnome-shell-sass/widgets/_overview.scss',
'gnome-shell-sass/widgets/_panel.scss',
'gnome-shell-sass/widgets/_popovers.scss',
'gnome-shell-sass/widgets/_screen-shield.scss',
'gnome-shell-sass/widgets/_scrollbars.scss',
'gnome-shell-sass/widgets/_search-entry.scss',
'gnome-shell-sass/widgets/_search-results.scss',
'gnome-shell-sass/widgets/_slider.scss',
'gnome-shell-sass/widgets/_switcher-popup.scss',
'gnome-shell-sass/widgets/_switches.scss',
'gnome-shell-sass/widgets/_tiled-previews.scss',
'gnome-shell-sass/widgets/_window-picker.scss',
'gnome-shell-sass/widgets/_workspace-switcher.scss',
'gnome-shell-sass/widgets/_workspace-thumbnails.scss'
)
theme_data = [
@@ -41,15 +76,20 @@ theme_data = [
'gnome-classic-high-contrast.css'
]
style = 'gnome-classic'
custom_target(style + '.css',
input: style + '.scss',
output: style + '.css',
depend_files: theme_sources,
command: [sassc, '-a', '@INPUT@', '@OUTPUT@'],
install: true,
install_dir: themedir
)
stylesheet = 'gnome-classic.css'
if fs.exists(stylesheet)
install_data(stylesheet, install_dir: themedir)
else
sassc = find_program('sassc', required: true)
custom_target(stylesheet,
input: fs.replace_suffix(stylesheet, '.scss'),
output: stylesheet,
depend_files: theme_sources,
command: [sassc, '-a', '@INPUT@', '@OUTPUT@'],
install: true,
install_dir: themedir
)
endif
install_data(theme_data, install_dir: themedir)

View File

@@ -29,9 +29,9 @@ class AutoMoveSettingsWidget extends Gtk.ScrolledWindow {
margin_start: 36,
margin_end: 36,
});
this.add(box);
this.set_child(box);
box.add(new Gtk.Label({
box.append(new Gtk.Label({
label: '<b>%s</b>'.format(_('Workspace Rules')),
use_markup: true,
halign: Gtk.Align.START,
@@ -40,9 +40,9 @@ class AutoMoveSettingsWidget extends Gtk.ScrolledWindow {
this._list = new Gtk.ListBox({
selection_mode: Gtk.SelectionMode.NONE,
valign: Gtk.Align.START,
show_separators: true,
});
this._list.set_header_func(this._updateHeader.bind(this));
box.add(this._list);
box.append(this._list);
const context = this._list.get_style_context();
const cssProvider = new Gtk.CssProvider();
@@ -53,7 +53,7 @@ class AutoMoveSettingsWidget extends Gtk.ScrolledWindow {
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
context.add_class('frame');
this._list.add(new NewRuleRow());
this._list.append(new NewRuleRow());
this._actionGroup = new Gio.SimpleActionGroup();
this._list.insert_action_group('rules', this._actionGroup);
@@ -84,12 +84,10 @@ class AutoMoveSettingsWidget extends Gtk.ScrolledWindow {
this._sync();
this.connect('destroy', () => this._settings.run_dispose());
this.show_all();
}
_onAddActivated() {
const dialog = new NewRuleDialog(this.get_toplevel());
const dialog = new NewRuleDialog(this.get_root());
dialog.connect('response', (dlg, id) => {
const appInfo = id === Gtk.ResponseType.OK
? dialog.get_widget().get_app_info() : null;
@@ -101,6 +99,7 @@ class AutoMoveSettingsWidget extends Gtk.ScrolledWindow {
}
dialog.destroy();
});
dialog.show();
}
_onRemoveActivated(action, param) {
@@ -113,7 +112,7 @@ class AutoMoveSettingsWidget extends Gtk.ScrolledWindow {
}
_getRuleRows() {
return this._list.get_children().filter(row => !!row.id);
return [...this._list].filter(row => !!row.id);
}
_sync() {
@@ -139,17 +138,11 @@ class AutoMoveSettingsWidget extends Gtk.ScrolledWindow {
const removed = oldRules.filter(
({ id }) => !newRules.find(r => r.id === id));
removed.forEach(r => r.destroy());
removed.forEach(r => this._list.remove(r));
this._settings.unblock_signal_handler(this._changedId);
this._updateAction.enabled = true;
}
_updateHeader(row, before) {
if (!before || row.get_header())
return;
row.set_header(new Gtk.Separator());
}
});
const RuleRow = GObject.registerClass({
@@ -165,12 +158,6 @@ const RuleRow = GObject.registerClass({
},
}, class RuleRow extends Gtk.ListBoxRow {
_init(appInfo, value) {
super._init({
activatable: false,
value,
});
this._appInfo = appInfo;
const box = new Gtk.Box({
spacing: 6,
margin_top: 6,
@@ -179,12 +166,19 @@ const RuleRow = GObject.registerClass({
margin_end: 6,
});
super._init({
activatable: false,
value,
child: box,
});
this._appInfo = appInfo;
const icon = new Gtk.Image({
gicon: appInfo.get_icon(),
pixel_size: 32,
});
icon.get_style_context().add_class('icon-dropshadow');
box.add(icon);
box.append(icon);
const label = new Gtk.Label({
label: appInfo.get_display_name(),
@@ -193,7 +187,7 @@ const RuleRow = GObject.registerClass({
max_width_chars: 20,
ellipsize: Pango.EllipsizeMode.END,
});
box.add(label);
box.append(label);
const spinButton = new Gtk.SpinButton({
adjustment: new Gtk.Adjustment({
@@ -207,26 +201,17 @@ const RuleRow = GObject.registerClass({
this.bind_property('value',
spinButton, 'value',
GObject.BindingFlags.SYNC_CREATE | GObject.BindingFlags.BIDIRECTIONAL);
box.add(spinButton);
box.append(spinButton);
const button = new Gtk.Button({
action_name: 'rules.remove',
action_target: new GLib.Variant('s', this.id),
image: new Gtk.Image({
icon_name: 'edit-delete-symbolic',
pixel_size: 16,
}),
icon_name: 'edit-delete-symbolic',
});
box.add(button);
box.append(button);
this.add(box);
this.connect('notify::value', () => {
const actionGroup = this.get_action_group('rules');
actionGroup.activate_action('update', null);
});
this.show_all();
this.connect('notify::value',
() => this.activate_action('rules.update', null));
}
get id() {
@@ -239,19 +224,17 @@ class NewRuleRow extends Gtk.ListBoxRow {
_init() {
super._init({
action_name: 'rules.add',
child: new Gtk.Image({
icon_name: 'list-add-symbolic',
pixel_size: 16,
margin_top: 12,
margin_bottom: 12,
margin_start: 12,
margin_end: 12,
}),
});
this.get_accessible().set_name(_('Add Rule'));
this.add(new Gtk.Image({
icon_name: 'list-add-symbolic',
pixel_size: 16,
margin_top: 12,
margin_bottom: 12,
margin_start: 12,
margin_end: 12,
}));
this.show_all();
this.update_property(
[Gtk.AccessibleProperty.LABEL], [_('Add Rule')]);
}
});
@@ -273,8 +256,6 @@ class NewRuleDialog extends Gtk.AppChooserDialog {
this.get_widget().connect('application-selected',
this._updateSensitivity.bind(this));
this._updateSensitivity();
this.show();
}
_updateSensitivity() {

View File

@@ -26,18 +26,21 @@ class UserThemePrefsWidget extends Gtk.ScrolledWindow {
});
const box = new Gtk.Box();
this.add(box);
this.set_child(box);
this._list = new Gtk.ListBox({
selection_mode: Gtk.SelectionMode.NONE,
show_separators: true,
halign: Gtk.Align.CENTER,
valign: Gtk.Align.START,
hexpand: true,
margin: 60,
margin_start: 60,
margin_end: 60,
margin_top: 60,
margin_bottom: 60,
});
this._list.get_style_context().add_class('frame');
this._list.set_header_func(this._updateHeader.bind(this));
box.add(this._list);
box.append(this._list);
this._actionGroup = new Gio.SimpleActionGroup();
this._list.insert_action_group('theme', this._actionGroup);
@@ -90,11 +93,10 @@ class UserThemePrefsWidget extends Gtk.ScrolledWindow {
}
_addTheme(name) {
const row = new ThemeRow(name);
const row = new ThemeRow(name, this._settings);
this._rows.set(name, row);
this._list.add(row);
row.show_all();
this._list.append(row);
}
async _enumerateDir(dir) {
@@ -121,31 +123,28 @@ class UserThemePrefsWidget extends Gtk.ScrolledWindow {
return fileInfos.map(info => info.get_name());
}
_updateHeader(row, before) {
if (!before || row.get_header())
return;
row.set_header(new Gtk.Separator());
}
});
const ThemeRow = GObject.registerClass(
class ThemeRow extends Gtk.ListBoxRow {
_init(name) {
this._name = new GLib.Variant('s', name);
super._init({
action_name: 'theme.name',
action_target: this._name,
});
_init(name, settings) {
this._name = name;
this._settings = settings;
const box = new Gtk.Box({
spacing: 12,
margin: 12,
margin_start: 12,
margin_end: 12,
margin_top: 12,
margin_bottom: 12,
});
super._init({
action_name: 'theme.name',
action_target: new GLib.Variant('s', name),
child: box,
});
this.add(box);
box.add(new Gtk.Label({
box.append(new Gtk.Label({
label: name || 'Default',
hexpand: true,
xalign: 0,
@@ -157,24 +156,21 @@ class ThemeRow extends Gtk.ListBoxRow {
icon_name: 'emblem-ok-symbolic',
pixel_size: 16,
});
box.add(this._checkmark);
box.append(this._checkmark);
box.show_all();
const id = this._settings.connect('changed::name',
this._syncCheckmark.bind(this));
this._syncCheckmark();
const id = this.connect('parent-set', () => {
this.disconnect(id);
const actionGroup = this.get_action_group('theme');
actionGroup.connect('action-state-changed::name',
this._syncCheckmark.bind(this));
this._syncCheckmark();
this.connect('destroy', () => {
this._settings.disconnect(id);
this._settings = null;
});
}
_syncCheckmark() {
const actionGroup = this.get_action_group('theme');
const state = actionGroup.get_action_state('name');
this._checkmark.opacity = this._name.equal(state);
const visible = this._name === this._settings.get_string('name');
this._checkmark.opacity = visible ? 1. : 0;
}
});
@@ -182,8 +178,5 @@ function init() {
}
function buildPrefsWidget() {
let widget = new UserThemePrefsWidget();
widget.show_all();
return widget;
return new UserThemePrefsWidget();
}

View File

@@ -27,7 +27,7 @@ class WindowListPrefsWidget extends Gtk.Box {
});
let groupingLabel = '<b>%s</b>'.format(_('Window Grouping'));
this.add(new Gtk.Label({
this.append(new Gtk.Label({
label: groupingLabel, use_markup: true,
halign: Gtk.Align.START,
}));
@@ -37,7 +37,7 @@ class WindowListPrefsWidget extends Gtk.Box {
spacing: 12,
margin_bottom: 12,
});
this.add(box);
this.append(box);
const context = box.get_style_context();
const cssProvider = new Gtk.CssProvider();
@@ -70,13 +70,13 @@ class WindowListPrefsWidget extends Gtk.Box {
continue;
}
radio = new Gtk.RadioButton({
radio = new Gtk.CheckButton({
active: !i,
label,
group: radio,
margin_end: 12,
});
box.add(radio);
box.append(radio);
if (currentMode === mode)
currentRadio = radio;
@@ -94,15 +94,13 @@ class WindowListPrefsWidget extends Gtk.Box {
label: _('Show on all monitors'),
});
this._settings.bind('show-on-all-monitors', check, 'active', Gio.SettingsBindFlags.DEFAULT);
this.add(check);
this.append(check);
check = new Gtk.CheckButton({
label: _('Show windows from all workspaces'),
});
this._settings.bind('display-all-workspaces', check, 'active', Gio.SettingsBindFlags.DEFAULT);
this.add(check);
this.show_all();
this.append(check);
}
});

View File

@@ -1,7 +1,7 @@
// -*- mode: js2; indent-tabs-mode: nil; js2-basic-offset: 4 -*-
/* exported init buildPrefsWidget */
const { Gdk, Gio, GLib, GObject, Gtk, Pango } = imports.gi;
const { Gio, GLib, GObject, Gtk, Pango } = imports.gi;
const Gettext = imports.gettext.domain('gnome-shell-extensions');
const _ = Gettext.gettext;
@@ -28,9 +28,9 @@ class WorkspaceSettingsWidget extends Gtk.ScrolledWindow {
margin_start: 36,
margin_end: 36,
});
this.add(box);
this.set_child(box);
box.add(new Gtk.Label({
box.append(new Gtk.Label({
label: '<b>%s</b>'.format(_('Workspace Names')),
use_markup: true,
halign: Gtk.Align.START,
@@ -39,10 +39,10 @@ class WorkspaceSettingsWidget extends Gtk.ScrolledWindow {
this._list = new Gtk.ListBox({
selection_mode: Gtk.SelectionMode.NONE,
valign: Gtk.Align.START,
show_separators: true,
});
this._list.set_header_func(this._updateHeader.bind(this));
this._list.connect('row-activated', (l, row) => row.edit());
box.add(this._list);
box.append(this._list);
const context = this._list.get_style_context();
const cssProvider = new Gtk.CssProvider();
@@ -53,7 +53,7 @@ class WorkspaceSettingsWidget extends Gtk.ScrolledWindow {
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
context.add_class('frame');
this._list.add(new NewWorkspaceRow());
this._list.append(new NewWorkspaceRow());
this._actionGroup = new Gio.SimpleActionGroup();
this._list.insert_action_group('workspaces', this._actionGroup);
@@ -94,12 +94,10 @@ class WorkspaceSettingsWidget extends Gtk.ScrolledWindow {
this._settings.connect(`changed::${WORKSPACE_KEY}`,
this._sync.bind(this));
this._sync();
this.show_all();
}
_getWorkspaceRows() {
return this._list.get_children().filter(row => row.name);
return [...this._list].filter(row => row.name);
}
_sync() {
@@ -111,17 +109,11 @@ class WorkspaceSettingsWidget extends Gtk.ScrolledWindow {
const removed = oldNames.filter(n => !newNames.includes(n));
const added = newNames.filter(n => !oldNames.includes(n));
removed.forEach(n => rows.find(r => r.name === n).destroy());
removed.forEach(n => this._list.remove(rows.find(r => r.name === n)));
added.forEach(n => {
this._list.insert(new WorkspaceRow(n), newNames.indexOf(n));
});
}
_updateHeader(row, before) {
if (!before || row.get_header())
return;
row.set_header(new Gtk.Separator());
}
});
const WorkspaceRow = GObject.registerClass(
@@ -129,6 +121,13 @@ class WorkspaceRow extends Gtk.ListBoxRow {
_init(name) {
super._init({ name });
const controller = new Gtk.ShortcutController();
controller.add_shortcut(new Gtk.Shortcut({
trigger: Gtk.ShortcutTrigger.parse_string('Escape'),
action: Gtk.CallbackAction.new(this._stopEdit.bind(this)),
}));
this.add_controller(controller);
const box = new Gtk.Box({
spacing: 12,
margin_top: 6,
@@ -145,18 +144,14 @@ class WorkspaceRow extends Gtk.ListBoxRow {
});
this.bind_property('name', label, 'label',
GObject.BindingFlags.SYNC_CREATE);
box.add(label);
box.append(label);
const image = new Gtk.Image({
icon_name: 'edit-delete-symbolic',
pixel_size: 16,
});
const button = new Gtk.Button({
action_name: 'workspaces.remove',
action_target: new GLib.Variant('s', name),
image,
icon_name: 'edit-delete-symbolic',
});
box.add(button);
box.append(button);
this._entry = new Gtk.Entry({
max_width_chars: 25,
@@ -165,7 +160,7 @@ class WorkspaceRow extends Gtk.ListBoxRow {
this._stack = new Gtk.Stack();
this._stack.add_named(box, 'display');
this._stack.add_named(this._entry, 'edit');
this.add(this._stack);
this.child = this._stack;
this._entry.connect('activate', () => {
this.name = this._entry.text;
@@ -176,17 +171,11 @@ class WorkspaceRow extends Gtk.ListBoxRow {
return;
this._stopEdit();
});
this._entry.connect('key-press-event',
this._onEntryKeyPress.bind(this));
this.connect('notify::name', () => {
button.action_target = new GLib.Variant('s', this.name);
const actionGroup = this.get_action_group('workspaces');
actionGroup.activate_action('update', null);
this.activate_action('workspaces.update', null);
});
this.show_all();
}
edit() {
@@ -199,14 +188,6 @@ class WorkspaceRow extends Gtk.ListBoxRow {
this.grab_focus();
this._stack.visible_child_name = 'display';
}
_onEntryKeyPress(entry, event) {
const [, keyval] = event.get_keyval();
if (keyval !== Gdk.KEY_Escape)
return Gdk.EVENT_PROPAGATE;
this._stopEdit();
return Gdk.EVENT_STOP;
}
});
const NewWorkspaceRow = GObject.registerClass(
@@ -214,19 +195,17 @@ class NewWorkspaceRow extends Gtk.ListBoxRow {
_init() {
super._init({
action_name: 'workspaces.add',
child: new Gtk.Image({
icon_name: 'list-add-symbolic',
pixel_size: 16,
margin_top: 12,
margin_bottom: 12,
margin_start: 12,
margin_end: 12,
}),
});
this.get_accessible().set_name(_('Add Workspace'));
this.add(new Gtk.Image({
icon_name: 'list-add-symbolic',
pixel_size: 16,
margin_top: 12,
margin_bottom: 12,
margin_start: 12,
margin_end: 12,
}));
this.show_all();
this.update_property(
[Gtk.AccessibleProperty.LABEL], [_('Add Workspace')]);
}
});

View File

@@ -1,11 +1,12 @@
project('gnome-shell-extensions',
version: '40.alpha',
version: '40.alpha.1',
meson_version: '>= 0.44.0',
license: 'GPL2+'
)
gettext_domain = meson.project_name()
fs = import('fs')
gnome = import('gnome')
i18n = import('i18n')
@@ -86,9 +87,10 @@ foreach e : enabled_extensions
endforeach
if classic_mode_enabled
sassc = find_program('sassc', required: true)
subdir('data')
endif
subdir('extensions')
subdir('po')
meson.add_dist_script('meson/generate-stylesheets.py')

View File

@@ -0,0 +1,13 @@
#!/usr/bin/env python3
import os
from pathlib import PurePath
import subprocess
sourceroot = os.environ.get('MESON_SOURCE_ROOT')
distroot = os.environ.get('MESON_DIST_ROOT')
stylesheet_path = PurePath('data/gnome-classic.css')
src = PurePath(sourceroot, stylesheet_path.with_suffix('.scss'))
dst = PurePath(distroot, stylesheet_path)
subprocess.call(['sassc', '-a', src, dst])