mirror of
https://github.com/Hopiu/RandomWallpaperGnome3.git
synced 2026-05-23 06:05:49 +00:00
Add missing 'Set As Wallpaper' button to the HistoryEntry
This commit is contained in:
parent
608f45c63b
commit
c9d1d25358
2 changed files with 16 additions and 3 deletions
|
|
@ -12,6 +12,8 @@ const HistoryElement = new Lang.Class({
|
|||
Extends: PopupMenu.PopupSubMenuMenuItem,
|
||||
historyEntry: null,
|
||||
|
||||
setAsWallpaperItem: null,
|
||||
|
||||
_init: function (historyEntry, index) {
|
||||
this.parent("", false);
|
||||
|
||||
|
|
@ -87,6 +89,12 @@ const HistoryElement = new Lang.Class({
|
|||
|
||||
this.menu.addMenuItem(this.imageUrlItem);
|
||||
|
||||
this.setAsWallpaperItem = new PopupMenu.PopupMenuItem('Set As Wallpaper');
|
||||
this.setAsWallpaperItem.connect('activate', () => {
|
||||
this.emit('activate');
|
||||
});
|
||||
|
||||
this.menu.addMenuItem(this.setAsWallpaperItem);
|
||||
} else {
|
||||
this.menu.addMenuItem(new PopupMenu.PopupMenuItem('Unknown source.'));
|
||||
}
|
||||
|
|
@ -98,8 +106,12 @@ const CurrentImageElement = new Lang.Class({
|
|||
Name: 'CurrentImageElement',
|
||||
Extends: HistoryElement,
|
||||
|
||||
_init: function(historyElement) {
|
||||
_init: function (historyElement) {
|
||||
this.parent(historyElement, 0);
|
||||
|
||||
if (this.setAsWallpaperItem !== null) {
|
||||
this.setAsWallpaperItem.destroy();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -168,6 +168,8 @@ let RandomWallpaperEntry = new Lang.Class({
|
|||
this.historySection.addMenuItem(tmp);
|
||||
}
|
||||
|
||||
let _this = this;
|
||||
|
||||
function onLeave(actor) {
|
||||
wallpaperController.resetWallpaper();
|
||||
}
|
||||
|
|
@ -175,9 +177,8 @@ let RandomWallpaperEntry = new Lang.Class({
|
|||
function onEnter(actor) {
|
||||
wallpaperController.previewWallpaper(actor.historyId);
|
||||
}
|
||||
|
||||
function onSelect(actor) {
|
||||
wallpaperController.setWallpaper(actor.historyId);
|
||||
wallpaperController.setWallpaper(actor.historyEntry.id);
|
||||
}
|
||||
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue