From e1ae6ea0fe2eb51b7a76d5b97061231cfe9d6704 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Sun, 25 Jan 2009 09:19:24 +0000 Subject: [PATCH] ability to hide systray icon when there is no pending events. Fixes #4645 --- configure.ac | 2 +- data/glade/preferences_window.glade | 946 ++++++++++++++-------------- src/common/config.py | 4 +- src/common/defs.py | 2 +- src/common/optparser.py | 14 +- src/config.py | 18 + src/gajim.py | 2 +- src/systray.py | 4 + 8 files changed, 528 insertions(+), 464 deletions(-) diff --git a/configure.ac b/configure.ac index 2fc9f54ce..b181a97d2 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_INIT([Gajim - A Jabber Instant Messager], - [0.12.0.1-svn],[http://trac.gajim.org/],[gajim]) + [0.12.1.1-svn],[http://trac.gajim.org/],[gajim]) AC_PREREQ([2.59]) AC_CONFIG_HEADER(config.h) diff --git a/data/glade/preferences_window.glade b/data/glade/preferences_window.glade index 127186201..ca87fb540 100644 --- a/data/glade/preferences_window.glade +++ b/data/glade/preferences_window.glade @@ -211,62 +211,37 @@ 6 6 - + + 50 True - 0 - 1 - _Window behavior: - True - one_window_type_combobox - - - 1 - 2 - GTK_FILL - - - - - True - + Detached roster with detached chats +Detached roster with single chat +Single window for everything +Detached roster with chat grouped by account +Detached roster with chat grouped by type + 1 2 + 1 + 2 - - True - If not disabled, Gajim will replace ascii smilies like ':)' with equivalent animated or static graphical emoticons - - - True - 0 - 1 - _Emoticons: - True - - - - - GTK_FILL - - - - + True - Hide all buttons in chat windows - Ma_ke message windows compact + If checked, Gajim will highlight spelling errors in input fields of chat windows. If no language is explicitly set via right click on the input field, the default language will be used for this contact or group chat. + _Highlight misspelled words True 0 True - + 2 - 2 - 3 + 4 + 5 GTK_FILL @@ -289,38 +264,63 @@ - + True - If checked, Gajim will highlight spelling errors in input fields of chat windows. If no language is explicitly set via right click on the input field, the default language will be used for this contact or group chat. - _Highlight misspelled words + Hide all buttons in chat windows + Ma_ke message windows compact True 0 True - + 2 - 4 - 5 + 2 + 3 GTK_FILL - - 50 + True - Detached roster with detached chats -Detached roster with single chat -Single window for everything -Detached roster with chat grouped by account -Detached roster with chat grouped by type - + If not disabled, Gajim will replace ascii smilies like ':)' with equivalent animated or static graphical emoticons + + + True + 0 + 1 + _Emoticons: + True + + + + + GTK_FILL + + + + + True + 1 2 + + + + + True + 0 + 1 + _Window behavior: + True + one_window_type_combobox + + 1 2 + GTK_FILL @@ -523,6 +523,38 @@ Show only in roster 4 + + + True + 6 + + + True + Show systray: + + + False + + + + + True + Never +Only when pending events +Always + + + + False + 1 + + + + + False + 5 + + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK @@ -547,7 +579,7 @@ Show only in roster - 5 + 6 @@ -678,18 +710,33 @@ Show only in roster 6 6 - + True All chat states Composing only Disabled - + 1 2 - 1 - 2 + + + + + True + Gajim can send and receive meta-information related to a conversation you may have with a contact. Here you can specify which chatstates you want to send to the other party. + + + True + 0 + _Send chat state notifications: + True + + + + + GTK_FILL @@ -712,33 +759,18 @@ Disabled - - True - Gajim can send and receive meta-information related to a conversation you may have with a contact. Here you can specify which chatstates you want to send to the other party. - - - True - 0 - _Send chat state notifications: - True - - - - - GTK_FILL - - - - + True All chat states Composing only Disabled - + 1 2 + 1 + 2 @@ -802,90 +834,37 @@ Disabled 12 6 - + True True - If checked, Gajim will change status to Away when the computer is unused. - _Away after: - True - 0 - True - + The auto not available status message. If empty, Gajim will not change the current status message +$S will be replaced by previous status message +$T will be replaced by auto-not-available timeout + - GTK_FILL + 3 + 4 + 1 + 2 - + True True - If checked, Gajim will change status to Not Available when the computer has not been used even longer - _Not available after: - True - 0 - True - + The auto away status message. If empty, Gajim will not change the current status message +$S will be replaced by previous status message +$T will be replaced by auto-away timeout + - 1 - 2 - GTK_FILL + 3 + 4 - - - True - 0 - minutes - - - 2 - 3 - GTK_FILL - - - - - - True - 0 - minutes - - - 2 - 3 - 1 - 2 - GTK_FILL - - - - - - True - 1 - 0 - - - 50 - True - True - 12 1 720 1 10 10 - 1 - - - - - - 1 - 2 - GTK_FILL - GTK_FILL - - True @@ -912,34 +891,87 @@ Disabled - + True - True - The auto away status message. If empty, Gajim will not change the current status message -$S will be replaced by previous status message -$T will be replaced by auto-away timeout - + 1 + 0 + + + 50 + True + True + 12 1 720 1 10 10 + 1 + + + - 3 - 4 + 1 + 2 + GTK_FILL + GTK_FILL + + + + + True + 0 + minutes + + + 2 + 3 + 1 + 2 + GTK_FILL - + True - True - The auto not available status message. If empty, Gajim will not change the current status message -$S will be replaced by previous status message -$T will be replaced by auto-not-available timeout - + 0 + minutes + + + 2 + 3 + GTK_FILL + + + + + + True + True + If checked, Gajim will change status to Not Available when the computer has not been used even longer + _Not available after: + True + 0 + True + - 3 - 4 1 2 + GTK_FILL + + + + + + True + True + If checked, Gajim will change status to Away when the computer is unused. + _Away after: + True + 0 + True + + + + GTK_FILL @@ -1099,6 +1131,46 @@ $T will be replaced by auto-not-available timeout + + + True + True + GTK_POLICY_NEVER + GTK_POLICY_NEVER + GTK_SHADOW_IN + + + True + True + 3 + GTK_WRAP_WORD + + + + + 1 + 2 + GTK_FILL + + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + + + True + True + False + + + + + + True @@ -1137,46 +1209,6 @@ $T will be replaced by auto-not-available timeout GTK_FILL - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - - - True - True - False - - - - - - - - - True - True - GTK_POLICY_NEVER - GTK_POLICY_NEVER - GTK_SHADOW_IN - - - True - True - 3 - GTK_WRAP_WORD - - - - - 1 - 2 - GTK_FILL - - @@ -1239,15 +1271,14 @@ $T will be replaced by auto-not-available timeout - + True - True - 0 - + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Chat message: - 1 - 2 + GTK_FILL + GTK_FILL @@ -1268,14 +1299,15 @@ $T will be replaced by auto-not-available timeout - + True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Chat message: + True + 0 + - GTK_FILL - GTK_FILL + 1 + 2 @@ -1325,62 +1357,18 @@ $T will be replaced by auto-not-available timeout - - True - True - If checked, Gajim will use protocol-specific status icons. (eg. A contact from MSN will have the equivalent msn icon for status online, away, busy, etc...) - Use _transports icons - True - 0 - True - - - - 1 - 3 - 2 - 3 - - - - - True - - - - 1 - 2 - 1 - 2 - GTK_FILL - GTK_FILL - - - - + True 0 - Status _iconset: + T_heme: True - iconset_combobox + theme_combobox - 1 - 2 GTK_FILL GTK_FILL - - - True - - - - 1 - 2 - - True @@ -1399,18 +1387,62 @@ $T will be replaced by auto-not-available timeout - + True - 0 - T_heme: - True - theme_combobox + + 1 + 2 + + + + + True + 0 + Status _iconset: + True + iconset_combobox + + + 1 + 2 GTK_FILL GTK_FILL + + + True + + + + 1 + 2 + 1 + 2 + GTK_FILL + GTK_FILL + + + + + True + True + If checked, Gajim will use protocol-specific status icons. (eg. A contact from MSN will have the equivalent msn icon for status online, away, busy, etc...) + Use _transports icons + True + 0 + True + + + + 1 + 3 + 2 + 3 + + @@ -1449,135 +1481,6 @@ $T will be replaced by auto-not-available timeout 4 12 6 - - - True - 0 - _Incoming message: - True - GTK_JUSTIFY_CENTER - True - incoming_msg_colorbutton - - - GTK_FILL - - - - - - True - True - True - True - True - 0 - - - - 1 - 2 - - - - - - - True - 0 - _Outgoing message: - True - GTK_JUSTIFY_CENTER - True - outgoing_msg_colorbutton - - - 2 - 3 - GTK_FILL - - - - - - True - True - 0 - - - - 3 - 4 - GTK_FILL - - - - - - True - 0 - _Status message: - True - GTK_JUSTIFY_CENTER - True - status_msg_colorbutton - - - 1 - 2 - GTK_FILL - - - - - - True - True - 0 - - - - 1 - 2 - 1 - 2 - - - - - - - True - 0 - _URL highlight: - True - url_msg_colorbutton - - - 2 - 3 - 1 - 2 - GTK_FILL - - - - - - True - True - 0 - - - - 3 - 4 - 1 - 2 - GTK_FILL - - - True @@ -1646,6 +1549,135 @@ $T will be replaced by auto-not-available timeout GTK_FILL + + + True + True + 0 + + + + 3 + 4 + 1 + 2 + GTK_FILL + + + + + + True + 0 + _URL highlight: + True + url_msg_colorbutton + + + 2 + 3 + 1 + 2 + GTK_FILL + + + + + + True + True + 0 + + + + 1 + 2 + 1 + 2 + + + + + + + True + 0 + _Status message: + True + GTK_JUSTIFY_CENTER + True + status_msg_colorbutton + + + 1 + 2 + GTK_FILL + + + + + + True + True + 0 + + + + 3 + 4 + GTK_FILL + + + + + + True + 0 + _Outgoing message: + True + GTK_JUSTIFY_CENTER + True + outgoing_msg_colorbutton + + + 2 + 3 + GTK_FILL + + + + + + True + True + True + True + True + 0 + + + + 1 + 2 + + + + + + + True + 0 + _Incoming message: + True + GTK_JUSTIFY_CENTER + True + incoming_msg_colorbutton + + + GTK_FILL + + + @@ -1730,60 +1762,18 @@ Custom 12 6 - - True - True - - - - 1 - 2 - 2 - 3 - - - - - + True 0 - _File manager: + _Browser: True - custom_file_manager_entry + custom_browser_entry - 2 - 3 GTK_FILL - - - True - True - - - - 1 - 2 - - - - - - True - True - - - - 1 - 2 - 1 - 2 - - - True @@ -1800,18 +1790,60 @@ Custom - + True - 0 - _Browser: - True - custom_browser_entry + True + + 1 + 2 + 1 + 2 + + + + + + True + True + + + + 1 + 2 + + + + + + True + 0 + _File manager: + True + custom_file_manager_entry + + + 2 + 3 GTK_FILL + + + True + True + + + + 1 + 2 + 2 + 3 + + + @@ -1872,18 +1904,19 @@ Custom 6 6 - + True True - If checked, Gajim will ignore incoming events from unauthorized contacts. Use with caution, because it blocks all messages from any contact that is not in the roster - _Ignore events from contacts not in the roster + If checked, Gajim will keep logs for encrypted messages. Please note that when using E2E encryption the remote party has to agree on logging, else the messages will not be logged. + Log _encrypted chat session True 0 True - + - GTK_FILL + 2 + 3 @@ -1903,19 +1936,18 @@ Custom - + True True - If checked, Gajim will keep logs for encrypted messages. Please note that when using E2E encryption the remote party has to agree on logging, else the messages will not be logged. - Log _encrypted chat session + If checked, Gajim will ignore incoming events from unauthorized contacts. Use with caution, because it blocks all messages from any contact that is not in the roster + _Ignore events from contacts not in the roster True 0 True - + - 2 - 3 + GTK_FILL diff --git a/src/common/config.py b/src/common/config.py index aec84a6be..71112c9aa 100644 --- a/src/common/config.py +++ b/src/common/config.py @@ -98,7 +98,7 @@ class Config: 'last_status_msg_dnd': [ opt_str, '' ], 'last_status_msg_invisible': [ opt_str, '' ], 'last_status_msg_offline': [ opt_str, '' ], - 'trayicon': [ opt_bool, True, '', True ], + 'trayicon': [opt_str, 'always', _("When to show systray icon. Can be 'never', 'on_event', 'always'."), True], 'iconset': [ opt_str, DEFAULT_ICONSET, '', True ], 'mood_iconset': [ opt_str, DEFAULT_MOOD_ICONSET, '', True ], 'activity_iconset': [ opt_str, DEFAULT_ACTIVITY_ICONSET, '', True ], @@ -269,7 +269,7 @@ class Config: 'attach_notifications_to_systray': [opt_bool, False, _('If True, notification windows from notification-daemon will be attached to systray icon.')], 'check_idle_every_foo_seconds': [opt_int, 2, _('Choose interval between 2 checks of idleness.')], 'latex_png_dpi': [opt_str, '108',_('Change the value to change the size of latex formulas displayed. The higher is larger.') ], - 'uri_schemes': [opt_str, 'aaa aaas acap cap cid crid data dav dict dns fax file ftp go gopher h323 http https icap im imap info ipp iris iris.beep iris.xpc iris.xpcs iris.lwz ldap mid modem msrp msrps mtqp mupdate news nfs nntp opaquelocktoken pop pres rtsp service shttp sip sips snmp soap.beep soap.beeps tag tel telnet tftp thismessage tip tv urn vemmi xmlrpc.beep xmlrpc.beeps z39.50r z39.50s about cvs daap ed2k feed fish git iax2 irc ircs ldaps magnet mms rsync ssh svn sftp smb webcal', _('Valid uri schemes. Only schemes in this list will be accepted as "real" uri. (mailto and xmpp are handled seperately)')], + 'uri_schemes': [opt_str, 'aaa aaas acap cap cid crid data dav dict dns fax file ftp go gopher h323 http https icap im imap info ipp iris iris.beep iris.xpc iris.xpcs iris.lwz ldap mid modem msrp msrps mtqp mupdate news nfs nntp opaquelocktoken pop pres rtsp service shttp sip sips snmp soap.beep soap.beeps tag tel telnet tftp thismessage tip tv urn vemmi xmlrpc.beep xmlrpc.beeps z39.50r z39.50s about cvs daap ed2k feed fish git iax2 irc ircs ldaps magnet mms rsync ssh svn sftp smb webcal', _('Valid uri schemes. Only schemes in this list will be accepted as "real" uri. (mailto and xmpp are handled seperately)'), True], } __options_per_key = { diff --git a/src/common/defs.py b/src/common/defs.py index c34b925e1..03ecf5502 100644 --- a/src/common/defs.py +++ b/src/common/defs.py @@ -26,7 +26,7 @@ docdir = '../' datadir = '../' -version = '0.12.0.1-svn' +version = '0.12.1.1-svn' import sys, os.path for base in ('.', 'common'): diff --git a/src/common/optparser.py b/src/common/optparser.py index ce6b56d2f..b9dacc98e 100644 --- a/src/common/optparser.py +++ b/src/common/optparser.py @@ -187,6 +187,8 @@ class OptionsParser: self.update_config_to_01144() if old < [0, 12, 0, 1] and new >= [0, 12, 0, 1]: self.update_config_to_01201() + if old < [0, 12, 1, 1] and new >= [0, 12, 1, 1]: + self.update_config_to_01211() gajim.logger.init_vars() gajim.config.set('version', new_version) @@ -563,8 +565,8 @@ class OptionsParser: cur.executescript( ''' CREATE TABLE IF NOT EXISTS rooms_last_message_time( - jid_id INTEGER PRIMARY KEY UNIQUE, - time INTEGER + jid_id INTEGER PRIMARY KEY UNIQUE, + time INTEGER ); ''' ) @@ -607,5 +609,13 @@ class OptionsParser: replace(' xmpp', '') gajim.config.set('uri_schemes', new_values) gajim.config.set('version', '0.12.0.1') + + def update_config_to_01211(self): + if 'trayicon' in self.old_values: + if self.old_values['trayicon'] == 'False': + gajim.config.set('trayicon', 'never') + else: + gajim.config.set('trayicon', 'always') + gajim.config.set('version', '0.12.1.1') # vim: se ts=3: diff --git a/src/config.py b/src/config.py index 5eb92ee56..03f85cc8e 100644 --- a/src/config.py +++ b/src/config.py @@ -301,6 +301,15 @@ class PreferencesWindow: st = gajim.config.get('autopopupaway') self.auto_popup_away_checkbutton.set_active(st) + # Systray + systray_combobox = self.xml.get_widget('systray_combobox') + if gajim.config.get('trayicon') == 'never': + systray_combobox.set_active(0) + elif gajim.config.get('trayicon') == 'on_event': + systray_combobox.set_active(1) + else: + systray_combobox.set_active(2) + # sounds if gajim.config.get('sounds_on'): self.xml.get_widget('play_sounds_checkbutton').set_active(True) @@ -720,6 +729,15 @@ class PreferencesWindow: def on_auto_popup_away_checkbutton_toggled(self, widget): self.on_checkbutton_toggled(widget, 'autopopupaway') + def on_systray_combobox_changed(self, widget): + active = widget.get_active() + if active == 0: + gajim.config.set('trayicon', 'never') + elif active == 1: + gajim.config.set('trayicon', 'on_event') + else: + gajim.config.set('trayicon', 'always') + def on_advanced_notifications_button_clicked(self, widget): dialogs.AdvancedNotificationsWindow() diff --git a/src/gajim.py b/src/gajim.py index c0021a3ea..3909422c2 100644 --- a/src/gajim.py +++ b/src/gajim.py @@ -3265,7 +3265,7 @@ class Interface: if self.systray_capabilities: self.systray = systray.Systray() - if self.systray_capabilities and gajim.config.get('trayicon'): + if self.systray_capabilities and gajim.config.get('trayicon') != 'never': self.show_systray() path_to_file = os.path.join(gajim.DATA_DIR, 'pixmaps', 'gajim.png') diff --git a/src/systray.py b/src/systray.py index 84f2c887f..8d3bb08b1 100644 --- a/src/systray.py +++ b/src/systray.py @@ -99,6 +99,10 @@ class Systray: state = 'event' else: state = self.status + if state != 'event' and gajim.config.get('trayicon') == 'on_event': + self.t.hide() + else: + self.t.show() image = gajim.interface.jabber_state_images['16'][state] if image.get_storage_type() == gtk.IMAGE_ANIMATION: self.img_tray.set_from_animation(image.get_animation())