diff --git a/src/chat.py b/src/chat.py index 6d8b7e7ff..bb92ec156 100644 --- a/src/chat.py +++ b/src/chat.py @@ -49,7 +49,7 @@ class Chat: self.nb_unread = {} self.last_message_time = {} self.print_time_timeout_id = {} - self.names = {} # what is printed in the tab : user.name for example + self.names = {} # what is printed in the tab (eg. user.name) self.childs = {} self.window = self.xml.get_widget(widget_name) self.widget_name = widget_name diff --git a/src/common/config.py b/src/common/config.py index 578e0ef9f..d8481ac8e 100644 --- a/src/common/config.py +++ b/src/common/config.py @@ -38,6 +38,9 @@ class Config: 'delroster': [ opt_bool, True ], 'alwaysauth': [ opt_bool, False ], 'autopopup': [ opt_bool, False ], + 'notify_on_online': [ opt_bool, True ], + 'notify_on_offline': [ opt_bool, False ], + 'notify_on_new_message': [ opt_bool, False ], 'autopopupaway': [ opt_bool, False ], 'ignore_unknown_contacts': [ opt_bool, False ], 'showoffline': [ opt_bool, False ], diff --git a/src/common/connection.py b/src/common/connection.py index 0cbb05e50..247003364 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -57,8 +57,17 @@ distro_info = { } def get_os_info(): - if os.name =='nt': - return 'windows' + if os.name == 'nt': + win_version = {(1, 4, 0): '95',\ + (1, 4, 10): '98',\ + (1, 4, 90): 'ME',\ + (2, 4, 0): 'NT',\ + (2, 5, 0): '2000',\ + (2, 5, 1): 'XP' + }[ os.sys.getwindowsversion()[3],\ + os.sys.getwindowsversion()[0],\ + os.sys.getwindowsversion()[1] ] + return 'Windows' + ' ' + win_version elif os.name =='posix': executable = 'lsb_release' params = ' --id --codename --release --short' diff --git a/src/config.py b/src/config.py index 353a4f615..89f99736a 100644 --- a/src/config.py +++ b/src/config.py @@ -363,10 +363,24 @@ class Preferences_window: else: window.show_all() - def on_auto_popup_checkbutton_toggled(self, widget): + def on_notify_on_new_message_radiobutton_toggled(self, widget): + self.on_checkbutton_toggled(widget, 'notify_on_new_message', \ + [self.auto_popup_away_checkbutton]) + + def on_popup_new_message_radiobutton_toggled(self, widget): self.on_checkbutton_toggled(widget, 'autopopup', \ [self.auto_popup_away_checkbutton]) + def on_only_in_roster_radiobutton_toggled(self, widget): + if widget.get_active(): + self.auto_popup_away_checkbutton.set_sensitive(False) + + def on_notify_on_online_checkbutton_toggled(self, widget): + self.on_checkbutton_toggled(widget, 'notify_on_online') + + def on_notify_on_offline_checkbutton_toggled(self, widget): + self.on_checkbutton_toggled(widget, 'notify_on_offline') + def on_auto_popup_away_checkbutton_toggled(self, widget): self.on_checkbutton_toggled(widget, 'autopopupaway') @@ -596,7 +610,14 @@ class Preferences_window: self.window = self.xml.get_widget('preferences_window') self.plugin = plugin self.iconset_combobox = self.xml.get_widget('iconset_combobox') - self.auto_popup_checkbutton = self.xml.get_widget('auto_popup_checkbutton') + self.notify_on_new_message_radiobutton = self.xml.get_widget \ + ('notify_on_new_message_radiobutton') + self.popup_new_message_radiobutton = self.xml.get_widget \ + ('popup_new_message_radiobutton') + self.notify_on_online_checkbutton = self.xml.get_widget \ + ('notify_on_online_checkbutton') + self.notify_on_offline_checkbutton = self.xml.get_widget \ + ('notify_on_offline_checkbutton') self.auto_popup_away_checkbutton = self.xml.get_widget \ ('auto_popup_away_checkbutton') self.auto_away_checkbutton = self.xml.get_widget('auto_away_checkbutton') @@ -728,15 +749,25 @@ class Preferences_window: self.xml.get_widget('use_emoticons_checkbutton').set_active(st) self.xml.get_widget('add_remove_emoticons_button').set_sensitive(st) + #notify on new message + st = gajim.config.get('notify_on_new_message') + self.notify_on_new_message_radiobutton.set_active(st) + #autopopup st = gajim.config.get('autopopup') - self.auto_popup_checkbutton.set_active(st) + self.notify_on_online_checkbutton.set_active(st) + + #notify on online statuses + st = gajim.config.get('notify_on_online') + self.notify_on_online_checkbutton.set_active(st) + + #notify on offline statuses + st = gajim.config.get('notify_on_offline') + self.notify_on_offline_checkbutton.set_active(st) #autopopupaway st = gajim.config.get('autopopupaway') self.auto_popup_away_checkbutton.set_active(st) - self.auto_popup_away_checkbutton.set_sensitive(gajim.config.get(\ - 'autopopup')) #Ignore messages from unknown contacts self.xml.get_widget('ignore_events_from_unknown_contacts_checkbutton').\ diff --git a/src/gtkgui.glade b/src/gtkgui.glade index e23d5e39c..cb92d747b 100644 --- a/src/gtkgui.glade +++ b/src/gtkgui.glade @@ -4287,14 +4287,14 @@ 5 - + True 0 0.5 GTK_SHADOW_ETCHED_IN - + True 0.5 0.5 @@ -4306,24 +4306,128 @@ 0 - + True False 0 - + + 2 True - If checked, Gajim will automatically show the new received message in a new chat window or tab in an existing chat window. If not checked, Gajim will notify you for new message via popups in the bottom right of the screen - True - Automatically _popup new message - True - GTK_RELIEF_NORMAL - True - False - False - True - + 0 + 0.5 + GTK_SHADOW_ETCHED_IN + + + + True + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 12 + 0 + + + + True + False + 5 + + + + True + Gajim will notify you for new message via a popup in the bottom right of the screen + True + _Notify me about it + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + 0 + False + False + + + + + + True + Gajim will automatically show the new received message in a new chat window or tab in an existing chat window + True + _Pop it up + True + GTK_RELIEF_NORMAL + True + False + False + True + notify_on_new_message_radiobutton + + + + 0 + False + False + + + + + + True + Gajim will only change the icon of the contact that sent the new message + True + Show only in _roster + True + GTK_RELIEF_NORMAL + True + False + False + True + notify_on_new_message_radiobutton + + + + 0 + False + False + + + + + + + + + + True + When new chat nessage is received + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + label_item + + 0 @@ -4332,11 +4436,91 @@ + + + True + False + 5 + + + + True + Notify me about contacts going: + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + True + Gajim will notify you via a popup window in the bottom right of the screen about contacts that just went online + True + _Online + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + 0 + False + False + + + + + + True + Gajim will notify you via a popup window in the bottom right of the screen about contacts that just went offline + True + Of_fline + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + 0 + False + False + + + + + 0 + False + True + + + True True - Allow automatically popup new message when _away/DND + Allow popup/notifications even when I'm _away/busy True GTK_RELIEF_NORMAL True @@ -4357,9 +4541,9 @@ - + True - <b>When new chat nessage is received</b> + <b>Notifications</b> False True GTK_JUSTIFY_LEFT @@ -4390,7 +4574,7 @@ True True - _Ignore events from contacts not in your roster + _Ignore events from contacts not in the roster True GTK_RELIEF_NORMAL True @@ -4717,7 +4901,7 @@ True True - Auto _away after + Auto _away after: True GTK_RELIEF_NORMAL True @@ -4740,7 +4924,7 @@ True True - Auto e_Xtended Away after + Auto e_Xtended Away after: True GTK_RELIEF_NORMAL True @@ -5621,7 +5805,7 @@ Custom True 0 0.5 - GTK_SHADOW_NONE + GTK_SHADOW_IN @@ -10049,7 +10233,7 @@ send a chat message to - 5 + 4 300 350 Add/Remove Emoticons @@ -10172,4 +10356,168 @@ send a chat message to + + 4 + 490 + 250 + New version of Gajim available + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + False + True + False + False + GDK_WINDOW_TYPE_HINT_DIALOG + GDK_GRAVITY_NORTH_WEST + True + False + + + + + True + False + 5 + + + + True + GTK_BUTTONBOX_END + + + + True + True + True + True + True + Open Download Page + True + GTK_RELIEF_NORMAL + True + 0 + + + + + + 0 + False + True + GTK_PACK_END + + + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + 6 + True + 0 + 0.5 + GTK_SHADOW_ETCHED_IN + + + + True + 0.5 + 0.5 + 1 + 1 + 5 + 5 + 5 + 5 + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + True + False + False + True + GTK_JUSTIFY_LEFT + GTK_WRAP_WORD + False + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + + + True + <b>Changes in latest version</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + label_item + + + + + 0 + True + True + + + + + + diff --git a/src/gtkgui.py b/src/gtkgui.py index f215a3f96..f64812493 100644 --- a/src/gtkgui.py +++ b/src/gtkgui.py @@ -27,6 +27,7 @@ import os import sre from common import gajim import common.sleepy +import common.check_for_new_version from common import i18n i18n.init() @@ -317,16 +318,8 @@ class interface: 'soundevents', 'contact_connected', 'enabled'): self.play_sound('contact_connected') if not self.windows[account]['chats'].has_key(jid) and \ - not self.queues[account].has_key(jid) and not gajim.config.get( \ - 'autopopup'): - #FIXME: - #DOES NOT ALWAYS WORK WHY? - #I control nkour@lagaule in jabber - # have nkour@lagaul in nkour@jabber.org - #go online from psi in lagaule - #gajim doesn't give a shit - # WHY? same with offline - # new message works + 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) @@ -334,8 +327,8 @@ class interface: '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 not gajim.config.get( \ - 'autopopup'): + 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) @@ -359,7 +352,7 @@ class interface: if not self.windows[account]['chats'].has_key(jid) and \ not self.queues[account].has_key(jid): first = True - if not gajim.config.get('autopopup'): + if gajim.config.get('notify_on_new_message'): 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) @@ -741,6 +734,8 @@ class interface: if self.systray_capabilities: self.show_systray() + common.check_for_new_version.Check_for_new_version_dialog(self) + self.init_regexp() # get instances for windows/dialogs that will show_all()/hide()