- 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 7cbba3a256
commit 6a71432199
4 changed files with 61 additions and 98 deletions

View File

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

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

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

View File

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