"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/Properties.cpp" between
xfe-1.41.tar.gz and xfe-1.42.tar.gz

About: Xfe (X File Explorer) is a file manager and browser (using the FOX toolkit).

Properties.cpp  (xfe-1.41):Properties.cpp  (xfe-1.42)
skipping to change at line 1165 skipping to change at line 1165
long PropertiesBox::onCmdAcceptSingle(FXObject* o, FXSelector s, void* p) long PropertiesBox::onCmdAcceptSingle(FXObject* o, FXSelector s, void* p)
{ {
char** str = NULL; char** str = NULL;
int rc = 0; int rc = 0;
File* f = NULL; File* f = NULL;
char file[MAXPATHLEN]; char file[MAXPATHLEN];
FXString oldfileassoc, fileassoc, op, v, e; FXString oldfileassoc, fileassoc, op, v, e;
FXbool confirm = false; FXbool confirm = false;
#ifdef STARTUP_NOTIFICATION
if (executable && snbutton->getCheck() != sndisable_prev) if (executable && snbutton->getCheck() != sndisable_prev)
{ {
confirm = true; confirm = true;
} }
#endif
FXbool cond; FXbool cond;
if (edit) // Condition is not the same if edit exist or not if (edit) // Condition is not the same if edit exist or not
{ {
cond = (open->getText() != open_prev || view->getText() != view_prev || edit->getText() != edit_prev || cond = (open->getText() != open_prev || view->getText() != view_prev || edit->getText() != edit_prev ||
descr->getText() != descr_prev || bigic->getText() != bigic_prev || miniic->getText() != miniic_prev); descr->getText() != descr_prev || bigic->getText() != bigic_prev || miniic->getText() != miniic_prev);
} }
else else
{ {
cond = (open->getText() != open_prev || view->getText() != view_prev || descr->getText() != descr_prev || cond = (open->getText() != open_prev || view->getText() != view_prev || descr->getText() != descr_prev ||
skipping to change at line 1575 skipping to change at line 1577
else else
{ {
MessageBox::error(this, BOX_OK, _("Error"), _("Chmod in %s faile d"), file); MessageBox::error(this, BOX_OK, _("Error"), _("Chmod in %s faile d"), file);
} }
delete f; delete f;
return(0); return(0);
} }
delete f; delete f;
} }
DialogBox::onCmdAccept(o, s, p); DialogBox::onCmdAccept(o, s, p);
// Redraw file lists // Redraw file lists
((XFileExplorer*)mainWindow)->deselectAll(); ((XFileExplorer*)mainWindow)->deselectAll();
((XFileExplorer*)mainWindow)->redrawPanels(); ((XFileExplorer*)mainWindow)->refreshPanels();
// Delete object // Delete object
delete this; delete this;
return(1); return(1);
} }
// Dialog for multiple selected files // Dialog for multiple selected files
long PropertiesBox::onCmdAcceptMult(FXObject* o, FXSelector s, void* p) long PropertiesBox::onCmdAcceptMult(FXObject* o, FXSelector s, void* p)
{ {
skipping to change at line 1787 skipping to change at line 1789
} }
} }
delete f; delete f;
getApp()->endWaitCursor(); getApp()->endWaitCursor();
} }
DialogBox::onCmdAccept(o, s, p); DialogBox::onCmdAccept(o, s, p);
// Redraw the file lists // Redraw the file lists
((XFileExplorer*)mainWindow)->deselectAll(); ((XFileExplorer*)mainWindow)->deselectAll();
((XFileExplorer*)mainWindow)->redrawPanels(); ((XFileExplorer*)mainWindow)->refreshPanels();
delete[]files; delete[]files;
delete[]paths; delete[]paths;
delete this; delete this;
return(1); return(1);
} }
// Cancel dialog // Cancel dialog
long PropertiesBox::onCmdCancel(FXObject* o, FXSelector s, void* p) long PropertiesBox::onCmdCancel(FXObject* o, FXSelector s, void* p)
skipping to change at line 1815 skipping to change at line 1817
totaldirsize = 0; totaldirsize = 0;
totalnbfiles = 0; totalnbfiles = 0;
totalnbsubdirs = 0; totalnbsubdirs = 0;
getApp()->removeChore(this, ID_WATCHPROCESS); getApp()->removeChore(this, ID_WATCHPROCESS);
} }
DialogBox::onCmdCancel(o, s, p); DialogBox::onCmdCancel(o, s, p);
// Redraw the file lists
((XFileExplorer*)mainWindow)->redrawPanels();
delete this; delete this;
return(1); return(1);
} }
long PropertiesBox::onCmdCommand(FXObject* o, FXSelector s, void* p) long PropertiesBox::onCmdCommand(FXObject* o, FXSelector s, void* p)
{ {
perm->cmd = FXSELID(s); perm->cmd = FXSELID(s);
return(1); return(1);
} }
skipping to change at line 2002 skipping to change at line 2001
// Watch progress of child process // Watch progress of child process
long PropertiesBox::onWatchProcess(FXObject*, FXSelector, void*) long PropertiesBox::onWatchProcess(FXObject*, FXSelector, void*)
{ {
char buf[1024]; char buf[1024];
char size[256]; char size[256];
int nread; int nread;
FXString strbuf, hsize; FXString strbuf, hsize;
FXString dsize, subdirs, files; FXString dsize, subdirs, files;
FXuint nbsubdirs, nbfiles; FXuint nbsubdirs=0, nbfiles;
FXulong dirsize; FXulong dirsize;
if ((waitpid(pid, NULL, WNOHANG) == 0)) if ((waitpid(pid, NULL, WNOHANG) == 0))
{ {
// Child is still running, just wait // Child is still running, just wait
getApp()->addChore(this, ID_WATCHPROCESS); getApp()->addChore(this, ID_WATCHPROCESS);
// Read data from the running child (first, set I-O to non-blocking) // Read data from the running child (first, set I-O to non-blocking)
int pflags; int pflags;
if ((pflags = fcntl(pipes[0], F_GETFL)) >= 0) if ((pflags = fcntl(pipes[0], F_GETFL)) >= 0)
{ {
pflags |= O_NONBLOCK; pflags |= O_NONBLOCK;
if (fcntl(pipes[0], F_SETFL, pflags) >= 0) if (fcntl(pipes[0], F_SETFL, pflags) >= 0)
{ {
// Now read the data from the pipe // Now read the data from the pipe
while ((nread = read(pipes[0], buf, sizeof(buf)-1)) > 0) while ((nread = read(pipes[0], buf, sizeof(buf)-1)) > 0)
{ {
buf[nread] = '\0'; buf[nread] = '\0';
// Get last string between two slashes // Get last string between two slashes
// or before the slash if there is only one
strbuf = buf; strbuf = buf;
strbuf = strbuf.rbefore('/'); strbuf = strbuf.rbefore('/');
if (strbuf.rfind('/') >= 0) if (strbuf.rfind('/') >= 0)
{ {
strbuf=strbuf.rafter('/'); strbuf=strbuf.rafter('/');
}
dsize = strbuf.section(' ',0); dsize = strbuf.section(' ',0);
files = strbuf.section(' ',1); files = strbuf.section(' ',1);
subdirs = strbuf.section(' ',2); subdirs = strbuf.section(' ',2);
hsize = ::hSize((char*)dsize.text hsize = ::hSize((char*)dsize.text());
());
// Directory size, number of files, numbe
// Directory size, number of file r of sub directories
s, number of sub directories dirsize = FXULongVal(dsize);
dirsize = FXULongVal(dsize); nbfiles = FXUIntVal(files);
nbfiles = FXUIntVal(files); nbsubdirs = FXUIntVal(subdirs);
nbsubdirs = FXUIntVal(subdirs); if (nbsubdirs > 0)
{
nbsubdirs--;
}
#if __WORDSIZE == 64 #if __WORDSIZE == 64
snprintf(size,sizeof(size)-1,_("% s (%lu bytes)"),hsize.text(),dirsize); snprintf(size,sizeof(size)-1,_("%s (%lu b ytes)"),hsize.text(),dirsize);
#else #else
snprintf(size,sizeof(size)-1,_("% s (%llu bytes)"),hsize.text(),dirsize); snprintf(size,sizeof(size)-1,_("%s (%llu bytes)"),hsize.text(),dirsize);
#endif #endif
fileSize->setText(size); fileSize->setText(size);
snprintf(size, sizeof(size)-1, _( snprintf(size, sizeof(size)-1, _("%u file
"%u files, %u subfolders"), nbfiles-nbsubdirs-nbseldirs, nbsubdirs); s, %u subfolders"), nbfiles-nbsubdirs-nbseldirs, nbsubdirs);
fileSizeDetails->setText(size); fileSizeDetails->setText(size);
}
if (nread < (int)(sizeof(buf)-1)) if (nread < (int)(sizeof(buf)-1))
{ {
break; break;
} }
} }
} }
} }
} }
skipping to change at line 2087 skipping to change at line 2090
dsize = strbuf.section(' ',0); dsize = strbuf.section(' ',0);
files = strbuf.section(' ',1); files = strbuf.section(' ',1);
subdirs = strbuf.section(' ',2); subdirs = strbuf.section(' ',2);
hsize = ::hSize((char*)dsize.text()); hsize = ::hSize((char*)dsize.text());
// Directory size, number of files, number of sub directories // Directory size, number of files, number of sub directories
dirsize = FXULongVal(dsize); dirsize = FXULongVal(dsize);
nbfiles = FXUIntVal(files); nbfiles = FXUIntVal(files);
nbsubdirs = FXUIntVal(subdirs); nbsubdirs = FXUIntVal(subdirs);
if (nbsubdirs >0)
{
nbsubdirs--;
}
#if __WORDSIZE == 64 #if __WORDSIZE == 64
snprintf(size,sizeof(size)-1,_("%s (%lu bytes)"), hsize.text(),dirsize); snprintf(size,sizeof(size)-1,_("%s (%lu bytes)"), hsize.text(),dirsize);
#else #else
snprintf(size,sizeof(size)-1,_("%s (%llu bytes)") ,hsize.text(),dirsize); snprintf(size,sizeof(size)-1,_("%s (%llu bytes)") ,hsize.text(),dirsize);
#endif #endif
fileSize->setText(size); fileSize->setText(size);
snprintf(size, sizeof(size)-1, _("%u files, %u su bfolders"), nbfiles-nbsubdirs-nbseldirs, nbsubdirs); snprintf(size, sizeof(size)-1, _("%u files, %u su bfolders"), nbfiles-nbsubdirs-nbseldirs, nbsubdirs);
fileSizeDetails->setText(size); fileSizeDetails->setText(size);
skipping to change at line 2151 skipping to change at line 2158
// Create child process // Create child process
pid = fork(); pid = fork();
if (pid == -1) if (pid == -1)
{ {
perror("fork"); perror("fork");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
if (pid == 0) // Child if (pid == 0) // Child
{ {
nbsubdirs--; if (nbsubdirs > 0)
{
nbsubdirs--;
}
pathsize(buf, &nbfiles, &nbsubdirs, &dirs ize, pipes); pathsize(buf, &nbfiles, &nbsubdirs, &dirs ize, pipes);
_exit(EXIT_SUCCESS); _exit(EXIT_SUCCESS);
} }
else // Parent else // Parent
{ {
// Make sure we get called so we can chec k when child has finished // Make sure we get called so we can chec k when child has finished
getApp()->addChore(this, ID_WATCHPROCESS) ; getApp()->addChore(this, ID_WATCHPROCESS) ;
} }
} }
skipping to change at line 2216 skipping to change at line 2227
if (files[i] == "..") if (files[i] == "..")
{ {
continue; continue;
} }
// Is it a directory? // Is it a directory?
isDirectory = S_ISDIR(info.st_mode); isDirectory = S_ISDIR(info.st_mode);
if (isDirectory) if (isDirectory)
{ {
strlcpy(buf, pathname.text(), pat hname.length()+1); strlcpy(buf, pathname.text(), pat hname.length()+1);
totalnbsubdirs--;
if (totalnbsubdirs > 0)
{
totalnbsubdirs--;
}
pathsize(buf, &totalnbfiles, &tot alnbsubdirs, &totaldirsize, pipes); pathsize(buf, &totalnbfiles, &tot alnbsubdirs, &totaldirsize, pipes);
} }
else // Regular file else // Regular file
{ {
strlcpy(buf, pathname.text(), pat hname.length()+1); strlcpy(buf, pathname.text(), pat hname.length()+1);
pathsize(buf, &totalnbfiles, &tot alnbsubdirs, &totaldirsize, pipes); pathsize(buf, &totalnbfiles, &tot alnbsubdirs, &totaldirsize, pipes);
} }
} }
_exit(EXIT_SUCCESS); _exit(EXIT_SUCCESS);
 End of changes. 18 change blocks. 
29 lines changed or deleted 44 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS