mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
p2v: Add Configure Network button (RHBZ#1167921).
The old version of virt-p2v had a whole custom-written dialog which interacted with NetworkManager over dbus. After trying that approach, it's really complex to get right. Instead this button simply opens NetworkManager's connection editor. This also adds nm-applet to the disk and starts it. However nm-applet does not display any visible indication -- probably because we are lacking a system tray.
This commit is contained in:
14
p2v/gui.c
14
p2v/gui.c
@@ -94,6 +94,7 @@ gui_application (struct config *config)
|
||||
|
||||
static void test_connection_clicked (GtkWidget *w, gpointer data);
|
||||
static void *test_connection_thread (void *data);
|
||||
static void configure_network_button_clicked (GtkWidget *w, gpointer data);
|
||||
static void about_button_clicked (GtkWidget *w, gpointer data);
|
||||
static void connection_next_clicked (GtkWidget *w, gpointer data);
|
||||
static void repopulate_output_combo (struct config *config);
|
||||
@@ -108,6 +109,7 @@ create_connection_dialog (struct config *config)
|
||||
GtkWidget *password_label;
|
||||
GtkWidget *test_hbox, *test;
|
||||
GtkWidget *about;
|
||||
GtkWidget *configure_network;
|
||||
char port_str[64];
|
||||
|
||||
conn_dlg = gtk_dialog_new ();
|
||||
@@ -198,7 +200,7 @@ create_connection_dialog (struct config *config)
|
||||
|
||||
/* Buttons. */
|
||||
gtk_dialog_add_buttons (GTK_DIALOG (conn_dlg),
|
||||
/* _("Configure network ..."), 1, */
|
||||
_("Configure network ..."), 1,
|
||||
_("About virt-p2v " PACKAGE_VERSION " ..."), 2,
|
||||
_("Next"), 3,
|
||||
NULL);
|
||||
@@ -206,6 +208,8 @@ create_connection_dialog (struct config *config)
|
||||
next_button = gtk_dialog_get_widget_for_response (GTK_DIALOG (conn_dlg), 3);
|
||||
gtk_widget_set_sensitive (next_button, FALSE);
|
||||
|
||||
configure_network =
|
||||
gtk_dialog_get_widget_for_response (GTK_DIALOG (conn_dlg), 1);
|
||||
about = gtk_dialog_get_widget_for_response (GTK_DIALOG (conn_dlg), 2);
|
||||
|
||||
/* Signals. */
|
||||
@@ -213,6 +217,8 @@ create_connection_dialog (struct config *config)
|
||||
G_CALLBACK (gtk_main_quit), NULL);
|
||||
g_signal_connect (G_OBJECT (test), "clicked",
|
||||
G_CALLBACK (test_connection_clicked), config);
|
||||
g_signal_connect (G_OBJECT (configure_network), "clicked",
|
||||
G_CALLBACK (configure_network_button_clicked), NULL);
|
||||
g_signal_connect (G_OBJECT (about), "clicked",
|
||||
G_CALLBACK (about_button_clicked), NULL);
|
||||
g_signal_connect (G_OBJECT (next_button), "clicked",
|
||||
@@ -341,6 +347,12 @@ test_connection_thread (void *data)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
configure_network_button_clicked (GtkWidget *w, gpointer data)
|
||||
{
|
||||
ignore_value (system ("nm-connection-editor &"));
|
||||
}
|
||||
|
||||
static void
|
||||
about_button_clicked (GtkWidget *w, gpointer data)
|
||||
{
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
if [ "$1" = "run" ]; then
|
||||
cd /
|
||||
metacity &
|
||||
nm-applet &
|
||||
exec @libexecdir@/virt-p2v
|
||||
else
|
||||
xinit "$0" run
|
||||
|
||||
@@ -77,6 +77,8 @@ metacity
|
||||
pcre
|
||||
libxml2
|
||||
gtk2
|
||||
network-manager-applet
|
||||
dbus-x11
|
||||
@hardware-support --optional
|
||||
|
||||
%end
|
||||
|
||||
@@ -95,11 +95,14 @@ trap cleanup INT QUIT TERM EXIT ERR
|
||||
# - some fonts
|
||||
# - hardware support (firmware etc, RHBZ#1157679)
|
||||
# - metacity (window manager, another could be used)
|
||||
# - NetworkManager
|
||||
# - nm-applet
|
||||
# - dbus-x11 (required by nm-applet, but not specified as a dep in Fedora)
|
||||
#
|
||||
# Note that libguestfs is NOT a dependency.
|
||||
case "$osversion" in
|
||||
centos-*|fedora-*|rhel-*|scientificlinux-*)
|
||||
deps=pcre,libxml2,gtk2,/usr/bin/xinit,/usr/bin/ssh,/usr/bin/qemu-nbd,/usr/bin/Xorg,xorg-x11-drivers,xorg-x11-fonts-Type1,metacity,@hardware-support
|
||||
deps=pcre,libxml2,gtk2,/usr/bin/xinit,/usr/bin/ssh,/usr/bin/qemu-nbd,/usr/bin/Xorg,xorg-x11-drivers,xorg-x11-fonts-Type1,metacity,NetworkManager,network-manager-applet,dbus-x11,@hardware-support
|
||||
cat > $tmpdir/p2v.conf <<'EOF'
|
||||
add_drivers+=" usb-storage "
|
||||
EOF
|
||||
@@ -117,13 +120,13 @@ EOF
|
||||
"
|
||||
;;
|
||||
debian-*|ubuntu-*)
|
||||
deps=libpcre3,libxml2,libgtk2.0-0,openssh-client,qemu-utils,xorg,xserver-xorg-video-all,metacity
|
||||
deps=libpcre3,libxml2,libgtk2.0-0,openssh-client,qemu-utils,xorg,xserver-xorg-video-all,metacity,network-manager,network-manager-applet,dbus-x11
|
||||
;;
|
||||
archlinux-*)
|
||||
deps=pcre,libxml2,gtk2,openssh,qemu,xorg-xinit,xorg-server,xf86-video-*,metacity
|
||||
deps=pcre,libxml2,gtk2,openssh,qemu,xorg-xinit,xorg-server,xf86-video-*,metacity,NetworkManager,network-manager-applet,dbus-x11
|
||||
;;
|
||||
opensuse-*|suse-*)
|
||||
deps=pcre,libxml2,gtk2,/usr/bin/ssh,/usr/bin/qemu-nbd,/usr/bin/xinit,/usr/bin/Xorg,xf86-video-*,metacity
|
||||
deps=pcre,libxml2,gtk2,/usr/bin/ssh,/usr/bin/qemu-nbd,/usr/bin/xinit,/usr/bin/Xorg,xf86-video-*,metacity,NetworkManager,network-manager-applet,dbus-x11
|
||||
;;
|
||||
*)
|
||||
echo "$program: internal error: could not work out the Linux distro from '$osversion'"
|
||||
|
||||
Reference in New Issue
Block a user