Port show-next-pending-event from gajim-remote
Delete some already ported methods
This commit is contained in:
parent
877b754ef3
commit
b26ba9aa67
|
@ -286,3 +286,13 @@ class AppActions():
|
||||||
win.present()
|
win.present()
|
||||||
else:
|
else:
|
||||||
app.interface.create_ipython_window()
|
app.interface.create_ipython_window()
|
||||||
|
|
||||||
|
def show_next_pending_event(self, action, param):
|
||||||
|
"""
|
||||||
|
Show the window(s) with next pending event in tabbed/group chats
|
||||||
|
"""
|
||||||
|
if app.events.get_nb_events():
|
||||||
|
account, jid, event = app.events.get_first_systray_event()
|
||||||
|
if not event:
|
||||||
|
return
|
||||||
|
app.interface.handle_event(account, jid, event.type_)
|
||||||
|
|
|
@ -96,7 +96,10 @@ class GajimApplication(Gtk.Application):
|
||||||
_('Show all warnings'))
|
_('Show all warnings'))
|
||||||
self.add_main_option('ipython', ord('i'), GLib.OptionFlags.NONE,
|
self.add_main_option('ipython', ord('i'), GLib.OptionFlags.NONE,
|
||||||
GLib.OptionArg.NONE,
|
GLib.OptionArg.NONE,
|
||||||
_('open ipython shell'))
|
_('Open IPython shell'))
|
||||||
|
self.add_main_option('show-next-pending-event', 0, GLib.OptionFlags.NONE,
|
||||||
|
GLib.OptionArg.NONE,
|
||||||
|
_('Pops up a window with the next pending event'))
|
||||||
|
|
||||||
self.connect('handle-local-options', self._handle_local_options)
|
self.connect('handle-local-options', self._handle_local_options)
|
||||||
self.connect('command-line', self._handle_remote_options)
|
self.connect('command-line', self._handle_remote_options)
|
||||||
|
@ -291,9 +294,14 @@ class GajimApplication(Gtk.Application):
|
||||||
# Parse all options that should be executed on a remote instance
|
# Parse all options that should be executed on a remote instance
|
||||||
options = command_line.get_options_dict()
|
options = command_line.get_options_dict()
|
||||||
|
|
||||||
if options.contains('ipython'):
|
remote_commands = ['ipython',
|
||||||
self.activate_action('ipython')
|
'show-next-pending-event',
|
||||||
return 0
|
]
|
||||||
|
|
||||||
|
for cmd in remote_commands:
|
||||||
|
if options.contains(cmd):
|
||||||
|
self.activate_action(cmd)
|
||||||
|
return 0
|
||||||
|
|
||||||
uri = self._parse_uris(command_line)
|
uri = self._parse_uris(command_line)
|
||||||
if uri is not None:
|
if uri is not None:
|
||||||
|
@ -415,6 +423,7 @@ class GajimApplication(Gtk.Application):
|
||||||
('about', action.on_about),
|
('about', action.on_about),
|
||||||
('faq', action.on_faq),
|
('faq', action.on_faq),
|
||||||
('ipython', action.toggle_ipython),
|
('ipython', action.toggle_ipython),
|
||||||
|
('show-next-pending-event', action.show_next_pending_event),
|
||||||
]
|
]
|
||||||
|
|
||||||
act = Gio.SimpleAction.new('add-contact', GLib.VariantType.new('s'))
|
act = Gio.SimpleAction.new('add-contact', GLib.VariantType.new('s'))
|
||||||
|
|
|
@ -85,14 +85,6 @@ class GajimRemote:
|
||||||
_('show help on command'), False)
|
_('show help on command'), False)
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'toggle_roster_appearance': [
|
|
||||||
_('Shows or hides the roster window'),
|
|
||||||
[]
|
|
||||||
],
|
|
||||||
'show_next_pending_event': [
|
|
||||||
_('Pops up a window with the next pending event'),
|
|
||||||
[]
|
|
||||||
],
|
|
||||||
'list_contacts': [
|
'list_contacts': [
|
||||||
_('Lists all contacts in roster, one for each line'),
|
_('Lists all contacts in roster, one for each line'),
|
||||||
[
|
[
|
||||||
|
@ -257,10 +249,6 @@ class GajimRemote:
|
||||||
_('Check if Gajim is running'),
|
_('Check if Gajim is running'),
|
||||||
[]
|
[]
|
||||||
],
|
],
|
||||||
'toggle_ipython': [
|
|
||||||
_('Shows or hides the ipython window'),
|
|
||||||
[]
|
|
||||||
],
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -646,50 +646,6 @@ class SignalObject(dbus.service.Object):
|
||||||
result.append(item)
|
result.append(item)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@dbus.service.method(INTERFACE, in_signature='', out_signature='')
|
|
||||||
def toggle_roster_appearance(self):
|
|
||||||
"""
|
|
||||||
Show/hide the roster window
|
|
||||||
"""
|
|
||||||
win = app.interface.roster.window
|
|
||||||
if win.get_property('visible'):
|
|
||||||
GLib.idle_add(win.hide)
|
|
||||||
else:
|
|
||||||
win.present()
|
|
||||||
# preserve the 'steal focus preservation'
|
|
||||||
if self._is_first():
|
|
||||||
win.window.present()
|
|
||||||
else:
|
|
||||||
win.window.present_with_time(int(time()))
|
|
||||||
|
|
||||||
@dbus.service.method(INTERFACE, in_signature='', out_signature='')
|
|
||||||
def show_roster(self):
|
|
||||||
"""
|
|
||||||
Show the roster window
|
|
||||||
"""
|
|
||||||
win = app.interface.roster.window
|
|
||||||
win.present()
|
|
||||||
# preserve the 'steal focus preservation'
|
|
||||||
if self._is_first():
|
|
||||||
win.window.present()
|
|
||||||
else:
|
|
||||||
win.window.present_with_time(int(time()))
|
|
||||||
|
|
||||||
@dbus.service.method(INTERFACE, in_signature='', out_signature='')
|
|
||||||
def toggle_ipython(self):
|
|
||||||
"""
|
|
||||||
Show/hide the ipython window
|
|
||||||
"""
|
|
||||||
win = app.ipython_window
|
|
||||||
if win:
|
|
||||||
if win.window.is_visible():
|
|
||||||
GLib.idle_add(win.hide)
|
|
||||||
else:
|
|
||||||
win.show_all()
|
|
||||||
win.present()
|
|
||||||
else:
|
|
||||||
app.interface.create_ipython_window()
|
|
||||||
|
|
||||||
@dbus.service.method(INTERFACE, in_signature='', out_signature='a{ss}')
|
@dbus.service.method(INTERFACE, in_signature='', out_signature='a{ss}')
|
||||||
def prefs_list(self):
|
def prefs_list(self):
|
||||||
prefs_dict = DBUS_DICT_SS()
|
prefs_dict = DBUS_DICT_SS()
|
||||||
|
|
Loading…
Reference in New Issue