Browse Source

Mark all messages as read option. fixes #205

master
Julio Biason 14 years ago
parent
commit
de551e63e4
  1. 50
      mitterlib/ui/ui_pygtk.py
  2. BIN
      pixmaps/reply.png

50
mitterlib/ui/ui_pygtk.py

@ -337,6 +337,7 @@ class Interface(object):
<toolbar name="MainToolbar">
<toolitem action="Refresh" />
<toolitem action="Clear" />
<toolitem action="AllRead" />
<separator />
<toolitem action="Delete" />
<toolitem action="Reply" />
@ -353,6 +354,7 @@ class Interface(object):
<menu action="Edit">
<menuitem action="Refresh" />
<menuitem action="Clear" />
<menuitem action="AllRead" />
<separator />
<menuitem action="Update" />
<menuitem action="Cancel" />
@ -410,6 +412,16 @@ class Interface(object):
refresh_action.connect('activate', self._refresh)
action_group.add_action_with_accel(refresh_action, None)
clear_action = gtk.Action('Clear', _('_Clear'),
_('Clear the message list'), gtk.STOCK_CLEAR)
clear_action.connect('activate', self._clear_posts)
action_group.add_action_with_accel(clear_action, '<Ctrl>l')
all_read_action = gtk.Action('AllRead', _('_Mark All Read'),
_('Mark all messages as read'), gtk.STOCK_APPLY)
all_read_action.connect('activate', self._mark_all_read)
action_group.add_action(all_read_action)
self._update_action = gtk.Action('Update', _('_Update'),
_('Update your status'), gtk.STOCK_ADD)
self._update_action.set_property('sensitive', False)
@ -423,11 +435,6 @@ class Interface(object):
action_group.add_action_with_accel(self._cancel_action,
'Escape')
clear_action = gtk.Action('Clear', _('_Clear'),
_('Clear the message list'), gtk.STOCK_CLEAR)
clear_action.connect('activate', self._clear_posts)
action_group.add_action_with_accel(clear_action, '<Ctrl>l')
settings_action = gtk.Action('Settings', _('_Settings'),
_('Settings'), gtk.STOCK_PREFERENCES)
settings_action.connect('activate', self._show_settings)
@ -956,6 +963,31 @@ class Interface(object):
self._message_count_updated()
return
def _mark_all_read(self, widget, user_data=None):
"""Mark all messages as read."""
grid = self._get_current_grid()
model = grid.get_model()
if len(model) == 0:
# no messages, so we don't worry (if I recall correctly,
# get_iter_first will fail if the model is empty)
return
iter = model.get_iter_first()
while iter:
message = model.get_value(iter, 0)
message.read = True
iter = model.iter_next(iter)
# update the counters
page = self._main_tabs.get_current_page()
if page == 0:
self._new_message_count = 0
else:
self._new_replies_count = 0
self._message_count_updated()
return
def _delete_message(self, widget, user_data=None):
"""Delete a message."""
grid = self._get_current_grid()
@ -1426,15 +1458,17 @@ class Interface(object):
has_alpha=False, bits_per_sample=8, width=48, height=48)
self._images = {}
self._images['icon'] = gtk.gdk.pixbuf_new_from_file(
find_image('mitter.png'))
self._images['avatar'] = default_pixmap
self._images['logo'] = gtk.gdk.pixbuf_new_from_file(
find_image('mitter-big.png'))
# icons (app and statusicon)
self._images['icon'] = gtk.gdk.pixbuf_new_from_file(
find_image('mitter.png'))
self._images['new-messages'] = gtk.gdk.pixbuf_new_from_file(
find_image('mitter-new.png'))
self._images['icon-error'] = gtk.gdk.pixbuf_new_from_file(
find_image('mitter-error.png'))
self._images['avatar'] = default_pixmap
# This is the ugly bit for speeding up things and making
# interthread communication.

BIN
pixmaps/reply.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Loading…
Cancel
Save