|
|
1205f8 |
From 8f9a1adcb9b8d62f537d53562c8324175310d577 Mon Sep 17 00:00:00 2001
|
|
|
1205f8 |
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
|
|
|
1205f8 |
Date: Wed, 19 May 2021 16:46:59 +0200
|
|
|
1205f8 |
Subject: [PATCH 1/2] desktop-icons: Revert "Use GTK-Theme CSS for selected
|
|
|
1205f8 |
file-item and rubberband"
|
|
|
1205f8 |
|
|
|
1205f8 |
GtkStyleContext requires a (X11) display connection, which may not
|
|
|
1205f8 |
be available with xwayland-on-demand. Better use some hardcoded
|
|
|
1205f8 |
colors than crashing the session.
|
|
|
1205f8 |
|
|
|
1205f8 |
This reverts commit 8dc524aa4efd6a3fbad67480bd6c904b0c0c99d6.
|
|
|
1205f8 |
---
|
|
|
1205f8 |
extensions/desktop-icons/desktopIconsUtil.js | 11 ----------
|
|
|
1205f8 |
extensions/desktop-icons/desktopManager.js | 12 -----------
|
|
|
1205f8 |
extensions/desktop-icons/fileItem.js | 22 ++++----------------
|
|
|
1205f8 |
extensions/desktop-icons/stylesheet.css | 9 ++++++++
|
|
|
1205f8 |
4 files changed, 13 insertions(+), 41 deletions(-)
|
|
|
1205f8 |
|
|
|
1205f8 |
diff --git a/extensions/desktop-icons/desktopIconsUtil.js b/extensions/desktop-icons/desktopIconsUtil.js
|
|
|
1205f8 |
index 696c945..57bedc1 100644
|
|
|
1205f8 |
--- a/extensions/desktop-icons/desktopIconsUtil.js
|
|
|
1205f8 |
+++ b/extensions/desktop-icons/desktopIconsUtil.js
|
|
|
1205f8 |
@@ -16,7 +16,6 @@
|
|
|
1205f8 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1205f8 |
*/
|
|
|
1205f8 |
|
|
|
1205f8 |
-const Gtk = imports.gi.Gtk;
|
|
|
1205f8 |
const Gio = imports.gi.Gio;
|
|
|
1205f8 |
const GLib = imports.gi.GLib;
|
|
|
1205f8 |
const ExtensionUtils = imports.misc.extensionUtils;
|
|
|
1205f8 |
@@ -114,16 +113,6 @@ function getFileExtensionOffset(filename, isDirectory) {
|
|
|
1205f8 |
return offset;
|
|
|
1205f8 |
}
|
|
|
1205f8 |
|
|
|
1205f8 |
-function getGtkClassBackgroundColor(classname, state) {
|
|
|
1205f8 |
- let widget = new Gtk.WidgetPath();
|
|
|
1205f8 |
- widget.append_type(Gtk.Widget);
|
|
|
1205f8 |
-
|
|
|
1205f8 |
- let context = new Gtk.StyleContext();
|
|
|
1205f8 |
- context.set_path(widget);
|
|
|
1205f8 |
- context.add_class(classname);
|
|
|
1205f8 |
- return context.get_background_color(state);
|
|
|
1205f8 |
-}
|
|
|
1205f8 |
-
|
|
|
1205f8 |
// Reference the extension org.gnome.shell.extensions.drive-menu
|
|
|
1205f8 |
function eject(mount) {
|
|
|
1205f8 |
let unmountArgs = [
|
|
|
1205f8 |
diff --git a/extensions/desktop-icons/desktopManager.js b/extensions/desktop-icons/desktopManager.js
|
|
|
1205f8 |
index 1aad8c6..10e3ce0 100644
|
|
|
1205f8 |
--- a/extensions/desktop-icons/desktopManager.js
|
|
|
1205f8 |
+++ b/extensions/desktop-icons/desktopManager.js
|
|
|
1205f8 |
@@ -16,7 +16,6 @@
|
|
|
1205f8 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1205f8 |
*/
|
|
|
1205f8 |
|
|
|
1205f8 |
-const Gtk = imports.gi.Gtk;
|
|
|
1205f8 |
const Clutter = imports.gi.Clutter;
|
|
|
1205f8 |
const GObject = imports.gi.GObject;
|
|
|
1205f8 |
const Gio = imports.gi.Gio;
|
|
|
1205f8 |
@@ -132,7 +131,6 @@ var DesktopManager = GObject.registerClass({
|
|
|
1205f8 |
startRubberBand(x, y) {
|
|
|
1205f8 |
this._rubberBandInitialX = x;
|
|
|
1205f8 |
this._rubberBandInitialY = y;
|
|
|
1205f8 |
- this._initRubberBandColor();
|
|
|
1205f8 |
this._updateRubberBand(x, y);
|
|
|
1205f8 |
this._rubberBand.show();
|
|
|
1205f8 |
this._grabHelper.grab({ actor: global.stage });
|
|
|
1205f8 |
@@ -235,16 +233,6 @@ var DesktopManager = GObject.registerClass({
|
|
|
1205f8 |
this._desktopGrids = {};
|
|
|
1205f8 |
}
|
|
|
1205f8 |
|
|
|
1205f8 |
- /**
|
|
|
1205f8 |
- * Initialize rubberband color from the GTK rubberband class
|
|
|
1205f8 |
- * */
|
|
|
1205f8 |
- _initRubberBandColor() {
|
|
|
1205f8 |
- let rgba = DesktopIconsUtil.getGtkClassBackgroundColor('rubberband', Gtk.StateFlags.NORMAL);
|
|
|
1205f8 |
- let background_color =
|
|
|
1205f8 |
- 'rgba(' + rgba.red * 255 + ', ' + rgba.green * 255 + ', ' + rgba.blue * 255 + ', 0.4)';
|
|
|
1205f8 |
- this._rubberBand.set_style('background-color: ' + background_color);
|
|
|
1205f8 |
- }
|
|
|
1205f8 |
-
|
|
|
1205f8 |
async _scanFiles() {
|
|
|
1205f8 |
for (let [fileItem, fileItemHandler] of this._fileItemHandlers)
|
|
|
1205f8 |
Object.values(fileItemHandler).forEach(id => fileItem.disconnect(id));
|
|
|
1205f8 |
diff --git a/extensions/desktop-icons/fileItem.js b/extensions/desktop-icons/fileItem.js
|
|
|
1205f8 |
index 9987e7f..1e8ea89 100644
|
|
|
1205f8 |
--- a/extensions/desktop-icons/fileItem.js
|
|
|
1205f8 |
+++ b/extensions/desktop-icons/fileItem.js
|
|
|
1205f8 |
@@ -16,7 +16,6 @@
|
|
|
1205f8 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1205f8 |
*/
|
|
|
1205f8 |
|
|
|
1205f8 |
-const Gtk = imports.gi.Gtk;
|
|
|
1205f8 |
const Clutter = imports.gi.Clutter;
|
|
|
1205f8 |
const Gio = imports.gi.Gio;
|
|
|
1205f8 |
const GLib = imports.gi.GLib;
|
|
|
1205f8 |
@@ -649,17 +648,6 @@ var FileItem = GObject.registerClass({
|
|
|
1205f8 |
DBusUtils.openFileWithOtherApplication(this.file.get_path());
|
|
|
1205f8 |
}
|
|
|
1205f8 |
|
|
|
1205f8 |
- _getSelectionStyle() {
|
|
|
1205f8 |
- let rgba = DesktopIconsUtil.getGtkClassBackgroundColor('view', Gtk.StateFlags.SELECTED);
|
|
|
1205f8 |
- let background_color =
|
|
|
1205f8 |
- 'rgba(' + rgba.red * 255 + ', ' + rgba.green * 255 + ', ' + rgba.blue * 255 + ', 0.6)';
|
|
|
1205f8 |
- let border_color =
|
|
|
1205f8 |
- 'rgba(' + rgba.red * 255 + ', ' + rgba.green * 255 + ', ' + rgba.blue * 255 + ', 0.8)';
|
|
|
1205f8 |
-
|
|
|
1205f8 |
- return 'background-color: ' + background_color + ';' +
|
|
|
1205f8 |
- 'border-color: ' + border_color + ';';
|
|
|
1205f8 |
- }
|
|
|
1205f8 |
-
|
|
|
1205f8 |
get menu() {
|
|
|
1205f8 |
return this._menu;
|
|
|
1205f8 |
}
|
|
|
1205f8 |
@@ -901,12 +889,10 @@ var FileItem = GObject.registerClass({
|
|
|
1205f8 |
if (isSelected == this._isSelected)
|
|
|
1205f8 |
return;
|
|
|
1205f8 |
|
|
|
1205f8 |
- if (isSelected) {
|
|
|
1205f8 |
- this._container.set_style(this._getSelectionStyle());
|
|
|
1205f8 |
- } else {
|
|
|
1205f8 |
- this._container.set_style('background-color: transparent');
|
|
|
1205f8 |
- this._container.set_style('border-color: transparent');
|
|
|
1205f8 |
- }
|
|
|
1205f8 |
+ if (isSelected)
|
|
|
1205f8 |
+ this._container.add_style_pseudo_class('selected');
|
|
|
1205f8 |
+ else
|
|
|
1205f8 |
+ this._container.remove_style_pseudo_class('selected');
|
|
|
1205f8 |
|
|
|
1205f8 |
this._isSelected = isSelected;
|
|
|
1205f8 |
}
|
|
|
1205f8 |
diff --git a/extensions/desktop-icons/stylesheet.css b/extensions/desktop-icons/stylesheet.css
|
|
|
1205f8 |
index 61b4ce8..4fd31c3 100644
|
|
|
1205f8 |
--- a/extensions/desktop-icons/stylesheet.css
|
|
|
1205f8 |
+++ b/extensions/desktop-icons/stylesheet.css
|
|
|
1205f8 |
@@ -8,6 +8,15 @@
|
|
|
1205f8 |
background-color: rgba(238, 238, 238, 0.2);
|
|
|
1205f8 |
}
|
|
|
1205f8 |
|
|
|
1205f8 |
+.file-item:selected {
|
|
|
1205f8 |
+ background-color: rgba(74, 144, 217, 0.6);
|
|
|
1205f8 |
+ border-color: rgba(74, 144, 217, 0.8);
|
|
|
1205f8 |
+}
|
|
|
1205f8 |
+
|
|
|
1205f8 |
+.rubber-band {
|
|
|
1205f8 |
+ background-color: rgba(74, 144, 238, 0.4);
|
|
|
1205f8 |
+}
|
|
|
1205f8 |
+
|
|
|
1205f8 |
.name-label {
|
|
|
1205f8 |
text-shadow: 1px 1px black;
|
|
|
1205f8 |
color: white;
|
|
|
1205f8 |
--
|
|
|
1205f8 |
2.28.0
|
|
|
1205f8 |
|
|
|
1205f8 |
|
|
|
1205f8 |
From 7f31b7697d3bacf53d5d37cb34642d82ea109a52 Mon Sep 17 00:00:00 2001
|
|
|
1205f8 |
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
|
|
|
1205f8 |
Date: Fri, 21 May 2021 00:50:52 +0200
|
|
|
1205f8 |
Subject: [PATCH 2/2] desktop-icons: Port prefs to GTK4
|
|
|
1205f8 |
|
|
|
1205f8 |
... for compatibility with GNOME 40.
|
|
|
1205f8 |
---
|
|
|
1205f8 |
extensions/desktop-icons/prefs.js | 32 ++++++++++++++++++-------------
|
|
|
1205f8 |
1 file changed, 19 insertions(+), 13 deletions(-)
|
|
|
1205f8 |
|
|
|
1205f8 |
diff --git a/extensions/desktop-icons/prefs.js b/extensions/desktop-icons/prefs.js
|
|
|
1205f8 |
index 890bcdb..c390aa8 100644
|
|
|
1205f8 |
--- a/extensions/desktop-icons/prefs.js
|
|
|
1205f8 |
+++ b/extensions/desktop-icons/prefs.js
|
|
|
1205f8 |
@@ -98,23 +98,29 @@ function get_schema(schema) {
|
|
|
1205f8 |
|
|
|
1205f8 |
function buildPrefsWidget() {
|
|
|
1205f8 |
initTranslations();
|
|
|
1205f8 |
- let frame = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL, border_width: 10, spacing: 10 });
|
|
|
1205f8 |
-
|
|
|
1205f8 |
- frame.add(buildSelector('icon-size', _("Size for the desktop icons"), { 'small': _("Small"), 'standard': _("Standard"), 'large': _("Large") }));
|
|
|
1205f8 |
- frame.add(buildSwitcher('show-home', _("Show the personal folder in the desktop")));
|
|
|
1205f8 |
- frame.add(buildSwitcher('show-trash', _("Show the trash icon in the desktop")));
|
|
|
1205f8 |
- frame.add(buildSwitcher('show-mount', _("Show mounted drives in the desktop")));
|
|
|
1205f8 |
- frame.show_all();
|
|
|
1205f8 |
+ let frame = new Gtk.Box({
|
|
|
1205f8 |
+ orientation: Gtk.Orientation.VERTICAL,
|
|
|
1205f8 |
+ margin_top: 10,
|
|
|
1205f8 |
+ margin_bottom: 10,
|
|
|
1205f8 |
+ margin_start: 10,
|
|
|
1205f8 |
+ margin_end: 10,
|
|
|
1205f8 |
+ spacing: 10,
|
|
|
1205f8 |
+ });
|
|
|
1205f8 |
+
|
|
|
1205f8 |
+ frame.append(buildSelector('icon-size', _("Size for the desktop icons"), { 'small': _("Small"), 'standard': _("Standard"), 'large': _("Large") }));
|
|
|
1205f8 |
+ frame.append(buildSwitcher('show-home', _("Show the personal folder in the desktop")));
|
|
|
1205f8 |
+ frame.append(buildSwitcher('show-trash', _("Show the trash icon in the desktop")));
|
|
|
1205f8 |
+ frame.append(buildSwitcher('show-mount', _("Show mounted drives in the desktop")));
|
|
|
1205f8 |
return frame;
|
|
|
1205f8 |
}
|
|
|
1205f8 |
|
|
|
1205f8 |
function buildSwitcher(key, labelText) {
|
|
|
1205f8 |
let hbox = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL, spacing: 10 });
|
|
|
1205f8 |
- let label = new Gtk.Label({ label: labelText, xalign: 0 });
|
|
|
1205f8 |
+ let label = new Gtk.Label({ label: labelText, xalign: 0, hexpand: true });
|
|
|
1205f8 |
let switcher = new Gtk.Switch({ active: settings.get_boolean(key) });
|
|
|
1205f8 |
settings.bind(key, switcher, 'active', 3);
|
|
|
1205f8 |
- hbox.pack_start(label, true, true, 0);
|
|
|
1205f8 |
- hbox.add(switcher);
|
|
|
1205f8 |
+ hbox.append(label);
|
|
|
1205f8 |
+ hbox.append(switcher);
|
|
|
1205f8 |
return hbox;
|
|
|
1205f8 |
}
|
|
|
1205f8 |
|
|
|
1205f8 |
@@ -131,15 +137,15 @@ function buildSelector(key, labelText, elements) {
|
|
|
1205f8 |
listStore.set (iter, [0, 1], [visibleText, val]);
|
|
|
1205f8 |
}
|
|
|
1205f8 |
let hbox = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL, spacing: 10 });
|
|
|
1205f8 |
- let label = new Gtk.Label({ label: labelText, xalign: 0 });
|
|
|
1205f8 |
+ let label = new Gtk.Label({ label: labelText, xalign: 0, hexpand: true });
|
|
|
1205f8 |
let combo = new Gtk.ComboBox({model: listStore});
|
|
|
1205f8 |
let rendererText = new Gtk.CellRendererText();
|
|
|
1205f8 |
combo.pack_start (rendererText, false);
|
|
|
1205f8 |
combo.add_attribute (rendererText, 'text', 0);
|
|
|
1205f8 |
combo.set_id_column(1);
|
|
|
1205f8 |
settings.bind(key, combo, 'active-id', 3);
|
|
|
1205f8 |
- hbox.pack_start(label, true, true, 0);
|
|
|
1205f8 |
- hbox.add(combo);
|
|
|
1205f8 |
+ hbox.append(label);
|
|
|
1205f8 |
+ hbox.append(combo);
|
|
|
1205f8 |
return hbox;
|
|
|
1205f8 |
}
|
|
|
1205f8 |
|
|
|
1205f8 |
--
|
|
|
1205f8 |
2.28.0
|
|
|
1205f8 |
|