From a14c758d06e990899aa4cef299137ed4b9acb787 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Sun, 12 May 2013 21:32:29 +0200 Subject: [PATCH] - regroup display PEP info in roster options - add option to show positive XEP-0184 ack in message window. Fixes 7341 --- data/gui/preferences_window.ui | 125 +++++++++++---------------------- src/common/config.py | 1 + src/config.py | 47 +++++-------- src/conversation_textview.py | 31 +++++--- 4 files changed, 80 insertions(+), 124 deletions(-) diff --git a/data/gui/preferences_window.ui b/data/gui/preferences_window.ui index c0411072b..d5e3d9279 100644 --- a/data/gui/preferences_window.ui +++ b/data/gui/preferences_window.ui @@ -148,6 +148,24 @@ + + + + + + + + + + + + + + + + + + False 6 @@ -234,8 +252,8 @@ - - Display m_ood of contacts in roster + + Display e_xtra information of contacts in roster (mood, activity, ...)m_ood of contacts in roster False True True @@ -245,7 +263,7 @@ True 0 True - + False @@ -253,67 +271,6 @@ 2 - - - Display _activity of contacts in roster - False - True - True - False - If checked, Gajim will display the activity of contacts in the roster window - False - True - 0 - True - - - - False - False - 3 - - - - - Display _tunes of contacts in roster - False - True - True - False - If checked, Gajim will display the tunes of contacts in the roster window - False - True - 0 - True - - - - False - False - 4 - - - - - Display _location of contacts in roster - False - True - True - False - True - If checked, Gajim will display the location of contacts in the roster window - False - True - 0 - True - - - - False - False - 5 - - True @@ -373,7 +330,7 @@ True True - 6 + 3 @@ -415,7 +372,7 @@ True False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 6 + 7 2 6 6 @@ -585,6 +542,24 @@ 3 + + + Show icon when your messages are received + False + True + True + False + False + 0 + True + + + + 2 + 6 + 7 + + @@ -3299,22 +3274,4 @@ to discover one from server. - - - - - - - - - - - - - - - - - - diff --git a/src/common/config.py b/src/common/config.py index d67ef814e..3d5370493 100644 --- a/src/common/config.py +++ b/src/common/config.py @@ -315,6 +315,7 @@ class Config: 'global_proxy': [opt_str, '', _('Proxy used for all outgoing connections if the account does not have a specific proxy configured')], 'ignore_incoming_attention': [opt_bool, False, _('If True, Gajim will ignore incoming attention requestd ("wizz").')], 'remember_opened_chat_controls': [ opt_bool, True, _('If enabled, Gajim will reopen chat windows that were opened last time Gajim was closed.')], + 'positive_184_ack': [ opt_bool, False, _('If enabled, Gajim will show an icon to show that sent message has been received by your contact')], }, {}) __options_per_key = { diff --git a/src/config.py b/src/config.py index aeb77eb63..31387ed1d 100644 --- a/src/config.py +++ b/src/config.py @@ -128,25 +128,16 @@ class PreferencesWindow: self.xml.get_object('show_status_msgs_in_roster_checkbutton'). \ set_active( st) - # Display mood in roster - st = gajim.config.get('show_mood_in_roster') - self.xml.get_object('show_mood_in_roster_checkbutton'). \ - set_active(st) - - # Display activity in roster - st = gajim.config.get('show_activity_in_roster') - self.xml.get_object('show_activity_in_roster_checkbutton'). \ - set_active(st) - - # Display tunes in roster - st = gajim.config.get('show_tunes_in_roster') - self.xml.get_object('show_tunes_in_roster_checkbutton'). \ - set_active(st) - - # Display location in roster - st = gajim.config.get('show_location_in_roster') - self.xml.get_object('show_location_in_roster_checkbutton'). \ - set_active(st) + # Display PEP in roster + st1 = gajim.config.get('show_mood_in_roster') + st2 = gajim.config.get('show_activity_in_roster') + st3 = gajim.config.get('show_tunes_in_roster') + st4 = gajim.config.get('show_location_in_roster') + w = self.xml.get_object('show_pep_in_roster_checkbutton') + if st1 == st2 == st3 == st4: + w.set_active(st1) + else: + w.set_inconsistent(True) # Sort contacts by show st = gajim.config.get('sort_by_show_in_roster') @@ -212,6 +203,10 @@ class PreferencesWindow: else: self.xml.get_object('speller_checkbutton').set_sensitive(False) + # XEP-0184 positive ack + st = gajim.config.get('positive_184_ack') + self.xml.get_object('positive_184_ack_checkbutton').set_active(st) + ### Style tab ### # Themes theme_combobox = self.xml.get_object('theme_combobox') @@ -670,19 +665,10 @@ class PreferencesWindow: for ctrl in self._get_all_muc_controls(): ctrl.update_ui() - def on_show_mood_in_roster_checkbutton_toggled(self, widget): + def on_show_pep_in_roster_checkbutton_toggled(self, widget): self.on_checkbutton_toggled(widget, 'show_mood_in_roster') - gajim.interface.roster.setup_and_draw_roster() - - def on_show_activity_in_roster_checkbutton_toggled(self, widget): self.on_checkbutton_toggled(widget, 'show_activity_in_roster') - gajim.interface.roster.setup_and_draw_roster() - - def on_show_tunes_in_roster_checkbutton_toggled(self, widget): self.on_checkbutton_toggled(widget, 'show_tunes_in_roster') - gajim.interface.roster.setup_and_draw_roster() - - def on_show_location_in_roster_checkbutton_toggled(self, widget): self.on_checkbutton_toggled(widget, 'show_location_in_roster') gajim.interface.roster.setup_and_draw_roster() @@ -772,6 +758,9 @@ class PreferencesWindow: else: self.remove_speller() + def on_positive_184_ack_checkbutton_toggled(self, widget): + self.on_checkbutton_toggled(widget, 'positive_184_ack') + def on_theme_combobox_changed(self, widget): model = widget.get_model() active = widget.get_active() diff --git a/src/conversation_textview.py b/src/conversation_textview.py index 2c56cc8e6..e97d5801e 100644 --- a/src/conversation_textview.py +++ b/src/conversation_textview.py @@ -176,6 +176,8 @@ class ConversationTextview(GObject.GObject): 'gajim-muc_separator') XEP0184_WARNING_PIXBUF = gtkgui_helpers.get_icon_pixmap( 'gajim-receipt_missing') + XEP0184_RECEIVED_PIXBUF = gtkgui_helpers.get_icon_pixmap( + 'gajim-receipt_received') MESSAGE_CORRECTED_PIXBUF = gtkgui_helpers.get_icon_pixmap( 'gajim-message_corrected') @@ -554,22 +556,29 @@ class ConversationTextview(GObject.GObject): if id_ not in self.xep0184_marks: return - if self.xep0184_shown[id_] == NOT_SHOWN: - self.xep0184_shown[id_] = ALREADY_RECEIVED - return - buffer_ = self.tv.get_buffer() buffer_.begin_user_action() - begin_iter = buffer_.get_iter_at_mark(self.xep0184_marks[id_]) + if self.xep0184_shown[id_] != NOT_SHOWN: + begin_iter = buffer_.get_iter_at_mark(self.xep0184_marks[id_]) - end_iter = begin_iter.copy() - # XXX: Is there a nicer way? - end_iter.forward_char() - end_iter.forward_char() + end_iter = begin_iter.copy() + # XXX: Is there a nicer way? + end_iter.forward_char() + end_iter.forward_char() - buffer_.delete(begin_iter, end_iter) - buffer_.delete_mark(self.xep0184_marks[id_]) + buffer_.delete(begin_iter, end_iter) + + if gajim.config.get('positive_184_ack'): + begin_iter = buffer_.get_iter_at_mark(self.xep0184_marks[id_]) + buffer_.insert(begin_iter, ' ') + anchor = buffer_.create_child_anchor(begin_iter) + img = TextViewImage(anchor, '') + img.set_from_pixbuf(ConversationTextview.XEP0184_RECEIVED_PIXBUF) + img.show() + self.tv.add_child_at_anchor(img, anchor) + + self.xep0184_shown[id_] = ALREADY_RECEIVED buffer_.end_user_action()