Add live popover icon property
authorKevin Sawicki <kevinsawicki@gmail.com>
Thu, 2 Mar 2017 21:37:34 +0000 (13:37 -0800)
committerKevin Sawicki <kevinsawicki@gmail.com>
Fri, 3 Mar 2017 22:00:39 +0000 (14:00 -0800)
atom/browser/ui/cocoa/atom_touch_bar.mm
lib/browser/api/touch-bar.js

index 9aaa534e425f3db9ca06d11ddea790e6dd50ae14..9c3ac9eeeebcfc6532aa851036afe9f7490f452d 100644 (file)
@@ -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();
   }
 
index 83a8028b82e1e9b3ca3d1cbd039a8513fb6019c6..abcf8289e621550e3e1562f478291bb012428631 100644 (file)
@@ -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)) {