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() self.dialog.destroy()
return message return message
class Popup_window: class Popup_notification_window:
def __init__(self, plugin, event_type, jid, account): def __init__(self, plugin, event_type, jid, account):
self.plugin = plugin self.plugin = plugin
self.account = account self.account = account
self.jid = jid self.jid = jid
xml = gtk.glade.XML(GTKGUI_GLADE, 'popup_window', APP) xml = gtk.glade.XML(GTKGUI_GLADE, 'popup_notification_window', APP)
self.window = xml.get_widget('popup_window') self.window = xml.get_widget('popup_notification_window')
close_button = xml.get_widget('close_button') close_button = xml.get_widget('close_button')
event_type_label = xml.get_widget('event_type_label') event_type_label = xml.get_widget('event_type_label')
event_description_label = xml.get_widget('event_description_label') event_description_label = xml.get_widget('event_description_label')
@ -661,29 +661,29 @@ class Popup_window:
gobject.timeout_add(5000, self.on_timeout) gobject.timeout_add(5000, self.on_timeout)
def on_close_button_clicked(self, widget): 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): 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 #remove
self.plugin.roster.popups_height -= self.window_height self.plugin.roster.popups_height -= self.window_height
self.window.destroy() 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 # 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 # move the rest of popup windows
self.plugin.roster.popups_height = 0 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() window_width, window_height = window_instance.window.get_size()
self.plugin.roster.popups_height += window_height self.plugin.roster.popups_height += window_height
window_instance.window.move(gtk.gdk.screen_width() - window_width, \ window_instance.window.move(gtk.gdk.screen_width() - window_width, \
gtk.gdk.screen_height() - self.plugin.roster.popups_height) 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 # use User class, new_chat expects it that way
# is it in the roster? # is it in the roster?
if self.plugin.roster.contacts[self.account].has_key(self.jid): 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.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].active_tab(self.jid)
self.plugin.windows[self.account]['chats'][self.jid].window.present() 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 elif gajim.connections[account].connected in (2, 3): #online or chat
show_notification = True show_notification = True
if show_notification: if show_notification:
instance = dialogs.Popup_window(self, 'Contact Online', jid, \ instance = dialogs.Popup_notification_window(self,
account) 'Contact Online', jid, account)
self.roster.popup_windows.append(instance) self.roster.popup_notification_windows.append(instance)
elif old_show > 1 and new_show < 2 and gajim.config.get_per( \ elif old_show > 1 and new_show < 2 and gajim.config.get_per( \
'soundevents', 'contact_disconnected', 'enabled'): 'soundevents', 'contact_disconnected', 'enabled'):
@ -255,9 +255,9 @@ class Interface:
elif gajim.connections[account].connected in (2, 3): #online or chat elif gajim.connections[account].connected in (2, 3): #online or chat
show_notification = True show_notification = True
if show_notification: if show_notification:
instance = dialogs.Popup_window(self, 'Contact Offline', jid, \ instance = dialogs.Popup_notification_window(self,
account) 'Contact Offline', jid, account)
self.roster.popup_windows.append(instance) self.roster.popup_notification_windows.append(instance)
elif self.windows[account]['gc'].has_key(ji): elif self.windows[account]['gc'].has_key(ji):
#it is a groupchat presence #it is a groupchat presence
@ -286,8 +286,9 @@ class Interface:
elif gajim.connections[account].connected in (2, 3): #online or chat elif gajim.connections[account].connected in (2, 3): #online or chat
show_notification = True show_notification = True
if show_notification: if show_notification:
instance = dialogs.Popup_window(self, 'New Message', jid, account) instance = dialogs.Popup_notification_window(self,
self.roster.popup_windows.append(instance) 'New Message', jid, account)
self.roster.popup_notification_windows.append(instance)
self.roster.on_message(jid, array[1], array[2], account) self.roster.on_message(jid, array[1], array[2], account)
if gajim.config.get_per('soundevents', 'first_message_received', \ if gajim.config.get_per('soundevents', 'first_message_received', \
'enabled') and first: 'enabled') and first:

View file

@ -8129,6 +8129,7 @@ Custom</property>
<widget class="GtkScrolledWindow" id="conversation_scrolledwindow"> <widget class="GtkScrolledWindow" id="conversation_scrolledwindow">
<property name="width_request">200</property> <property name="width_request">200</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property> <property name="shadow_type">GTK_SHADOW_IN</property>
@ -8137,6 +8138,7 @@ Custom</property>
<child> <child>
<widget class="GtkTextView" id="conversation_textview"> <widget class="GtkTextView" id="conversation_textview">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property> <property name="editable">False</property>
<property name="overwrite">False</property> <property name="overwrite">False</property>
<property name="accepts_tab">True</property> <property name="accepts_tab">True</property>
@ -8172,6 +8174,7 @@ Custom</property>
<widget class="GtkScrolledWindow" id="scrolledwindow19"> <widget class="GtkScrolledWindow" id="scrolledwindow19">
<property name="height_request">55</property> <property name="height_request">55</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property> <property name="shadow_type">GTK_SHADOW_IN</property>
@ -8181,7 +8184,6 @@ Custom</property>
<widget class="GtkTextView" id="message_textview"> <widget class="GtkTextView" id="message_textview">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="editable">True</property> <property name="editable">True</property>
<property name="overwrite">False</property> <property name="overwrite">False</property>
<property name="accepts_tab">False</property> <property name="accepts_tab">False</property>
@ -10202,7 +10204,7 @@ send a chat message to</property>
</child> </child>
</widget> </widget>
<widget class="GtkWindow" id="popup_window"> <widget class="GtkWindow" id="popup_notification_window">
<property name="border_width">4</property> <property name="border_width">4</property>
<property name="title" translatable="yes"></property> <property name="title" translatable="yes"></property>
<property name="type">GTK_WINDOW_POPUP</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="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_SOUTH_EAST</property> <property name="gravity">GDK_GRAVITY_SOUTH_EAST</property>
<property name="focus_on_map">True</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> <child>
<widget class="GtkEventBox" id="eventbox"> <widget class="GtkEventBox" id="eventbox">