When we just received a message in a groupchat room and we close it Gajim asks if we really want to close it.

This commit is contained in:
Yann Leboulanger 2005-03-07 11:29:11 +00:00
parent d330521f4d
commit dbb665da60
2 changed files with 19 additions and 4 deletions

View File

@ -7010,9 +7010,9 @@ Custom</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<signal name="destroy" handler="on_groupchat_window_destroy" last_modification_time="Sat, 05 Mar 2005 00:34:45 GMT"/>
<signal name="focus_in_event" handler="on_groupchat_window_focus_in_event" last_modification_time="Sat, 05 Mar 2005 00:34:51 GMT"/>
<signal name="key_press_event" handler="on_groupchat_window_key_press_event" last_modification_time="Sat, 05 Mar 2005 10:57:33 GMT"/>
<signal name="delete_event" handler="on_groupchat_window_delete_event" last_modification_time="Mon, 07 Mar 2005 11:19:05 GMT"/>
<child>
<widget class="GtkVBox" id="vbox27">

View File

@ -620,8 +620,14 @@ class tabbed_chat_window:
self.show_title()
class Groupchat_window:
def on_groupchat_window_destroy(self, widget):
def on_groupchat_window_delete_event(self, widget):
"""close window"""
for room_jid in self.xmls:
if time.time() - self.last_message_time[room_jid] < 2:
dialog = Confirmation_dialog(_('You received a message in the room %s in the last two secondes.\nDo you still want to close this window ?') % \
room_jid.split('@')[0])
if dialog.get_response() != gtk.RESPONSE_YES:
return True #stop the propagation of the event
for room_jid in self.xmls:
self.plugin.send('GC_STATUS', self.account, (self.nicks[room_jid], \
room_jid, 'offline', 'offline'))
@ -914,6 +920,7 @@ class Groupchat_window:
tag = 'incoming_bold'
else:
tag = 'incoming'
self.last_message_time[room_jid] = time.time()
if text.startswith('/me'):
ttext = contact + text[3:] + '\n'
@ -1093,6 +1100,11 @@ class Groupchat_window:
self.xmls[room_jid].get_widget('message_textview').grab_focus()
def remove_tab(self, room_jid):
if time.time() - self.last_message_time[room_jid] < 2:
dialog = Confirmation_dialog(_('You received a message in the room %s in the last two secondes.\nDo you still want to close this tab ?') % \
room_jid.split('@')[0])
if dialog.get_response() != gtk.RESPONSE_YES:
return
if len(self.xmls) == 1:
self.window.destroy()
else:
@ -1102,6 +1114,7 @@ class Groupchat_window:
del self.plugin.windows[self.account]['gc'][room_jid]
del self.nicks[room_jid]
del self.nb_unread[room_jid]
del self.last_message_time[room_jid]
del self.xmls[room_jid]
del self.tagIn[room_jid]
del self.tagInBold[room_jid]
@ -1115,6 +1128,7 @@ class Groupchat_window:
def new_group(self, room_jid, nick):
self.nb_unread[room_jid] = 0
self.last_message_time[room_jid] = 0
self.nicks[room_jid] = nick
self.subjects[room_jid] = ''
self.xmls[room_jid] = gtk.glade.XML(GTKGUI_GLADE, 'group_vbox', APP)
@ -1235,13 +1249,14 @@ class Groupchat_window:
self.tagStatus = {}
self.nicks = {}
self.nb_unread = {}
self.last_message_time = {}
self.list_treeview = {}
self.subjects = {}
self.window = self.xml.get_widget('groupchat_window')
self.new_group(room_jid, nick)
self.show_title()
self.xml.signal_connect('on_groupchat_window_destroy', \
self.on_groupchat_window_destroy)
self.xml.signal_connect('on_groupchat_window_delete_event', \
self.on_groupchat_window_delete_event)
self.xml.signal_connect('on_groupchat_window_focus_in_event', \
self.on_groupchat_window_focus_in_event)
self.xml.signal_connect('on_groupchat_window_key_press_event', \