diff --git a/data/gui/preferences_window.ui b/data/gui/preferences_window.ui index 16c11804029c0c10a6c38a4a955caf3a134ba8b6..2ee0afd6c0d56cfb43056641763b776a9b45a0e4 100644 --- a/data/gui/preferences_window.ui +++ b/data/gui/preferences_window.ui @@ -226,15 +226,15 @@ </packing> </child> <child> - <object class="GtkCheckButton" id="show_mood_in_roster_checkbutton"> - <property name="label" translatable="yes">Display m_ood of contacts in roster</property> + <object class="GtkCheckButton" id="show_pep_in_roster_checkbutton"> + <property name="label" translatable="yes">Display e_xtra information of contacts in roster (mood, activity, ...)</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> <property name="tooltip_text" translatable="yes">If checked, Gajim will display the mood of contacts in the roster window</property> <property name="use_underline">True</property> <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_show_mood_in_roster_checkbutton_toggled"/> + <signal name="toggled" handler="on_show_pep_in_roster_checkbutton_toggled"/> </object> <packing> <property name="expand">False</property> @@ -242,58 +242,6 @@ <property name="position">2</property> </packing> </child> - <child> - <object class="GtkCheckButton" id="show_activity_in_roster_checkbutton"> - <property name="label" translatable="yes">Display _activity of contacts in roster</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">If checked, Gajim will display the activity of contacts in the roster window</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_show_activity_in_roster_checkbutton_toggled"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">3</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="show_tunes_in_roster_checkbutton"> - <property name="label" translatable="yes">Display _tunes of contacts in roster</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">If checked, Gajim will display the tunes of contacts in the roster window</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_show_tunes_in_roster_checkbutton_toggled"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">4</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="show_location_in_roster_checkbutton"> - <property name="label" translatable="yes">Display _location of contacts in roster</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="has_tooltip">True</property> - <property name="tooltip_text" translatable="yes">If checked, Gajim will display the location of contacts in the roster window</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_show_location_in_roster_checkbutton_toggled"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">5</property> - </packing> - </child> <child> <object class="GtkHBox" id="hbox3"> <property name="visible">True</property> @@ -339,7 +287,7 @@ </child> </object> <packing> - <property name="position">6</property> + <property name="position">3</property> </packing> </child> </object> @@ -376,7 +324,7 @@ <object class="GtkTable" id="table1"> <property name="visible">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="n_rows">6</property> + <property name="n_rows">7</property> <property name="n_columns">2</property> <property name="column_spacing">6</property> <property name="row_spacing">6</property> @@ -530,6 +478,21 @@ <property name="bottom_attach">3</property> </packing> </child> + <child> + <object class="GtkCheckButton" id="positive_184_ack_checkbutton"> + <property name="label" translatable="yes">Show icon when your messages are received</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="on_positive_184_ack_checkbutton_toggled"/> + </object> + <packing> + <property name="right_attach">2</property> + <property name="top_attach">6</property> + <property name="bottom_attach">7</property> + </packing> + </child> </object> </child> </object> diff --git a/src/common/config.py b/src/common/config.py index 25ed299b248e47cc12a7b2ddc1b23df0ce62dd07..7d6a8de72230035b8f0504c52eec6a1a36002645 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 1732558ed1ac3ae2639360a663a4cafc4bd4c77d..2e08fdcf34f60c4776c1fbf1f56f7f78007b539b 100644 --- a/src/config.py +++ b/src/config.py @@ -126,25 +126,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') @@ -210,6 +201,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') @@ -668,19 +663,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() @@ -770,6 +756,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 e606545a34a1ce5a6693cf5219e0f3a3ada33a93..a9c948ea87881b484409fed5e0d11ba36f30b102 100644 --- a/src/conversation_textview.py +++ b/src/conversation_textview.py @@ -169,9 +169,12 @@ class ConversationTextview(gobject.GObject): ) ) - FOCUS_OUT_LINE_PIXBUF = gtkgui_helpers.get_icon_pixmap('gajim-muc_separator') + FOCUS_OUT_LINE_PIXBUF = gtkgui_helpers.get_icon_pixmap( + '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') @@ -549,22 +552,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() + + buffer_.delete(begin_iter, end_iter) - end_iter = begin_iter.copy() - # XXX: Is there a nicer way? - end_iter.forward_char() - end_iter.forward_char() + 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) - buffer_.delete(begin_iter, end_iter) - buffer_.delete_mark(self.xep0184_marks[id_]) + self.xep0184_shown[id_] = ALREADY_RECEIVED buffer_.end_user_action()