Browse Source

Trying to make the window title string configurable, but having issues

with ConfigOpt trying to save it back.
master
Julio Biason 14 years ago
parent
commit
6168f74353
  1. 43
      mitterlib/ui/ui_pygtk.py

43
mitterlib/ui/ui_pygtk.py

@ -418,12 +418,14 @@ class Interface(object):
self._main_tabs.set_tab_label_text(child, message)
replies = self._main_tabs.get_nth_page(1)
messages_title = ('%d ' +
N_('message', 'messages', data)) % (data)
replies_title = ('%d ' +
N_('reply', 'replies', replies.count)) % (replies.count)
title = 'Mitter (%s, %s)' % (messages_title, replies_title)
title_info = {
'message_count': data,
'message': N_('message', 'messages', data),
'replies_count': replies.count,
'replies': N_('reply', 'replies', replies.count)
}
title = self._options[self.NAMESPACE]['window_title'] % (title_info)
self._main_window.set_title(title)
if (data + replies.count) > 0:
@ -441,12 +443,14 @@ class Interface(object):
self._main_tabs.set_tab_label_text(child, message)
messages = self._main_tabs.get_nth_page(0)
messages_title = ('%d ' +
N_('message', 'messages', messages.count)) % (messages.count)
replies_title = ('%d ' +
N_('reply', 'replies', data)) % (data)
title = 'Mitter (%s, %s)' % (messages_title, replies_title)
title_info = {
'message_count': messages.count,
'message': N_('message', 'messages', messages.count),
'replies_count': data,
'replies': N_('reply', 'replies', data)
}
title = self._options[self.NAMESPACE]['window_title'] % (title_info)
self._main_window.set_title(title)
if (data + messages.count) > 0:
self._statusicon.set_from_pixbuf(self._images['new-messages'])
@ -1102,3 +1106,18 @@ class Interface(object):
metavar='CHAR',
default=_('<small>(protected)</small>'),
is_cmd_option=False)
options.add_option(
group=self.NAMESPACE,
option='window_title',
help='Format string to be used in the title, following ' \
"Python's string formatting rules. Mitter will " \
'pass a dictionary with:\n' \
'"message_count": the number of unread messages,\n' \
'"message": the translatable word for ' \
'"message(s)",\n' \
'"replies_count": the number of unread replies,\n' \
'"replies": the translatable word for "replies"',
metavar='STRING',
default='Mitter (%(message_count)d %(message)s, ' \
'%(replies_count)d %(replies)s)',
is_cmd_option=False)
Loading…
Cancel
Save