add icons to menu
This commit is contained in:
parent
db90fc6430
commit
3b358d603c
16
src/chat.py
16
src/chat.py
|
@ -189,7 +189,7 @@ class Chat:
|
||||||
self.plugin.systray.remove_jid(jid, self.account)
|
self.plugin.systray.remove_jid(jid, self.account)
|
||||||
|
|
||||||
def populate_popup_menu(self, menu):
|
def populate_popup_menu(self, menu):
|
||||||
'''To be overwritten in parrent class'''
|
'''To be overwritten in child class'''
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def on_chat_window_button_press_event(self, widget, event):
|
def on_chat_window_button_press_event(self, widget, event):
|
||||||
|
@ -203,7 +203,7 @@ class Chat:
|
||||||
for jid in self.xmls:
|
for jid in self.xmls:
|
||||||
if jid != self.get_active_jid():
|
if jid != self.get_active_jid():
|
||||||
# FIXME: add icons representing contact's status?
|
# 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(
|
item.connect('activate', lambda obj,jid:self.set_active_tab(
|
||||||
jid), jid)
|
jid), jid)
|
||||||
menu.append(item)
|
menu.append(item)
|
||||||
|
@ -213,6 +213,15 @@ class Chat:
|
||||||
# menuitems specific to type of chat
|
# menuitems specific to type of chat
|
||||||
self.populate_popup_menu(menu)
|
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
|
# show the menu
|
||||||
menu.popup(None, None, None, event.button, event.time)
|
menu.popup(None, None, None, event.button, event.time)
|
||||||
menu.show_all()
|
menu.show_all()
|
||||||
|
@ -360,8 +369,7 @@ class Chat:
|
||||||
gtklabel = gtk.Label(jid.split('@')[0])
|
gtklabel = gtk.Label(jid.split('@')[0])
|
||||||
gtklabel.set_property('xalign', 0)
|
gtklabel.set_property('xalign', 0)
|
||||||
|
|
||||||
xm.signal_connect('on_close_button_clicked',
|
xm.signal_autoconnect(self)
|
||||||
self.on_close_button_clicked, jid)
|
|
||||||
|
|
||||||
#FIXME: text formating buttons will be hidden in 0.8 release
|
#FIXME: text formating buttons will be hidden in 0.8 release
|
||||||
for w in ['bold_togglebutton', 'italic_togglebutton', 'underline_togglebutton']:
|
for w in ['bold_togglebutton', 'italic_togglebutton', 'underline_togglebutton']:
|
||||||
|
|
|
@ -135,7 +135,7 @@ class GroupchatWindow(chat.Chat):
|
||||||
"""When window get focus"""
|
"""When window get focus"""
|
||||||
chat.Chat.on_chat_window_focus_in_event(self, widget, event)
|
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:
|
if event.type != gtk.gdk.BUTTON_PRESS:
|
||||||
return False
|
return False
|
||||||
self.on_chat_window_button_press_event(widget, event)
|
self.on_chat_window_button_press_event(widget, event)
|
||||||
|
@ -784,31 +784,66 @@ class GroupchatWindow(chat.Chat):
|
||||||
"""Add menuitems do popup menu"""
|
"""Add menuitems do popup menu"""
|
||||||
|
|
||||||
# FIXME: add icons / use ItemFactory
|
# 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)
|
item.connect('activate', self.on_history_button_clicked)
|
||||||
menu.append(item)
|
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)
|
item.connect('activate', self.on_configure_room_menuitem_activate)
|
||||||
menu.append(item)
|
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)
|
item.connect('activate', self.on_change_subject_menuitem_activate)
|
||||||
menu.append(item)
|
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)
|
item.connect('activate', self.on_change_nick_menuitem_activate)
|
||||||
menu.append(item)
|
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)
|
item.connect('activate', self.on_bookmark_room_menuitem_activate)
|
||||||
menu.append(item)
|
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):
|
def remove_tab(self, room_jid):
|
||||||
if time.time() - self.last_message_time[room_jid] < 2:
|
if time.time() - self.last_message_time[room_jid] < 2:
|
||||||
dialog = dialogs.ConfirmationDialog(
|
dialog = dialogs.ConfirmationDialog(
|
||||||
|
|
|
@ -470,8 +470,3 @@ class TabbedChatWindow(chat.Chat):
|
||||||
menu.append(item)
|
menu.append(item)
|
||||||
|
|
||||||
# FIXME: GPG stuff
|
# 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)
|
|
||||||
|
|
Loading…
Reference in New Issue