From a52596266cc7eb17fc40b3a830b80281001761b6 Mon Sep 17 00:00:00 2001 From: Travis Shirk Date: Fri, 30 Dec 2005 21:37:36 +0000 Subject: [PATCH] Merged trunk --- README | 2 + debian/changelog | 6 +- debian/control | 5 +- gajim.iss | 2 +- launch.bat | 2 + src/cell_renderer_image.py | 2 + src/common/config.py | 3 +- src/common/gajim.py | 2 +- src/common/helpers.py | 12 ++ src/dialogs.py | 3 +- src/gajim-remote.py | 8 +- src/gtkgui.glade | 220 ++++++++++++++++++++++++------------- src/gtkgui_helpers.py | 3 +- src/notify.py | 3 +- src/remote_control.py | 16 +++ 15 files changed, 200 insertions(+), 89 deletions(-) create mode 100644 launch.bat diff --git a/README b/README index 0a9b90086..02116896a 100644 --- a/README +++ b/README @@ -25,6 +25,8 @@ Optionally: dnspython or pydns for SRV support; if you don't know what that is, you don't need it gtkspell and aspell-LANG where lang is your locale eg. en, fr etc GnomePythonExtras 2.10 or above so you can avoid compiling trayicon and gtkspell +notification-daemon (and D-Bus) to get cooler popups +D-Bus to have gajim-remote working NOTE TO PACKAGERS: Gajim is a GTK+ app and not a gnome one. Just do 'make' so you don't require gnomepythonextras diff --git a/debian/changelog b/debian/changelog index 09ef7781f..942dcd1e7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,9 +4,9 @@ gajim (0.9.1-1) unstable; urgency=low * Gajim now reconnects when connection is lost Closes: #329376 * Status-changer widget's behaviour has been improved Closes: #340499 * Gajim now recommends python-dns Closes: #340492 - * new russion translation Closes: #337971 - * Gajim now depends on python-pysqlite2, recommands python-dbus, and - suggests python-gnome2 + * new russian translation Closes: #337971 + * Gajim now depends on python-pysqlite2, recommends python-dbus and + notification-daemon, and suggests python-gnome2 -- Yann Le Boulanger Fri, 27 Dec 2005 01:20:54 +0100 diff --git a/debian/control b/debian/control index 4246b238a..b280da754 100644 --- a/debian/control +++ b/debian/control @@ -8,8 +8,9 @@ Standards-Version: 3.6.2 Package: gajim Architecture: any Depends: ${shlibs:Depends}, python (>= 2.3), python-glade2 (>= 2.6.0), python-gtk2 (>= 2.6.0), python-pysqlite2 -Recommends: python-dns, python2.3-dbus | python2.4-dbus +Recommends: python-dns, python2.4-dbus | python2.3-dbus, notification-daemon Suggests: python-gnupginterface, python-gnome2 Description: Jabber client written in PyGTK Gajim is a jabber client written in python, with a GTK frontend. It supports - tabbed chat, MUC, systray icon, TLS, GPG, SSL, multiple accounts, ... + tabbed chat, MUC, systray icon, TLS, GPG, SSL, multiple accounts, avatars, + file transfert, transports, DBus. diff --git a/gajim.iss b/gajim.iss index 30ff55aa6..3307ef2db 100644 --- a/gajim.iss +++ b/gajim.iss @@ -1,6 +1,6 @@ [Setup] AppName=Gajim -AppVerName=Gajim version 0.9.1 +AppVerName=Gajim version 0.10 DefaultDirName={pf}\Gajim DefaultGroupName=Gajim UninstallDisplayIcon={app}\src\Gajim.exe diff --git a/launch.bat b/launch.bat new file mode 100644 index 000000000..d11c2115b --- /dev/null +++ b/launch.bat @@ -0,0 +1,2 @@ +cd src +gajim.py \ No newline at end of file diff --git a/src/cell_renderer_image.py b/src/cell_renderer_image.py index 21e7a9c02..2af7fd551 100644 --- a/src/cell_renderer_image.py +++ b/src/cell_renderer_image.py @@ -95,6 +95,8 @@ class CellRendererImage(gtk.GenericCellRenderer): pix = self.image.get_pixbuf() else: return + if draw_rect.x < 1: + return window.draw_pixbuf(widget.style.black_gc, pix, draw_rect.x - pix_rect.x, draw_rect.y - pix_rect.y, diff --git a/src/common/config.py b/src/common/config.py index 84c88d11d..dd894819a 100644 --- a/src/common/config.py +++ b/src/common/config.py @@ -172,7 +172,8 @@ class Config: 'restored_messages_color': [opt_str, 'grey'], 'hide_avatar_of_transport': [opt_bool, False], 'roster_window_skip_taskbar': [opt_bool, False], - # TODO: Need to decide Gajim default. methinks 'always' + 'use_urgency_hint': [opt_bool, True, _('If True and installed GTK+ and PyGTK versions are at least 2.8, make the window flash (the default behaviour in most Window Managers) when holding pending events.')], + 'notification_timeout': [opt_int, 5], 'one_message_window': [opt_str, 'never', _('Controls the window where new messages are placed.\n\'always\' - All messages are sent to a single window.\n\'never\' - All messages get their own window.\n\'peracct\' - Messages for each account are sent to a specific window.\n\'pertype\' - Each message type (e.g., chats vs. groupchats) are sent to a specific window. Note, changing this option requires restarting Gajim before the changes will take effect')], } diff --git a/src/common/gajim.py b/src/common/gajim.py index b8009fee8..3a57e3555 100644 --- a/src/common/gajim.py +++ b/src/common/gajim.py @@ -32,7 +32,7 @@ import config interface = None # The actual interface (the gtk one for the moment) -version = '0.9.1' +version = '0.10' config = config.Config() connections = {} verbose = False diff --git a/src/common/helpers.py b/src/common/helpers.py index eac8be05a..75fc10ef3 100644 --- a/src/common/helpers.py +++ b/src/common/helpers.py @@ -496,6 +496,18 @@ def get_global_show(): if connected > maxi: maxi = connected return gajim.SHOW_LIST[maxi] + +def get_global_status(): + maxi = 0 + for account in gajim.connections: + if not gajim.config.get_per('accounts', account, + 'sync_with_global_status'): + continue + connected = gajim.connections[account].connected + if connected > maxi: + maxi = connected + status = gajim.connections[account].status + return status def get_icon_name_to_show(contact, account = None): '''Get the icon name to show in online, away, requested, ...''' diff --git a/src/dialogs.py b/src/dialogs.py index 282f412f9..46063b0e6 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -898,7 +898,8 @@ class PopupNotificationWindow: xml.signal_autoconnect(self) self.window.show_all() - gobject.timeout_add(5000, self.on_timeout) + timeout = gajim.config.get('notification_timeout') * 1000 # make it ms + gobject.timeout_add(timeout, self.on_timeout) def on_close_button_clicked(self, widget): self.adjust_height_and_move_popup_notification_windows() diff --git a/src/gajim-remote.py b/src/gajim-remote.py index 9dbe566d1..cc22e2ca7 100755 --- a/src/gajim-remote.py +++ b/src/gajim-remote.py @@ -196,7 +196,13 @@ class GajimRemote: (_('account'), _(''), False) ] ], - + + 'get_status_message': [ + _('Returns current status message(the global one unless account is specified)'), + [ + (_('account'), _(''), False) + ] + ], } if self.argv_len < 2 or \ sys.argv[1] not in self.commands.keys(): # no args or bad args diff --git a/src/gtkgui.glade b/src/gtkgui.glade index b8776c1c3..d1d01feb3 100644 --- a/src/gtkgui.glade +++ b/src/gtkgui.glade @@ -9136,7 +9136,7 @@ Custom True True - True + False 0 @@ -12317,99 +12317,55 @@ Status message - - 6 + True False 6 - + True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - False - True - False - False - False - - - - - - 0 - True - True - - - - - - True - GTK_BUTTONBOX_START + False 6 - + True - True - True - gtk-add - True - GTK_RELIEF_NORMAL - True - + Emoticon set: + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + 0 + False + False + - + True - True - True - gtk-remove - True - GTK_RELIEF_NORMAL + Animated +Static + False True - - - - - - - True - True - True - _Set Image... - True - GTK_RELIEF_NORMAL - True - - - - - - - True - True - True - gtk-close - True - GTK_RELIEF_NORMAL - True - + + 0 + True + True + @@ -12418,6 +12374,116 @@ Status message True + + + + 6 + True + False + 6 + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + True + False + False + True + False + False + False + + + + + + 0 + True + True + + + + + + True + GTK_BUTTONBOX_START + 6 + + + + True + True + True + gtk-add + True + GTK_RELIEF_NORMAL + True + + + + + + + True + True + True + gtk-remove + True + GTK_RELIEF_NORMAL + True + + + + + + + True + True + True + _Set Image... + True + GTK_RELIEF_NORMAL + True + + + + + + + True + True + True + gtk-close + True + GTK_RELIEF_NORMAL + True + + + + + + 0 + False + True + + + + + 0 + True + True + + diff --git a/src/gtkgui_helpers.py b/src/gtkgui_helpers.py index 0df2aa43e..e2c3b7625 100644 --- a/src/gtkgui_helpers.py +++ b/src/gtkgui_helpers.py @@ -264,7 +264,8 @@ def parse_server_xml(path_to_file): def set_unset_urgency_hint(window, unread_messages_no): '''sets/unsets urgency hint in window argument depending if we have unread messages or not''' - if gtk.gtk_version >= (2, 8, 0) and gtk.pygtk_version >= (2, 8, 0): + if gtk.gtk_version >= (2, 8, 0) and gtk.pygtk_version >= (2, 8, 0) and \ + gajim.config.get('use_urgency_hint'): if unread_messages_no > 0: window.props.urgency_hint = True else: diff --git a/src/notify.py b/src/notify.py index 167586d91..5947af905 100644 --- a/src/notify.py +++ b/src/notify.py @@ -189,10 +189,11 @@ class DesktopNotification: self.notif = dbus_support.get_notifications_interface() if self.notif is None: raise dbus.dbus_bindings.DBusException() + timeout = gajim.config.get('notification_timeout') # in seconds self.id = self.notif.Notify(dbus.String(_('Gajim')), dbus.String(path), dbus.UInt32(0), ntype, dbus.Byte(0), dbus.String(event_type), dbus.String(txt), - [dbus.String(path)], {'default':0}, [''], True, dbus.UInt32(5)) + [dbus.String(path)], {'default': 0}, [''], True, dbus.UInt32(timeout)) notification_response_manager.attach_to_interface() notification_response_manager.pending[self.id] = self diff --git a/src/remote_control.py b/src/remote_control.py index d1ddcce0c..e6bb2a777 100644 --- a/src/remote_control.py +++ b/src/remote_control.py @@ -107,6 +107,7 @@ class SignalObject(DbusPrototype): self.add_contact, self.remove_contact, self.get_status, + self.get_status_message, ]) def raise_signal(self, signal, arg): @@ -137,6 +138,20 @@ class SignalObject(DbusPrototype): # return show for the given account index = gajim.connections[account].connected return STATUS_LIST[index] + + def get_status_message(self, *args): + '''get_status(account = None) + returns status which is the global one + unless account is given''' + account = self._get_real_arguments(args, 1)[0] + accounts = gajim.contacts.keys() + if not account: + # If user did not ask for account, returns the global status + return str(helpers.get_global_status()) + # return show for the given account + status = gajim.connections[account].status + return str(status) + def send_file(self, *args): '''send_file(file_path, jid, account=None) @@ -488,3 +503,4 @@ class SignalObject(DbusPrototype): remove_contact = method(INTERFACE)(remove_contact) add_contact = method(INTERFACE)(add_contact) get_status = method(INTERFACE)(get_status) + get_status_message = method(INTERFACE)(get_status_message)