menu change to tooltip
This commit is contained in:
@@ -8,9 +8,6 @@ import * as Main from 'resource:///org/gnome/shell/ui/main.js';
|
||||
import * as PanelMenu from 'resource:///org/gnome/shell/ui/panelMenu.js';
|
||||
import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js';
|
||||
|
||||
export var schema = 'org.gnome.desktop.background';
|
||||
export var imagePath = GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_PICTURES) + '/BingWallpaper';
|
||||
|
||||
export default class BingWallpaperExtension extends Extension {
|
||||
enable() {
|
||||
this._indicator = new PanelMenu.Button(0.0, this.metadata.name, false);
|
||||
@@ -25,13 +22,15 @@ export default class BingWallpaperExtension extends Extension {
|
||||
|
||||
Main.panel.addToStatusArea(this.uuid, this._indicator);
|
||||
|
||||
this.imagePath = GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_PICTURES) + '/BingWallpaper';
|
||||
const menu_browse = new PopupMenu.PopupImageMenuItem('Browse', 'folder-directory-symbolic', {});
|
||||
menu_browse.connect('activate', () => {
|
||||
let uri = 'file://' + imagePath;
|
||||
let uri = 'file://' + this.imagePath;
|
||||
Gio.app_info_launch_default_for_uri(uri, global.create_app_launch_context(0, -1));
|
||||
});
|
||||
this._indicator.menu.addMenuItem(menu_browse);
|
||||
|
||||
const schema = 'org.gnome.desktop.background';
|
||||
this.gsettings = new Gio.Settings({ schema: schema });
|
||||
let uri = this.gsettings.get_string('picture-uri');
|
||||
let filename = uri.substring(uri.lastIndexOf('/') + 1)
|
||||
@@ -40,9 +39,10 @@ export default class BingWallpaperExtension extends Extension {
|
||||
this._indicator.menu.addMenuItem(this.menu_update);
|
||||
}
|
||||
|
||||
disable() {
|
||||
disable() {
|
||||
this._indicator?.destroy();
|
||||
this._indicator = null;
|
||||
this._indicator = null;
|
||||
this.gsettings = null;
|
||||
}
|
||||
|
||||
getWallpaper() {
|
||||
@@ -57,7 +57,7 @@ export default class BingWallpaperExtension extends Extension {
|
||||
let imgUrl = "http://www.bing.com" + json.images[0].url;
|
||||
var filename = json.images[0].enddate + '_' + json.images[0].urlbase.replace('/th?id=OHR.', '') + '.jpg';
|
||||
this.menu_update.label.text = json.images[0].copyright;
|
||||
var filepath = imagePath + '/' + filename;
|
||||
var filepath = this.imagePath + '/' + filename;
|
||||
let file = Gio.file_new_for_path(filepath);
|
||||
let request = Soup.Message.new('GET', imgUrl);
|
||||
httpSession.send_and_read_async(request, GLib.PRIORITY_DEFAULT, null, (httpSession, message) => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"uuid": "BingWallpaper@sonichy",
|
||||
"name": "Bing Wallpaper",
|
||||
"description": "Change wallpaper of GNOME with Bing wallpaper on one click.",
|
||||
"description": "Change wallpaper of GNOME with Bing wallpaper on one click. This extension is not affiliated, funded, or in any way associated with Microsoft and Bing.",
|
||||
"author": "sonichy",
|
||||
"version": "1.0",
|
||||
"shell-version": [ "45", "46", "47", "48" ],
|
||||
|
||||
Reference in New Issue
Block a user