"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "f.file.cc" between
fotoxx-22.30.tar.gz and fotoxx-22.35.tar.gz

About: fotoxx is a program for photo editing and collection management.

f.file.cc  (fotoxx-22.30):f.file.cc  (fotoxx-22.35)
skipping to change at line 749 skipping to change at line 749
delete_thumbfile(rename_file); // remove old thumbnail delete_thumbfile(rename_file); // remove old thumbnail
update_thumbfile(newfile); // add new thumbnail update_thumbfile(newfile); // add new thumbnail
add_recent_file(newfile); // first in recent files list add_recent_file(newfile); // first in recent files list
strncpy0(rename_prev,rename_new,199); // save new name to previous name strncpy0(rename_prev,rename_new,199); // save new name to previous name
if (curr_file && strmatch(rename_file,curr_file)) // current file exists no more if (curr_file && strmatch(rename_file,curr_file)) // current file exists no more
free_resources(); free_resources();
if (navi::gallerytype == GDIR) { // refresh gallery list if (navi::gallerytype == FOLDER) { // refresh gallery list
gallery(0,"init",0); gallery(0,"init",0);
gallery(0,"sort",-2); // recall sort and position gallery(0,"sort",-2); // recall sort and position
gallery(0,"paint",-1); gallery(0,"paint",-1);
} }
Fblock("rename",0); Fblock("rename",0);
zdialog_fetch(zd,"keepopen",Fkeep); zdialog_fetch(zd,"keepopen",Fkeep);
if (Fkeep) { // keep dialog open if (Fkeep) { // keep dialog open
if (FGWM == 'F' && nextfile) { if (FGWM == 'F' && nextfile) {
skipping to change at line 1081 skipping to change at line 1081
int f_open(cchar *filespec, int Nth, int Fkeep, int Fack, int fzoom) int f_open(cchar *filespec, int Nth, int Fkeep, int Fack, int fzoom)
{ {
PXB *tempxb = 0; PXB *tempxb = 0;
int fposn, retcode = 0; int fposn, retcode = 0;
FTYPE ftype; FTYPE ftype;
static int Freent = 0; static int Freent = 0;
char *pp, *file; char *pp, *file;
void (*editfunc)(GtkWidget *, cchar *); void (*editfunc)(GtkWidget *, cchar *);
if (Freent++) { // stop re-entry if (Freent++) { // stop re-entry
Plog(1,"f_open() re-entry \n"); Plog(0,"f_open() re-entry \n");
goto ret1; goto ret1;
} }
poptext_killnow(); // kill pending popup message poptext_killnow(); // kill pending popup message
if (CEF && ! CEF->Frestart) goto ret2; // edit function not restartable if (CEF && ! CEF->Frestart) goto ret2; // edit function not restartable
if (CEF) editfunc = CEF->menufunc; // active edit, save edit function if (CEF) editfunc = CEF->menufunc; // active edit, save edit function
else editfunc = 0; // for possible edit restart else editfunc = 0; // for possible edit restart
skipping to change at line 1103 skipping to change at line 1103
if (CEF) goto ret2; // cannot if (CEF) goto ret2; // cannot
sa_clear(); // clear area if any sa_clear(); // clear area if any
file = 0; file = 0;
if (filespec) if (filespec)
file = zstrdup(filespec,"f-open"); // use passed filespec file = zstrdup(filespec,"f-open"); // use passed filespec
else { else {
pp = curr_file; // use file open dialog pp = curr_file; // use file open dialog
if (! pp && navi::gallerytype == GDIR) pp = navi::galleryname; if (! pp && navi::gallerytype == FOLDER) pp = navi::galleryname;
file = zgetfile("Open Image File",MWIN,"file",pp); file = zgetfile("Open Image File",MWIN,"file",pp);
} }
if (! file) goto ret3; if (! file) goto ret3;
if (! regfile(file)) { // check file exists if (! regfile(file)) { // check file exists
if (Fack) zmessage_post(Mwin,"20/20",4,"file not found: %s",file); if (Fack) zmessage_post(Mwin,"20/20",4,"file not found: %s",file);
zfree(file); zfree(file);
goto ret3; goto ret3;
} }
skipping to change at line 1263 skipping to change at line 1263
'opt' is "delete" or "trash". 'opt' is "delete" or "trash".
trash logic: Move target file to ~/Desktop/ first, then move to trash. trash logic: Move target file to ~/Desktop/ first, then move to trash.
Gnome trash fails for files on mounted volumes. Gnome trash fails for files on mounted volumes.
Returns 0 if OK, else error code. Returns 0 if OK, else error code.
****/ ****/
int f_remove(cchar *file, cchar *opt) int f_remove(cchar *file, cchar *opt)
{ {
int err, Nth; int err, Nth;
char *currfile; char *currfile = 0;
char trashfile[400] = "~/Desktop/"; char trashfile[400] = "~/Desktop/";
cchar *pp; cchar *pp;
GFile *gfile; GFile *gfile;
GError *gerror = 0; GError *gerror = 0;
int gstat; int gstat;
if (*opt == 'd') // delete if (*opt == 'd') // delete
{ {
err = remove(file); err = remove(file);
if (err && errno != ENOENT) { // OK if already deleted if (err && errno != ENOENT) { // OK if already deleted
skipping to change at line 1316 skipping to change at line 1316
} }
} }
delete_image_index(file); // delete file in image index delete_image_index(file); // delete file in image index
delete_thumbfile(file); // delete thumbnail file and cache delete_thumbfile(file); // delete thumbnail file and cache
Nth = file_position(file,0); // find in gallery list Nth = file_position(file,0); // find in gallery list
if (Nth >= 0) gallery(0,"delete",Nth); // delete from gallery list if (Nth >= 0) gallery(0,"delete",Nth); // delete from gallery list
if (curr_file && strmatch(file,curr_file)) { // current file was removed if (curr_file && strmatch(file,curr_file)) { // current file was removed
last_file_posn = curr_file_posn; // remember for prev/next use
free_resources(); free_resources();
currfile = gallery(0,"get",curr_file_posn); // new current file = next currfile = gallery(0,"get",curr_file_posn); // new current file = next
if (currfile) { if (currfile) {
f_open(currfile); f_open(currfile);
zfree(currfile); zfree(currfile);
} }
else if (FGWM == 'F') m_blank_window(0,0); else {
Nth = curr_file_posn - 1;
if (Nth >= navi::Gfolders && Nth < navi::Gfiles) {
// no next, try previous 22.35
currfile = gallery(0,"get",curr_file_posn - 1);
if (currfile) {
f_open(currfile);
zfree(currfile);
}
}
}
} }
if (! currfile && FGWM == 'F') m_blank_window(0,0);
// 22.35
return 0; return 0;
} }
/******************************************************************************* */ /******************************************************************************* */
// Function to preload image files hopefully ahead of need. // Function to preload image files hopefully ahead of need.
// Usage: f_preload(next) // Usage: f_preload(next)
// next = -1 / +1 to read previous / next image file in curr. gallery // next = -1 / +1 to read previous / next image file in curr. gallery
// preload_file will be non-zero if and when preload_pxb is available. // preload_file will be non-zero if and when preload_pxb is available.
skipping to change at line 1506 skipping to change at line 1516
char color[20], fname[100], fext[8], *filespec; char color[20], fname[100], fext[8], *filespec;
int zstat, err, cc, ww, hh, RGB[3]; int zstat, err, cc, ww, hh, RGB[3];
zdialog *zd; zdialog *zd;
cchar *pp; cchar *pp;
char *curr_folder = 0; char *curr_folder = 0;
F1_help_topic = "blank image"; F1_help_topic = "blank image";
Plog(1,"m_blank_image \n"); Plog(1,"m_blank_image \n");
if (navi::gallerytype == GDIR) curr_folder = navi::galleryname; if (navi::gallerytype == FOLDER) curr_folder = navi::galleryname;
else curr_folder = topfolders[0]; else curr_folder = topfolders[0];
if (! curr_folder) { if (! curr_folder) {
Plog(1,"no top image folders defined \n"); // should not happen Plog(0,"no top image folders defined \n"); // should not happen
return; return;
} }
if (Fblock("blank_image","block edits")) return; // check pend, block if (Fblock("blank_image","block edits")) return; // check pend, block
m_viewmode(0,"F"); m_viewmode(0,"F");
/*** /***
__________________________________________________ __________________________________________________
| Create Blank Image | | Create Blank Image |
skipping to change at line 1888 skipping to change at line 1898
return 1; return 1;
} }
zd->zstat = 0; // [apply] - keep dialog active zd->zstat = 0; // [apply] - keep dialog active
if (image_file_type(sorcfile) != IMAGE) { if (image_file_type(sorcfile) != IMAGE) {
zmessageACK(Mwin,"invalid source file: %s",sorcfile); // validate source file zmessageACK(Mwin,"invalid source file: %s",sorcfile); // validate source file
return 1; return 1;
} }
if (curr_file && strmatch(curr_file,sorcfile)) if (Fblock(0,"blocked")) return 1;
// current file was moved // check for blocking function 22.35
if (Fblock(0,"blocked edits")) return 1; if (curr_file && strmatch(curr_file,sorcfile))
// check for edits pending // current file will be moved
if (Fblock(0,"edits")) return 1;
// check for edits pending
zdialog_fetch(zd,"copy",Fcopy); // get options zdialog_fetch(zd,"copy",Fcopy); // get options
zdialog_fetch(zd,"move",Fmove); zdialog_fetch(zd,"move",Fmove);
zdialog_fetch(zd,"next",Fnext); zdialog_fetch(zd,"next",Fnext);
if (Fcopy + Fmove != 1) return 1; // one of copy/move must be set if (Fcopy + Fmove != 1) return 1; // one of copy/move must be set
zdialog_fetch(zd,"copymove_loc",copyloc,XFCC); // get move-to location from dialog zdialog_fetch(zd,"copymove_loc",copyloc,XFCC); // get move-to location from dialog
if (! dirfile(copyloc)) { // check for valid folder if (! dirfile(copyloc)) { // check for valid folder
zmessageACK(Mwin,"new location is not a folder"); zmessageACK(Mwin,"new location is not a folder");
skipping to change at line 1989 skipping to change at line 2000
f_open(sorcfile,0,0,1,0); // show file or highlight thumb f_open(sorcfile,0,0,1,0); // show file or highlight thumb
pp = strrchr(sorcfile,'/'); pp = strrchr(sorcfile,'/');
if (pp) { if (pp) {
zdialog_stuff(zd,"sorcname",pp+1); // next source and dest file name zdialog_stuff(zd,"sorcname",pp+1); // next source and dest file name
zdialog_stuff(zd,"destname",pp+1); zdialog_stuff(zd,"destname",pp+1);
} }
} }
else if (curr_file) f_open(curr_file,0,0,1,0); // restore curr. metadata else if (curr_file) f_open(curr_file,0,0,1,0); // restore curr. metadata
if (FGWM == 'G' && navi::gallerytype == GDIR) { // refresh gallery if (FGWM == 'G' && navi::gallerytype == FOLDER) { // refresh gallery
gallery(0,"init",0); gallery(0,"init",0);
gallery(0,"sort",-2); // recall sort and position gallery(0,"sort",-2); // recall sort and position
gallery(0,"paint",-1); gallery(0,"paint",-1);
} }
zdialog_fetch(zd,"keepopen",Fkeep); zdialog_fetch(zd,"keepopen",Fkeep);
if (! Fkeep) { if (! Fkeep) {
zdialog_free(zd); // kill dialog zdialog_free(zd); // kill dialog
zd_copymove = 0; zd_copymove = 0;
} }
skipping to change at line 2113 skipping to change at line 2124
GError *gerror = 0; GError *gerror = 0;
pixbuf = gdk_pixbuf_new_from_file(file,&gerror); pixbuf = gdk_pixbuf_new_from_file(file,&gerror);
if (! pixbuf) return 0; if (! pixbuf) return 0;
clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
if (! clipboard) return 0; if (! clipboard) return 0;
gtk_clipboard_clear(clipboard); gtk_clipboard_clear(clipboard);
gtk_clipboard_set_image(clipboard,pixbuf); gtk_clipboard_set_image(clipboard,pixbuf);
gtk_clipboard_set_can_store(clipboard,0,0); gtk_clipboard_set_can_store(clipboard,0,0);
gtk_clipboard_store(clipboard); // persistence does not work gtk_clipboard_store(clipboard); // persistence after exit does not work
// GdkWindow *gdkw = gtk_widget_get_window(Mwin); // GdkWindow *gdkw = gtk_widget_get_window(Mwin);
// gdk_display_store_clipboard(zfuncs::display,gdkw,0,null,0); // also does not work // gdk_display_store_clipboard(zfuncs::display,gdkw,0,null,0);
g_object_unref(pixbuf); g_object_unref(pixbuf);
return 1; return 1;
} }
/******************************************************************************* */ /******************************************************************************* */
// Delete or Trash an image file. // Delete or Trash an image file.
// Use the Linux standard trash function. // Use the Linux standard trash function.
// If not available, show diagnostic and do nothing. // If not available, show diagnostic and do nothing.
char *delete_trash_file = 0; char *deltrash_file = 0;
void m_delete_trash(GtkWidget *, cchar *) // combined delete/trash function void m_delete_trash(GtkWidget *, cchar *) // combined delete/trash function
{ {
int delete_trash_dialog_event(zdialog *zd, cchar *event); int delete_trash_dialog_event(zdialog *zd, cchar *event);
cchar *title = "Delete/Trash Image File"; cchar *title = "Delete/Trash Image File";
F1_help_topic = "delete/trash"; F1_help_topic = "delete/trash";
Plog(1,"m_delete_trash \n"); Plog(1,"m_delete_trash \n");
if (FGWM != 'F' && FGWM != 'G') return; if (FGWM != 'F' && FGWM != 'G') return;
if (delete_trash_file) zfree(delete_trash_file); if (deltrash_file) zfree(deltrash_file);
delete_trash_file = 0; deltrash_file = 0;
if (clicked_file) { // use clicked file if present if (clicked_file) { // use clicked file if present
delete_trash_file = clicked_file; deltrash_file = clicked_file;
clicked_file = 0; clicked_file = 0;
} }
else if (curr_file) // else current file else if (curr_file) // else current file
delete_trash_file = zstrdup(curr_file,"delete-trash"); deltrash_file = zstrdup(curr_file,"delete-trash");
/*** /***
______________________________________ ______________________________________
| Delete/Trash Image File | | Delete/Trash Image File |
| | | |
| File: [____________________________] | | File: [____________________________] |
| | | |
| [x] keep this dialog open | | [x] keep this dialog open |
| | | |
| [delete] [trash] [cancel] | | [delete] [trash] [cancel] |
skipping to change at line 2180 skipping to change at line 2191
zdialog_add_widget(zd,"label","labf","hb1","File:","space=3"); zdialog_add_widget(zd,"label","labf","hb1","File:","space=3");
zdialog_add_widget(zd,"label","file","hb1",0,"space=3"); zdialog_add_widget(zd,"label","file","hb1",0,"space=3");
zdialog_add_widget(zd,"hbox","hb2","dialog",0,"space=3"); zdialog_add_widget(zd,"hbox","hb2","dialog",0,"space=3");
zdialog_add_widget(zd,"check","keepopen","hb2","keep this dialog open","sp ace=3"); zdialog_add_widget(zd,"check","keepopen","hb2","keep this dialog open","sp ace=3");
zdialog_resize(zd,300,0); zdialog_resize(zd,300,0);
zdialog_restore_inputs(zd); zdialog_restore_inputs(zd);
zdialog_run(zd,delete_trash_dialog_event,"parent"); // run dialog zdialog_run(zd,delete_trash_dialog_event,"parent"); // run dialog
} }
if (delete_trash_file) if (deltrash_file)
{ {
char *pp = strrchr(delete_trash_file,'/'); char *pp = strrchr(deltrash_file,'/');
if (pp) pp++; if (pp) pp++;
else pp = delete_trash_file; else pp = deltrash_file;
zdialog_stuff(zd_deltrash,"file",pp); zdialog_stuff(zd_deltrash,"file",pp);
if (FGWM == 'G') f_open(delete_trash_file,0,0,1,0); // show or highlight gallery 22.18 if (FGWM == 'G') f_open(deltrash_file,0,0,1,0); // show or highlight gallery 22.18
} }
else zdialog_stuff(zd_deltrash,"file",""); else zdialog_stuff(zd_deltrash,"file","");
return; return;
} }
// dialog event and completion callback function // dialog event and completion callback function
int delete_trash_dialog_event(zdialog *zd, cchar *event) int delete_trash_dialog_event(zdialog *zd, cchar *event)
{ {
skipping to change at line 2212 skipping to change at line 2223
if (strmatch(event,"escape")) zd->zstat = -2; // escape key if (strmatch(event,"escape")) zd->zstat = -2; // escape key
if (zd->zstat == 0) return 1; // wait for dialog finished if (zd->zstat == 0) return 1; // wait for dialog finished
if (zd->zstat == 1) goto PREP; // [delete] button if (zd->zstat == 1) goto PREP; // [delete] button
if (zd->zstat == 2) goto PREP; // [trash] button if (zd->zstat == 2) goto PREP; // [trash] button
goto EXIT; // [cancel] or [x] goto EXIT; // [cancel] or [x]
PREP: PREP:
if (! delete_trash_file) goto EXIT; // no file to delete or trash if (! deltrash_file) goto EXIT; // no file to delete or trash
if (! regfile(delete_trash_file,&statB)) { // check file exists if (! regfile(deltrash_file,&statB)) { // check file exists
zmessageACK(Mwin,strerror(errno)); zmessageACK(Mwin,strerror(errno));
goto EXIT; goto EXIT;
} }
ftype = image_file_type(delete_trash_file); ftype = image_file_type(deltrash_file);
if (ftype != IMAGE && ftype != RAW && ftype != VIDEO) { // must be image or RAW or VIDEO if (ftype != IMAGE && ftype != RAW && ftype != VIDEO) { // must be image or RAW or VIDEO
zmessageACK(Mwin,"not a known image file"); zmessageACK(Mwin,"not a known image file");
goto EXIT; goto EXIT;
} }
if (! hasperm(delete_trash_file,'w')) { // check permission if (! hasperm(deltrash_file,'w')) { // check permission
if (zd->zstat == 1) if (zd->zstat == 1)
yn = zmessageYN(Mwin,"Delete read-only file?"); yn = zmessageYN(Mwin,"Delete read-only file?");
if (zd->zstat == 2) if (zd->zstat == 2)
yn = zmessageYN(Mwin,"Trash read-only file?"); yn = zmessageYN(Mwin,"Trash read-only file?");
if (! yn) goto NEXT; // keep file if (! yn) goto NEXT; // keep file
statB.st_mode |= S_IWUSR; // make writable statB.st_mode |= S_IWUSR; // make writable
err = chmod(delete_trash_file,statB.st_mode); err = chmod(deltrash_file,statB.st_mode);
if (err) { if (err) {
zmessageACK(Mwin,strerror(errno)); zmessageACK(Mwin,strerror(errno));
goto EXIT; goto EXIT;
} }
} }
if (Fblock(0,"blocked edits")) goto EXIT; if (Fblock(0,"blocked")) goto EXIT;
// blocking function or unsaved edits // check for blocking function 22.35
if (curr_file && strmatch(curr_file,deltrash_file))
// current file will be deleted
if (Fblock(0,"edits")) goto EXIT;
// check for edits pending
album_purge_replace("ALL",delete_trash_file,0); // remove from albums if present album_purge_replace("ALL",deltrash_file,0); // remove from albums if present
if (zd->zstat == 1) opt = "delete"; // [delete] button if (zd->zstat == 1) opt = "delete"; // [delete] button
if (zd->zstat == 2) opt = "trash"; // [trash] button if (zd->zstat == 2) opt = "trash"; // [trash] button
err = f_remove(delete_trash_file,opt); // remove file/index/thumb/gallery err = f_remove(deltrash_file,opt); // remove file/index/thumb/gallery
if (err) goto EXIT; if (err) goto EXIT;
if (FGWM == 'F') { // F window if (FGWM == 'F') { // F window
zdialog_fetch(zd,"keepopen",Fkeep); zdialog_fetch(zd,"keepopen",Fkeep);
if (! Fkeep) goto EXIT; if (! Fkeep) goto EXIT;
zd->zstat = 0; // keep dialog active zd->zstat = 0; // keep dialog active
gtk_window_present(MWIN); // keep focus on main window gtk_window_present(MWIN); // keep focus on main window
return 1; return 1;
} }
skipping to change at line 2275 skipping to change at line 2288
if (FGWM == 'F') m_next(0,0); // file view mode, open next image if (FGWM == 'F') m_next(0,0); // file view mode, open next image
zdialog_fetch(zd,"keepopen",Fkeep); // keep going if wanted zdialog_fetch(zd,"keepopen",Fkeep); // keep going if wanted
if (! Fkeep) goto EXIT; if (! Fkeep) goto EXIT;
zd->zstat = 0; // keep dialog active zd->zstat = 0; // keep dialog active
gtk_window_present(MWIN); // keep focus on main window 22.14 gtk_window_present(MWIN); // keep focus on main window 22.14
zdialog_stuff(zd_deltrash,"file",""); // set no next file in dialog zdialog_stuff(zd_deltrash,"file",""); // set no next file in dialog
if (delete_trash_file) zfree(delete_trash_file); if (deltrash_file) zfree(deltrash_file);
delete_trash_file = 0; deltrash_file = 0;
if (! curr_file) goto EXIT; // no current file if (! curr_file) goto EXIT; // no current file
delete_trash_file = zstrdup(curr_file,"delete-trash"); deltrash_file = zstrdup(curr_file,"delete-trash");
// default delete new current file 22.30 // default delete new current file 22.30
pp = strrchr(delete_trash_file,'/'); pp = strrchr(deltrash_file,'/');
if (pp) pp++; if (pp) pp++;
else pp = delete_trash_file; else pp = deltrash_file;
zdialog_stuff(zd_deltrash,"file",pp); zdialog_stuff(zd_deltrash,"file",pp);
if (FGWM == 'G') f_open(delete_trash_file,0,0,1,0); // show or highlight gallery if (FGWM == 'G') f_open(deltrash_file,0,0,1,0); // show or highlight gallery
return 1; return 1;
EXIT: EXIT:
if (delete_trash_file) zfree(delete_trash_file); if (deltrash_file) zfree(deltrash_file);
// free memory // free memory
delete_trash_file = 0; deltrash_file = 0;
zdialog_free(zd); // quit dialog zdialog_free(zd); // quit dialog
zd_deltrash = 0; zd_deltrash = 0;
return 1; return 1;
} }
/******************************************************************************* */ /******************************************************************************* */
// set current file as desktop wallpaper (GNOME only) // set current file as desktop wallpaper (GNOME only)
void m_wallpaper(GtkWidget *, cchar *) void m_wallpaper(GtkWidget *, cchar *)
 End of changes. 34 change blocks. 
43 lines changed or deleted 61 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)