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