Browse Source

Added a statusicon, not sure if it works since I'm still using OS X with X11

master
Julio Biason 15 years ago
parent
commit
86280da938
  1. 24
      mitterlib/ui/ui_pygtk.py

24
mitterlib/ui/ui_pygtk.py

@ -963,7 +963,14 @@ class Interface(object):
iter = self._grid.get_model().get_iter(path) iter = self._grid.get_model().get_iter(path)
message = self._grid.get_model().get_value(iter, 0) message = self._grid.get_model().get_value(iter, 0)
if message.read:
return True
message.read = True message.read = True
self._new_message_count -= 1
if self._new_message_count == 0 and self._statusicon:
self._statusicon.set_from_file(find_image('mitter.png'))
return True return True
@ -1001,6 +1008,11 @@ class Interface(object):
self._refresh_id = gobject.timeout_add( self._refresh_id = gobject.timeout_add(
interval * 60 * 1000, interval * 60 * 1000,
self._refresh, None) self._refresh, None)
self._new_message_count += len(results)
if self._new_message_count > 0 and self._statusicon:
self._statusicon.set_from_file(find_image('mitter-new.png'))
return return
def _exception_get_messages(self, widget, exception): def _exception_get_messages(self, widget, exception):
@ -1145,6 +1157,7 @@ class Interface(object):
# interthread communication. # interthread communication.
self._delete_iter = None self._delete_iter = None
self._reply_message_id = None self._reply_message_id = None
self._new_message_count = 0
return return
@ -1154,6 +1167,12 @@ class Interface(object):
self._main_window = self._create_main_window() self._main_window = self._create_main_window()
self._main_window.show_all() self._main_window.show_all()
if self._options[self.NAMESPACE]['statusicon']:
self._statusicon = gtk.StatusIcon()
self._statusicon.set_from_file(find_image('mitter.png'))
else:
self._statusicon = None
self._threads = _ThreadManager() self._threads = _ThreadManager()
# queue the first fetch # queue the first fetch
@ -1173,6 +1192,11 @@ class Interface(object):
metavar='MINUTES', metavar='MINUTES',
default=5, default=5,
conflict_group='interface') conflict_group='interface')
options.add_option('--use-statusicon',
group=self.NAMESPACE,
option='statusicon',
default=True,
conflict_group='interface')
# Most of the options for non-cmd-options are useless, but I'm keeping # Most of the options for non-cmd-options are useless, but I'm keeping
# them as documentation. # them as documentation.
options.add_option( options.add_option(

Loading…
Cancel
Save