diff -cr rox-1.3.9/ROX-Filer/src/abox.c rox-1.3.9-filecmp/ROX-Filer/src/abox.c *** rox-1.3.9/ROX-Filer/src/abox.c Sun Feb 9 14:08:23 2003 --- rox-1.3.9-filecmp/ROX-Filer/src/abox.c Wed May 21 17:47:40 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-1.3.9/ROX-Filer/src/abox.h rox-1.3.9-filecmp/ROX-Filer/src/abox.h *** rox-1.3.9/ROX-Filer/src/abox.h Tue Feb 11 00:14:20 2003 --- rox-1.3.9-filecmp/ROX-Filer/src/abox.h Wed May 21 17:47:40 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-1.3.9/ROX-Filer/src/action.c rox-1.3.9-filecmp/ROX-Filer/src/action.c *** rox-1.3.9/ROX-Filer/src/action.c Sun Feb 9 16:00:46 2003 --- rox-1.3.9-filecmp/ROX-Filer/src/action.c Wed May 21 17:47:40 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();