anjuta r3457 - in trunk: . plugins/debug-manager
- From: sgranjoux svn gnome org
- To: svn-commits-list gnome org
- Subject: anjuta r3457 - in trunk: . plugins/debug-manager
- Date: Fri, 11 Jan 2008 20:18:17 +0000 (GMT)
Author: sgranjoux
Date: Fri Jan 11 20:18:17 2008
New Revision: 3457
URL: http://svn.gnome.org/viewvc/anjuta?rev=3457&view=rev
Log:
* plugins/debug-manager/anjuta-debug-manager.ui,
plugins/debug-manager/plugin.c,
plugins/debug-manager/start.h,
plugins/debug-manager/start.c:
New menu item to add extra source directories for debugger
Modified:
trunk/ChangeLog
trunk/plugins/debug-manager/anjuta-debug-manager.ui
trunk/plugins/debug-manager/plugin.c
trunk/plugins/debug-manager/start.c
trunk/plugins/debug-manager/start.h
Modified: trunk/plugins/debug-manager/anjuta-debug-manager.ui
==============================================================================
--- trunk/plugins/debug-manager/anjuta-debug-manager.ui (original)
+++ trunk/plugins/debug-manager/anjuta-debug-manager.ui Fri Jan 11 20:18:17 2008
@@ -7,6 +7,7 @@
<menuitem name="RestartTarget" action="ActionDebuggerRestartTarget" />
<menuitem name="AttachProcess" action="ActionDebuggerAttachProcess" />
<menuitem name="Stop" action="ActionDebuggerStop" />
+ <menuitem name="AddSource" action="ActionDebuggerAddSource" />
<separator name="separator3"/>
<menuitem name="Run" action="ActionDebuggerRunContinue" />
Modified: trunk/plugins/debug-manager/plugin.c
==============================================================================
--- trunk/plugins/debug-manager/plugin.c (original)
+++ trunk/plugins/debug-manager/plugin.c Fri Jan 11 20:18:17 2008
@@ -610,6 +610,12 @@
}
}
+static void
+on_add_source_activate (GtkAction* action, DebugManagerPlugin* this)
+{
+ dma_add_source_path (this->start);
+}
+
/* Execute call back
*---------------------------------------------------------------------------*/
@@ -865,6 +871,14 @@
N_("Say goodbye to the debugger"),
G_CALLBACK (on_debugger_stop_activate)
},
+ {
+ "ActionDebuggerAddSource",
+ NULL,
+ N_("Add source paths..."),
+ NULL,
+ N_("Add additional source paths"),
+ G_CALLBACK (on_add_source_activate)
+ }
};
static GtkActionEntry actions_loaded[] =
Modified: trunk/plugins/debug-manager/start.c
==============================================================================
--- trunk/plugins/debug-manager/start.c (original)
+++ trunk/plugins/debug-manager/start.c Fri Jan 11 20:18:17 2008
@@ -64,7 +64,7 @@
CLEAR_REVIEW,
CLEAR_FINAL
};
-
+
struct _AttachProcess
{
GtkWidget* dialog;
@@ -110,6 +110,8 @@
gchar* program_args;
gboolean run_in_terminal;
gboolean stop_at_beginning;
+
+ GList *source_dirs;
};
/* Widgets found in glade file
@@ -122,6 +124,10 @@
#define TARGET_COMBO "target_combo"
#define TARGET_SELECT_SIGNAL "on_select_target_clicked"
+#define ADD_SOURCE_DIALOG "source_paths_dialog"
+#define SOURCE_ENTRY "src_entry"
+#define SOURCE_LIST "src_clist"
+
#define ANJUTA_RESPONSE_SELECT_TARGET 0
static void attach_process_clear (AttachProcess * ap, gint ClearRequest);
@@ -141,7 +147,7 @@
GList *slibs_dirs = NULL;
GList *libs_dirs = NULL;
GValue value = {0,};
-
+
return NULL;
cwd = g_get_current_dir();
search_dirs = g_list_prepend (search_dirs, gnome_vfs_get_uri_from_local_path(cwd));
@@ -227,6 +233,10 @@
}
anjuta_session_set_int (session, "Execution", "Run in terminal", this->run_in_terminal + 1);
anjuta_session_set_int (session, "Execution", "Stop at beginning", this->stop_at_beginning + 1);
+ if (this->source_dirs)
+ {
+ anjuta_session_set_string_list (session, "Debugger", "Source directories", this->source_dirs);
+ }
}
static void on_session_load (AnjutaShell *shell, AnjutaSessionPhase phase, AnjutaSession *session, DmaStart *this)
@@ -262,17 +272,24 @@
}
/* The flag is store as 1 == FALSE, 2 == TRUE */
- run_in_terminal = anjuta_session_get_int (session, "Execution", "Run in terminal");
- if (run_in_terminal == 0)
+ run_in_terminal = anjuta_session_get_int (session, "Execution", "Run in terminal");
+ if (run_in_terminal == 0)
this->run_in_terminal = TRUE; /* Default value */
else
this->run_in_terminal = run_in_terminal - 1;
- stop_at_beginning = anjuta_session_get_int (session, "Execution", "Stop at beginning");
- if (stop_at_beginning == 0)
+ stop_at_beginning = anjuta_session_get_int (session, "Execution", "Stop at beginning");
+ if (stop_at_beginning == 0)
this->stop_at_beginning = TRUE; /* Default value */
else
this->stop_at_beginning = stop_at_beginning - 1;
+ /* Initialize source_dirs */
+ if (this->source_dirs != NULL)
+ {
+ g_list_foreach (this->source_dirs, (GFunc)g_free, NULL);
+ g_list_free (this->source_dirs);
+ }
+ this->source_dirs = anjuta_session_get_string_list (session, "Debugger", "Source directories");
}
/* Attach to process private functions
@@ -840,7 +857,7 @@
mime_type = gnome_vfs_get_mime_type (this->target_uri);
filename = gnome_vfs_uri_get_path (vfs_uri);
- dma_queue_load (this->debugger, filename, mime_type, search_dirs);
+ dma_queue_load (this->debugger, filename, mime_type, this->source_dirs);
g_free (mime_type);
gnome_vfs_uri_unref (vfs_uri);
@@ -1044,6 +1061,117 @@
return response == GTK_RESPONSE_OK;
}
+static gboolean
+on_add_source_in_list (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer user_data)
+{
+ GList** list = (GList **)user_data;
+ gchar* dir;
+ gchar* uri;
+
+ gtk_tree_model_get (model, iter, 0, &dir, -1);
+ uri = gnome_vfs_get_uri_from_local_path (dir);
+ *list = g_list_prepend (*list, uri);
+ g_free (dir);
+
+ return FALSE;
+}
+
+static void
+on_add_source_in_model (gpointer data, gpointer user_data)
+{
+ GtkListStore* model = (GtkListStore *)user_data;
+ GtkTreeIter iter;
+ gchar *local;
+
+ local = gnome_vfs_get_local_path_from_uri ((const char *)data);
+ gtk_list_store_append (model, &iter);
+ gtk_list_store_set (model, &iter, 0, local, -1);
+ g_free (local);
+}
+
+static void
+add_source_show (DmaStart *this)
+{
+ GtkWindow *parent;
+ GladeXML *gxml;
+ GtkWidget *dlg;
+ GtkTreeView *tree;
+ GtkEntry *entry;
+ GtkCellRenderer *renderer;
+ GtkTreeViewColumn *column;
+ gint response;
+ GtkListStore* model;
+ GtkTreeIter iter;
+ GtkTreeSelection* sel;
+ const gchar *path;
+
+ parent = GTK_WINDOW (this->plugin->shell);
+ gxml = glade_xml_new (GLADE_FILE, ADD_SOURCE_DIALOG, NULL);
+ if (gxml == NULL)
+ {
+ anjuta_util_dialog_error(parent, _("Missing file %s"), GLADE_FILE);
+ return;
+ }
+
+ dlg = glade_xml_get_widget (gxml, ADD_SOURCE_DIALOG);
+ tree = GTK_TREE_VIEW (glade_xml_get_widget (gxml, SOURCE_LIST));
+ entry = GTK_ENTRY (glade_xml_get_widget (gxml, SOURCE_ENTRY));
+ g_object_unref (gxml);
+
+ renderer = gtk_cell_renderer_text_new ();
+ column = gtk_tree_view_column_new_with_attributes (_("Path"), renderer, "text", 0, NULL);
+ gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
+ gtk_tree_view_append_column (tree, column);
+ gtk_tree_view_set_expander_column(tree, column);
+
+ model = gtk_list_store_new (1, GTK_TYPE_STRING);
+ gtk_tree_view_set_model (tree, GTK_TREE_MODEL (model));
+
+ gtk_window_set_transient_for (GTK_WINDOW (dlg), parent);
+
+ /* Initialize source path list */
+ g_list_foreach (this->source_dirs, on_add_source_in_model, model);
+
+ /* Run dialog */
+ for (;;)
+ {
+ response = gtk_dialog_run (GTK_DIALOG (dlg));
+
+ switch (response)
+ {
+ case GTK_RESPONSE_OK:
+ path = gtk_entry_get_text (entry);
+ if ((path != NULL) && (*path != '\0'))
+ {
+ gtk_list_store_append (model, &iter);
+ gtk_list_store_set (model, &iter, 0, path, -1);
+ }
+ continue;
+ case GTK_RESPONSE_CANCEL:
+ sel = gtk_tree_view_get_selection (tree);
+ if (gtk_tree_selection_get_selected (sel, NULL, &iter))
+ {
+ gtk_list_store_remove (model, &iter);
+ }
+ continue;
+ case GTK_RESPONSE_REJECT:
+ gtk_list_store_clear (model);
+ continue;
+ case GTK_RESPONSE_APPLY:
+ g_list_foreach (this->source_dirs, (GFunc)g_free, NULL);
+ g_list_free (this->source_dirs);
+ this->source_dirs = NULL;
+ gtk_tree_model_foreach (GTK_TREE_MODEL (model), on_add_source_in_list, &this->source_dirs);
+ this->source_dirs = g_list_reverse (this->source_dirs);
+ break;
+ default:
+ break;
+ }
+ break;
+ }
+ gtk_widget_destroy (dlg);
+}
+
/* Public functions
*---------------------------------------------------------------------------*/
@@ -1065,6 +1193,12 @@
}
void
+dma_add_source_path (DmaStart *self)
+{
+ add_source_show (self);
+}
+
+void
dma_attach_to_process (DmaStart* this)
{
pid_t selected_pid;
@@ -1084,7 +1218,7 @@
search_dirs = get_source_directories (this->plugin);
- dma_queue_attach (this->debugger, lpid, search_dirs);
+ dma_queue_attach (this->debugger, lpid, this->source_dirs);
free_source_directories (search_dirs);
}
attach_process_destroy(attach_process);
@@ -1125,6 +1259,7 @@
self->plugin = ANJUTA_PLUGIN (plugin);
self->debugger = dma_debug_manager_get_queue (plugin);
+ self->source_dirs = NULL;
g_signal_connect (self->plugin->shell, "save-session",
G_CALLBACK (on_session_save), self);
@@ -1139,6 +1274,11 @@
{
g_signal_handlers_disconnect_by_func (this->plugin->shell, G_CALLBACK (on_session_save), this);
g_signal_handlers_disconnect_by_func (this->plugin->shell, G_CALLBACK (on_session_load), this);
+ if (this->source_dirs != NULL)
+ {
+ g_list_foreach (this->source_dirs, (GFunc)g_free, NULL);
+ g_list_free (this->source_dirs);
+ }
if (this->program_args != NULL) g_free (this->program_args);
if (this->target_uri != NULL) g_free (this->target_uri);
g_free (this);
Modified: trunk/plugins/debug-manager/start.h
==============================================================================
--- trunk/plugins/debug-manager/start.h (original)
+++ trunk/plugins/debug-manager/start.h Fri Jan 11 20:18:17 2008
@@ -30,6 +30,7 @@
DmaStart *dma_start_new (DebugManagerPlugin *plugin);
void dma_start_free (DmaStart *this);
+void dma_add_source_path (DmaStart *self);
void dma_attach_to_process (DmaStart *this);
gboolean dma_run_target (DmaStart *this);
gboolean dma_rerun_target (DmaStart *this);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]