@@ -39,10 +39,6 @@ var connectWindow;
3939// since this code was laid down.
4040var windowsOpenCount = 0 ;
4141
42- function isConnectDialog ( url ) {
43- return url === DEFAULT_URL ;
44- }
45-
4642// returns true if the application is a single instance application otherwise
4743// focus the second window (which we'll quit from) and return false
4844// see "app.makeSingleInstance" in https://github.com/atom/electron/blob/master/docs/api/app.md
@@ -118,19 +114,6 @@ module.exports.create = function(opts) {
118114 } ) ;
119115 } ) ;
120116
121- if ( isConnectDialog ( opts . url ) ) {
122- AppMenu . hideConnect ( _window ) ;
123- connectWindow = _window ;
124- connectWindow . on ( 'focus' , function ( ) {
125- debug ( 'connect window focused.' ) ;
126- connectWindow . webContents . send ( 'message' , 'connect-window-focused' ) ;
127- } ) ;
128- connectWindow . on ( 'closed' , function ( ) {
129- debug ( 'connect window closed.' ) ;
130- connectWindow = null ;
131- } ) ;
132- }
133-
134117 // @see `all-windows-closed` above
135118 windowsOpenCount ++ ;
136119 _window . on ( 'closed' , function ( ) {
@@ -144,20 +127,14 @@ module.exports.create = function(opts) {
144127 return _window ;
145128} ;
146129
147- app . on ( 'show connect dialog' , function ( opts ) {
148- if ( connectWindow ) {
149- connectWindow . focus ( ) ;
150- return connectWindow ;
151- }
152-
153- opts = opts || { } ;
154- opts = _ . extend ( opts || { } , {
130+ function createWindow ( opts , url ) {
131+ opts = _ . extend ( opts , {
155132 width : config . windows . DEFAULT_WIDTH_DIALOG ,
156133 height : config . windows . DEFAULT_HEIGHT_DIALOG ,
157- url : DEFAULT_URL
134+ url : url
158135 } ) ;
159- module . exports . create ( opts ) ;
160- } ) ;
136+ return module . exports . create ( opts ) ;
137+ }
161138
162139app . on ( 'show about dialog' , function ( ) {
163140 dialog . showMessageBox ( {
@@ -167,8 +144,21 @@ app.on('show about dialog', function() {
167144 } ) ;
168145} ) ;
169146
170- app . on ( 'hide connect submenu' , function ( ) {
171- AppMenu . hideConnect ( ) ;
147+ app . on ( 'show connect dialog' , function ( opts ) {
148+ if ( connectWindow ) {
149+ connectWindow . focus ( ) ;
150+ return connectWindow ;
151+ }
152+
153+ connectWindow = createWindow ( { } , DEFAULT_URL ) ;
154+ connectWindow . on ( 'focus' , function ( ) {
155+ debug ( 'connect window focused.' ) ;
156+ connectWindow . webContents . send ( 'message' , 'connect-window-focused' ) ;
157+ } ) ;
158+ connectWindow . on ( 'closed' , function ( ) {
159+ debug ( 'connect window closed.' ) ;
160+ connectWindow = null ;
161+ } ) ;
172162} ) ;
173163
174164app . on ( 'hide share submenu' , function ( ) {
@@ -179,10 +169,6 @@ app.on('show compass overview submenu', function() {
179169 AppMenu . showCompassOverview ( ) ;
180170} ) ;
181171
182- app . on ( 'show connect submenu' , function ( ) {
183- AppMenu . showConnect ( ) ;
184- } ) ;
185-
186172app . on ( 'show share submenu' , function ( ) {
187173 AppMenu . showShare ( ) ;
188174} ) ;
0 commit comments