"Execute command..." entry in roster in contact's popup menu, plus two fixes.
The fixes: * when received a single message from a contact that has one resource online, 'start chat' entry in popup menu open only that message, not the chat * when contact has more resources online, 'rename item' entry in popup menu doesn't work
This commit is contained in:
parent
e66a8a3430
commit
8a959c846b
|
@ -136,6 +136,26 @@
|
|||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="execute_command_menuitem">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Execute Command...</property>
|
||||
<property name="use_underline">True</property>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image1467">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-execute</property>
|
||||
<property name="icon_size">1</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkSeparatorMenuItem" id="separator5">
|
||||
<property name="visible">True</property>
|
||||
|
|
|
@ -1256,6 +1256,8 @@ class RosterWindow:
|
|||
'assign_openpgp_key_menuitem')
|
||||
add_special_notification_menuitem = xml.get_widget(
|
||||
'add_special_notification_menuitem')
|
||||
execute_command_menuitem = xml.get_widget(
|
||||
'execute_command_menuitem')
|
||||
|
||||
add_special_notification_menuitem.hide()
|
||||
add_special_notification_menuitem.set_no_show_all(True)
|
||||
|
@ -1279,8 +1281,9 @@ class RosterWindow:
|
|||
|
||||
contacts = gajim.contacts.get_contact(account, jid)
|
||||
if len(contacts) > 1: # sevral resources
|
||||
def resources_submenu(action):
|
||||
""" Build a submenu with contact's resources. """
|
||||
sub_menu = gtk.Menu()
|
||||
start_chat_menuitem.set_submenu(sub_menu)
|
||||
|
||||
iconset = gajim.config.get('iconset')
|
||||
if not iconset:
|
||||
|
@ -1294,12 +1297,23 @@ class RosterWindow:
|
|||
icon = state_images[icon_name]
|
||||
item.set_image(icon)
|
||||
sub_menu.append(item)
|
||||
item.connect('activate', self.on_open_chat_window, c, account,
|
||||
item.connect('activate', action, c, account,
|
||||
c.resource)
|
||||
return sub_menu
|
||||
|
||||
start_chat_menuitem.set_submenu(resources_submenu(self.on_open_chat_window))
|
||||
execute_command_menuitem.set_submenu(resources_submenu(self.on_open_chat_window))
|
||||
|
||||
else: # one resource
|
||||
start_chat_menuitem.connect('activate',
|
||||
self.on_open_chat_window, contact, account)
|
||||
# we cannot execute commands when the resource is unknown
|
||||
if contact.resource:
|
||||
execute_command_menuitem.connect('activate',
|
||||
self.on_roster_treeview_row_activated, path)
|
||||
else:
|
||||
execute_command_menuitem.hide()
|
||||
execute_command_menuitem.set_no_show_all(True)
|
||||
|
||||
if contact.resource:
|
||||
send_file_menuitem.connect('activate',
|
||||
|
@ -1368,7 +1382,7 @@ class RosterWindow:
|
|||
for widget in [start_chat_menuitem, send_single_message_menuitem,
|
||||
rename_menuitem, edit_groups_menuitem, send_file_menuitem,
|
||||
subscription_menuitem, add_to_roster_menuitem,
|
||||
remove_from_roster_menuitem]:
|
||||
remove_from_roster_menuitem, execute_commands_menuitem]:
|
||||
widget.set_sensitive(False)
|
||||
|
||||
#FIXME: create menu for sub contacts
|
||||
|
|
Loading…
Reference in New Issue