aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Bradford <rob@o-hand.com>2008-04-03 18:01:34 +0000
committerrob <rob@aea7fca7-3721-49c4-ace3-ac8c44b998bb>2008-04-03 18:01:34 +0000
commit9cd09522f5c71bfc3c2227804d652a8a2cf5e1b5 (patch)
tree63acce84b18af8d15ada3e7a8fee6f92bb85aaa8
parent2654d7aee67fdef0a42a934fbc214ad6facf3fc3 (diff)
downloadanjuta-poky-9cd09522f5c71bfc3c2227804d652a8a2cf5e1b5.tar.gz
anjuta-poky-9cd09522f5c71bfc3c2227804d652a8a2cf5e1b5.tar.bz2
anjuta-poky-9cd09522f5c71bfc3c2227804d652a8a2cf5e1b5.zip
2008-04-03 Rob Bradford <rob@openedhand.com>
* src/plugin.c: (remote_run_dialog), (action_remote_run_activate_cb): Switch running a remote command over to use the new target based remote run mechanism.
-rw-r--r--ChangeLog7
-rw-r--r--src/plugin.c61
2 files changed, 29 insertions, 39 deletions
diff --git a/ChangeLog b/ChangeLog
index 6ba7965..2b5cc10 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2008-04-03 Rob Bradford <rob@openedhand.com>
+ * src/plugin.c: (remote_run_dialog),
+ (action_remote_run_activate_cb):
+ Switch running a remote command over to use the new target based
+ remote run mechanism.
+
+2008-04-03 Rob Bradford <rob@openedhand.com>
+
* src/beaver-target-qemu.c: (beaver_target_qemu_set_state),
(launcher_data_cb):
Don't blindly transition into the READY state. Check that we are still
diff --git a/src/plugin.c b/src/plugin.c
index 59e370b..cccca9c 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -51,11 +51,6 @@
"-o \"UserKnownHostsFile /dev/null\"' " \
"-avv %s/usr/ root@%s:/usr"
-#define REMOTE_COMMAND "ssh -o 'CheckHostIP no' " \
- "-o 'StrictHostKeyChecking no' " \
- "-o 'UserKnownHostsFile /dev/null' " \
- "root@%s anjuta-remote-run %s"
-
#define REMOTE_GDB_COMMAND "ssh -o 'CheckHostIP no' " \
"-o 'StrictHostKeyChecking no' " \
"-o 'UserKnownHostsFile /dev/null' " \
@@ -625,14 +620,15 @@ remote_debug_dialog (AnjutaPluginSdk *sp)
return res;
}
-static gint
-remote_run_dialog (AnjutaPluginSdk *sp)
+static gchar *
+remote_run_dialog (AnjutaPluginSdk *sp, gchar *prev_cmd)
{
GtkWidget *dialog;
GtkWidget *inner_vbox;
GtkWidget *label;
GtkWidget *hbox;
GtkWidget *entry;
+ gchar *ret = NULL;
gint res;
dialog = gtk_dialog_new_with_buttons (_("Run remotely"),
@@ -656,7 +652,9 @@ remote_run_dialog (AnjutaPluginSdk *sp)
/* Make hitting enter in the entry do the window default action */
gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
- gtk_entry_set_text (GTK_ENTRY (entry), sp->remote_command);
+ if (prev_cmd)
+ gtk_entry_set_text (GTK_ENTRY (entry), prev_cmd);
+
gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 2);
gtk_box_pack_start (GTK_BOX (inner_vbox), hbox, TRUE, TRUE, 2);
@@ -672,15 +670,15 @@ remote_run_dialog (AnjutaPluginSdk *sp)
switch (res)
{
case GTK_RESPONSE_ACCEPT:
- g_free (sp->remote_command);
- sp->remote_command = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
+ if (strlen (gtk_entry_get_text (GTK_ENTRY (entry))) > 0)
+ ret = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
break;
default:
break;
}
gtk_widget_destroy (dialog);
- return res;
+ return ret;
}
static void
@@ -898,40 +896,25 @@ action_remote_run_activate_cb (GtkAction *action,
gpointer userdata)
{
AnjutaPluginSdk *sp = (AnjutaPluginSdk *)userdata;
- IAnjutaTerminal *terminal = NULL;
GError *error = NULL;
- gchar *cur_dir = NULL;
gchar *cmd = NULL;
- gint res = 0;
-
- terminal = anjuta_shell_get_interface (ANJUTA_PLUGIN (sp)->shell,
- IAnjutaTerminal, &error);
-
- if (terminal == NULL)
- {
- g_warning ("Error getting terminal interface from shell: %s",
- error->message);
- g_clear_error (&error);
- return;
- }
- cur_dir = g_get_current_dir ();
- res = remote_run_dialog (sp);
+ cmd = remote_run_dialog (sp, sp->remote_command);
- switch (res)
+ if (cmd)
{
- case GTK_RESPONSE_ACCEPT:
- cmd = g_strdup_printf (REMOTE_COMMAND,
- beaver_target_get_ip_address (sp->target),
- sp->remote_command);
- ianjuta_terminal_execute_command (terminal, cur_dir, cmd, &error);
- break;
- default:
- break;
+ if (!beaver_target_run_remote (sp->target, cmd, &error))
+ {
+ g_warning ("Error running remote command: %s", error->message);
+ g_clear_error (&error);
+ g_free (cmd);
+ } else {
+ g_free (sp->remote_command);
+ sp->remote_command = cmd;
+ }
+ } else {
+ g_warning ("No command to run given");
}
-
- g_free (cmd);
- g_free (cur_dir);
}
static void