Skip to content
Commits on Source (74)
3.36.2
3.37.91
=======
Contributors:
Florian Müllner
Translators:
Fran Dieguez [gl], Akarshan Biswas [bn_IN], Kukuh Syafaat [id],
Piotr Drąg [pl], Rafael Fontenelle [pt_BR], Jiri Grönroos [fi],
Марко Костић [sr], Goran Vidović [hr]
3.37.90
=======
* Misc. bug fixes and cleanups [Florian, Piotr; !126, !128]
Contributors:
Piotr Drąg, Florian Müllner
Translators:
Fabio Tomat [fur], Efstathios Iosifidis [el], Anders Jonsson [sv],
Asier Sarasua Garmendia [eu], Alexandre Franke [fr]
3.37.3
======
* Misc. bug fixes and cleanups [Florian, Xiaoguang; !113, !106]
* window-list, native-window-placement: Adjust to shell changes [Florian; !124]
Contributors:
Florian Müllner, Xiaoguang Wang
Florian Müllner
Translators:
Jordi Mas [ca], sicklylife [ja], Boyuan Yang [zh_CN],
Baurzhan Muftakhidinov [kk]
3.37.2
======
* window-list, auto-move: Modernize preference dialogs [Florian; !121]
* Adjust to gnome-shell changes [Florian; !122]
Contributors:
Florian Müllner
Translators:
Yosef Or Boczko [he], Kristjan SCHMIDT [eo]
3.36.1
Cheng-Chia Tseng [zh_TW], Yuri Chornoivan [uk], Daniel Mustieles [es],
Emin Tufan Çetin [tr], Danial Behzadi [fa], Daniel Șerbănescu [ro],
Matej Urbančič [sl]
3.37.1
======
* drive-menu: Emphasize eject buttons [Florian; #223]
* user-theme: Add preference dialog [Florian; !117]
* window-list: Fix inconsistent state in preference dialog [Milan; !119]
* workspace-indicator: Overhaul preference dialog [Florian; !120]
* user-theme: Support session mode styles [Florian; !118]
* Misc. bug fixes and cleanups [Florian, Xiaoguang; !113, !106, !114, !116]
Contributors:
Milan Crha, Florian Müllner, Xiaoguang Wang
Translators:
Daniel Korostil [uk]
Daniel Korostil [uk], Yosef Or Boczko [he], Kristjan SCHMIDT [eo],
Dz Chen [zh_CN], Danial Behzadi [fa], Yuri Chornoivan [uk],
Anders Jonsson [sv], Daniel Mustieles [es]
3.36.0
======
......
[Desktop Entry]
Name=GNOME Classic
Comment=This session logs you into GNOME Classic
Exec=env GNOME_SHELL_SESSION_MODE=classic gnome-session --session gnome-classic
Exec=env GNOME_SHELL_SESSION_MODE=classic gnome-session
TryExec=gnome-session
Type=Application
DesktopNames=GNOME-Classic;GNOME;
[GNOME Session]
Name=GNOME Classic
RequiredComponents=org.gnome.Shell;org.gnome.SettingsDaemon.A11ySettings;org.gnome.SettingsDaemon.Color;org.gnome.SettingsDaemon.Datetime;org.gnome.SettingsDaemon.Housekeeping;org.gnome.SettingsDaemon.Keyboard;org.gnome.SettingsDaemon.MediaKeys;org.gnome.SettingsDaemon.Power;org.gnome.SettingsDaemon.PrintNotifications;org.gnome.SettingsDaemon.Rfkill;org.gnome.SettingsDaemon.ScreensaverProxy;org.gnome.SettingsDaemon.Sharing;org.gnome.SettingsDaemon.Smartcard;org.gnome.SettingsDaemon.Sound;org.gnome.SettingsDaemon.Wacom;org.gnome.SettingsDaemon.XSettings;
......@@ -79,7 +79,7 @@
@function draw_button_hilight_color($c) {
//
// calculate the right top hilight color for buttons
// calculate the right top highlight color for buttons
//
// $c: base color;
//
......
/* App Grid */
$app_icon_size: 96px;
$app_icon_padding: 24px;
// app icons
.icon-grid {
-shell-grid-horizontal-item-size: $app_icon_size + $app_icon_padding * 2;
-shell-grid-vertical-item-size: $app_icon_size + $app_icon_padding * 2;
spacing: $base_spacing * 6;
.overview-icon {
icon-size: $app_icon_size;
}
row-spacing: $base_spacing * 6;
column-spacing: $base_spacing * 6;
max-row-spacing: $base_spacing * 12;
max-column-spacing: $base_spacing * 12;
}
//.app-display { spacing: 20px; }
/* App Icons */
$app_grid_fg_color: #fff;
......@@ -44,8 +38,8 @@ $app_grid_fg_color: #fff;
.app-folder-dialog {
border-radius: $modal_radius * 1.5;
border: 1px solid $osd_outer_borders_color;
spacing: 12px;
background-color: transparentize(darken($osd_bg_color,10%), 0.05);
padding: 12px;
& .folder-name-container {
padding: 24px 36px 0;
......@@ -54,7 +48,7 @@ $app_grid_fg_color: #fff;
& .folder-name-label,
& .folder-name-entry {
font-size: 18pt;
font-weight: bold;
font-weight: 800;
}
& .folder-name-entry { width: 300px }
......@@ -73,11 +67,24 @@ $app_grid_fg_color: #fff;
& > StIcon { icon-size: 16px }
}
}
& .icon-grid {
row-spacing: $base_spacing * 2;
column-spacing: $base_spacing * 5;
}
& .page-indicators {
margin-bottom: 18px;
.page-indicator {
padding: 15px 12px;
}
}
}
.app-folder-dialog-container {
padding: 12px;
width: 800px;
height: 600px;
width: 620px;
height: 620px;
}
.app-folder-icon {
......@@ -123,15 +130,11 @@ $app_grid_fg_color: #fff;
}
// Some hacks I don't even know
.all-apps,
.frequent-apps > StBoxLayout {
.all-apps {
// horizontal padding to make sure scrollbars or dash don't overlap content
padding: 0px 88px 10px 88px;
}
// Label when no frequent apps
.no-frequent-applications-label { @extend %status_text; }
// shutdown and other actions in the grid
.system-action-icon {
background-color: rgba(0,0,0,0.8);
......@@ -139,44 +142,3 @@ $app_grid_fg_color: #fff;
border-radius: 99px;
icon-size: $app_icon_size * 0.5;
}
/* Frequent | All toggle */
// container
.app-view-controls {
padding-bottom: 32px;
}
// buttons
.app-view-control {
padding: 4px 32px;
margin: 0 4px;
&, &:hover, &:checked {
@include button(undecorated);
color: darken($osd_fg_color, 25%);
}
&:hover {
color: $osd_fg_color;
box-shadow: inset 0 -2px darken($osd_fg_color, 25%);
}
&:active {
box-shadow: inset 0 -2px $osd_fg_color;
}
&:checked {
color: $osd_fg_color;
box-shadow: inset 0 -2px $selected_bg_color;
}
&:first-child {
border-right-width: 0;
border-radius: 0;
}
&:last-child {
border-radius: 0;
}
}
......@@ -170,13 +170,38 @@
height: 1.8em;
width: 2.3em;
border-radius: 2px;
padding: 0.5em 0 0;
margin: 6px;
background-color: darken($bg_color, 2%);
color: lighten($fg_color, 5%);
}
}
/* Events */
.events-button {
@include notification_bubble;
padding: $base_padding * 2;
.events-box {
spacing: $base_spacing;
}
.events-list {
spacing: 2 * $base_spacing;
}
.events-title {
color: desaturate(darken($fg_color,40%), 10%);
font-weight: bold;
margin-bottom: $base_margin;
}
.event-time {
color: darken($fg_color,20%);
font-feature-settings: "tnum";
@include fontsize($base_font_size - 1);
}
}
/* World clocks */
.world-clocks-button {
@include notification_bubble;
......@@ -204,9 +229,11 @@
.world-clocks-time {
font-weight: bold;
color: $fg_color;
font-feature-settings: "lnum";
font-feature-settings: "tnum";
@include fontsize($base_font_size);
text-align: right;
&:ltr { text-align: right; }
&:rtl { text-align: left; }
}
// timezone offset label
......
......@@ -38,7 +38,7 @@
font-size: 18pt;
font-weight: 800;
&.leightweight {
&.lightweight {
font-size: 13pt;
font-weight: 800;
}
......
......@@ -138,11 +138,10 @@
.user-widget.horizontal .user-widget-label {
@include fontsize($base_font_size + 2);
font-weight: bold;
text-align: left;
padding-left: 15px;
&:ltr { padding-left: 14px; }
&:rtl { padding-right: 14px; }
&:ltr { padding-left: 14px; text-align: left; }
&:rtl { padding-right: 14px; text-align: right; }
}
.user-widget.vertical .user-widget-label {
......
/* Looking Glass */
$text_fg_color: #ccc;
// Dialog
#LookingGlassDialog {
background-color: $osd_bg_color;
......@@ -52,6 +54,11 @@
&:hover { color: lighten($link_color, 10%); }
&:active { color: darken($link_color, 10%); }
}
.actor-link {
color: $text_fg_color;
&:hover { color: lighten($text_fg_color, 20%); }
&:active { color: darken($text_fg_color, 20%); }
}
}
.lg-completions-text {
......
......@@ -71,9 +71,11 @@
> .event-time {
color: transparentize($fg_color, 0.5);
@include fontsize($base_font_size - 2);
text-align: right;
/* HACK: the label should be baseline-aligned with a 1em label, fake this with some bottom padding */
padding-bottom: 0.13em;
&:ltr { text-align: right };
&:rtl { text-align: left };
}
}
......
/* Notifications & Mesage Tray */
/* Notifications & Message Tray */
$notification_banner_height: 64px;
$notification_banner_width: 34em;
......
......@@ -76,8 +76,10 @@ $popover_arrow_height: 12px;
// container for radio and check boxes
.popup-menu-ornament {
text-align: right;
width: 1.2em;
&:ltr { text-align: right };
&:rtl { text-align: left };
}
// separator
......
......@@ -54,6 +54,10 @@
@extend %status_text;
}
.grid-search-results {
spacing: $base_spacing * 6;
}
// Search results with icons
.grid-search-result {
@extend %app-well-app;
......
......@@ -16,7 +16,7 @@ $slider_size: 15px;
-barlevel-overdrive-color: $destructive_color;
-barlevel-overdrive-border-color: if($variant == 'light', darken($destructive_color, 4%), lighten($destructive_color, 2%)); //trough border when red;
-barlevel-overdrive-separator-width:1px;
// slider hander
// slider handler
-slider-handle-radius: $slider_size * 0.5; // half the size of the size
-slider-handle-border-width: 1px;
-slider-handle-border-color: if($variant == 'light', $borders_color, $fg_color);
......
/* Window Picker */
$window_picker_spacing: $base_spacing * 2; // 16px
$window_picker_padding: $base_padding * 2; // 16px
$window_picker_spacing: $base_spacing; // 6px
$window_picker_padding: $base_padding * 2; // 12px
$window_thumbnail_border_color:transparentize($selected_fg_color, 0.65);
$window_close_button_size: 24px;
$window_close_button_padding: 3px;
$window_clone_border_size: 6px;
// Window picker
.window-picker {
// Space between window thumbnails
-horizontal-spacing: $window_picker_spacing;
-vertical-spacing: $window_picker_spacing;
spacing: $window_picker_spacing;
// Padding for container around window thumbnails
padding: $window_picker_padding;
......@@ -22,7 +23,7 @@ $window_close_button_padding: 3px;
// Borders on window thumbnails
.window-clone-border {
border-width: 6px;
border-width: $window_clone_border_size;
border-style: solid;
border-color: $window_thumbnail_border_color;
border-radius: $base_border_radius + 2;
......@@ -54,8 +55,6 @@ $window_close_button_padding: 3px;
width: $window_close_button_size;
box-shadow: -1px 1px 5px 0px rgba(0,0,0,0.5);
-shell-close-overlap: $window_close_button_size * 0.5;
&:hover {
background-color: lighten($selected_bg_color, 5%);
}
......
sessions = [
['gnome-classic.session.desktop.in', sessiondir],
['gnome-classic.desktop.in', xsessiondir]
]
foreach s : sessions
name_array = s[0].split('.')
i18n.merge_file('',
input: s[0],
output: '.'.join([name_array[0], name_array[1]]),
po_dir: '../po',
install: true,
install_dir: s[1],
type: 'desktop'
)
endforeach
session_desktop = 'gnome-classic.desktop'
i18n.merge_file('',
input: session_desktop + '.in',
output: session_desktop,
po_dir: '../po',
install: true,
install_dir: xsessiondir,
type: 'desktop'
)
classic_uuids = []
foreach e : classic_extensions
......
......@@ -21,16 +21,23 @@ for f in $extensiondir/*; do
uuid=$name@gnome-shell-extensions.gcampax.github.com
schema=$schemadir/org.gnome.shell.extensions.$name.gschema.xml
xgettext --from-code=UTF-8 --output-dir=$builddir --output=$name.pot $f/*.js
if [ -f $builddir/$name.pot ]; then
mkdir $f/po
for l in $(<$srcdir/po/LINGUAS); do
msgmerge --quiet --output-file=$f/po/$l.po \
$srcdir/po/$l.po $builddir/$name.pot
done
fi
cp $srcdir/NEWS $srcdir/COPYING $f
cp -r $localedir $f
sources=(NEWS COPYING $(cd $f; ls *.js))
if [ -f $schema ]; then
mkdir $f/schemas
cp $schema $f/schemas;
glib-compile-schemas $f/schemas
fi
[ -f $schema ] || unset schema
(cd $f && zip -rmq $srcdir/zip-files/$uuid.shell-extension.zip .)
gnome-extensions pack ${sources[@]/#/--extra-source=} \
${schema:+--schema=$schema} --out-dir=$srcdir/zip-files $f
done
rm -rf $builddir
......
......@@ -35,17 +35,16 @@ class WindowMover {
_updateAppData() {
let ids = [...this._appConfigs.keys()];
let removedApps = [...this._appData.keys()].filter(
a => !ids.includes(a.id)
);
let removedApps = [...this._appData.keys()]
.filter(a => !ids.includes(a.id));
removedApps.forEach(app => {
app.disconnect(this._appData.get(app).windowsChangedId);
this._appData.delete(app);
});
let addedApps = ids.map(id => this._appSystem.lookup_app(id)).filter(
app => app && !this._appData.has(app)
);
let addedApps = ids
.map(id => this._appSystem.lookup_app(id))
.filter(app => app && !this._appData.has(app));
addedApps.forEach(app => {
let data = {
windowsChangedId: app.connect('windows-changed',
......@@ -94,9 +93,9 @@ class WindowMover {
// the window still exists and is just moved to a different workspace
// or something; assume it'll be added back immediately, so keep it
// to avoid moving it again
windows.push(...data.windows.filter(
w => !windows.includes(w) && w.get_compositor_private() !== null
));
windows.push(...data.windows.filter(w => {
return !windows.includes(w) && w.get_compositor_private() !== null;
}));
let workspaceNum = this._appConfigs.get(app.id);
windows.filter(w => !data.windows.includes(w)).forEach(window => {
......
......@@ -2,11 +2,10 @@
// Start apps on custom workspaces
/* exported init buildPrefsWidget */
const { Gio, GObject, Gtk } = imports.gi;
const { Gio, GLib, GObject, Gtk, Pango } = imports.gi;
const Gettext = imports.gettext.domain('gnome-shell-extensions');
const _ = Gettext.gettext;
const N_ = e => e;
const ExtensionUtils = imports.misc.extensionUtils;
......@@ -14,269 +13,282 @@ const SETTINGS_KEY = 'application-list';
const WORKSPACE_MAX = 36; // compiled in limit of mutter
const Columns = {
APPINFO: 0,
DISPLAY_NAME: 1,
ICON: 2,
WORKSPACE: 3,
ADJUSTMENT: 4,
};
const AutoMoveSettingsWidget = GObject.registerClass(
class AutoMoveSettingsWidget extends Gtk.ScrolledWindow {
_init() {
super._init({
hscrollbar_policy: Gtk.PolicyType.NEVER,
});
const box = new Gtk.Box({
orientation: Gtk.Orientation.VERTICAL,
halign: Gtk.Align.CENTER,
spacing: 12,
margin_top: 36,
margin_bottom: 36,
margin_start: 36,
margin_end: 36,
});
this.add(box);
const Widget = GObject.registerClass(
class Widget extends Gtk.Grid {
_init(params) {
super._init(params);
this.set_orientation(Gtk.Orientation.VERTICAL);
box.add(new Gtk.Label({
label: '<b>%s</b>'.format(_('Workspace Rules')),
use_markup: true,
halign: Gtk.Align.START,
}));
this._settings = ExtensionUtils.getSettings();
this._settings.connect('changed', this._refresh.bind(this));
this._changedPermitted = false;
this._list = new Gtk.ListBox({
selection_mode: Gtk.SelectionMode.NONE,
valign: Gtk.Align.START,
});
this._list.set_header_func(this._updateHeader.bind(this));
box.add(this._list);
this._store = new Gtk.ListStore();
this._store.set_column_types([
Gio.AppInfo,
GObject.TYPE_STRING,
Gio.Icon,
GObject.TYPE_INT,
Gtk.Adjustment,
]);
const context = this._list.get_style_context();
const cssProvider = new Gtk.CssProvider();
cssProvider.load_from_data(
'list { min-width: 30em; }');
let scrolled = new Gtk.ScrolledWindow({ shadow_type: Gtk.ShadowType.IN });
scrolled.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
this.add(scrolled);
context.add_provider(cssProvider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
context.add_class('frame');
this._list.add(new NewRuleRow());
this._treeView = new Gtk.TreeView({
model: this._store,
hexpand: true,
vexpand: true,
});
this._treeView.get_selection().set_mode(Gtk.SelectionMode.SINGLE);
this._actionGroup = new Gio.SimpleActionGroup();
this._list.insert_action_group('rules', this._actionGroup);
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);
let nameRenderer = new Gtk.CellRendererText();
appColumn.pack_start(nameRenderer, true);
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 action;
action = new Gio.SimpleAction({ name: 'add' });
action.connect('activate', this._onAddActivated.bind(this));
this._actionGroup.add_action(action);
action = new Gio.SimpleAction({
name: 'remove',
parameter_type: new GLib.VariantType('s'),
});
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);
this._treeView.append_column(workspaceColumn);
scrolled.add(this._treeView);
let toolbar = new Gtk.Toolbar({ icon_size: Gtk.IconSize.SMALL_TOOLBAR });
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,
action.connect('activate', this._onRemoveActivated.bind(this));
this._actionGroup.add_action(action);
action = new Gio.SimpleAction({ name: 'update' });
action.connect('activate', () => {
this._settings.set_strv(SETTINGS_KEY,
this._getRuleRows().map(row => `${row.id}:${row.value}`));
});
newButton.connect('clicked', this._createNew.bind(this));
toolbar.add(newButton);
this._actionGroup.add_action(action);
this._updateAction = action;
let delButton = new Gtk.ToolButton({ icon_name: 'edit-delete-symbolic' });
delButton.connect('clicked', this._deleteSelected.bind(this));
toolbar.add(delButton);
this._settings = ExtensionUtils.getSettings();
this._changedId = this._settings.connect('changed',
this._sync.bind(this));
this._sync();
let selection = this._treeView.get_selection();
selection.connect('changed', () => {
delButton.sensitive = selection.count_selected_rows() > 0;
});
delButton.sensitive = selection.count_selected_rows() > 0;
this.connect('destroy', () => this._settings.run_dispose());
this._changedPermitted = true;
this._refresh();
this.show_all();
}
_createNew() {
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,
});
dialog._appChooser = new Gtk.AppChooserWidget({ show_all: true });
dialog._appChooser.connect('application-selected', (w, appInfo) => {
addButton.sensitive = appInfo && this._checkId(appInfo.get_id());
});
let appInfo = dialog._appChooser.get_app_info();
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,
snap_to_ticks: true,
});
dialog._spin.set_value(1);
grid.attach(dialog._spin, 1, 1, 1, 1);
dialog.get_content_area().add(grid);
_onAddActivated() {
const dialog = new NewRuleDialog(this.get_toplevel());
dialog.connect('response', (dlg, id) => {
if (id !== Gtk.ResponseType.OK) {
dialog.destroy();
return;
const appInfo = id === Gtk.ResponseType.OK
? dialog.get_widget().get_app_info() : null;
if (appInfo) {
this._settings.set_strv(SETTINGS_KEY, [
...this._settings.get_strv(SETTINGS_KEY),
`${appInfo.get_id()}:1`,
]);
}
dialog.destroy();
});
}
appInfo = dialog._appChooser.get_app_info();
if (!appInfo)
return;
let index = Math.floor(dialog._spin.value);
if (isNaN(index) || index < 0)
index = 1;
this._changedPermitted = false;
this._appendItem(appInfo.get_id(), index);
this._changedPermitted = true;
_onRemoveActivated(action, param) {
const removed = param.deepUnpack();
this._settings.set_strv(SETTINGS_KEY,
this._settings.get_strv(SETTINGS_KEY).filter(entry => {
const [id] = entry.split(':');
return id !== removed;
}));
}
this._appendRow(appInfo, index);
_getRuleRows() {
return this._list.get_children().filter(row => !!row.id);
}
dialog.destroy();
_sync() {
const oldRules = this._getRuleRows();
const newRules = this._settings.get_strv(SETTINGS_KEY).map(entry => {
const [id, value] = entry.split(':');
return { id, value };
});
dialog.show_all();
}
_deleteSelected() {
let [any, model_, iter] = this._treeView.get_selection().get_selected();
this._settings.block_signal_handler(this._changedId);
this._updateAction.enabled = false;
if (any) {
let appInfo = this._store.get_value(iter, Columns.APPINFO);
newRules.forEach(({ id, value }, index) => {
const row = oldRules.find(r => r.id === id);
const appInfo = row
? null : Gio.DesktopAppInfo.new(id);
this._changedPermitted = false;
this._removeItem(appInfo.get_id());
this._changedPermitted = true;
this._store.remove(iter);
}
}
if (row)
row.set({ value });
else if (appInfo)
this._list.insert(new RuleRow(appInfo, value), index);
});
const removed = oldRules.filter(
({ id }) => !newRules.find(r => r.id === id));
removed.forEach(r => r.destroy());
_workspaceEdited(renderer, pathString, text) {
let index = parseInt(text);
if (isNaN(index) || index < 0)
index = 1;
let path = Gtk.TreePath.new_from_string(pathString);
let [model_, iter] = this._store.get_iter(path);
let appInfo = this._store.get_value(iter, Columns.APPINFO);
this._changedPermitted = false;
this._changeItem(appInfo.get_id(), index);
this._store.set_value(iter, Columns.WORKSPACE, index);
this._changedPermitted = true;
this._settings.unblock_signal_handler(this._changedId);
this._updateAction.enabled = true;
}
_refresh() {
if (!this._changedPermitted)
// Ignore this notification, model is being modified outside
_updateHeader(row, before) {
if (!before || row.get_header())
return;
row.set_header(new Gtk.Separator());
}
});
this._store.clear();
const RuleRow = GObject.registerClass({
Properties: {
'id': GObject.ParamSpec.string(
'id', 'id', 'id',
GObject.ParamFlags.READABLE,
''),
'value': GObject.ParamSpec.uint(
'value', 'value', 'value',
GObject.ParamFlags.READWRITE,
1, WORKSPACE_MAX, 1),
},
}, 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,
margin_bottom: 6,
margin_start: 6,
margin_end: 6,
});
let currentItems = this._settings.get_strv(SETTINGS_KEY);
let validItems = [];
for (let i = 0; i < currentItems.length; i++) {
let [id, index] = currentItems[i].split(':');
let appInfo = Gio.DesktopAppInfo.new(id);
if (!appInfo)
continue;
validItems.push(currentItems[i]);
const icon = new Gtk.Image({
gicon: appInfo.get_icon(),
pixel_size: 32,
});
icon.get_style_context().add_class('icon-dropshadow');
box.add(icon);
this._appendRow(appInfo, parseInt(index));
}
const label = new Gtk.Label({
label: appInfo.get_display_name(),
halign: Gtk.Align.START,
hexpand: true,
max_width_chars: 20,
ellipsize: Pango.EllipsizeMode.END,
});
box.add(label);
const spinButton = new Gtk.SpinButton({
adjustment: new Gtk.Adjustment({
lower: 1,
upper: WORKSPACE_MAX,
step_increment: 1,
}),
snap_to_ticks: true,
margin_end: 6,
});
this.bind_property('value',
spinButton, 'value',
GObject.BindingFlags.SYNC_CREATE | GObject.BindingFlags.BIDIRECTIONAL);
box.add(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,
}),
});
box.add(button);
if (validItems.length !== currentItems.length) // some items were filtered out
this._settings.set_strv(SETTINGS_KEY, validItems);
}
this.add(box);
_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: workspace,
this.connect('notify::value', () => {
const actionGroup = this.get_action_group('rules');
actionGroup.activate_action('update', null);
});
let { APPINFO, ICON, DISPLAY_NAME, WORKSPACE, ADJUSTMENT } = Columns;
this._store.set(iter,
[APPINFO, ICON, DISPLAY_NAME, WORKSPACE, ADJUSTMENT],
[appInfo, icon, displayName, workspace, adj]);
this.show_all();
}
_checkId(id) {
let items = this._settings.get_strv(SETTINGS_KEY);
return !items.some(i => i.startsWith(`${id}:`));
get id() {
return this._appInfo.get_id();
}
});
_appendItem(id, workspace) {
let currentItems = this._settings.get_strv(SETTINGS_KEY);
currentItems.push(`${id}:${workspace}`);
this._settings.set_strv(SETTINGS_KEY, currentItems);
const NewRuleRow = GObject.registerClass(
class NewRuleRow extends Gtk.ListBoxRow {
_init() {
super._init({
action_name: 'rules.add',
});
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();
}
});
_removeItem(id) {
let currentItems = this._settings.get_strv(SETTINGS_KEY);
let index = currentItems.map(el => el.split(':')[0]).indexOf(id);
const NewRuleDialog = GObject.registerClass(
class NewRuleDialog extends Gtk.AppChooserDialog {
_init(parent) {
super._init({
transient_for: parent,
modal: true,
});
if (index < 0)
return;
currentItems.splice(index, 1);
this._settings.set_strv(SETTINGS_KEY, currentItems);
}
this._settings = ExtensionUtils.getSettings();
this.get_widget().set({
show_all: true,
show_other: true, // hide more button
});
_changeItem(id, workspace) {
let currentItems = this._settings.get_strv(SETTINGS_KEY);
let index = currentItems.map(el => el.split(':')[0]).indexOf(id);
this.get_widget().connect('application-selected',
this._updateSensitivity.bind(this));
this._updateSensitivity();
if (index < 0)
currentItems.push(`${id}:${workspace}`);
else
currentItems[index] = `${id}:${workspace}`;
this._settings.set_strv(SETTINGS_KEY, currentItems);
this.show();
}
});
_updateSensitivity() {
const rules = this._settings.get_strv(SETTINGS_KEY);
const appInfo = this.get_widget().get_app_info();
this.set_response_sensitive(Gtk.ResponseType.OK,
appInfo && !rules.some(i => i.startsWith(appInfo.get_id())));
}
});
function init() {
ExtensionUtils.initTranslations();
}
function buildPrefsWidget() {
let widget = new Widget({ margin: 12 });
widget.show_all();
return widget;
return new AutoMoveSettingsWidget();
}
/* exported init enable disable */
// Drive menu extension
const { Gio, GObject, Shell, St } = imports.gi;
const { Clutter, Gio, GObject, Shell, St } = imports.gi;
const Gettext = imports.gettext.domain('gnome-shell-extensions');
const _ = Gettext.gettext;
......@@ -14,9 +14,15 @@ const ShellMountOperation = imports.ui.shellMountOperation;
var MountMenuItem = GObject.registerClass(
class MountMenuItem extends PopupMenu.PopupBaseMenuItem {
_init(mount) {
super._init();
super._init({
style_class: 'drive-menu-item',
});
this.label = new St.Label({ text: mount.get_name() });
this.label = new St.Label({
text: mount.get_name(),
x_expand: true,
y_align: Clutter.ActorAlign.CENTER,
});
this.add_child(this.label);
this.label_actor = this.label;
......@@ -28,7 +34,10 @@ class MountMenuItem extends PopupMenu.PopupBaseMenuItem {
icon_name: 'media-eject-symbolic',
style_class: 'popup-menu-icon',
});
let ejectButton = new St.Button({ child: ejectIcon });
let ejectButton = new St.Button({
child: ejectIcon,
style_class: 'button',
});
ejectButton.connect('clicked', this._eject.bind(this));
this.add(ejectButton);
......