From d6930bbcc3be8b40fa65c6d7470fd1f68ba798b9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristoffer=20Gr=C3=B6nlund?= Date: Sun, 3 Jan 2010 02:39:31 +0100 Subject: [PATCH] Only allow one player window in the window stack --- jamaui/playerwindow.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/jamaui/playerwindow.py b/jamaui/playerwindow.py index 724e73d..ab6e95e 100644 --- a/jamaui/playerwindow.py +++ b/jamaui/playerwindow.py @@ -38,10 +38,14 @@ from songposition import SongPosition log = logging.getLogger(__name__) class PlayerWindow(hildon.StackableWindow): + instance = None + def __init__(self): hildon.StackableWindow.__init__(self) self.set_title("jamaendo") + PlayerWindow.instance = self + self.connect('destroy', self.on_destroy) self.player = the_player @@ -153,6 +157,7 @@ class PlayerWindow(hildon.StackableWindow): return None def on_destroy(self, wnd): + PlayerWindow.instance = None self.stop_position_timer() postoffice.disconnect(['album-cover', 'next', 'prev', 'play', 'stop'], self) @@ -297,6 +302,15 @@ class PlayerWindow(hildon.StackableWindow): self.player.stop() def open_playerwindow(): - player = PlayerWindow() - player.show_all() + if PlayerWindow.instance: + player = PlayerWindow.instance + stack = player.get_stack() + sz = stack.size() + windows = stack.pop(sz) + windows.remove(player) + windows.append(player) + stack.push_list(windows) + else: + player = PlayerWindow() + player.show_all() return player -- 1.7.9.5