Revision: 2180 http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=2180&view=re... Author: cesspit Date: 2011-08-28 15:06:23 +0000 (Sun, 28 Aug 2011) Log Message: ----------- debugger: config auto save, stack tree click on already selected item opens frame location
Modified Paths: -------------- trunk/geany-plugins/debugger/src/breakpoints.c trunk/geany-plugins/debugger/src/breakpoints.h trunk/geany-plugins/debugger/src/btnpanel.c trunk/geany-plugins/debugger/src/dconfig.c trunk/geany-plugins/debugger/src/dconfig.h trunk/geany-plugins/debugger/src/debug.c trunk/geany-plugins/debugger/src/debug.h trunk/geany-plugins/debugger/src/plugin.c trunk/geany-plugins/debugger/src/stree.c trunk/geany-plugins/debugger/src/tpage.c trunk/geany-plugins/debugger/src/tpage.h trunk/geany-plugins/debugger/src/wtree.c trunk/geany-plugins/debugger/src/wtree.h
Modified: trunk/geany-plugins/debugger/src/breakpoints.c =================================================================== --- trunk/geany-plugins/debugger/src/breakpoints.c 2011-08-27 21:52:56 UTC (rev 2179) +++ trunk/geany-plugins/debugger/src/breakpoints.c 2011-08-28 15:06:23 UTC (rev 2180) @@ -149,6 +149,8 @@ bptree_add_breakpoint(bp); /* add marker */ markers_add_breakpoint(bp); + /* mark config for saving */ + dconfig_set_changed(); } else dialogs_show_msgbox(GTK_MESSAGE_ERROR, "%s", debug_error_message()); @@ -171,6 +173,9 @@ /* remove from internal storage */ GTree *tree = g_hash_table_lookup(files,bp->file); g_tree_remove(tree, GINT_TO_POINTER(bp->line)); + + /* mark config for saving */ + dconfig_set_changed(); } else dialogs_show_msgbox(GTK_MESSAGE_ERROR, "%s", debug_error_message()); @@ -189,6 +194,8 @@ bptree_set_hitscount(bp->iter, bp->hitscount); markers_remove_breakpoint(bp); markers_add_breakpoint(bp); + /* mark config for saving */ + dconfig_set_changed(); } else dialogs_show_msgbox(GTK_MESSAGE_ERROR, "%s", debug_error_message()); @@ -208,6 +215,8 @@ bptree_set_condition(bp->iter, bp->condition); markers_remove_breakpoint(bp); markers_add_breakpoint(bp); + /* mark config for saving */ + dconfig_set_changed(); } else { @@ -234,6 +243,9 @@
/* set checkbox in breaks tree */ bptree_set_enabled(bp->iter, bp->enabled); + + /* mark config for saving */ + dconfig_set_changed(); }
/* @@ -495,6 +507,9 @@ g_tree_steal(tree, GINT_TO_POINTER(line_from)); bp->line = line_to; g_tree_insert(tree, GINT_TO_POINTER(line_to), bp); + + /* mark config for saving */ + dconfig_set_changed(); } } } @@ -557,21 +572,3 @@ { return bptree_get_widget(); } - -/* - * Read new breakpoints from dconfig - */ -void breaks_read_config() -{ - /* clear all breaks */ - breaks_remove_all(); - - GList *list = dconfig_breaks_get(); - - while(list) - { - breakpoint *bp = (breakpoint*)list->data; - breaks_add(bp->file, bp->line, bp->condition, bp->enabled, bp->hitscount); - list = list->next; - } -}
Modified: trunk/geany-plugins/debugger/src/breakpoints.h =================================================================== --- trunk/geany-plugins/debugger/src/breakpoints.h 2011-08-27 21:52:56 UTC (rev 2179) +++ trunk/geany-plugins/debugger/src/breakpoints.h 2011-08-28 15:06:23 UTC (rev 2180) @@ -40,5 +40,4 @@ GtkWidget* breaks_get_widget(); GList* breaks_get_for_document(const char* file); GList* breaks_get_all(); -void breaks_read_config();
Modified: trunk/geany-plugins/debugger/src/btnpanel.c =================================================================== --- trunk/geany-plugins/debugger/src/btnpanel.c 2011-08-27 21:52:56 UTC (rev 2179) +++ trunk/geany-plugins/debugger/src/btnpanel.c 2011-08-28 15:06:23 UTC (rev 2180) @@ -42,9 +42,7 @@ #define CP_BUTTONS_PAD 5 #define CONFIG_NAME ".debugger"
-static GtkWidget *savebtn = NULL; static GtkWidget *loadbtn = NULL; -static GtkWidget *clearbtn = NULL;
static GtkWidget *runbtn = NULL; static GtkWidget *restartbtn = NULL; @@ -77,38 +75,11 @@ { dialogs_show_msgbox(GTK_MESSAGE_ERROR, _("Error reading config file")); } - else - { - /* update target page */ - tpage_read_config(); - /* breakpoints */ - breaks_read_config(); - /* watches */ - wtree_read_config(); - } g_free(folder); } }
/* - * save config button handler - */ -void on_config_save(GtkButton *button, gpointer user_data) -{ - GeanyDocument *doc = document_get_current(); - if (doc && doc->real_path) - { - /* open config file */ - gchar *folder = g_path_get_dirname(DOC_FILENAME(doc)); - if (!dconfig_save(folder)) - { - dialogs_show_msgbox(GTK_MESSAGE_ERROR, _("Error saving config file")); - } - g_free(folder); - } -} - -/* * clear config values button handler */ void on_config_clear(GtkButton *button, gpointer user_data) @@ -203,14 +174,6 @@ g_signal_connect(G_OBJECT(loadbtn), "clicked", G_CALLBACK (on_config_load), (gpointer)TRUE); gtk_box_pack_start(GTK_BOX(vbutton_box), loadbtn, FALSE, TRUE, 0);
- savebtn = create_stock_button(GTK_STOCK_SAVE, _("Save settings")); - g_signal_connect(G_OBJECT(savebtn), "clicked", G_CALLBACK (on_config_save), NULL); - gtk_box_pack_start(GTK_BOX(vbutton_box), savebtn, FALSE, TRUE, 0); - - clearbtn = create_stock_button(GTK_STOCK_CLEAR, _("Clear settings")); - g_signal_connect(G_OBJECT(clearbtn), "clicked", G_CALLBACK (on_config_clear), NULL); - gtk_box_pack_start(GTK_BOX(vbutton_box), clearbtn, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(vbox_panels_buttons), vbutton_box, TRUE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), vbox_panels_buttons, TRUE, FALSE, 0);
@@ -233,7 +196,6 @@ void btnpanel_on_document_close() { gtk_widget_set_sensitive(loadbtn, FALSE); - gtk_widget_set_sensitive(savebtn, FALSE); }
/* @@ -251,8 +213,6 @@ return; }
- gtk_widget_set_sensitive(savebtn, TRUE); - gchar *dirname = g_path_get_dirname(DOC_FILENAME(doc)); gchar *config = g_build_path(G_DIR_SEPARATOR_S, dirname, CONFIG_NAME, NULL); struct stat st; @@ -298,5 +258,4 @@ gtk_widget_set_sensitive(runcursorbtn, DBS_STOPPED == state);
gtk_widget_set_sensitive(loadbtn, DBS_IDLE == state); - gtk_widget_set_sensitive(clearbtn, DBS_IDLE == state); }
Modified: trunk/geany-plugins/debugger/src/dconfig.c =================================================================== --- trunk/geany-plugins/debugger/src/dconfig.c 2011-08-27 21:52:56 UTC (rev 2179) +++ trunk/geany-plugins/debugger/src/dconfig.c 2011-08-28 15:06:23 UTC (rev 2180) @@ -49,13 +49,22 @@ /* maximus config file line length */ #define MAXLINE 1000
-static gchar *target = NULL; -static int module = -1; -static gchar *args = NULL; -static GList *env = NULL; -static GList *breaks = NULL; -static GList *watches = NULL; +/* saving interval */ +#define SAVING_INTERVAL 2000000
+/* idle callback staff */ +static GMutex *change_config_mutex; +static GCond *cond; +static GThread *saving_thread; +static gboolean config_changed = FALSE; +static gboolean loading_or_cleaning = FALSE; + +/* the folder, config has been loaded from */ +static gchar *current_folder = NULL; + +/* forward declaration */ +gboolean dconfig_save(gchar *folder); + /* * reads line from a file */ @@ -71,11 +80,79 @@ buffer[read] = '\0';
return read; -} +}
/* - * checks whether a config fileis founs in the folder + * function for a config file background saving if changed */ +gpointer saving_thread_func(gpointer data) +{ + GTimeVal interval; + GMutex *m = g_mutex_new(); + do + { + g_mutex_lock(change_config_mutex); + if (config_changed && current_folder) + { + dconfig_save(current_folder); + config_changed = FALSE; + } + g_mutex_unlock(change_config_mutex); + + g_get_current_time(&interval); + g_time_val_add(&interval, SAVING_INTERVAL); + } + while (!g_cond_timed_wait(cond, m, &interval)); + g_mutex_free(m); + + return NULL; +} + +/* + * set "changed" flag to save it on "saving_thread" thread + */ +void dconfig_set_changed() +{ + if (!loading_or_cleaning) + { + g_mutex_lock(change_config_mutex); + config_changed = TRUE; + g_mutex_unlock(change_config_mutex); + } +} + +/* + * init config + */ +void dconfig_init() +{ + change_config_mutex = g_mutex_new(); + cond = g_cond_new(); + + saving_thread = g_thread_create(saving_thread_func, NULL, TRUE, NULL); +} + +/* + * destroys config + */ +void dconfig_destroy() +{ + g_cond_signal(cond); + /* ??? g_thread_join(saving_thread); */ + + g_mutex_free(change_config_mutex); + g_cond_free(cond); + + if (current_folder) + { + g_free(current_folder); + current_folder = NULL; + } +} + +/* + * checks whether a config file is founs in the folder + */ gboolean dconfig_is_found_at(gchar *folder) { gchar *config = g_build_path(G_DIR_SEPARATOR_S, folder, CONFIG_NAME, NULL); @@ -90,40 +167,50 @@ */ gboolean dconfig_load(gchar *folder) { - dconfig_clear(); + loading_or_cleaning = TRUE; + g_mutex_lock(change_config_mutex); + + tpage_clear(); + wtree_remove_all(); + breaks_remove_all(); + if (current_folder) + { + g_free(current_folder); + } + current_folder = g_strdup(folder); + gchar *path = g_build_path(G_DIR_SEPARATOR_S, folder, CONFIG_NAME, NULL); FILE *file = fopen(path, "r"); if (!file) { + config_changed = FALSE; + + loading_or_cleaning = FALSE; + g_mutex_unlock(change_config_mutex); + return FALSE; }
/* target */ gchar buffer[FILENAME_MAX]; - if(!readline(file, buffer, FILENAME_MAX - 1)) + if(readline(file, buffer, FILENAME_MAX - 1)) { - memset(target, 0, FILENAME_MAX * sizeof(gchar)); + tpage_set_target(buffer); } - target = g_strdup(buffer);
/* debugger */ gchar debugger[FILENAME_MAX]; if(readline(file, debugger, FILENAME_MAX - 1)) { - module = debug_get_module_index(debugger); - if (-1 == module) - { - module = 0; - } + tpage_set_debugger(debugger); } /* arguments */ - if(!readline(file, buffer, FILENAME_MAX - 1)) + if(readline(file, buffer, FILENAME_MAX - 1)) { - memset(buffer, 0, FILENAME_MAX * sizeof(gchar)); + tpage_set_commandline(buffer); } - args = g_strdup(buffer);
/* breakpoints and environment variables */ gchar line[MAXLINE]; @@ -158,8 +245,7 @@ struct stat st; if(!stat(_path, &st)) { - breakpoint *bp = break_new_full(_path, nline, condition, enabled, hitscount); - breaks = g_list_append(breaks, bp); + breaks_add(_path, nline, condition, enabled, hitscount); } } else if (!strcmp(line, ENVIRONMENT_MARKER)) @@ -167,8 +253,7 @@ gchar name[MAXLINE], value[1000]; if(readline(file, name, MAXLINE) && readline(file, value, MAXLINE)) { - env = g_list_append(env, name); - env = g_list_append(env, value); + tpage_add_environment(name, value); } } else if (!strcmp(line, WATCH_MARKER)) @@ -176,10 +261,15 @@ gchar watch[MAXLINE]; if(readline(file, watch, MAXLINE)) { - watches = g_list_append(watches, g_strdup(watch)); + wtree_add_watch(watch); } } } + + config_changed = FALSE; + + loading_or_cleaning = FALSE; + g_mutex_unlock(change_config_mutex); return TRUE; } @@ -263,127 +353,3 @@
return (gboolean)config; } - -/* - * gets target - */ -gchar* dconfig_target_get() -{ - return target; -} - -/* - * sets target - */ -void dconfig_target_set(gchar *newvalue) -{ - if (target) - { - g_free(target); - } - target = newvalue; -} - -/* - * gets debugger module index - */ -int dconfig_module_get() -{ - return module; -} - -/* - * sets debugger module index - */ -void dconfig_module_set(int newvalue) -{ - module = newvalue; -} - -/* - * gets command line arguments - */ -gchar* dconfig_args_get() -{ - return args; -} - -/* - * sets command line arguments - */ -void dconfig_args_set(gchar *newvalue) -{ - if (args) - { - g_free(args); - } - args = newvalue; -} - -/* - * gets environment variables - */ -GList* dconfig_env_get() -{ - return env; -} - -/* - * removes all environment variables - */ -void dconfig_env_clear() -{ - g_list_foreach(env, (GFunc)g_free, NULL); - g_list_free(env); - env = NULL; -} - -/* - * gets breakpoints - */ -GList* dconfig_breaks_get() -{ - return breaks; -} - -/* - * clears breakpoints - */ -void dconfig_breaks_clear() -{ - g_list_foreach(breaks, (GFunc)g_free, NULL); - g_list_free(breaks); - breaks = NULL; -} - -/* - * gets watches - */ -GList* dconfig_watches_get() -{ - return watches; -} - -/* - * clears watches - */ -void dconfig_watches_clear() -{ - g_list_foreach(watches, (GFunc)g_free, NULL); - g_list_free(watches); - watches = NULL; -} - -/* - * clears all config values - */ -void dconfig_clear() -{ - dconfig_target_set(NULL); - dconfig_module_set(0); - dconfig_args_set(NULL); - dconfig_env_clear(); - - dconfig_breaks_clear(); - dconfig_watches_clear(); -}
Modified: trunk/geany-plugins/debugger/src/dconfig.h =================================================================== --- trunk/geany-plugins/debugger/src/dconfig.h 2011-08-27 21:52:56 UTC (rev 2179) +++ trunk/geany-plugins/debugger/src/dconfig.h 2011-08-28 15:06:23 UTC (rev 2180) @@ -18,17 +18,13 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ - + +void dconfig_init(); +void dconfig_destroy(); + gboolean dconfig_is_found_at(gchar *folder); gboolean dconfig_load(gchar *folder); -gboolean dconfig_save(gchar *folder); -void dconfig_clear();
-gchar* dconfig_target_get(); -int dconfig_module_get(); -gchar* dconfig_args_get(); -GList* dconfig_env_get(); -GList* dconfig_breaks_get(); -GList* dconfig_watches_get(); +void dconfig_set_changed();
Modified: trunk/geany-plugins/debugger/src/debug.c =================================================================== --- trunk/geany-plugins/debugger/src/debug.c 2011-08-27 21:52:56 UTC (rev 2179) +++ trunk/geany-plugins/debugger/src/debug.c 2011-08-28 15:06:23 UTC (rev 2180) @@ -59,6 +59,7 @@ #include "calltip.h" #include "bptree.h" #include "btnpanel.h" +#include "dconfig.h"
/* * calltip size @@ -244,6 +245,8 @@ gtk_tree_store_remove(wstore, &iter); if (DBS_STOPPED == debug_state) active_module->remove_watch(internal); + + dconfig_set_changed(); } else if (strcmp(oldvalue, striped)) { @@ -274,6 +277,8 @@ gtk_tree_selection_select_path(selection, _path); gtk_tree_path_free(_path); } + + dconfig_set_changed(); } /* free resources */ @@ -339,6 +344,8 @@ } else variable_set_name_only(wstore, &newvar, expression); + + dconfig_set_changed(); }
/* @@ -453,6 +460,8 @@ /* free references list */ g_list_foreach (references, (GFunc)gtk_tree_row_reference_free, NULL); g_list_free (references); + + dconfig_set_changed(); }
/* free rows list */ @@ -499,6 +508,7 @@ else variable_set_name_only(wstore, &newvar, expression);
+ dconfig_set_changed(); }
g_free(expression); @@ -1014,7 +1024,7 @@ * arguments: * modulename - debug module name */ -int debug_get_module_index(gchar *modulename) +int debug_get_module_index(const gchar *modulename) { int _index = 0; while (modules[_index].title) @@ -1059,7 +1069,7 @@ if (DBS_IDLE == debug_state) { /* init selected debugger module */ - if((active_module = modules[tpage_get_module_index()].module)->init(&callbacks)) + if((active_module = modules[tpage_get_debug_module_index()].module)->init(&callbacks)) { /* gets parameters from the target page */ gchar *target = g_strstrip(tpage_get_target());
Modified: trunk/geany-plugins/debugger/src/debug.h =================================================================== --- trunk/geany-plugins/debugger/src/debug.h 2011-08-27 21:52:56 UTC (rev 2179) +++ trunk/geany-plugins/debugger/src/debug.h 2011-08-28 15:06:23 UTC (rev 2180) @@ -47,7 +47,7 @@ void debug_request_interrupt(bs_callback cb, breakpoint* bp, break_set_activity flags); gchar* debug_error_message(); GList* debug_get_modules(); -int debug_get_module_index(gchar *modulename); +int debug_get_module_index(const gchar *modulename); gboolean debug_supports_async_breaks(); void debug_destroy(); gchar* debug_evaluate_expression(gchar *expression);
Modified: trunk/geany-plugins/debugger/src/plugin.c =================================================================== --- trunk/geany-plugins/debugger/src/plugin.c 2011-08-27 21:52:56 UTC (rev 2179) +++ trunk/geany-plugins/debugger/src/plugin.c 2011-08-28 15:06:23 UTC (rev 2180) @@ -40,7 +40,7 @@
/* These items are set by Geany before plugin_init() is called. */ GeanyPlugin *geany_plugin; -GeanyData *geany_data; +GeanyData *geany_data; GeanyFunctions *geany_functions;
@@ -121,10 +121,12 @@ GTK_NOTEBOOK(geany->main_widgets->message_window_notebook), hbox, gtk_label_new(_("Debug"))); + + /* init config */ + dconfig_init(); }
- /* Called by Geany to show the plugin's configure dialog. This function is always called after * plugin_init() was called. * You can omit this function if the plugin doesn't need to be configured. @@ -160,7 +162,7 @@ breaks_destroy();
/* clears config */ - dconfig_clear(); + dconfig_destroy();
/* release other allocated strings and objects */ gtk_widget_destroy(hbox);
Modified: trunk/geany-plugins/debugger/src/stree.c =================================================================== --- trunk/geany-plugins/debugger/src/stree.c 2011-08-27 21:52:56 UTC (rev 2179) +++ trunk/geany-plugins/debugger/src/stree.c 2011-08-28 15:06:23 UTC (rev 2180) @@ -69,6 +69,54 @@ static gboolean handle_selection = TRUE;
/* + * Handles same tree row click to open frame position + */ +static gboolean on_msgwin_button_press(GtkWidget *widget, GdkEventButton *event, gpointer user_data) +{ + if (event->type == GDK_BUTTON_PRESS) + { + GtkTreePath *pressed_path = NULL; + if (gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tree), (int)event->x, (int)event->y, &pressed_path, NULL, NULL, NULL)) + { + GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)); + GList *rows = gtk_tree_selection_get_selected_rows(selection, &model); + GtkTreePath *selected_path = (GtkTreePath*)rows->data; + + if (!gtk_tree_path_compare(pressed_path, selected_path)) + { + GtkTreeIter iter; + gtk_tree_model_get_iter ( + model, + &iter, + pressed_path); + + gchar *file; + int line; + gtk_tree_model_get ( + model, + &iter, + S_FILEPATH, &file, + S_LINE, &line, + -1); + + /* check if file name is not empty and we have source files for the frame */ + if (strlen(file) && GPOINTER_TO_INT(g_hash_table_lookup(frames, (gpointer)file))) + callback(file, line); + + g_free(file); + } + + g_list_foreach (rows, (GFunc) gtk_tree_path_free, NULL); + g_list_free (rows); + + gtk_tree_path_free(pressed_path); + } + } + + return FALSE; +} + +/* * Tree view selection changed callback */ void on_selection_changed(GtkTreeSelection *treeselection, gpointer user_data) @@ -131,6 +179,10 @@ g_signal_connect(G_OBJECT(gtk_tree_view_get_selection(GTK_TREE_VIEW(tree))), "changed", G_CALLBACK (on_selection_changed), NULL);
+ /* for clicking on already selected frame */ + g_signal_connect(tree, "button-press-event", + G_CALLBACK(on_msgwin_button_press), NULL); + /* creating columns */ GtkCellRenderer *renderer; GtkTreeViewColumn *column;
Modified: trunk/geany-plugins/debugger/src/tpage.c =================================================================== --- trunk/geany-plugins/debugger/src/tpage.c 2011-08-27 21:52:56 UTC (rev 2179) +++ trunk/geany-plugins/debugger/src/tpage.c 2011-08-28 15:06:23 UTC (rev 2180) @@ -97,6 +97,22 @@ GtkCellRenderer *renderer_value = NULL;
/* + * tells config to update when target arguments change + */ +void on_arguments_changed(GtkTextBuffer *textbuffer, gpointer user_data) +{ + dconfig_set_changed(); +} + +/* + * tells config to update when target changes + */ +void on_target_changed (GtkEditable *editable, gpointer user_data) +{ + dconfig_set_changed(); +} + +/* * delete selected rows from env variables page */ void delete_selected_rows() @@ -193,7 +209,10 @@ guint keyval = ((GdkEventKey*)event)->keyval; if (GDK_Delete == keyval) + { delete_selected_rows(); + dconfig_set_changed(); + }
return GDK_Tab == keyval; } @@ -247,7 +266,7 @@ static void on_value_changed(GtkCellRendererText *renderer, gchar *path, gchar *new_text, gpointer user_data) { GtkTreeIter iter; - GtkTreePath *tree_path = gtk_tree_path_new_from_string (path); + GtkTreePath *tree_path = gtk_tree_path_new_from_string (path);
gboolean empty = !gtk_tree_path_compare(tree_path, gtk_tree_row_reference_get_path(empty_row));
@@ -269,6 +288,8 @@ if (dialogs_show_question(_("Delete variable?"))) { delete_selected_rows(); + dconfig_set_changed(); + gtk_widget_grab_focus(envtree); } } @@ -290,6 +311,7 @@ add_empty_row(); g_object_set (renderer_value, "editable", FALSE, NULL); + dconfig_set_changed(); } g_free(oldvalue); @@ -345,7 +367,7 @@ static void on_name_changed(GtkCellRendererText *renderer, gchar *path, gchar *new_text, gpointer user_data) { GtkTreeIter iter; - GtkTreePath *tree_path = gtk_tree_path_new_from_string (path); + GtkTreePath *tree_path = gtk_tree_path_new_from_string (path);
gboolean empty = !gtk_tree_path_compare(tree_path, gtk_tree_row_reference_get_path(empty_row));
@@ -369,6 +391,8 @@ if (!empty && dialogs_show_question(_("Delete variable?"))) { delete_selected_rows(); + dconfig_set_changed(); + gtk_widget_grab_focus(envtree); } } @@ -381,6 +405,10 @@ entering_new_var = TRUE; gtk_tree_view_set_cursor_on_cell(GTK_TREE_VIEW(envtree), tree_path, column_value, renderer_value, TRUE); } + if (!empty) + { + dconfig_set_changed(); + } } gtk_tree_path_free(tree_path); @@ -388,37 +416,49 @@ g_free(striped); }
-void tpage_read_config() +/* + * set target + */ +void tpage_set_target(const gchar *newvalue) { - /* remove old values */ - tpage_clear(); + gtk_entry_set_text(GTK_ENTRY(targetname), newvalue); +}
- /* target */ - gtk_entry_set_text(GTK_ENTRY(targetname), dconfig_target_get()); +/* + * set debugger + */ +void tpage_set_debugger(const gchar *newvalue) +{ + int module = debug_get_module_index(newvalue); + if (-1 == module) + { + module = 0; + } + gtk_combo_box_set_active(GTK_COMBO_BOX(cmb_debugger), module); +}
- /* debugger */ - gtk_combo_box_set_active(GTK_COMBO_BOX(cmb_debugger), dconfig_module_get()); - - /* arguments */ +/* + * set command line + */ +void tpage_set_commandline(const gchar *newvalue) +{ GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview)); - gtk_text_buffer_set_text(buffer, dconfig_args_get(), -1); + gtk_text_buffer_set_text(buffer, newvalue, -1); +}
- /* environment */ - GList *env = dconfig_env_get(); - while (env) - { - gchar *name = (gchar*)env->data; - env = env->next; - gchar *value = (gchar*)env->data; - - GtkTreeIter iter; - gtk_list_store_append(store, &iter); - gtk_list_store_set(store, &iter, NAME, name, VALUE, value, -1); - - env = env->next; - } +/* + * add environment variable + */ +void tpage_add_environment(const gchar *name, const gchar *value) +{ + GtkTreeIter iter; + gtk_list_store_prepend(store, &iter); + gtk_list_store_set(store, &iter, NAME, name, VALUE, value, -1); }
+/* + * removes all data (clears widgets) + */ void tpage_clear() { /* target */ @@ -482,7 +522,7 @@ /* * get selected debugger module index */ -int tpage_get_module_index() +int tpage_get_debug_module_index() { return gtk_combo_box_get_active(GTK_COMBO_BOX(cmb_debugger)); } @@ -570,6 +610,8 @@ gtk_container_set_border_width(GTK_CONTAINER(hbox), SPACING);
targetname = gtk_entry_new (); + g_signal_connect(G_OBJECT(targetname), "changed", G_CALLBACK (on_target_changed), NULL); + button_browse = gtk_button_new_with_label(_("Browse")); g_signal_connect(G_OBJECT(button_browse), "clicked", G_CALLBACK (on_target_browse_clicked), NULL); @@ -611,6 +653,9 @@ textview = gtk_text_view_new (); gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(textview), GTK_WRAP_CHAR); + + GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview)); + g_signal_connect(G_OBJECT(buffer), "changed", G_CALLBACK (on_arguments_changed), NULL); gtk_box_pack_start(GTK_BOX(hbox), textview, TRUE, TRUE, 0); gtk_container_add(GTK_CONTAINER(_frame), hbox);
Modified: trunk/geany-plugins/debugger/src/tpage.h =================================================================== --- trunk/geany-plugins/debugger/src/tpage.h 2011-08-27 21:52:56 UTC (rev 2179) +++ trunk/geany-plugins/debugger/src/tpage.h 2011-08-28 15:06:23 UTC (rev 2180) @@ -21,11 +21,21 @@
void tpage_init(); GtkWidget* tpage_get_widget(); + gchar* tpage_get_target(); +void tpage_set_target(const gchar *newvalue); + gchar* tpage_get_debugger(); -int tpage_get_module_index(); +void tpage_set_debugger(const gchar *newvalue); + +int tpage_get_debug_module_index(); + gchar* tpage_get_commandline(); +void tpage_set_commandline(const gchar *newvalue); + GList* tpage_get_environment(); +void tpage_add_environment(const gchar *name, const gchar *value); + void tpage_set_readonly(gboolean readonly); -void tpage_read_config(); void tpage_clear(); +
Modified: trunk/geany-plugins/debugger/src/wtree.c =================================================================== --- trunk/geany-plugins/debugger/src/wtree.c 2011-08-27 21:52:56 UTC (rev 2179) +++ trunk/geany-plugins/debugger/src/wtree.c 2011-08-28 15:06:23 UTC (rev 2180) @@ -199,18 +199,3 @@
variable_set_name_only(store, &newvar, watch); } - -/* - * reads watches from config - */ -void wtree_read_config() -{ - wtree_remove_all(); - GList *list = dconfig_watches_get(); - while(list) - { - gchar *expression = (gchar*)list->data; - wtree_add_watch(expression); - list = list->next; - } -}
Modified: trunk/geany-plugins/debugger/src/wtree.h =================================================================== --- trunk/geany-plugins/debugger/src/wtree.h 2011-08-27 21:52:56 UTC (rev 2179) +++ trunk/geany-plugins/debugger/src/wtree.h 2011-08-28 15:06:23 UTC (rev 2180) @@ -29,6 +29,5 @@ GList* wtree_get_watches(); void wtree_remove_all(); void wtree_add_watch(gchar *watch); -void wtree_read_config();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
plugins-commits@lists.geany.org