Merge branch 'execute_command' into 'master'
Add ad-hoc commands for Groupchats Closes #8819 See merge request gajim/gajim!179
This commit is contained in:
commit
bf3aac28cb
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!-- Generated with glade 3.18.3 -->
|
<!-- Generated with glade 3.20.0 -->
|
||||||
<interface>
|
<interface>
|
||||||
<requires lib="gtk+" version="3.12"/>
|
<requires lib="gtk+" version="3.12"/>
|
||||||
<object class="GtkAccelGroup" id="accelgroup1"/>
|
<object class="GtkAccelGroup" id="accelgroup1"/>
|
||||||
|
@ -125,6 +125,14 @@
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkMenuItem" id="execute_command_menuitem">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label" translatable="yes">_Execute command</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkMenuItem" id="block_menuitem">
|
<object class="GtkMenuItem" id="block_menuitem">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
|
|
@ -46,6 +46,7 @@ from gajim import config
|
||||||
from gajim import vcard
|
from gajim import vcard
|
||||||
from gajim import cell_renderer_image
|
from gajim import cell_renderer_image
|
||||||
from gajim import dataforms_widget
|
from gajim import dataforms_widget
|
||||||
|
from gajim import adhoc_commands
|
||||||
from gajim.common.const import AvatarSize
|
from gajim.common.const import AvatarSize
|
||||||
from gajim.common.caps_cache import muc_caps_cache
|
from gajim.common.caps_cache import muc_caps_cache
|
||||||
import nbxmpp
|
import nbxmpp
|
||||||
|
@ -514,6 +515,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
('configure-', self._on_configure_room),
|
('configure-', self._on_configure_room),
|
||||||
('bookmark-', self._on_bookmark_room),
|
('bookmark-', self._on_bookmark_room),
|
||||||
('request-voice-', self._on_request_voice),
|
('request-voice-', self._on_request_voice),
|
||||||
|
('execute-command-', self._on_execute_command),
|
||||||
]
|
]
|
||||||
|
|
||||||
for action in actions:
|
for action in actions:
|
||||||
|
@ -582,6 +584,10 @@ class GroupchatControl(ChatControlBase):
|
||||||
win.lookup_action('change-nick-' + self.control_id).set_enabled(
|
win.lookup_action('change-nick-' + self.control_id).set_enabled(
|
||||||
online)
|
online)
|
||||||
|
|
||||||
|
# Execute command
|
||||||
|
win.lookup_action('execute-command-' + self.control_id).set_enabled(
|
||||||
|
online)
|
||||||
|
|
||||||
# Actions
|
# Actions
|
||||||
|
|
||||||
def _on_change_subject(self, action, param):
|
def _on_change_subject(self, action, param):
|
||||||
|
@ -679,6 +685,12 @@ class GroupchatControl(ChatControlBase):
|
||||||
app.config.set_per('rooms', self.contact.jid,
|
app.config.set_per('rooms', self.contact.jid,
|
||||||
'notify_on_all_messages', param.get_boolean())
|
'notify_on_all_messages', param.get_boolean())
|
||||||
|
|
||||||
|
def _on_execute_command(self, action, param):
|
||||||
|
"""
|
||||||
|
Execute AdHoc commands on the current room
|
||||||
|
"""
|
||||||
|
adhoc_commands.CommandWindow(self.account, self.room_jid)
|
||||||
|
|
||||||
def show_roster(self):
|
def show_roster(self):
|
||||||
new_state = not self.hpaned.get_child2().is_visible()
|
new_state = not self.hpaned.get_child2().is_visible()
|
||||||
image = self.hide_roster_button.get_image()
|
image = self.hide_roster_button.get_image()
|
||||||
|
@ -2560,6 +2572,10 @@ class GroupchatControl(ChatControlBase):
|
||||||
id_ = item.connect('activate', self.on_add_to_roster, jid)
|
id_ = item.connect('activate', self.on_add_to_roster, jid)
|
||||||
self.handlers[id_] = item
|
self.handlers[id_] = item
|
||||||
|
|
||||||
|
item = xml.get_object('execute_command_menuitem')
|
||||||
|
id_ = item.connect('activate', self._on_execute_command_occupant, nick)
|
||||||
|
self.handlers[id_] = item
|
||||||
|
|
||||||
item = xml.get_object('block_menuitem')
|
item = xml.get_object('block_menuitem')
|
||||||
item2 = xml.get_object('unblock_menuitem')
|
item2 = xml.get_object('unblock_menuitem')
|
||||||
if not app.connections[self.account].privacy_rules_supported:
|
if not app.connections[self.account].privacy_rules_supported:
|
||||||
|
@ -2608,6 +2624,10 @@ class GroupchatControl(ChatControlBase):
|
||||||
|
|
||||||
return ctrl
|
return ctrl
|
||||||
|
|
||||||
|
def _on_execute_command_occupant(self, widget, nick):
|
||||||
|
jid = self.room_jid + '/' + nick
|
||||||
|
adhoc_commands.CommandWindow(self.account, jid)
|
||||||
|
|
||||||
def on_row_activated(self, widget, path):
|
def on_row_activated(self, widget, path):
|
||||||
"""
|
"""
|
||||||
When an iter is activated (dubblick or single click if gnome is set this
|
When an iter is activated (dubblick or single click if gnome is set this
|
||||||
|
|
|
@ -642,6 +642,7 @@ def get_groupchat_menu(control_id):
|
||||||
('win.request-voice-', _('Request Voice')),
|
('win.request-voice-', _('Request Voice')),
|
||||||
('win.notify-on-message-', _('Notify on all messages')),
|
('win.notify-on-message-', _('Notify on all messages')),
|
||||||
('win.minimize-', _('Minimize on close')),
|
('win.minimize-', _('Minimize on close')),
|
||||||
|
('win.execute-command-', _('Execute command')),
|
||||||
('win.browse-history-', _('History')),
|
('win.browse-history-', _('History')),
|
||||||
('win.disconnect-', _('Disconnect')),
|
('win.disconnect-', _('Disconnect')),
|
||||||
]
|
]
|
||||||
|
|
|
@ -5389,8 +5389,16 @@ class RosterWindow:
|
||||||
item = Gtk.SeparatorMenuItem.new() # separator
|
item = Gtk.SeparatorMenuItem.new() # separator
|
||||||
menu.append(item)
|
menu.append(item)
|
||||||
|
|
||||||
|
adhoc_menuitem = Gtk.MenuItem.new_with_mnemonic(_('Execute command'))
|
||||||
|
adhoc_menuitem.connect('activate', self.on_execute_command, contact,
|
||||||
|
account)
|
||||||
|
menu.append(adhoc_menuitem)
|
||||||
|
|
||||||
|
item = Gtk.SeparatorMenuItem.new() # separator
|
||||||
|
menu.append(item)
|
||||||
|
|
||||||
history_menuitem = Gtk.MenuItem.new_with_mnemonic(_('_History'))
|
history_menuitem = Gtk.MenuItem.new_with_mnemonic(_('_History'))
|
||||||
history_menuitem .connect('activate', self.on_history, contact, account)
|
history_menuitem.connect('activate', self.on_history, contact, account)
|
||||||
menu.append(history_menuitem)
|
menu.append(history_menuitem)
|
||||||
|
|
||||||
event_button = gtkgui_helpers.get_possible_button_event(event)
|
event_button = gtkgui_helpers.get_possible_button_event(event)
|
||||||
|
|
Loading…
Reference in New Issue