Allow creation of more than one window

This commit is contained in:
René Stadler 2008-01-23 17:07:55 +02:00 committed by Stefan Sauer
parent f998069d6b
commit 2b2e3c11c8
2 changed files with 17 additions and 9 deletions

View file

@ -1828,7 +1828,7 @@ class Window (object):
def handle_new_window_action_activate (self, action): def handle_new_window_action_activate (self, action):
pass self.app.open_window ()
def handle_open_file_action_activate (self, action): def handle_open_file_action_activate (self, action):
@ -2190,7 +2190,9 @@ class App (object):
self.load_plugins () self.load_plugins ()
self.windows = [Window (self)] self.windows = []
self.open_window ()
def detach (self): def detach (self):
@ -2207,14 +2209,20 @@ class App (object):
else: else:
self.detach () self.detach ()
def open_window (self):
self.windows.append (Window (self))
def close_window (self, window): def close_window (self, window):
# GtkTreeView takes some time to go down for large files. Let's block self.windows.remove (window)
# until the window is hidden: if not self.windows:
gobject.idle_add (gtk.main_quit) # GtkTreeView takes some time to go down for large files. Let's block
gtk.main () # until the window is hidden:
gobject.idle_add (gtk.main_quit)
gtk.main_quit () gtk.main ()
gtk.main_quit ()
import time import time

View file

@ -2,7 +2,7 @@
<ui> <ui>
<menubar> <menubar>
<menu name="FileMenu" action="FileMenuAction"> <menu name="FileMenu" action="FileMenuAction">
<!--<menuitem name="FileNewWindow" action="new-window"/>--> <menuitem name="FileNewWindow" action="new-window"/>
<menuitem name="FileOpen" action="open-file"/> <menuitem name="FileOpen" action="open-file"/>
<menuitem name="FileReload" action="reload-file"/> <menuitem name="FileReload" action="reload-file"/>
<separator/> <separator/>