diff -cr rox-2.0.0/ROX-Filer/src/abox.c rox/ROX-Filer/src/abox.c *** rox-2.0.0/ROX-Filer/src/abox.c Sun Feb 9 14:08:23 2003 --- rox/ROX-Filer/src/abox.c Sun Jun 1 11:41:24 2003 *************** *** 118,123 **** --- 118,124 ---- GtkWidget *frame, *text, *scrollbar, *button; ABox *abox = ABOX(object); GtkDialog *dialog = GTK_DIALOG(object); + int i; gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_MOUSE); *************** *** 169,174 **** --- 170,203 ---- GTK_STOCK_YES, GTK_RESPONSE_YES, NULL); + abox->cmp_area=gtk_table_new(2, 4, FALSE); + gtk_box_pack_start(GTK_BOX(dialog->vbox), + abox->cmp_area, FALSE, FALSE, 2); + gtk_table_set_row_spacings(GTK_TABLE(abox->cmp_area), 2); + gtk_table_set_col_spacings(GTK_TABLE(abox->cmp_area), 2); + for(i=0; i<2; i++) { + abox->cmp_icon[i]=gtk_image_new(); + gtk_table_attach(GTK_TABLE(abox->cmp_area), + abox->cmp_icon[i], + 0, 1, i, i+1, + GTK_SHRINK, GTK_SHRINK, 1, 1); + abox->cmp_name[i]=gtk_label_new(""); + gtk_table_attach(GTK_TABLE(abox->cmp_area), + abox->cmp_name[i], + 1, 2, i, i+1, + GTK_EXPAND|GTK_FILL, GTK_SHRINK, 1, 1); + abox->cmp_size[i]=gtk_label_new(""); + gtk_table_attach(GTK_TABLE(abox->cmp_area), + abox->cmp_size[i], + 2, 3, i, i+1, + GTK_SHRINK, GTK_SHRINK, 1, 1); + abox->cmp_date[i]=gtk_label_new(""); + gtk_table_attach(GTK_TABLE(abox->cmp_area), + abox->cmp_date[i], + 3, 4, i, i+1, + GTK_SHRINK, GTK_SHRINK, 1, 1); + } + abox->flag_box = gtk_hbox_new(FALSE, 16); gtk_box_pack_end(GTK_BOX(dialog->vbox), abox->flag_box, FALSE, TRUE, 2); *************** *** 179,184 **** --- 208,214 ---- gtk_dialog_set_default_response(dialog, RESPONSE_QUIET); gtk_widget_show_all(dialog->vbox); + gtk_widget_hide(abox->cmp_area); abox->quiet = abox_add_flag(abox, _("Quiet"), _("Don't confirm every operation"), *************** *** 555,557 **** --- 585,650 ---- g_signal_emit_by_name(dialog, "abort_operation"); return TRUE; } + + void abox_show_compare(ABox *abox, gboolean show) + { + if(show) + gtk_widget_show(abox->cmp_area); + else + gtk_widget_hide(abox->cmp_area); + } + + #include "diritem.h" + #include "pixmaps.h" + + void abox_set_file(ABox *abox, int i, const gchar *path) + { + DirItem *item; + gchar *base; + + g_return_if_fail(i>=0 && i<2); + + if(!path || !path[0]) { + /*printf("path=%s\n", path? path: "NULL");*/ + gtk_widget_hide(abox->cmp_icon[i]); + gtk_widget_hide(abox->cmp_name[i]); + gtk_widget_hide(abox->cmp_size[i]); + gtk_widget_hide(abox->cmp_date[i]); + } + + base=g_path_get_basename(path); + item=diritem_new(base); + g_free(base); + diritem_restat(path, item, NULL); + if(!item->lstat_errno) { + gchar *str; + + if(item->image) { + gtk_image_set_from_pixbuf(GTK_IMAGE(abox->cmp_icon[i]), + item->image->pixbuf); + gtk_widget_show(abox->cmp_icon[i]); + } else { + gtk_widget_hide(abox->cmp_icon[i]); + } + gtk_label_set_text(GTK_LABEL(abox->cmp_name[i]), + item->leafname); + gtk_widget_show(abox->cmp_name[i]); + + str=format_size_aligned(item->size); + gtk_label_set_text(GTK_LABEL(abox->cmp_size[i]), str); + gtk_widget_show(abox->cmp_size[i]); + + str=pretty_time(&item->mtime); + gtk_label_set_text(GTK_LABEL(abox->cmp_date[i]), str); + g_free(str); + gtk_widget_show(abox->cmp_date[i]); + + diritem_free(item); + } else { + gtk_widget_hide(abox->cmp_icon[i]); + gtk_widget_hide(abox->cmp_name[i]); + gtk_widget_hide(abox->cmp_size[i]); + gtk_widget_hide(abox->cmp_date[i]); + } + } + diff -cr rox-2.0.0/ROX-Filer/src/abox.h rox/ROX-Filer/src/abox.h *** rox-2.0.0/ROX-Filer/src/abox.h Tue Feb 11 00:14:20 2003 --- rox/ROX-Filer/src/abox.h Sun Jun 1 11:41:24 2003 *************** *** 29,34 **** --- 29,40 ---- GtkWidget *entry; /* Plain entry, or part of combo */ FilerWindow *preview; + GtkWidget *cmp_area; /* Area where files are compared */ + GtkWidget *cmp_icon[2]; + GtkWidget *cmp_name[2]; + GtkWidget *cmp_size[2]; + GtkWidget *cmp_date[2]; + gchar *next_dir; /* NULL => no timer active */ gint next_timer; *************** *** 69,73 **** --- 75,82 ---- void abox_add_entry (ABox *abox, const gchar *text, GtkWidget *help_button); + + extern void abox_show_compare(ABox *abox, gboolean show); + extern void abox_set_file(ABox *abox, int file, const gchar *path); #endif /* __ABOX_H__ */ diff -cr rox-2.0.0/ROX-Filer/src/action.c rox/ROX-Filer/src/action.c *** rox-2.0.0/ROX-Filer/src/action.c Sun Feb 9 16:00:46 2003 --- rox/ROX-Filer/src/action.c Sun Jun 1 11:41:24 2003 *************** *** 313,318 **** --- 313,325 ---- gui_side->errors++; abox_log(abox, buffer + 1, "error"); } + else if (*buffer == '<') + abox_set_file(abox, 0, buffer+1); + else if (*buffer == '>') + { + abox_set_file(abox, 1, buffer+1); + abox_show_compare(abox, TRUE); + } else abox_log(abox, buffer + 1, NULL); } *************** *** 508,513 **** --- 515,521 ---- fputc(code, gui_side->to_child); fflush(gui_side->to_child); + abox_show_compare(gui_side->abox, FALSE); } static void flag_toggled(ABox *abox, gint flag, GUIside *gui_side) *************** *** 854,859 **** --- 862,869 ---- : access(src_path, W_OK) != 0; if (write_prot || !quiet) { + printf_send("<%s", src_path); + printf_send(">"); if (!printf_reply(from_parent, write_prot && !o_force, _("?Delete %s'%s'?"), write_prot ? _("WRITE-PROTECTED ") : "", *************** *** 1001,1006 **** --- 1011,1018 ---- if (!quiet) { + printf_send("<%s", path); + printf_send(">"); if (!printf_reply(from_parent, FALSE, _("?Change permissions of '%s'?"), path)) return; *************** *** 1112,1117 **** --- 1124,1131 ---- } else { + printf_send("<%s", path); + printf_send(">%s", dest_path); if (!printf_reply(from_parent, TRUE, _("?'%s' already exists - %s?"), dest_path, *************** *** 1138,1143 **** --- 1152,1159 ---- } else if (!quiet) { + printf_send("<%s", path); + printf_send(">"); if (!printf_reply(from_parent, FALSE, _("?Copy %s as %s?"), path, dest_path)) return; *************** *** 1269,1278 **** { /* Newer; keep going */ } ! else if (!printf_reply(from_parent, TRUE, _("?'%s' already exists - overwrite?"), dest_path)) ! return; if (S_ISDIR(info.st_mode)) err = rmdir(dest_path); --- 1285,1298 ---- { /* Newer; keep going */ } ! else { ! printf_send("<%s", path); ! printf_send(">%s", dest_path); ! if (!printf_reply(from_parent, TRUE, _("?'%s' already exists - overwrite?"), dest_path)) ! return; ! } if (S_ISDIR(info.st_mode)) err = rmdir(dest_path); *************** *** 1289,1294 **** --- 1309,1316 ---- } else if (!quiet) { + printf_send("<%s", path); + printf_send(">"); if (!printf_reply(from_parent, FALSE, _("?Move %s as %s?"), path, dest_path)) return; *************** *** 1356,1364 **** if (quiet) printf_send(_("'Linking %s as %s\n"), path, dest_path); ! else if (!printf_reply(from_parent, FALSE, ! _("?Link %s as %s?"), path, dest_path)) ! return; if (symlink(path, dest_path)) send_error(); --- 1378,1390 ---- if (quiet) printf_send(_("'Linking %s as %s\n"), path, dest_path); ! else { ! printf_send("<%s", path); ! printf_send(">%s", dest_path); ! if (!printf_reply(from_parent, FALSE, ! _("?Link %s as %s?"), path, dest_path)) ! return; ! } if (symlink(path, dest_path)) send_error(); diff -cr rox-2.0.0/ROX-Filer/src/filer.c rox/ROX-Filer/src/filer.c *** rox-2.0.0/ROX-Filer/src/filer.c Tue May 27 14:03:16 2003 --- rox/ROX-Filer/src/filer.c Sun Jun 1 11:41:30 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-2.0.0/ROX-Filer/src/filer.h rox/ROX-Filer/src/filer.h *** rox-2.0.0/ROX-Filer/src/filer.h Tue Feb 11 00:14:20 2003 --- rox/ROX-Filer/src/filer.h Sun Jun 1 11:41:30 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-2.0.0/ROX-Filer/src/infobox.c rox/ROX-Filer/src/infobox.c *** rox-2.0.0/ROX-Filer/src/infobox.c Thu Feb 27 11:50:40 2003 --- rox/ROX-Filer/src/infobox.c Sun Jun 1 11:41:19 2003 *************** *** 57,68 **** --- 57,85 ---- gchar *text; /* String so far */ }; + typedef struct _Permissions Permissions; + + struct _Permissions + { + gchar *path; + DirItem *item; + GtkWidget *bits[12]; + }; + + typedef struct du { + gchar *path; + GtkListStore *store; + guint watch; + GIOChannel *chan; + } DU; + /* Static prototypes */ static void refresh_info(GObject *window); static GtkWidget *make_vbox(const guchar *path); static GtkWidget *make_details(const guchar *path, DirItem *item); static GtkWidget *make_about(const guchar *path, XMLwrapper *ai); static GtkWidget *make_file_says(const guchar *path); + static GtkWidget *make_permissions(const gchar *path, DirItem *item); static void add_file_output(FileStatus *fs, gint source, GdkInputCondition condition); static const gchar *pretty_type(DirItem *file, const guchar *path); *************** *** 271,276 **** --- 288,295 ---- } g_free(help_dir); + add_frame(vbox, make_permissions(path, item)); + if (about) add_frame(vbox, make_about(path, ai)); else *************** *** 312,321 **** g_free(text); } ! static void add_row(GtkListStore *store, const gchar *label, const gchar *data) { GtkTreeIter iter; gchar *u8 = NULL; if (!g_utf8_validate(data, -1, NULL)) u8 = to_utf8(data); --- 331,343 ---- g_free(text); } ! static gchar *add_row(GtkListStore *store, const gchar *label, ! const gchar *data) { GtkTreeIter iter; gchar *u8 = NULL; + GtkTreePath *tpath; + gchar *last=NULL; if (!g_utf8_validate(data, -1, NULL)) u8 = to_utf8(data); *************** *** 324,329 **** --- 346,359 ---- gtk_list_store_set(store, &iter, 0, label, 1, u8 ? u8 : data, -1); g_free(u8); + + tpath=gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter); + if(last) + g_free(last); + last=gtk_tree_path_to_string(tpath); + gtk_tree_path_free(tpath); + + return last; } static void add_row_and_free(GtkListStore *store, *************** *** 361,366 **** --- 391,462 ---- *list_store = store; *list_view = (GtkWidget *) view; } + + static void set_cell(GtkListStore *store, const gchar *path, + const gchar *ctext) + { + GtkTreeIter iter; + + gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(store), + &iter, path); + gtk_list_store_set(store, &iter, 1, ctext, -1); + } + + static void insert_size(DU *du, const char *line) + { + off_t size; + gchar *cell; + + #ifdef LARGE_FILE_SUPPORT + size=strtoll(line, NULL, 10); + #else + size=strtol(line, NULL, 10); + #endif + size<<=10; /* Because du reports in K */ + cell=(size >= PRETTY_SIZE_LIMIT)? + g_strdup_printf("%s (%" SIZE_FMT " %s)", + format_size(size), + size, _("bytes")) + : g_strdup(format_size(size)); + + set_cell(du->store, du->path, cell); + + g_free(cell); + } + + static gboolean read_du_output(GIOChannel *source, GIOCondition cond, + DU *du) + { + GString *line; + GIOStatus stat; + GError *err=NULL; + + line=g_string_new(""); + stat=g_io_channel_read_line_string(source, line, NULL, &err); + switch(stat) { + case G_IO_STATUS_NORMAL: + insert_size(du, line->str); + break; + case G_IO_STATUS_EOF: + break; + case G_IO_STATUS_AGAIN: + g_string_free(line, TRUE); + return TRUE; + case G_IO_STATUS_ERROR: + set_cell(du->store, du->path, err->message); + break; + } + g_string_free(line, TRUE); + + return FALSE; + } + + static void kill_du_output(GtkWidget *widget, DU *du) + { + g_io_channel_unref(du->chan); + g_free(du->path); + g_free(du); + } /* Create the TreeView widget with the file's details */ static GtkWidget *make_details(const guchar *path, DirItem *item) *************** *** 388,400 **** user_name(item->uid), group_name(item->gid))); ! if (item->base_type != TYPE_DIRECTORY) add_row_and_free(store, _("Size:"), item->size >= PRETTY_SIZE_LIMIT ? g_strdup_printf("%s (%" SIZE_FMT " %s)", format_size(item->size), item->size, _("bytes")) : g_strdup(format_size(item->size))); add_row_and_free(store, _("Change time:"), pretty_time(&item->ctime)); --- 484,521 ---- user_name(item->uid), group_name(item->gid))); ! if (item->base_type != TYPE_DIRECTORY) { add_row_and_free(store, _("Size:"), item->size >= PRETTY_SIZE_LIMIT ? g_strdup_printf("%s (%" SIZE_FMT " %s)", format_size(item->size), item->size, _("bytes")) : g_strdup(format_size(item->size))); + } else { + DU *du=g_new(DU, 1); + int out; + gchar *args[]={"du", "-sk", "", NULL}; + + du->store=store; + du->path=g_strdup(add_row(store, _("Size:"), _("Scanning"))); + + args[2]=(gchar *) path; + if(g_spawn_async_with_pipes(NULL, args, NULL, + G_SPAWN_SEARCH_PATH, + NULL, NULL, NULL, + NULL, &out, NULL, + NULL)) { + du->chan=g_io_channel_unix_new(out); + du->watch=g_io_add_watch(du->chan, G_IO_IN, + (GIOFunc) read_du_output, du); + g_signal_connect(G_OBJECT(view), "destroy", + G_CALLBACK(kill_du_output), du); + } else { + set_cell(store, du->path, _("Failed to scan")); + g_free(du->path); + g_free(du); + } + } add_row_and_free(store, _("Change time:"), pretty_time(&item->ctime)); *************** *** 402,409 **** add_row_and_free(store, _("Access time:"), pretty_time(&item->atime)); add_row(store, _("Permissions:"), pretty_permissions(item->mode)); ! add_row(store, _("Type:"), pretty_type(item, path)); if (item->mime_type) --- 523,533 ---- add_row_and_free(store, _("Access time:"), pretty_time(&item->atime)); + /* Disable because we use the tick boxes */ + /* add_row(store, _("Permissions:"), pretty_permissions(item->mode)); ! */ ! add_row(store, _("Type:"), pretty_type(item, path)); if (item->mime_type) *************** *** 600,605 **** --- 724,837 ---- g_free(fs->text); g_free(fs); + } + + static void permissions_destroyed(GtkWidget *widget, Permissions *perm) + { + g_free(perm->path); + g_free(perm->item); + + g_free(perm); + } + + static void permissions_apply(GtkWidget *widget, Permissions *perm) + { + mode_t nmode; + int i; + + nmode=0; + + for(i=0; i<9; i++) { + if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(perm->bits[i]))) + nmode|=(1<bits[9]))) + nmode|=S_ISUID; + if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(perm->bits[10]))) + nmode|=S_ISGID; + if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(perm->bits[11]))) + nmode|=S_ISVTX; + + if(chmod(perm->path, nmode)) { + report_error(_("Could not change permissions: %s"), + strerror(errno)); + } + } + + static GtkWidget *make_permissions(const gchar *path, DirItem *item) + { + Permissions *perm; + GtkWidget *frame; + GtkWidget *table; + GtkWidget *but, *tick, *label; + int i, x, y; + + perm=g_new(Permissions, 1); + + perm->path=g_strdup(path); + perm->item=diritem_new(path); + + frame=gtk_frame_new(_("Permissions")); + + table=gtk_table_new(4, 5, TRUE); + gtk_container_add(GTK_CONTAINER(frame), table); + + label=gtk_label_new(_("Owner")); + gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); + label=gtk_label_new(_("Group")); + gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 2, 3); + label=gtk_label_new(_("World")); + gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 3, 4); + + label=gtk_label_new(_("Read")); + gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 2, 0, 1); + label=gtk_label_new(_("Write")); + gtk_table_attach_defaults(GTK_TABLE(table), label, 2, 3, 0, 1); + label=gtk_label_new(_("Exec")); + gtk_table_attach_defaults(GTK_TABLE(table), label, 3, 4, 0, 1); + + for(i=0; i<9; i++) { + x=1+2-i%3; + y=1+2-i/3; + perm->bits[i]=tick=gtk_check_button_new(); + gtk_table_attach_defaults(GTK_TABLE(table), tick, + x, x+1, y, y+1); + if(item->mode & (1<mode & S_ISUID) + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(tick), TRUE); + g_signal_connect(tick, "toggled", + G_CALLBACK(permissions_apply ), perm); + perm->bits[9]=tick; + + tick=gtk_check_button_new_with_label(_("SGID")); + gtk_table_attach_defaults(GTK_TABLE(table), tick, 4, 5, 2, 3); + if(item->mode & S_ISGID) + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(tick), TRUE); + g_signal_connect(tick, "toggled", + G_CALLBACK(permissions_apply ), perm); + perm->bits[10]=tick; + + tick=gtk_check_button_new_with_label(_("Sticky")); + gtk_table_attach_defaults(GTK_TABLE(table), tick, 4, 5, 3, 4); + if(item->mode & S_ISVTX) + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(tick), TRUE); + g_signal_connect(tick, "toggled", + G_CALLBACK(permissions_apply ), perm); + perm->bits[11]=tick; + + g_signal_connect(frame, "destroy", + G_CALLBACK(permissions_destroyed), perm); + + gtk_widget_show_all(frame); + return frame; } /* Don't g_free() the result */ diff -cr rox-2.0.0/ROX-Filer/src/menu.c rox/ROX-Filer/src/menu.c *** rox-2.0.0/ROX-Filer/src/menu.c Tue Apr 15 21:09:25 2003 --- rox/ROX-Filer/src/menu.c Sun Jun 1 11:41:30 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-2.0.0/ROX-Filer/src/toolbar.c rox/ROX-Filer/src/toolbar.c *** rox-2.0.0/ROX-Filer/src/toolbar.c Tue Apr 15 21:09:26 2003 --- rox/ROX-Filer/src/toolbar.c Sun Jun 1 11:41:46 2003 *************** *** 42,47 **** --- 42,48 ---- #include "diritem.h" #include "view_iface.h" #include "bookmarks.h" + #include "gui_support.h" typedef struct _Tool Tool; *************** *** 84,89 **** --- 85,94 ---- FilerWindow *filer_window); static void toolbar_hidden_clicked(GtkWidget *widget, FilerWindow *filer_window); + static void toolbar_select_clicked(GtkWidget *widget, + FilerWindow *filer_window); + static void toolbar_sort_clicked(GtkWidget *widget, + FilerWindow *filer_window); static GtkWidget *add_button(GtkWidget *bar, Tool *tool, FilerWindow *filer_window); static GtkWidget *create_toolbar(FilerWindow *filer_window); *************** *** 138,147 **** --- 143,160 ---- toolbar_details_clicked, DROP_NONE, TRUE, FALSE}, + {N_("Sort"), GTK_STOCK_SORT_ASCENDING, N_("Change sort criteria"), + toolbar_sort_clicked, DROP_NONE, TRUE, + FALSE}, + {N_("Hidden"), ROX_STOCK_SHOW_HIDDEN, N_("Show/hide hidden files"), toolbar_hidden_clicked, DROP_NONE, TRUE, FALSE}, + {N_("Select"), GTK_STOCK_COPY, N_("Select all/invert selection"), + toolbar_select_clicked, DROP_NONE, TRUE, + FALSE}, + {N_("Help"), GTK_STOCK_HELP, N_("Show ROX-Filer help"), toolbar_help_clicked, DROP_NONE, TRUE, FALSE}, *************** *** 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) --- 362,382 ---- 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) *************** *** 380,385 **** --- 402,463 ---- display_change_size(filer_window, bev->button == 1); } + static void toolbar_sort_clicked(GtkWidget *widget, + FilerWindow *filer_window) + { + GdkEventButton *bev; + int i, current, next; + gboolean adjust; + GtkSortType dir; + gchar *tip; + + static const SortType sorts[]={ + SORT_NAME, SORT_TYPE, SORT_DATE, SORT_SIZE, + SORT_OWNER, SORT_GROUP, + }; + static const int nsorts=sizeof(sorts)/sizeof(sorts[0]); + static const char *sort_names[]={ + N_("Sort by name"), N_("Sort by type"), N_("Sort by date"), + N_("Sort by size"), N_("Sort by owner"), N_("Sort by group"), + }; + + bev = (GdkEventButton *) gtk_get_current_event(); + adjust=(bev->button == 2) && bev->type == GDK_BUTTON_RELEASE; + + current=-1; + dir=filer_window->sort_order; + for(i=0; isort_type==sorts[i]) { + current=i; + break; + } + if(current==-1) { + next=0; + dir=GTK_SORT_ASCENDING; + } else if(adjust) { + next=current-1; + if(next<0) { + next=nsorts-1; + dir=(dir==GTK_SORT_ASCENDING)? + GTK_SORT_DESCENDING: GTK_SORT_ASCENDING; + } + } else { + next=current+1; + if(next>=nsorts) { + next=0; + dir=(dir==GTK_SORT_ASCENDING)? + GTK_SORT_DESCENDING: GTK_SORT_ASCENDING; + } + } + + display_set_sort_type(filer_window, sorts[next], dir); + tip=g_strconcat(_(sort_names[next]), ", ", + dir==GTK_SORT_ASCENDING? _("ascending"): _("descending"), + NULL); + tooltip_show(tip); + g_free(tip); + } + static void toolbar_details_clicked(GtkWidget *widget, FilerWindow *filer_window) { *************** *** 393,398 **** --- 471,500 ---- FilerWindow *filer_window) { display_set_hidden(filer_window, !filer_window->show_hidden); + } + + static gboolean invert_cb(ViewIter *iter, gpointer data) + { + return !view_get_selected((ViewIface *) data, iter); + } + + static void toolbar_select_clicked(GtkWidget *widget, FilerWindow *filer_window) + { + GdkEvent *event; + + event = gtk_get_current_event(); + if (event->type == GDK_BUTTON_RELEASE && + ((GdkEventButton *) event)->button==2) + { + view_select_if(filer_window->view, invert_cb, + filer_window->view); + } + else if (event->type == GDK_BUTTON_RELEASE && + ((GdkEventButton *) event)->button==1) + { + view_select_all(filer_window->view); + } + filer_window->temp_item_selected = FALSE; } /* If filer_window is NULL, the toolbar is for the options window */