basically popup notifications allow when not online/chat works. so popup notifications I think are 100% ready :P. some other fixes too

This commit is contained in:
Nikos Kouremenos 2005-04-18 23:55:13 +00:00
parent 5a910155c8
commit c3440cae35
6 changed files with 70 additions and 27 deletions

View File

@ -257,7 +257,7 @@ class Config:
return None
return self.__options[optname][OPT_VAL]
def add_per(self, typename, name):
def add_per(self, typename, name): # per_group_of_option
if not self.__options_per_key.has_key(typename):
# print 'error: option %s doesn\'t exist' % (typename)
return -1
@ -266,7 +266,7 @@ class Config:
opt[1][name] = copy.deepcopy(opt[0])
def del_per(self, typename, name):
def del_per(self, typename, name): # per_group_of_option
if not self.__options_per_key.has_key(typename):
# print 'error: option %s doesn\'t exist' % (typename)
return -1
@ -274,7 +274,7 @@ class Config:
opt = self.__options_per_key[typename]
del opt[1][name]
def set_per(self, optname, key, subname, value):
def set_per(self, optname, key, subname, value): # per_group_of_option
if not self.__options_per_key.has_key(optname):
# print 'error: option %s doesn\'t exist' % (optname)
return -1
@ -290,7 +290,7 @@ class Config:
subobj[OPT_VAL] = value
return 0
def get_per(self, optname, key = None, subname = None):
def get_per(self, optname, key = None, subname = None): # per_group_of_option
if not self.__options_per_key.has_key(optname):
return None
dict = self.__options_per_key[optname][1]

View File

@ -231,18 +231,33 @@ class Interface:
if not self.windows[account]['chats'].has_key(jid) and \
not self.queues[account].has_key(jid) and \
gajim.config.get('notify_on_online'):
instance = dialogs.Popup_window(self, 'Contact Online', jid, \
account)
self.roster.popup_windows.append(instance)
show_notification = False
# check OUR status and if we allow notifications for that status
if gajim.config.get('autopopupaway'): # always notify
show_notification = True
elif gajim.connections[account].connected in (1, 2): #online or chat
show_notification = True
if show_notification:
instance = dialogs.Popup_window(self, 'Contact Online', jid, \
account)
self.roster.popup_windows.append(instance)
elif old_show > 1 and new_show < 2 and gajim.config.get_per( \
'soundevents', 'contact_disconnected', 'enabled'):
self.play_sound('contact_disconnected')
if not self.windows[account]['chats'].has_key(jid) and \
not self.queues[account].has_key(jid) and \
gajim.config.get('notify_on_offline'):
instance = dialogs.Popup_window(self, 'Contact Offline', jid, \
account)
self.roster.popup_windows.append(instance)
show_notification = False
# check OUR status and if we allow notifications for that status
if gajim.config.get('autopopupaway'): # always notify
show_notification = True
elif gajim.connections[account].connected in (1, 2): #online or chat
show_notification = True
if show_notification:
instance = dialogs.Popup_window(self, 'Contact Offline', jid, \
account)
self.roster.popup_windows.append(instance)
elif self.windows[account]['gc'].has_key(ji):
#it is a groupchat presence
@ -264,8 +279,15 @@ class Interface:
not self.queues[account].has_key(jid):
first = True
if gajim.config.get('notify_on_new_message'):
instance = dialogs.Popup_window(self, 'New Message', jid, account)
self.roster.popup_windows.append(instance)
show_notification = False
# check OUR status and if we allow notifications for that status
if gajim.config.get('autopopupaway'): # always show notification
show_notification = True
elif gajim.connections[account].connected in (1, 2): #online or chat
show_notification = True
if show_notification:
instance = dialogs.Popup_window(self, 'New Message', jid, account)
self.roster.popup_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

@ -2828,7 +2828,7 @@
<widget class="GtkWindow" id="preferences_window">
<property name="border_width">4</property>
<property name="width_request">460</property>
<property name="width_request">465</property>
<property name="height_request">410</property>
<property name="title" translatable="yes">Preferences</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
@ -10026,6 +10026,21 @@ send a chat message to</property>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="free_for_chat_menuitem">
<property name="visible">True</property>
<property name="label" translatable="yes">Free for chat</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_free_for_chat_menuitem_activate" last_modification_time="Mon, 18 Apr 2005 22:28:10 GMT"/>
</widget>
</child>
<child>
<widget class="GtkSeparatorMenuItem" id="separator5">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="away_menuitem">
<property name="visible">True</property>
@ -10047,7 +10062,7 @@ send a chat message to</property>
<child>
<widget class="GtkMenuItem" id="dnd_menuitem">
<property name="visible">True</property>
<property name="label" translatable="yes">DND</property>
<property name="label" translatable="yes">Busy</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_dnd_menuitem_activate" last_modification_time="Tue, 15 Mar 2005 00:15:28 GMT"/>
</widget>
@ -10096,7 +10111,7 @@ send a chat message to</property>
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image473">
<widget class="GtkImage" id="image497">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>

