mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone
Blob Blame History Raw
From a364cdd1d65a11f7672c22ae9d2d7ef553327d7c Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 3 Jun 2016 10:29:46 +0100
Subject: [PATCH] p2v: Add "XTerm" button which launches a terminal window.

(cherry picked from commit bf434bdb3523b7629d50144f35a6bccc05bf94e6)
---
 p2v/gui.c | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/p2v/gui.c b/p2v/gui.c
index 015fa21..b8d61b5 100644
--- a/p2v/gui.c
+++ b/p2v/gui.c
@@ -95,6 +95,7 @@ gui_conversion (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 xterm_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);
@@ -112,6 +113,7 @@ create_connection_dialog (struct config *config)
   GtkWidget *test_hbox, *test;
   GtkWidget *about;
   GtkWidget *configure_network;
+  GtkWidget *xterm;
   char port_str[64];
 
   conn_dlg = gtk_dialog_new ();
@@ -220,16 +222,18 @@ create_connection_dialog (struct config *config)
   /* Buttons. */
   gtk_dialog_add_buttons (GTK_DIALOG (conn_dlg),
                           _("Configure network ..."), 1,
-                          _("About virt-p2v " PACKAGE_VERSION " ..."), 2,
-                          _("Next"), 3,
+                          _("XTerm ..."), 2,
+                          _("About virt-p2v " PACKAGE_VERSION " ..."), 3,
+                          _("Next"), 4,
                           NULL);
 
-  next_button = gtk_dialog_get_widget_for_response (GTK_DIALOG (conn_dlg), 3);
+  next_button = gtk_dialog_get_widget_for_response (GTK_DIALOG (conn_dlg), 4);
   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);
+  xterm = gtk_dialog_get_widget_for_response (GTK_DIALOG (conn_dlg), 2);
+  about = gtk_dialog_get_widget_for_response (GTK_DIALOG (conn_dlg), 3);
 
   /* Signals. */
   g_signal_connect_swapped (G_OBJECT (conn_dlg), "destroy",
@@ -238,6 +242,8 @@ create_connection_dialog (struct config *config)
                     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 (xterm), "clicked",
+                    G_CALLBACK (xterm_button_clicked), NULL);
   g_signal_connect (G_OBJECT (about), "clicked",
                     G_CALLBACK (about_button_clicked), NULL);
   g_signal_connect (G_OBJECT (next_button), "clicked",
@@ -387,6 +393,15 @@ configure_network_button_clicked (GtkWidget *w, gpointer data)
   ignore_value (system ("nm-connection-editor &"));
 }
 
+/**
+ * Callback from the C<XTerm ...> button.
+ */
+static void
+xterm_button_clicked (GtkWidget *w, gpointer data)
+{
+  ignore_value (system ("xterm &"));
+}
+
 static void
 about_button_clicked (GtkWidget *w, gpointer data)
 {
-- 
2.7.4