From 6fbb1ddfd9cc5dd53b279e19a67b9029e11d3b4e Mon Sep 17 00:00:00 2001 From: compudj Date: Fri, 19 Mar 2004 15:15:07 +0000 Subject: [PATCH] remember old path, modified DirSel so we do not get any .. anymore git-svn-id: http://ltt.polymtl.ca/svn@497 04897980-b3bd-0310-b5e0-8ef037075253 --- .../poly/lttv/modules/gui/main/src/callbacks.c | 13 ++++++++++++- .../poly/lttv/modules/gui/main/src/gtkdirsel.c | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ltt/branches/poly/lttv/modules/gui/main/src/callbacks.c b/ltt/branches/poly/lttv/modules/gui/main/src/callbacks.c index 08a58516..a6979aa9 100644 --- a/ltt/branches/poly/lttv/modules/gui/main/src/callbacks.c +++ b/ltt/branches/poly/lttv/modules/gui/main/src/callbacks.c @@ -48,6 +48,10 @@ extern GSList * g_main_window_list; static int g_win_count = 0; +// MD : keep old directory +static char remember_dir[PATH_LENGTH] = ""; + + MainWindow * get_window_data_struct(GtkWidget * widget); char * get_unload_module(char ** loaded_module_name, int nb_module); char * get_remove_trace(char ** all_trace_name, int nb_trace); @@ -1026,6 +1030,8 @@ on_load_module_activate (GtkMenuItem *menuitem, char str[PATH_LENGTH], *str1; MainWindow * mw_data = get_window_data_struct((GtkWidget*)menuitem); GtkFileSelection * file_selector = (GtkFileSelection *)gtk_file_selection_new("Select a module"); + if(remember_dir[0] != '\0') + gtk_file_selection_set_filename(file_selector, remember_dir); gtk_file_selection_hide_fileop_buttons(file_selector); str[0] = '\0'; @@ -1034,7 +1040,8 @@ on_load_module_activate (GtkMenuItem *menuitem, case GTK_RESPONSE_ACCEPT: case GTK_RESPONSE_OK: dir = gtk_file_selection_get_selections (file_selector); - sprintf(str,dir[0]); + strncpy(str,dir[0],PATH_LENGTH); + strncpy(remember_dir,dir[0],PATH_LENGTH); str1 = strrchr(str,'/'); if(str1)str1++; else{ @@ -1109,12 +1116,16 @@ on_add_module_search_path_activate (GtkMenuItem *menuitem, gint id; MainWindow * mw_data = get_window_data_struct((GtkWidget*)menuitem); + if(remember_dir[0] != '\0') + gtk_dir_selection_set_filename(file_selector, remember_dir); id = gtk_dialog_run(GTK_DIALOG(file_selector)); switch(id){ case GTK_RESPONSE_ACCEPT: case GTK_RESPONSE_OK: dir = gtk_dir_selection_get_dir (file_selector); + strncpy(remember_dir,dir,PATH_LENGTH); + strncat(remember_dir,"/",PATH_LENGTH); lttv_library_path_add(dir); case GTK_RESPONSE_REJECT: case GTK_RESPONSE_CANCEL: diff --git a/ltt/branches/poly/lttv/modules/gui/main/src/gtkdirsel.c b/ltt/branches/poly/lttv/modules/gui/main/src/gtkdirsel.c index 651c5b22..e17ed4c8 100644 --- a/ltt/branches/poly/lttv/modules/gui/main/src/gtkdirsel.c +++ b/ltt/branches/poly/lttv/modules/gui/main/src/gtkdirsel.c @@ -2159,6 +2159,7 @@ gtk_dir_selection_populate (GtkDirSelection *fs, g_free (escaped); gtk_label_set_text_with_mnemonic (GTK_LABEL (fs->selection_text), sel_text); + gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), cmpl_reference_position (cmpl_state)); g_free (sel_text); } -- 2.34.1