aboutsummaryrefslogtreecommitdiff
path: root/x11-fm/xfe/files/patch-src_FilePanel
diff options
context:
space:
mode:
Diffstat (limited to 'x11-fm/xfe/files/patch-src_FilePanel')
-rw-r--r--x11-fm/xfe/files/patch-src_FilePanel262
1 files changed, 262 insertions, 0 deletions
diff --git a/x11-fm/xfe/files/patch-src_FilePanel b/x11-fm/xfe/files/patch-src_FilePanel
new file mode 100644
index 000000000000..04da45a21081
--- /dev/null
+++ b/x11-fm/xfe/files/patch-src_FilePanel
@@ -0,0 +1,262 @@
+--- src/FilePanel.cpp.orig 2013-08-21 13:32:33.000000000 +0200
++++ src/FilePanel.cpp 2013-08-26 18:08:30.000000000 +0200
+@@ -119,9 +119,13 @@
+ FXMAPFUNC(SEL_COMMAND,FilePanel::ID_EXTRACT,FilePanel::onCmdExtract),
+ FXMAPFUNC(SEL_COMMAND,FilePanel::ID_EXTRACT_TO_FOLDER,FilePanel::onCmdExtractToFolder),
+ FXMAPFUNC(SEL_COMMAND,FilePanel::ID_EXTRACT_HERE,FilePanel::onCmdExtractHere),
++#if defined(linux) || defined(__FreeBSD__)
+ FXMAPFUNC(SEL_COMMAND,FilePanel::ID_RUN_SCRIPT,FilePanel::onCmdRunScript),
++#endif
+ FXMAPFUNC(SEL_UPDATE,FilePanel::ID_RUN_SCRIPT,FilePanel::onUpdRunScript),
++#if defined(linux) || defined(__FreeBSD__)
+ FXMAPFUNC(SEL_COMMAND,FilePanel::ID_GO_SCRIPTDIR,FilePanel::onCmdGoScriptDir),
++#endif
+ FXMAPFUNC(SEL_RIGHTBUTTONRELEASE,FilePanel::ID_FILELIST,FilePanel::onCmdPopupMenu),
+ FXMAPFUNC(SEL_COMMAND,FilePanel::ID_POPUP_MENU,FilePanel::onCmdPopupMenu),
+ FXMAPFUNC(SEL_DOUBLECLICKED,FilePanel::ID_FILELIST,FilePanel::onCmdItemDoubleClicked),
+@@ -4548,108 +4552,6 @@
+ }
+
+
+-// Run script
+-long FilePanel::onCmdRunScript(FXObject* o, FXSelector sel, void*)
+-{
+- // Wait cursor
+- getApp()->beginWaitCursor();
+-
+- FXString pathname, cmd, itemslist=" ";
+- FXString scriptpath = dynamic_cast<FXMenuCommand *>(o)->getHelpText();
+-
+- // Construct selected files list
+- current->list->setFocus();
+- for (int u=0; u<current->list->getNumItems(); u++)
+- {
+- if (current->list->isItemSelected(u))
+- {
+- pathname=current->list->getItemPathname(u);
+-
+- // List of selected items
+- itemslist += ::quote(pathname) + " ";
+- }
+- }
+-
+- // Construct command line
+- cmd = scriptpath + itemslist + " &";
+-
+- // Go to the current directory
+- int ret=chdir(current->list->getDirectory().text());
+- if (ret < 0)
+- {
+- int errcode=errno;
+- if (errcode)
+- MessageBox::error(this,BOX_OK,_("Error"),_("Can't enter folder %s: %s"),current->list->getDirectory().text(),strerror(errcode));
+- else
+- MessageBox::error(this,BOX_OK,_("Error"),_("Can't enter folder %s"),current->list->getDirectory().text());
+- }
+-
+- // Execute command
+- static pid_t child_pid = 0;
+- switch ((child_pid = fork ()))
+- {
+- case -1:
+- fprintf (stderr,_("Error: Fork failed: %s\n"),strerror (errno));
+- break;
+-
+- case 0:
+- execl("/bin/sh","sh","-c",cmd.text(),(char *)NULL);
+- exit(1);
+- break;
+- }
+-
+- // Return to the starting directory
+- ret=chdir(startlocation.text());
+- if (ret < 0)
+- {
+- int errcode=errno;
+- if (errcode)
+- MessageBox::error(this,BOX_OK,_("Error"),_("Can't enter folder %s: %s"),startlocation.text(),strerror(errcode));
+- else
+- MessageBox::error(this,BOX_OK,_("Error"),_("Can't enter folder %s"),startlocation.text());
+- }
+-
+- getApp()->endWaitCursor();
+-
+- return 1;
+-}
+-
+-
+-// Go to scripts directory
+-long FilePanel::onCmdGoScriptDir(FXObject* o, FXSelector sel, void*)
+-{
+- FXString scriptpath = homedir + PATHSEPSTRING CONFIGPATH PATHSEPSTRING XFECONFIGPATH PATHSEPSTRING SCRIPTPATH;
+-
+- if (!::exists(scriptpath))
+- {
+- // Create the script directory according to the umask
+- int mask=umask(0);
+- umask(mask);
+- errno=0;
+- int ret=mkpath(scriptpath.text(),511 & ~mask);
+- int errcode=errno;
+- if (ret==-1)
+- {
+- if (errcode)
+- MessageBox::error(this,BOX_OK,_("Error"),_("Can't create script folder %s: %s"),scriptpath.text(),strerror(errcode));
+- else
+- MessageBox::error(this,BOX_OK,_("Error"),_("Can't create script folder %s"),scriptpath.text());
+-
+- return 0;
+- }
+- }
+-
+- // Go to scripts directory
+- current->list->setDirectory(scriptpath);
+- current->list->setFocus();
+- dirpanel->setDirectory(scriptpath,TRUE);
+- current->updatePath();
+- updateLocation();
+-
+- return 1;
+-}
+-
+-
+ // Update the Mount button
+ long FilePanel::onUpdMount(FXObject* o,FXSelector sel,void*)
+ {
+@@ -4815,6 +4717,114 @@
+ }
+ #endif // End #if defined(linux)
+
++#if defined(linux) || defined(__FreeBSD__)
++
++// Go to scripts directory
++long FilePanel::onCmdGoScriptDir(FXObject* o, FXSelector sel, void*)
++{
++ FXString scriptpath = homedir + PATHSEPSTRING CONFIGPATH PATHSEPSTRING XFECONFIGPATH PATHSEPSTRING SCRIPTPATH;
++
++ if (!::exists(scriptpath))
++ {
++ // Create the script directory according to the umask
++ int mask=umask(0);
++ umask(mask);
++ errno=0;
++ int ret=mkpath(scriptpath.text(),511 & ~mask);
++ int errcode=errno;
++ if (ret==-1)
++ {
++ if (errcode)
++ MessageBox::error(this,BOX_OK,_("Error"),_("Can't create script folder %s: %s"),scriptpath.text(),strerror(errcode));
++ else
++ MessageBox::error(this,BOX_OK,_("Error"),_("Can't create script folder %s"),scriptpath.text());
++
++ return 0;
++ }
++ }
++
++ // Go to scripts directory
++ current->list->setDirectory(scriptpath);
++ current->list->setFocus();
++ dirpanel->setDirectory(scriptpath,TRUE);
++ current->updatePath();
++ updateLocation();
++
++ return 1;
++}
++
++// Run script
++long FilePanel::onCmdRunScript(FXObject* o, FXSelector sel, void*)
++{
++ // Wait cursor
++ getApp()->beginWaitCursor();
++
++ FXString pathname, cmd, itemslist=" ";
++ FXString scriptpath = dynamic_cast<FXMenuCommand *>(o)->getHelpText();
++
++ // Construct selected files list
++ current->list->setFocus();
++ for (int u=0; u<current->list->getNumItems(); u++)
++ {
++ if (current->list->isItemSelected(u))
++ {
++ pathname=current->list->getItemPathname(u);
++
++ // List of selected items
++ itemslist += ::quote(pathname) + " ";
++ }
++ }
++
++ // Construct command line
++ cmd = scriptpath + itemslist + " &";
++
++ // Go to the current directory
++ int ret=chdir(current->list->getDirectory().text());
++ if (ret < 0)
++ {
++ int errcode=errno;
++ if (errcode)
++ MessageBox::error(this,BOX_OK,_("Error"),_("Can't enter folder %s: %s"),current->list->getDirectory().text(),strerror(errcode));
++ else
++ MessageBox::error(this,BOX_OK,_("Error"),_("Can't enter folder %s"),current->list->getDirectory().text());
++ }
++
++ // Execute command
++ static pid_t child_pid = 0;
++ switch ((child_pid = fork ()))
++ {
++ case -1:
++ fprintf (stderr,_("Error: Fork failed: %s\n"),strerror (errno));
++ break;
++
++ case 0:
++ execl("/bin/sh","sh","-c",cmd.text(),(char *)NULL);
++ exit(1);
++ break;
++ }
++
++ // Return to the starting directory
++ ret=chdir(startlocation.text());
++ if (ret < 0)
++ {
++ int errcode=errno;
++ if (errcode)
++ MessageBox::error(this,BOX_OK,_("Error"),_("Can't enter folder %s: %s"),startlocation.text(),strerror(errcode));
++ else
++ MessageBox::error(this,BOX_OK,_("Error"),_("Can't enter folder %s"),startlocation.text());
++ }
++
++ getApp()->endWaitCursor();
++
++ return 1;
++}
++
++
++
++#endif
++
++
++
+
+ // Update the status bar and the path linker
+ long FilePanel::onUpdStatus(FXObject* sender,FXSelector,void*)
+--- src/FilePanel.h.orig 2013-08-20 15:14:01.000000000 +0200
++++ src/FilePanel.h 2013-08-26 18:06:46.000000000 +0200
+@@ -176,7 +176,9 @@
+ long onCmdToggleHidden(FXObject*,FXSelector,void*);
+ long onUpdToggleHidden(FXObject*,FXSelector,void*);
+ long onCmdToggleThumbnails(FXObject*,FXSelector,void*);
++#if defined(linux) || defined(__FreeBSD__)
+ long onCmdRunScript(FXObject* o,FXSelector sel,void*);
++#endif
+ long onUpdToggleThumbnails(FXObject*,FXSelector,void*);
+ long onCmdAddToArch(FXObject*,FXSelector,void*);
+ long onUpdMenu(FXObject*,FXSelector,void*);
+@@ -190,7 +192,9 @@
+ void updatePath();
+ long onCmdStopListRefreshTimer(FXObject*,FXSelector,void*);
+ long onUpdRunScript(FXObject*,FXSelector,void*);
++#if defined(linux) || defined(__FreeBSD__)
+ long onCmdGoScriptDir(FXObject*, FXSelector, void*);
++#endif
+
+ #if defined(linux)
+ long onCmdMount(FXObject*,FXSelector,void*);