dom0/qvm-run: fix tray notify

This commit is contained in:
Marek Marczykowski 2011-11-02 00:46:57 +01:00
parent c0c64ecdc5
commit 4a6447f11b
2 changed files with 7 additions and 7 deletions

View File

@ -260,7 +260,7 @@ def run_in_vm(vm, command, verbose = True, autostart = False, notify_function =
if verbose: if verbose:
print >> sys.stderr, "Starting the VM '{0}'...".format(vm.name) print >> sys.stderr, "Starting the VM '{0}'...".format(vm.name)
if notify_function is not None: if notify_function is not None:
notify_function ("info", "Starting the '{0}' VM...".format(vm.name), label=vm.label) notify_function ("info", "Starting the '{0}' VM...".format(vm.name))
xid = vm.start(verbose=verbose) xid = vm.start(verbose=verbose)
except (IOError, OSError, QubesException) as err: except (IOError, OSError, QubesException) as err:

View File

@ -47,12 +47,6 @@ def tray_notify(str, label, timeout = 3000):
def tray_notify_error(str, timeout = 3000): def tray_notify_error(str, timeout = 3000):
notify_object.Notify("Qubes", 0, "dialog-error", "Qubes", str, [], [], timeout, dbus_interface="org.freedesktop.Notifications") notify_object.Notify("Qubes", 0, "dialog-error", "Qubes", str, [], [], timeout, dbus_interface="org.freedesktop.Notifications")
def tray_notify_generic(level, str):
if level == "info":
tray_notify(str)
elif level == "error":
tray_notify_error(str)
def vm_run_cmd(vm, cmd, options): def vm_run_cmd(vm, cmd, options):
if options.shutdown: if options.shutdown:
if options.verbose: if options.verbose:
@ -83,6 +77,12 @@ def vm_run_cmd(vm, cmd, options):
print >> sys.stderr, "Running command on VM: '{0}'...".format(vm.name) print >> sys.stderr, "Running command on VM: '{0}'...".format(vm.name)
try: try:
def tray_notify_generic(level, str):
if level == "info":
tray_notify(str, label=vm.label)
elif level == "error":
tray_notify_error(str)
return qubesutils.run_in_vm(vm, cmd, autostart = options.auto, return qubesutils.run_in_vm(vm, cmd, autostart = options.auto,
verbose = options.verbose, verbose = options.verbose,
notify_function = tray_notify_generic if options.tray else None, notify_function = tray_notify_generic if options.tray else None,