From 474fe3447e74375a15b1500da00c1792ae05e886 Mon Sep 17 00:00:00 2001 From: Nikos Kouremenos Date: Mon, 4 Apr 2005 19:27:06 +0000 Subject: [PATCH] timeout in popup. I will also do the rest --- plugins/gtkgui/dialogs.py | 25 ++++++++--- plugins/gtkgui/gtkgui.glade | 74 +++++++-------------------------- plugins/gtkgui/roster_window.py | 5 ++- 3 files changed, 38 insertions(+), 66 deletions(-) diff --git a/plugins/gtkgui/dialogs.py b/plugins/gtkgui/dialogs.py index eef14bdda..15180ba4f 100644 --- a/plugins/gtkgui/dialogs.py +++ b/plugins/gtkgui/dialogs.py @@ -781,17 +781,30 @@ class Popup_window: def __init__(self, plugin=None, account=None): self.plugin = plugin self.account = account - self.xml = gtk.glade.XML(GTKGUI_GLADE, 'popup_window', APP) - self.window = self.xml.get_widget('popup_window') + + xml = gtk.glade.XML(GTKGUI_GLADE, 'popup_window', APP) + self.window = xml.get_widget('popup_window') + close_button = xml.get_widget('close_button') + self.window.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('green')) # position the window to bottom-right of screen gtk.gdk.flush() window_width, window_height = self.window.get_size() - self.window.move(gtk.gdk.screen_width() - window_width, gtk.gdk.screen_height() - window_height) + self.plugin.roster.popups_height += window_height + self.window.move(gtk.gdk.screen_width() - window_width, \ + gtk.gdk.screen_height() - self.plugin.roster.popups_height) - self.xml.signal_autoconnect(self) + xml.signal_autoconnect(self) + close_button.connect('clicked', self.on_close_button_clicked, window_height) self.window.show_all() - def on_close_button_clicked(self, widget): - self.window.hide() + gobject.timeout_add(5000, self.on_timeout, window_height) + + def on_close_button_clicked(self, widget, window_height): + self.plugin.roster.popups_height -= window_height + widget.get_toplevel().destroy() + + def on_timeout(self, window_height): + self.plugin.roster.popups_height -= window_height + self.window.destroy() diff --git a/plugins/gtkgui/gtkgui.glade b/plugins/gtkgui/gtkgui.glade index 1c9f4b60c..be02514bd 100644 --- a/plugins/gtkgui/gtkgui.glade +++ b/plugins/gtkgui/gtkgui.glade @@ -9877,21 +9877,6 @@ send a chat message to False 5 - - - True - 0.5 - 0.5 - 0 - 0 - - - 0 - True - True - - - True @@ -9923,7 +9908,6 @@ send a chat message to True GTK_RELIEF_NORMAL True - @@ -9952,50 +9936,22 @@ send a chat message to - + True - False - 5 - - - - True - 0.5 - 0.5 - 0 - 0 - - - 0 - False - True - - - - - - True - jid_label - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - + jid_label + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 diff --git a/plugins/gtkgui/roster_window.py b/plugins/gtkgui/roster_window.py index f793c9fdf..ebd6427f3 100644 --- a/plugins/gtkgui/roster_window.py +++ b/plugins/gtkgui/roster_window.py @@ -909,7 +909,9 @@ class Roster_window: Popup_window(self.plugin) def on_accounts_menuitem_activate(self, widget): - if not self.plugin.windows.has_key('accounts'): + if self.plugin.windows.has_key('accounts'): + self.plugin.windows['accounts'].present() + else: self.plugin.windows['accounts'] = Accounts_window(self.plugin) def close_all(self, dic): @@ -1305,6 +1307,7 @@ class Roster_window: self.window.show_all() self.groups = {} self.contacts = {} + self.popups_height = 0 for a in self.plugin.accounts.keys(): self.contacts[a] = {} self.groups[a] = {}