Use zenity instead of kdialog in appvm code
This commit is contained in:
parent
a8e32bea4c
commit
d5537b72a7
@ -61,8 +61,14 @@ main()
|
|||||||
"HOME=/home/user DISPLAY=:0 /usr/bin/mimeopen -n -M '%s' > /tmp/kde-open.log 2>&1 </dev/null",
|
"HOME=/home/user DISPLAY=:0 /usr/bin/mimeopen -n -M '%s' > /tmp/kde-open.log 2>&1 </dev/null",
|
||||||
filename);
|
filename);
|
||||||
if (system(cmdbuf))
|
if (system(cmdbuf))
|
||||||
|
#ifdef USE_KDIALOG
|
||||||
system
|
system
|
||||||
("HOME=/home/user DISPLAY=:0 /usr/bin/kdialog --sorry 'Unable to handle mimetype of the requested file!' > /tmp/kdialog.log 2>&1 </dev/null");
|
("HOME=/home/user DISPLAY=:0 /usr/bin/kdialog --sorry 'Unable to handle mimetype of the requested file!' > /tmp/kdialog.log 2>&1 </dev/null");
|
||||||
|
#else
|
||||||
|
system
|
||||||
|
("HOME=/home/user DISPLAY=:0 /usr/bin/zenity --error --text 'Unable to handle mimetype of the requested file!' > /tmp/kdialog.log 2>&1 </dev/null");
|
||||||
|
#endif
|
||||||
|
|
||||||
if (stat(filename, &stat_post)) {
|
if (stat(filename, &stat_post)) {
|
||||||
perror("stat post");
|
perror("stat post");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
43
appvm/qvm-copy-to-vm2.gnome
Executable file
43
appvm/qvm-copy-to-vm2.gnome
Executable file
@ -0,0 +1,43 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# The Qubes OS Project, http://www.qubes-os.org
|
||||||
|
#
|
||||||
|
# Copyright (C) 2010 Rafal Wojtczuk <rafal@invisiblethingslab.com>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
|
||||||
|
VM=$(zenity --entry --title="File Copy" --text="Enter the destination domain name:")
|
||||||
|
if [ X$VM = X ] ; then exit 0 ; fi
|
||||||
|
|
||||||
|
SIZE=$(du --apparent-size -c "$@" | tail -1 | cut -f 1)
|
||||||
|
|
||||||
|
export PROGRESS_FILE=$(mktemp)
|
||||||
|
/usr/lib/qubes/qvm-trigger-copy-to-vm $VM "$@"
|
||||||
|
while ! [ -s $PROGRESS_FILE ] ; do
|
||||||
|
sleep 0.1
|
||||||
|
done
|
||||||
|
(while true ; do
|
||||||
|
read agentpid sentsize agentstatus < $PROGRESS_FILE
|
||||||
|
if [ "x"$agentstatus = x ] ; then continue ; fi
|
||||||
|
if ! [ -e /proc/$agentpid ] ; then break ; fi
|
||||||
|
if [ "x"$agentstatus = xdone ] ; then break ; fi
|
||||||
|
CURRSIZE=$(($sentsize/1024))
|
||||||
|
echo $((100*$CURRSIZE/$SIZE))
|
||||||
|
sleep 0.1
|
||||||
|
done) | | zenity --progress --text="Copying..."
|
||||||
|
|
||||||
|
rm -f $PROGRESS_FILE
|
@ -15,18 +15,23 @@ static void fix_display()
|
|||||||
|
|
||||||
static void produce_message(char * type, const char *fmt, va_list args)
|
static void produce_message(char * type, const char *fmt, va_list args)
|
||||||
{
|
{
|
||||||
char *kdialog_msg;
|
char *dialog_msg;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
(void) vsnprintf(buf, sizeof(buf), fmt, args);
|
(void) vsnprintf(buf, sizeof(buf), fmt, args);
|
||||||
asprintf(&kdialog_msg, "%s: %s: %s (error type: %s)",
|
asprintf(&dialog_msg, "%s: %s: %s (error type: %s)",
|
||||||
program_invocation_short_name, type, buf, strerror(errno));
|
program_invocation_short_name, type, buf, strerror(errno));
|
||||||
fprintf(stderr, "%s", kdialog_msg);
|
fprintf(stderr, "%s", dialog_msg);
|
||||||
switch (fork()) {
|
switch (fork()) {
|
||||||
case -1:
|
case -1:
|
||||||
exit(1); //what else
|
exit(1); //what else
|
||||||
case 0:
|
case 0:
|
||||||
fix_display();
|
fix_display();
|
||||||
execlp("kdialog", "kdialog", "--sorry", kdialog_msg, NULL);
|
#ifdef USE_KDIALOG
|
||||||
|
execlp("kdialog", "kdialog", "--sorry", dialog_msg, NULL);
|
||||||
|
#else
|
||||||
|
|
||||||
|
execlp("zenity", "zenity", "--error --text", dialog_msg, NULL);
|
||||||
|
#endif
|
||||||
exit(1);
|
exit(1);
|
||||||
default:;
|
default:;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user