Popup_ --> Popup_notification

This commit is contained in:
Nikos Kouremenos 2005-04-21 21:23:41 +00:00
parent 31b804582a
commit ba7bf98468
3 changed files with 25 additions and 22 deletions

View File

@ -615,14 +615,14 @@ class Change_password_dialog:
self.dialog.destroy()
return message
class Popup_window:
class Popup_notification_window:
def __init__(self, plugin, event_type, jid, account):
self.plugin = plugin
self.account = account
self.jid = jid
xml = gtk.glade.XML(GTKGUI_GLADE, 'popup_window', APP)
self.window = xml.get_widget('popup_window')
xml = gtk.glade.XML(GTKGUI_GLADE, 'popup_notification_window', APP)
self.window = xml.get_widget('popup_notification_window')
close_button = xml.get_widget('close_button')
event_type_label = xml.get_widget('event_type_label')
event_description_label = xml.get_widget('event_description_label')
@ -661,29 +661,29 @@ class Popup_window:
gobject.timeout_add(5000, self.on_timeout)
def on_close_button_clicked(self, widget):
self.adjust_height_and_move_popup_windows()
self.adjust_height_and_move_popup_notification_windows()
def on_timeout(self):
self.adjust_height_and_move_popup_windows()
self.adjust_height_and_move_popup_notification_windows()
def adjust_height_and_move_popup_windows(self):
def adjust_height_and_move_popup_notification_windows(self):
#remove
self.plugin.roster.popups_height -= self.window_height
self.window.destroy()
if len(self.plugin.roster.popup_windows) > 0:
if len(self.plugin.roster.popup_notification_windows) > 0:
# we want to remove the first window added in the list
self.plugin.roster.popup_windows.pop(0) # remove first item
self.plugin.roster.popup_notification_windows.pop(0) # remove 1st item
# move the rest of popup windows
self.plugin.roster.popups_height = 0
for window_instance in self.plugin.roster.popup_windows:
for window_instance in self.plugin.roster.popup_notification_windows:
window_width, window_height = window_instance.window.get_size()
self.plugin.roster.popups_height += window_height
window_instance.window.move(gtk.gdk.screen_width() - window_width, \
gtk.gdk.screen_height() - self.plugin.roster.popups_height)
def on_popup_window_button_press_event(self, widget, event):
def on_popup_notification_window_button_press_event(self, widget, event):
# use User class, new_chat expects it that way
# is it in the roster?
if self.plugin.roster.contacts[self.account].has_key(self.jid):
@ -697,4 +697,4 @@ class Popup_window:
self.plugin.roster.new_chat(user, self.account)
self.plugin.windows[self.account]['chats'][self.jid].active_tab(self.jid)
self.plugin.windows[self.account]['chats'][self.jid].window.present()
self.adjust_height_and_move_popup_windows()
self.adjust_height_and_move_popup_notification_windows()

View File

@ -238,9 +238,9 @@ class Interface:
elif gajim.connections[account].connected in (2, 3): #online or chat
show_notification = True
if show_notification:
instance = dialogs.Popup_window(self, 'Contact Online', jid, \
account)
self.roster.popup_windows.append(instance)
instance = dialogs.Popup_notification_window(self,
'Contact Online', jid, account)
self.roster.popup_notification_windows.append(instance)
elif old_show > 1 and new_show < 2 and gajim.config.get_per( \
'soundevents', 'contact_disconnected', 'enabled'):
@ -255,9 +255,9 @@ class Interface:
elif gajim.connections[account].connected in (2, 3): #online or chat
show_notification = True
if show_notification:
instance = dialogs.Popup_window(self, 'Contact Offline', jid, \
account)
self.roster.popup_windows.append(instance)
instance = dialogs.Popup_notification_window(self,
'Contact Offline', jid, account)
self.roster.popup_notification_windows.append(instance)
elif self.windows[account]['gc'].has_key(ji):
#it is a groupchat presence
@ -286,8 +286,9 @@ class Interface:
elif gajim.connections[account].connected in (2, 3): #online or chat
show_notification = True
if show_notification:
instance = dialogs.Popup_window(self, 'New Message', jid, account)
self.roster.popup_windows.append(instance)
instance = dialogs.Popup_notification_window(self,
'New Message', jid, account)
self.roster.popup_notification_windows.append(instance)
self.roster.on_message(jid, array[1], array[2], account)
if gajim.config.get_per('soundevents', 'first_message_received', \
'enabled') and first:

View File

@ -8129,6 +8129,7 @@ Custom</property>
<widget class="GtkScrolledWindow" id="conversation_scrolledwindow">
<property name="width_request">200</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
@ -8137,6 +8138,7 @@ Custom</property>
<child>
<widget class="GtkTextView" id="conversation_textview">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
<property name="overwrite">False</property>
<property name="accepts_tab">True</property>
@ -8172,6 +8174,7 @@ Custom</property>
<widget class="GtkScrolledWindow" id="scrolledwindow19">
<property name="height_request">55</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
@ -8181,7 +8184,6 @@ Custom</property>
<widget class="GtkTextView" id="message_textview">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="editable">True</property>
<property name="overwrite">False</property>
<property name="accepts_tab">False</property>
@ -10202,7 +10204,7 @@ send a chat message to</property>
</child>
</widget>
<widget class="GtkWindow" id="popup_window">
<widget class="GtkWindow" id="popup_notification_window">
<property name="border_width">4</property>
<property name="title" translatable="yes"></property>
<property name="type">GTK_WINDOW_POPUP</property>
@ -10216,7 +10218,7 @@ send a chat message to</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_SOUTH_EAST</property>
<property name="focus_on_map">True</property>
<signal name="button_press_event" handler="on_popup_window_button_press_event" last_modification_time="Tue, 05 Apr 2005 21:39:57 GMT"/>
<signal name="button_press_event" handler="on_popup_notification_window_button_press_event" last_modification_time="Thu, 21 Apr 2005 21:20:43 GMT"/>
<child>
<widget class="GtkEventBox" id="eventbox">