From ce12dcd3b42dbee2a4d6bf2f0e7fbd17a31b67ba Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 2 Mar 2017 13:37:34 -0800 Subject: [PATCH] Add live popover icon property --- atom/browser/ui/cocoa/atom_touch_bar.mm | 5 +++-- lib/browser/api/touch-bar.js | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/atom/browser/ui/cocoa/atom_touch_bar.mm b/atom/browser/ui/cocoa/atom_touch_bar.mm index 9aaa534e4..9c3ac9eee 100644 --- a/atom/browser/ui/cocoa/atom_touch_bar.mm +++ b/atom/browser/ui/cocoa/atom_touch_bar.mm @@ -333,10 +333,11 @@ static NSTouchBarItemIdentifier SliderIdentifier = @"com.electron.touchbar.slide - (void)updatePopover:(NSPopoverTouchBarItem*)item withSettings:(const mate::PersistentDictionary&)settings { std::string label; - gfx::Image image; if (settings.Get("label", &label)) { item.collapsedRepresentationLabel = base::SysUTF8ToNSString(label); - } else if (settings.Get("image", &image)) { + } + gfx::Image image; + if (settings.Get("icon", &image)) { item.collapsedRepresentationImage = image.AsNSImage(); } diff --git a/lib/browser/api/touch-bar.js b/lib/browser/api/touch-bar.js index 83a8028b8..abcf8289e 100644 --- a/lib/browser/api/touch-bar.js +++ b/lib/browser/api/touch-bar.js @@ -174,6 +174,7 @@ TouchBar.Popover = class TouchBarPopover extends TouchBarItem { super(config) this.type = 'popover' this._addLiveProperty('label', config.label) + this._addLiveProperty('icon', config.icon) this.showCloseButton = config.showCloseButton this.child = config.items if (!(this.child instanceof TouchBar)) { -- 2.34.1