Skip to content
Snippets Groups Projects
Commit 3b358d60 authored by Yann Leboulanger's avatar Yann Leboulanger
Browse files

add icons to menu

parent db90fc64
No related branches found
No related tags found
No related merge requests found
......@@ -189,7 +189,7 @@ class Chat:
self.plugin.systray.remove_jid(jid, self.account)
def populate_popup_menu(self, menu):
'''To be overwritten in parrent class'''
'''To be overwritten in child class'''
pass
def on_chat_window_button_press_event(self, widget, event):
......@@ -203,7 +203,7 @@ class Chat:
for jid in self.xmls:
if jid != self.get_active_jid():
# FIXME: add icons representing contact's status?
item = gtk.MenuItem(self.names[jid])
item = gtk.MenuItem('switch to %s' % self.names[jid])
item.connect('activate', lambda obj,jid:self.set_active_tab(
jid), jid)
menu.append(item)
......@@ -213,6 +213,15 @@ class Chat:
# menuitems specific to type of chat
self.populate_popup_menu(menu)
item = gtk.CheckMenuItem(_('_Compact View'))# + ' Alt+C')
#FIXME: The accelerator is not used, it's just to show the Alt+c
ag = gtk.AccelGroup()
item.add_accelerator('activate', ag, ord('c'), gtk.gdk.MOD1_MASK, gtk.ACCEL_VISIBLE)
item.set_active(self.get_compact_view())
item.connect('activate', lambda obj:self.set_compact_view(
not self.get_compact_view()))
menu.append(item)
# show the menu
menu.popup(None, None, None, event.button, event.time)
menu.show_all()
......@@ -360,8 +369,7 @@ class Chat:
gtklabel = gtk.Label(jid.split('@')[0])
gtklabel.set_property('xalign', 0)
xm.signal_connect('on_close_button_clicked',
self.on_close_button_clicked, jid)
xm.signal_autoconnect(self)
#FIXME: text formating buttons will be hidden in 0.8 release
for w in ['bold_togglebutton', 'italic_togglebutton', 'underline_togglebutton']:
......
......@@ -135,7 +135,7 @@ class GroupchatWindow(chat.Chat):
"""When window get focus"""
chat.Chat.on_chat_window_focus_in_event(self, widget, event)
def on_groupchat_window_event(self,widget,event):
def on_groupchat_window_event(self, widget, event):
if event.type != gtk.gdk.BUTTON_PRESS:
return False
self.on_chat_window_button_press_event(widget, event)
......@@ -784,31 +784,66 @@ class GroupchatWindow(chat.Chat):
"""Add menuitems do popup menu"""
# FIXME: add icons / use ItemFactory
item = gtk.MenuItem(_('_History'))
item = gtk.MenuItem()
icon = gtk.Image()
icon.set_from_stock(gtk.STOCK_JUSTIFY_FILL, gtk.ICON_SIZE_BUTTON)
label = gtk.Label(_('_History'))
label.set_use_underline(True)
hbox = gtk.HBox(False, 3)
hbox.pack_start(icon, False, False)
hbox.pack_start(label, False, False)
item.add(hbox)
item.connect('activate', self.on_history_button_clicked)
menu.append(item)
item = gtk.MenuItem(_('Configure _Room'))
item = gtk.MenuItem()
icon = gtk.Image()
icon.set_from_stock(gtk.STOCK_PROPERTIES, gtk.ICON_SIZE_BUTTON)
label = gtk.Label(_('Configure _Room'))
label.set_use_underline(True)
hbox = gtk.HBox(False, 3)
hbox.pack_start(icon, False, False)
hbox.pack_start(label, False, False)
item.add(hbox)
item.connect('activate', self.on_configure_room_menuitem_activate)
menu.append(item)
item = gtk.MenuItem(_('Change _Subject'))
item = gtk.MenuItem()
icon = gtk.Image()
icon.set_from_stock(gtk.STOCK_EDIT, gtk.ICON_SIZE_BUTTON)
label = gtk.Label(_('Change _Subject'))
label.set_use_underline(True)
hbox = gtk.HBox(False, 3)
hbox.pack_start(icon, False, False)
hbox.pack_start(label, False, False)
item.add(hbox)
item.connect('activate', self.on_change_subject_menuitem_activate)
menu.append(item)
item = gtk.MenuItem(_('Change _Nickname'))
item = gtk.MenuItem()
icon = gtk.Image()
icon.set_from_stock(gtk.STOCK_REDO, gtk.ICON_SIZE_BUTTON)
label = gtk.Label(_('Change _Nickname'))
label.set_use_underline(True)
hbox = gtk.HBox(False, 3)
hbox.pack_start(icon, False, False)
hbox.pack_start(label, False, False)
item.add(hbox)
item.connect('activate', self.on_change_nick_menuitem_activate)
menu.append(item)
item = gtk.MenuItem(_('_Bookmark This Room'))
item = gtk.MenuItem()
icon = gtk.Image()
icon.set_from_stock(gtk.STOCK_ADD, gtk.ICON_SIZE_BUTTON)
label = gtk.Label(_('_Bookmark This Room'))
label.set_use_underline(True)
hbox = gtk.HBox(False, 3)
hbox.pack_start(icon, False, False)
hbox.pack_start(label, False, False)
item.add(hbox)
item.connect('activate', self.on_bookmark_room_menuitem_activate)
menu.append(item)
item=gtk.MenuItem(_('_Toggle compact view'))
item.connect('activate', lambda obj:self.set_compact_view(
not self.get_compact_view()))
menu.append(item)
def remove_tab(self, room_jid):
if time.time() - self.last_message_time[room_jid] < 2:
dialog = dialogs.ConfirmationDialog(
......
......@@ -470,8 +470,3 @@ class TabbedChatWindow(chat.Chat):
menu.append(item)
# FIXME: GPG stuff
item=gtk.MenuItem(_('_Toggle compact view'))
item.connect('activate', lambda obj:self.set_compact_view(
not self.get_compact_view()))
menu.append(item)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment