Browse Source

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

with ConfigOpt trying to save it back.
master
Julio Biason 15 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) self._main_tabs.set_tab_label_text(child, message)
replies = self._main_tabs.get_nth_page(1) replies = self._main_tabs.get_nth_page(1)
messages_title = ('%d ' + title_info = {
N_('message', 'messages', data)) % (data) 'message_count': data,
replies_title = ('%d ' + 'message': N_('message', 'messages', data),
N_('reply', 'replies', replies.count)) % (replies.count) 'replies_count': replies.count,
'replies': N_('reply', 'replies', replies.count)
title = 'Mitter (%s, %s)' % (messages_title, replies_title) }
title = self._options[self.NAMESPACE]['window_title'] % (title_info)
self._main_window.set_title(title) self._main_window.set_title(title)
if (data + replies.count) > 0: if (data + replies.count) > 0:
@ -441,12 +443,14 @@ class Interface(object):
self._main_tabs.set_tab_label_text(child, message) self._main_tabs.set_tab_label_text(child, message)
messages = self._main_tabs.get_nth_page(0) messages = self._main_tabs.get_nth_page(0)
messages_title = ('%d ' + title_info = {
N_('message', 'messages', messages.count)) % (messages.count) 'message_count': messages.count,
replies_title = ('%d ' + 'message': N_('message', 'messages', messages.count),
N_('reply', 'replies', data)) % (data) 'replies_count': data,
'replies': N_('reply', 'replies', data)
title = 'Mitter (%s, %s)' % (messages_title, replies_title) }
title = self._options[self.NAMESPACE]['window_title'] % (title_info)
self._main_window.set_title(title) self._main_window.set_title(title)
if (data + messages.count) > 0: if (data + messages.count) > 0:
self._statusicon.set_from_pixbuf(self._images['new-messages']) self._statusicon.set_from_pixbuf(self._images['new-messages'])
@ -1102,3 +1106,18 @@ class Interface(object):
metavar='CHAR', metavar='CHAR',
default=_('<small>(protected)</small>'), default=_('<small>(protected)</small>'),
is_cmd_option=False) 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