- regroup display PEP info in roster options

- add option to show positive XEP-0184 ack in message window. Fixes 7341
This commit is contained in:
Yann Leboulanger 2013-05-12 21:32:29 +02:00
parent 5cf946f53c
commit a14c758d06
4 changed files with 80 additions and 124 deletions

View File

@ -148,6 +148,24 @@
</row>
</data>
</object>
<object class="GtkListStore" id="status_message_liststore">
<columns>
<!-- column-name name -->
<column type="gchararray"/>
<!-- column-name text -->
<column type="gchararray"/>
<!-- column-name activity -->
<column type="gchararray"/>
<!-- column-name sub_activity -->
<column type="gchararray"/>
<!-- column-name activity_text -->
<column type="gchararray"/>
<!-- column-name mood -->
<column type="gchararray"/>
<!-- column-name mood_text -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkWindow" id="preferences_window">
<property name="can_focus">False</property>
<property name="border_width">6</property>
@ -234,8 +252,8 @@
</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, ...)m_ood of contacts in roster</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@ -245,7 +263,7 @@
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_show_mood_in_roster_checkbutton_toggled" swapped="no"/>
<signal name="toggled" handler="on_show_pep_in_roster_checkbutton_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@ -253,67 +271,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="use_action_appearance">False</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_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_show_activity_in_roster_checkbutton_toggled" swapped="no"/>
</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="use_action_appearance">False</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_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_show_tunes_in_roster_checkbutton_toggled" swapped="no"/>
</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="use_action_appearance">False</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_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_show_location_in_roster_checkbutton_toggled" swapped="no"/>
</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>
@ -373,7 +330,7 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">6</property>
<property name="position">3</property>
</packing>
</child>
</object>
@ -415,7 +372,7 @@
<property name="visible">True</property>
<property name="can_focus">False</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>
@ -585,6 +542,24 @@
<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="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_positive_184_ack_checkbutton_toggled" swapped="no"/>
</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>
@ -3299,22 +3274,4 @@ to discover one from server.</property>
</object>
</child>
</object>
<object class="GtkListStore" id="status_message_liststore">
<columns>
<!-- column-name name -->
<column type="gchararray"/>
<!-- column-name text -->
<column type="gchararray"/>
<!-- column-name activity -->
<column type="gchararray"/>
<!-- column-name sub_activity -->
<column type="gchararray"/>
<!-- column-name activity_text -->
<column type="gchararray"/>
<!-- column-name mood -->
<column type="gchararray"/>
<!-- column-name mood_text -->
<column type="gchararray"/>
</columns>
</object>
</interface>

View File

@ -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 = {

View File

@ -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()

View File

@ -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()