diff --git a/data/theme/gnome-shell-sass/_widgets.scss b/data/theme/gnome-shell-sass/_widgets.scss index ee16a7141..9eac62d95 100644 --- a/data/theme/gnome-shell-sass/_widgets.scss +++ b/data/theme/gnome-shell-sass/_widgets.scss @@ -21,7 +21,6 @@ @import 'widgets/ibus-popup'; // Notifications @import 'widgets/notifications'; -@import 'widgets/hotplug'; // Dialogs @import 'widgets/dialogs'; // OSDs diff --git a/data/theme/gnome-shell-sass/widgets/_hotplug.scss b/data/theme/gnome-shell-sass/widgets/_hotplug.scss deleted file mode 100644 index f20626b5e..000000000 --- a/data/theme/gnome-shell-sass/widgets/_hotplug.scss +++ /dev/null @@ -1,10 +0,0 @@ -// hotplug - -.hotplug-notification-item { - @extend %bubble_button; -} - -.hotplug-notification-item-icon { - icon-size: $medium_icon_size; - padding: 0 $base_margin; -} diff --git a/data/theme/meson.build b/data/theme/meson.build index 0d28efd03..8d01ae826 100644 --- a/data/theme/meson.build +++ b/data/theme/meson.build @@ -17,7 +17,6 @@ theme_sources = files([ '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-lock.scss', diff --git a/js/ui/components/autorunManager.js b/js/ui/components/autorunManager.js index d2b69d67e..7e53f8396 100644 --- a/js/ui/components/autorunManager.js +++ b/js/ui/components/autorunManager.js @@ -1,9 +1,6 @@ // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- -import Clutter from 'gi://Clutter'; import Gio from 'gi://Gio'; -import GObject from 'gi://GObject'; -import St from 'gi://St'; import * as GnomeSession from '../../misc/gnomeSession.js'; import * as MessageTray from '../messageTray.js'; @@ -190,7 +187,20 @@ class AutorunDispatcher { return; const source = MessageTray.getSystemSource(); - const notification = new AutorunNotification(source, mount, apps); + const notification = new MessageTray.Notification( + source, + mount.get_name() + ); + notification.connect('activate', () => { + const app = Gio.app_info_get_default_for_type('inode/directory', false); + startAppForMount(app, mount); + }); + apps.forEach(app => { + notification.addAction( + _('Open with %s').format(app.get_name()), + () => startAppForMount(app, mount) + ); + }); notification.connect('destroy', () => this._notifications.delete(mount)); this._notifications.set(mount, notification); source.showNotification(notification); @@ -238,70 +248,4 @@ class AutorunDispatcher { } } -const AutorunNotification = GObject.registerClass( -class AutorunNotification extends MessageTray.Notification { - constructor(source, mount, apps) { - super(source, mount.get_name()); - - this.gicon = mount.get_icon(); - - this._mount = mount; - this._apps = apps; - } - - createBanner() { - let banner = new MessageTray.NotificationBanner(this); - - this._apps.forEach(app => { - let actor = this._buttonForApp(app); - - if (actor) - banner.addButton(actor); - }); - - return banner; - } - - _buttonForApp(app) { - let box = new St.BoxLayout({ - x_expand: true, - x_align: Clutter.ActorAlign.START, - }); - const icon = new St.Icon({ - gicon: app.get_icon(), - style_class: 'hotplug-notification-item-icon', - }); - box.add_child(icon); - - let label = new St.Bin({ - child: new St.Label({ - text: _('Open with %s').format(app.get_name()), - y_align: Clutter.ActorAlign.CENTER, - }), - }); - box.add_child(label); - - const button = new St.Button({ - child: box, - x_expand: true, - button_mask: St.ButtonMask.ONE, - style_class: 'hotplug-notification-item button', - }); - - button.connect('clicked', () => { - startAppForMount(app, this._mount); - this.destroy(); - }); - - return button; - } - - activate() { - super.activate(); - - let app = Gio.app_info_get_default_for_type('inode/directory', false); - startAppForMount(app, this._mount); - } -}); - export {AutorunManager as Component};