diff -cr rox-1.3.9/ROX-Filer/src/filer.c rox-1.3.9-history/ROX-Filer/src/filer.c *** rox-1.3.9/ROX-Filer/src/filer.c Tue Apr 15 21:09:24 2003 --- rox-1.3.9-history/ROX-Filer/src/filer.c Wed May 21 17:48:34 2003 *************** *** 433,438 **** --- 433,443 ---- if (filer_window->thumb_queue) destroy_glist(&filer_window->thumb_queue); + if(filer_window->history) { + g_slist_foreach(filer_window->history, (GFunc) g_free, NULL); + g_slist_free(filer_window->history); + } + tooltip_show(NULL); g_free(filer_window->auto_select); *************** *** 1065,1072 **** from_dup = from && *from ? g_strdup(from) : NULL; detach(filer_window); g_free(filer_window->real_path); - g_free(filer_window->sym_path); filer_window->real_path = real_path; filer_window->sym_path = sym_path; tidy_sympath(filer_window->sym_path); --- 1070,1085 ---- from_dup = from && *from ? g_strdup(from) : NULL; detach(filer_window); + /* Compare pointers, so we detect when we are going back */ + if(filer_window->history && filer_window->history->data==path) { + /* We are going one back in the history, do not push this onto + the stack */ + g_free(filer_window->sym_path); + } else { + filer_window->history=g_slist_prepend(filer_window->history, + filer_window->sym_path); + } g_free(filer_window->real_path); filer_window->real_path = real_path; filer_window->sym_path = sym_path; tidy_sympath(filer_window->sym_path); *************** *** 1097,1102 **** --- 1110,1148 ---- filer_window); } + void filer_change_to_previous(FilerWindow *filer_window) + { + GSList *tmp; + + g_return_if_fail(filer_window!=NULL); + + if(!filer_window->history) { + gdk_beep(); + return; + } + + filer_change_to(filer_window, (gchar *) filer_window->history->data, + NULL); + + tmp=filer_window->history; + filer_window->history=g_slist_remove_link(filer_window->history, tmp); + g_free(tmp->data); + g_slist_free(tmp); + } + + FilerWindow *filer_open_previous(FilerWindow *filer_window) + { + g_return_val_if_fail(filer_window!=NULL, NULL); + + if(!filer_window->history) { + gdk_beep(); + return NULL; + } + + return filer_opendir((gchar *) filer_window->history->data, + NULL, NULL); + } + /* Returns a list containing the full (sym) pathname of every selected item. * You must g_free() each item in the list. */ *************** *** 1178,1183 **** --- 1224,1230 ---- filer_window->target_cb = NULL; filer_window->mini_type = MINI_NONE; filer_window->selection_state = GTK_STATE_INSENSITIVE; + filer_window->history = NULL; filer_window->toolbar = NULL; filer_window->toplevel_vbox = NULL; filer_window->view_hbox = NULL; diff -cr rox-1.3.9/ROX-Filer/src/filer.h rox-1.3.9-history/ROX-Filer/src/filer.h *** rox-1.3.9/ROX-Filer/src/filer.h Tue Feb 11 00:14:20 2003 --- rox-1.3.9-history/ROX-Filer/src/filer.h Wed May 21 17:48:34 2003 *************** *** 95,100 **** --- 95,102 ---- int max_thumbs; /* total for this batch */ gint auto_scroll; /* Timer */ + + GSList *history; }; extern FilerWindow *window_with_focus; *************** *** 144,148 **** --- 146,153 ---- gint filer_key_press_event(GtkWidget *widget, GdkEventKey *event, FilerWindow *filer_window); void filer_set_autoscroll(FilerWindow *filer_window, gboolean auto_scroll); + + extern void filer_change_to_previous(FilerWindow *filer_window); + extern FilerWindow *filer_open_previous(FilerWindow *filer_window); #endif /* _FILER_H */ diff -cr rox-1.3.9/ROX-Filer/src/menu.c rox-1.3.9-history/ROX-Filer/src/menu.c *** rox-1.3.9/ROX-Filer/src/menu.c Tue Apr 15 21:09:25 2003 --- rox-1.3.9-history/ROX-Filer/src/menu.c Wed May 21 17:48:34 2003 *************** *** 149,154 **** --- 149,156 ---- static void open_parent_same(gpointer data, guint action, GtkWidget *widget); static void open_parent(gpointer data, guint action, GtkWidget *widget); + static void open_previous_same(gpointer data, guint action, GtkWidget *widget); + static void open_previous(gpointer data, guint action, GtkWidget *widget); static void home_directory(gpointer data, guint action, GtkWidget *widget); static void show_bookmarks(gpointer data, guint action, GtkWidget *widget); static void new_window(gpointer data, guint action, GtkWidget *widget); *************** *** 232,237 **** --- 234,241 ---- {N_("Window"), NULL, NULL, 0, ""}, {">" N_("Parent, New Window"), NULL, open_parent, 0, "", GTK_STOCK_GO_UP}, {">" N_("Parent, Same Window"), NULL, open_parent_same, 0, NULL}, + {">" N_("Previous, New Window"), NULL, open_previous, 0, NULL}, + {">" N_("Previous, Same Window"), NULL, open_previous_same, 0, NULL}, {">" N_("New Window"), NULL, new_window, 0, NULL}, {">" N_("Home Directory"), NULL, home_directory, 0, "", GTK_STOCK_HOME}, {">" N_("Show Bookmarks"), "B", show_bookmarks, 0, "", ROX_STOCK_BOOKMARKS}, *************** *** 1584,1589 **** --- 1588,1607 ---- g_return_if_fail(window_with_focus != NULL); change_to_parent(window_with_focus); + } + + static void open_previous(gpointer data, guint action, GtkWidget *widget) + { + g_return_if_fail(window_with_focus != NULL); + + (void) filer_open_previous(window_with_focus); + } + + static void open_previous_same(gpointer data, guint action, GtkWidget *widget) + { + g_return_if_fail(window_with_focus != NULL); + + filer_change_to_previous(window_with_focus); } static void resize(gpointer data, guint action, GtkWidget *widget) diff -cr rox-1.3.9/ROX-Filer/src/toolbar.c rox-1.3.9-history/ROX-Filer/src/toolbar.c *** rox-1.3.9/ROX-Filer/src/toolbar.c Tue Apr 15 21:09:26 2003 --- rox-1.3.9-history/ROX-Filer/src/toolbar.c Wed May 21 17:48:34 2003 *************** *** 349,360 **** GdkEvent *event; event = gtk_get_current_event(); ! if (event->type == GDK_BUTTON_RELEASE && NEW_WIN_BUTTON(event)) ! { ! filer_open_parent(filer_window); } - else - change_to_parent(filer_window); } static void toolbar_autosize_clicked(GtkWidget *widget, FilerWindow *filer_window) --- 349,369 ---- GdkEvent *event; event = gtk_get_current_event(); ! if(event->type == GDK_BUTTON_RELEASE) { ! GdkEventButton *button=(GdkEventButton *) event; ! gboolean control=(button->state & GDK_CONTROL_MASK); ! if (NEW_WIN_BUTTON(event)){ ! if(control) ! filer_open_previous(filer_window); ! else ! filer_open_parent(filer_window); ! } else { ! if(control) ! filer_change_to_previous(filer_window); ! else ! change_to_parent(filer_window); ! } } } static void toolbar_autosize_clicked(GtkWidget *widget, FilerWindow *filer_window)