View File

@ -552,13 +552,16 @@ class Roster_window:
item = gtk.MenuItem(_('Online'))
sub_menu.append(item)
item.connect('activate', self.change_status, account, 'online')
item = gtk.MenuItem(_('Free for chat'))
sub_menu.append(item)
item.connect('activate', self.change_status, account, 'chat')
item = gtk.MenuItem(_('Away'))
sub_menu.append(item)
item.connect('activate', self.change_status, account, 'away')
item = gtk.MenuItem(_('NA'))
item = gtk.MenuItem(_('XA'))
sub_menu.append(item)
item.connect('activate', self.change_status, account, 'xa')
item = gtk.MenuItem(_('DND'))
item = gtk.MenuItem(_('Busy'))
sub_menu.append(item)
item.connect('activate', self.change_status, account, 'dnd')
item = gtk.MenuItem(_('Invisible'))
@ -1010,11 +1013,11 @@ class Roster_window:
recent = True
break
if unread:
dialog = dialogs.Confirmation_dialog(_('You have unread messages, do you still want to quit Gajim ?'))
dialog = dialogs.Confirmation_dialog(_('You have unread messages.\nAre you sure you want to quit Gajim?'))
if dialog.get_response() != gtk.RESPONSE_YES:
return
if recent:
dialog = dialogs.Confirmation_dialog(_('You received a message in the last two seconds. Do you still want to quit Gajim ?'))
dialog = dialogs.Confirmation_dialog(_('You received a message in the last two seconds.\nAre you sure you want to quit Gajim?'))
if dialog.get_response() != gtk.RESPONSE_YES:
return
get_msg = False
@ -1409,7 +1412,7 @@ class Roster_window:
iter = liststore.append([status_better, self.pixbufs[status], status])
self.status_combobox.show_all()
self.status_combobox.set_model(liststore)
self.status_combobox.set_active(5)
self.status_combobox.set_active(6) # default to offline
showOffline = gajim.config.get('showoffline')
self.xml.get_widget('show_offline_contacts_menuitem').set_active(showOffline)

View File

@ -213,21 +213,24 @@ class Systray:
def on_online_menuitem_activate(self, widget):
self.plugin.roster.status_combobox.set_active(0) # 0 is online
def on_free_for_chat_menuitem_activate(self, widget):
self.plugin.roster.status_combobox.set_active(0) # 1 is free for chat
def on_away_menuitem_activate(self, widget):
self.plugin.roster.status_combobox.set_active(1) # 1 is away
self.plugin.roster.status_combobox.set_active(1) # 2 is away
def on_xa_menuitem_activate(self, widget):
self.plugin.roster.status_combobox.set_active(2) # 2 is xa
self.plugin.roster.status_combobox.set_active(2) # 3 is xa
def on_dnd_menuitem_activate(self, widget):
self.plugin.roster.status_combobox.set_active(3) # 3 is dnd
self.plugin.roster.status_combobox.set_active(3) # 4 is dnd
def on_invisible_menuitem_activate(self, widget):
self.plugin.roster.status_combobox.set_active(4) # 4 is invisible
self.plugin.roster.status_combobox.set_active(4) # 5 is invisible
def on_offline_menuitem_activate(self, widget):
self.plugin.roster.status_combobox.set_active(5) # 5 is offline
self.plugin.roster.status_combobox.set_active(5) # 6 is offline
def show_icon(self):
if not self.t:

View File

@ -91,7 +91,7 @@ class Tabbed_chat_window(chat.Chat):
"""close window"""
for jid in self.users:
if time.time() - self.last_message_time[jid] < 2: # 2 seconds
dialog = dialogs.Confirmation_dialog(_('You received a message from %s in the last two seconds.\nDo you still want to close this window ?') % jid)
dialog = dialogs.Confirmation_dialog(_('You received a message from %s in the last two seconds.\nDo you still want to close this window?') % jid)
if dialog.get_response() != gtk.RESPONSE_YES:
return True #stop the propagation of the event