aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--src/plugin.c83
-rw-r--r--src/plugin.h5
3 files changed, 75 insertions, 23 deletions
diff --git a/ChangeLog b/ChangeLog
index d8b437d..33bf224 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2008-01-23 Rob Bradford <rob@openedhand.com>
+ * src/plugin.c: (remote_debug_dialog), (remote_run_dialog),
+ (do_local_gdb), (do_remote_gdb), (action_remote_debug_activate_cb),
+ (action_remote_run_activate_cb), (shell_session_load_cb),
+ (shell_session_save_cb), (anjuta_plugin_sdk_activate),
+ (anjuta_plugin_sdk_deactivate):
+ * src/plugin.h:
+ Save local path and remote command in the session.
+
+2008-01-23 Rob Bradford <rob@openedhand.com>
+
* src/plugin.c: (action_start_qemu_activate_cb),
(remote_gdb_launcher_child_exited_cb):
Only make the "Remote debug..." option available when we have a
diff --git a/src/plugin.c b/src/plugin.c
index e542a5c..57d4586 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -57,7 +57,7 @@
#define REMOTE_COMMAND "ssh -o 'CheckHostIP no' " \
"-o 'StrictHostKeyChecking no' " \
"-o 'UserKnownHostsFile /dev/null' " \
- "root@%s anjuta-remote-run %s\" "
+ "root@%s anjuta-remote-run %s"
#define REMOTE_GDB_COMMAND "ssh -o 'CheckHostIP no' " \
"-o 'StrictHostKeyChecking no' " \
@@ -590,7 +590,7 @@ action_start_qemu_activate_cb (GtkAction *action, gpointer userdata)
}
static gint
-remote_debug_dialog (gchar **local_path, gchar **target_cmd)
+remote_debug_dialog (AnjutaPluginSdk *sp)
{
GtkWidget *dialog;
GtkWidget *inner_vbox;
@@ -623,7 +623,9 @@ remote_debug_dialog (gchar **local_path, gchar **target_cmd)
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 2);
chooser = gtk_file_chooser_button_new (_("Select the local executable"),
- GTK_FILE_CHOOSER_ACTION_OPEN);
+ GTK_FILE_CHOOSER_ACTION_OPEN);
+ gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (chooser), sp->gdb_local_path);
+
gtk_size_group_add_widget (control_group, chooser);
gtk_box_pack_start (GTK_BOX (hbox), chooser, TRUE, TRUE, 2);
@@ -637,6 +639,7 @@ remote_debug_dialog (gchar **local_path, gchar **target_cmd)
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 2);
entry = gtk_entry_new ();
+ gtk_entry_set_text (GTK_ENTRY (entry), sp->gdb_remote_command);
gtk_size_group_add_widget (control_group, entry);
gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 2);
@@ -653,8 +656,10 @@ remote_debug_dialog (gchar **local_path, gchar **target_cmd)
switch (res)
{
case GTK_RESPONSE_ACCEPT:
- *target_cmd = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
- *local_path = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser));
+ g_free (sp->gdb_remote_command);
+ g_free (sp->gdb_local_path);
+ sp->gdb_remote_command = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
+ sp->gdb_local_path = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser));
break;
default:
break;
@@ -665,7 +670,7 @@ remote_debug_dialog (gchar **local_path, gchar **target_cmd)
}
static gint
-remote_run_dialog (gchar **target_cmd)
+remote_run_dialog (AnjutaPluginSdk *sp)
{
GtkWidget *dialog;
GtkWidget *inner_vbox;
@@ -690,6 +695,7 @@ remote_run_dialog (gchar **target_cmd)
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2);
entry = gtk_entry_new ();
+ gtk_entry_set_text (GTK_ENTRY (entry), sp->remote_command);
gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 2);
gtk_box_pack_start (GTK_BOX (inner_vbox), hbox, TRUE, TRUE, 2);
@@ -705,7 +711,8 @@ remote_run_dialog (gchar **target_cmd)
switch (res)
{
case GTK_RESPONSE_ACCEPT:
- *target_cmd = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
+ g_free (sp->remote_command);
+ sp->remote_command = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
break;
default:
break;
@@ -775,7 +782,7 @@ do_local_gdb (AnjutaPluginSdk *sp)
}
cmd = g_strdup_printf (LOCAL_GDB_COMMAND, sp->sdk_root, sp->triplet,
- script_name, sp->local_path);
+ script_name, sp->gdb_local_path);
cur_dir = g_get_current_dir ();
ianjuta_terminal_execute_command (terminal, cur_dir, cmd, &error);
@@ -786,8 +793,6 @@ do_local_gdb (AnjutaPluginSdk *sp)
}
g_free (script_name);
- g_free (sp->local_path);
- sp->local_path = NULL;
g_free (cmd);
g_free (cur_dir);
}
@@ -802,7 +807,7 @@ remote_gdb_timeout_cb (gpointer userdata)
}
static void
-do_remote_gdb (AnjutaPluginSdk *sp, gchar *local_path, gchar *target_cmd)
+do_remote_gdb (AnjutaPluginSdk *sp)
{
IAnjutaMessageManager *msg_manager = NULL;
gchar *cmd = NULL;
@@ -816,7 +821,6 @@ do_remote_gdb (AnjutaPluginSdk *sp, gchar *local_path, gchar *target_cmd)
(GCallback)remote_gdb_launcher_child_exited_cb, sp);
}
-
/* Get the message view manager */
msg_manager = anjuta_shell_get_interface (ANJUTA_PLUGIN (sp)->shell,
IAnjutaMessageManager, &error);
@@ -861,15 +865,12 @@ do_remote_gdb (AnjutaPluginSdk *sp, gchar *local_path, gchar *target_cmd)
return;
}
- cmd = g_strdup_printf (REMOTE_GDB_COMMAND, QEMU_IP_ADDRESS, target_cmd);
+ cmd = g_strdup_printf (REMOTE_GDB_COMMAND, QEMU_IP_ADDRESS, sp->gdb_remote_command);
/* start the remote gdbserver */
if (anjuta_launcher_execute (sp->remote_gdb_launcher, cmd,
remote_gdb_launcher_data_cb, sp))
{
-
- sp->local_path = local_path;
-
/*
* Add a timeout for 8s to allow the gdbserver to startup (or perhaps it
* might fail. if it fails then this timeout will be removed and the local
@@ -892,8 +893,7 @@ action_remote_debug_activate_cb (GtkAction *action,
GError *error = NULL;
gchar *cur_dir = NULL;
gchar *cmd = NULL;
- gchar *target_cmd = NULL;
- gchar *local_path = NULL;
+
gint res = 0;
terminal = anjuta_shell_get_interface (ANJUTA_PLUGIN (sp)->shell,
@@ -908,19 +908,18 @@ action_remote_debug_activate_cb (GtkAction *action,
}
cur_dir = g_get_current_dir ();
- res = remote_debug_dialog (&local_path, &target_cmd);
+ res = remote_debug_dialog (sp);
switch (res)
{
case GTK_RESPONSE_ACCEPT:
- do_remote_gdb (sp, local_path, target_cmd);
+ do_remote_gdb (sp);
gtk_action_set_sensitive (sp->remote_debug_action, FALSE);
break;
default:
break;
}
- g_free (target_cmd);
g_free (cmd);
g_free (cur_dir);
}
@@ -949,7 +948,7 @@ action_remote_run_activate_cb (GtkAction *action,
}
cur_dir = g_get_current_dir ();
- res = remote_run_dialog (&target_cmd);
+ res = remote_run_dialog (sp);
switch (res)
{
@@ -1266,6 +1265,34 @@ project_root_uri_value_removed (AnjutaPlugin *plugin, const gchar *name,
gtk_action_set_sensitive (sp->deploy_action, FALSE);
}
+static void
+shell_session_load_cb (AnjutaShell *shell, AnjutaSessionPhase phase,
+ AnjutaSession *session, gpointer userdata)
+{
+ AnjutaPluginSdk *sp = (AnjutaPluginSdk *)userdata;
+
+ sp->remote_command = anjuta_session_get_string (session, "SDK",
+ "Remote command");
+ sp->gdb_local_path = anjuta_session_get_string (session, "SDK",
+ "Remote gdb local path");
+ sp->gdb_remote_command = anjuta_session_get_string (session, "SDK",
+ "Remote gdb remote command");
+}
+
+static void
+shell_session_save_cb (AnjutaShell *shell, AnjutaSessionPhase phase,
+ AnjutaSession *session, gpointer userdata)
+{
+ AnjutaPluginSdk *sp = (AnjutaPluginSdk *)userdata;
+
+ anjuta_session_set_string (session, "SDK", "Remote command",
+ sp->remote_command);
+ anjuta_session_set_string (session, "SDK", "Remote gdb local path",
+ sp->gdb_local_path);
+ anjuta_session_set_string (session, "SDK", "Remote gdb remote command",
+ sp->gdb_remote_command);
+}
+
static gboolean
anjuta_plugin_sdk_activate (AnjutaPlugin *plugin)
{
@@ -1332,6 +1359,11 @@ anjuta_plugin_sdk_activate (AnjutaPlugin *plugin)
(AnjutaPluginValueRemoved) project_root_uri_value_removed,
sp);
+ g_signal_connect (plugin->shell, "load-session",
+ (GCallback)shell_session_load_cb, sp);
+ g_signal_connect (plugin->shell, "save-session",
+ (GCallback)shell_session_save_cb, sp);
+
return TRUE;
}
@@ -1406,6 +1438,9 @@ anjuta_plugin_sdk_deactivate (AnjutaPlugin *plugin)
anjuta_plugin_remove_watch (plugin, sp->project_root_uri_watch, FALSE);
+ g_signal_handlers_disconnect_by_func (plugin->shell, shell_session_load_cb, sp);
+ g_signal_handlers_disconnect_by_func (plugin->shell, shell_session_save_cb, sp);
+
if (sp->prefs_icon)
g_object_unref (sp->prefs_icon);
@@ -1416,6 +1451,10 @@ anjuta_plugin_sdk_deactivate (AnjutaPlugin *plugin)
g_free (sp->project_root_uri);
g_free (sp->path_component);
+ g_free (sp->gdb_local_path);
+ g_free (sp->gdb_remote_command);
+ g_free (sp->remote_command);
+
return TRUE;
}
diff --git a/src/plugin.h b/src/plugin.h
index 313db3d..1b3f629 100644
--- a/src/plugin.h
+++ b/src/plugin.h
@@ -100,7 +100,10 @@ struct _AnjutaPluginSdk
GtkWidget *dialog;
GdkPixbuf *prefs_icon;
- gchar *local_path;
+ gchar *gdb_local_path;
+ gchar *gdb_remote_command;
+ gchar *remote_command;
+
IAnjutaBuildable *buildable;
};