From 35ee5c2719b5599d91bf90851c6de74983813646 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Mon, 7 Nov 2016 16:10:03 +0100 Subject: [PATCH] inform mac users on title change --- .../browser/parts/titlebar/titlebarPart.ts | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts b/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts index 842a8bcab42..b76dbd988e4 100644 --- a/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts +++ b/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts @@ -6,10 +6,16 @@ 'use strict'; import 'vs/css!./media/titlebarpart'; +import * as nls from 'vs/nls'; +import { TPromise } from 'vs/base/common/winjs.base'; import { Builder, $, Dimension } from 'vs/base/browser/builder'; import { Part } from 'vs/workbench/browser/part'; import { ITitleService } from 'vs/workbench/services/title/common/titleService'; import { getZoomFactor } from 'vs/base/browser/browser'; +import { Action } from 'vs/base/common/actions'; +import { IMessageService, Severity, IMessageWithAction } from 'vs/platform/message/common/message'; +import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; +import { isMacintosh } from 'vs/base/common/platform'; export class TitlebarPart extends Part implements ITitleService { @@ -20,6 +26,50 @@ export class TitlebarPart extends Part implements ITitleService { private pendingTitle: string; private initialTitleFontSize: number; + constructor( + id: string, + @IMessageService private messageService: IMessageService, + @IStorageService private storageService: IStorageService + ) { + super(id); + + this.informUser(); // TODO@Ben remove me + } + + private informUser(): void { + if (isMacintosh && !this.storageService.getBoolean('customTitleBarInformUser', StorageScope.GLOBAL)) { + this.storageService.store('customTitleBarInformUser', true, StorageScope.GLOBAL); + + const okAction = new Action( + 'customTitle.ok', + nls.localize('customTitle.ok', "OK"), + null, + true, + () => TPromise.as(true) + ); + + const moreInfoAction = new Action( + 'customTitle.moreInfo', + nls.localize('customTitle.moreInfo', "More information"), + null, + true, + () => { + window.open('https://github.com/Microsoft/vscode/issues/15098'); + + return TPromise.as(true); + } + ); + + this.messageService.show(Severity.Info, { + message: nls.localize('customTitleBarInformUser', "We have enabled a new custom title bar style on Mac. The related setting is called **window.titleBarStyle**."), + actions: [ + okAction, + moreInfoAction + ] + }); + } + } + public createContentArea(parent: Builder): Builder { this.titleContainer = $(parent); -- GitLab