dom0: fallback to zenity when kdialog not available
This can be the case on Xfce.
This commit is contained in:
parent
134dfa6d46
commit
51d0b3dba3
@ -46,7 +46,10 @@ class QfileDaemonDvm:
|
||||
qmemman_client.close()
|
||||
errmsg = 'Not enough memory to create DVM. '
|
||||
errmsg +='Terminate some appVM and retry.'
|
||||
if os.path.exists('/usr/bin/kdialog'):
|
||||
subprocess.call(['/usr/bin/kdialog', '--sorry', errmsg])
|
||||
else:
|
||||
subprocess.call(['/usr/bin/zenity', '--warning', errmsg])
|
||||
return None
|
||||
|
||||
self.tray_notify("Starting new DispVM...")
|
||||
@ -74,7 +77,10 @@ class QfileDaemonDvm:
|
||||
'-l', str(label.index)])
|
||||
qmemman_client.close()
|
||||
if retcode != 0:
|
||||
if os.path.exists('/usr/bin/kdialog'):
|
||||
subprocess.call(['/usr/bin/kdialog', '--sorry', 'DisposableVM creation failed, see qubes_restore.log'])
|
||||
else:
|
||||
subprocess.call(['/usr/bin/zenity', '--warning', 'DisposableVM creation failed, see qubes_restore.log'])
|
||||
qvm_collection.unlock_db()
|
||||
return None
|
||||
f = open('/var/run/qubes/dispVM_xid', 'r');
|
||||
|
@ -1,19 +1,29 @@
|
||||
#!/bin/sh
|
||||
|
||||
line1="<b>Please wait (up to 120s) while the DispVM savefile is being updated.</b>"
|
||||
line2="<i><small>This only happens when you have updated the template.</small></i>"
|
||||
line3="<i><small>Next time will be much faster.</small></i>"
|
||||
|
||||
if type kdialog &> /dev/null; then
|
||||
ref=`kdialog --title="Updating default DispVM savefile" \
|
||||
--progressbar \
|
||||
"<center>
|
||||
<font>
|
||||
<b>Please wait (up to 120s) while the DispVM savefile is being updated.</b>
|
||||
<br>
|
||||
<i><small>
|
||||
This only happens when you have updated the template.<br>
|
||||
Next time will be much faster.
|
||||
</small></i>
|
||||
$line1<br>
|
||||
$line2<br>
|
||||
$line3
|
||||
</font>
|
||||
</center>" 0`;
|
||||
|
||||
trap "qdbus $ref close" EXIT
|
||||
else
|
||||
pipe=/tmp/qvm-create-default-dvm-$$.progress
|
||||
mkfifo $pipe
|
||||
zenity --progress --pulsate --auto-close --text "$line1\n$line2\n$line3" < $pipe &
|
||||
exec 5>$pipe
|
||||
echo 0 >&5
|
||||
trap "echo 100 >&5" EXIT
|
||||
fi
|
||||
|
||||
#qdbus $ref showCancelButton true;
|
||||
|
||||
|
@ -94,10 +94,16 @@ int ask_on_connect_timeout(int xid, int timeout)
|
||||
{
|
||||
char text[1024];
|
||||
int ret;
|
||||
struct stat buf;
|
||||
ret=stat("/usr/bin/kdialog", &buf);
|
||||
#define KDIALOG_CMD "kdialog --title 'Qrexec daemon' --warningyesno "
|
||||
#define ZENITY_CMD "zenity --title 'Qrexec daemon' --question --text "
|
||||
snprintf(text, sizeof(text),
|
||||
"kdialog --title 'Qrexec daemon' --warningyesno "
|
||||
ret==0 ? KDIALOG_CMD : ZENITY_CMD
|
||||
"'Timeout while trying connecting to qrexec agent (Xen domain ID: %d). Do you want to wait next %d seconds?'",
|
||||
xid, timeout);
|
||||
#undef KDIALOG_CMD
|
||||
#undef ZENITY_CMD
|
||||
ret = system(text);
|
||||
ret = WEXITSTATUS(ret);
|
||||
// fprintf(stderr, "ret=%d\n", ret);
|
||||
|
Loading…
Reference in New Issue
Block a user