remember old path, modified DirSel so we do not get any .. anymore
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 19 Mar 2004 15:15:07 +0000 (15:15 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 19 Mar 2004 15:15:07 +0000 (15:15 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@497 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/modules/gui/main/src/callbacks.c
ltt/branches/poly/lttv/modules/gui/main/src/gtkdirsel.c

index 08a58516c2eb22bd47019b7e2596e22e3dbf52c4..a6979aa981f818ab4c4d15e225e2c3bc52fedde0 100644 (file)
@@ -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:
index 651c5b22382b6042df5c9b2b47802afa1db5210c..e17ed4c800619cb9219879dcf65498fd72532102 100644 (file)
@@ -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);
        }
 
This page took 0.027731 seconds and 4 git commands to generate.