[emelfm] Another user

  • From: Florian Zähringer <flo.zaehringer@xxxxxx>
  • To: emelfm@xxxxxxxxxxxxx
  • Date: Mon, 12 Dec 2005 21:51:27 +0100

Hi there,

another one responded to my mail :)
But he has troubles subscribing :(

While we will try to figure that out here's his e-mail he wasn't able to send 
yet. Thus I will just forward it for him:


Hello all:

Sorry for the late response, but I have troubles for subscribing myself to
the list (and I am too busy in the last times).

In the release of emelfm-elm1 I contributed with the (poor) code for the
plugins that makes that emelf can archive and de-archive some format like
rar, arj, deb...

But I have some others modifications in my emelfm. All of these
"improvements" are ugly and simple modifications to the source code, as I
am not a programer, I'am a simple user, but that likes to investigate how
the program works. The following is a simple list with the things that I
changed in my emelfm:

- File list dates: I changed the default date in the file-list. I put the
spanish date format (07/11/05 for today) with the 'date' codes (man date)=
'%e/%m/%y %H:%M' in the source code file filelist.c (lines 793, 797 and 801
or so). 

But if you look at the date man page, there are some 'codes' adapted to the
locales (%x: locale's date representation (mm/dd/yy), and %X: locale's time
representation (%H:%M:%S)) that we can use for emelfm in a general case.
Or, if someone has code skills, it was be wonderful if this setting shall
be selectable in the config dialog.


- Improved drag&drop menu: I use a lot the drag&drop menu (mouse's central
button) for copy and move files. But the standar menu doesn't have entries
for 'copy as' and 'move as', so I changed it a bit. Now my menu have the
following entries: 'copy', 'copy as', 'move', 'move as', 'symlink' and
'symlink as'. But the code is ugly, and in the 'as' cases mades some
strange things (in some cases emelfm says that the copy_as/move_as file
already exist, and you must say yes to the "overwrite" dialog, for change
the files's name). 

The code is in the source file: fileview.c, in the line 465 and
subsequents, and I put, following to one original line (exemp: "Copy"), a
new line (exemp: "Copy As..."):

/* COPY_AS, MOVE_AS Y SIMLINK_AS EN DRAG-MENU.*/
  app.drag_op_menu = gtk_menu_new();
  item = add_menu_item(app.drag_op_menu, _("Copy"), drag_op_cb, file_copy);
  gtk_object_set_data_full(GTK_OBJECT(item), "dest_dir",
g_strdup(dest_dir),
                           free_data);
  gtk_object_set_data_full(GTK_OBJECT(item), "file_list",
g_strdup(file_list),
                           free_data);

  item = add_menu_item(app.drag_op_menu, _("Copy As..."), drag_op_cb,
copy_as_cb);
  gtk_object_set_data_full(GTK_OBJECT(item), "dest_dir",
g_strdup(dest_dir),
                           free_data);
  gtk_object_set_data_full(GTK_OBJECT(item), "file_list",
g_strdup(file_list),
                           free_data);
                           
  item = add_menu_item(app.drag_op_menu, _("Move"), drag_op_cb, file_move);
  gtk_object_set_data_full(GTK_OBJECT(item), "dest_dir",
g_strdup(dest_dir),
                           free_data);
  gtk_object_set_data_full(GTK_OBJECT(item), "file_list",
g_strdup(file_list),
                           free_data);
                           
  item = add_menu_item(app.drag_op_menu, _("Move As..."), drag_op_cb,
move_as_cb);
  gtk_object_set_data_full(GTK_OBJECT(item), "dest_dir",
g_strdup(dest_dir),
                           free_data);
  gtk_object_set_data_full(GTK_OBJECT(item), "file_list",
g_strdup(file_list),
                           free_data);                             
                           
  item = add_menu_item(app.drag_op_menu, _("SymLink"), drag_op_cb,
file_symlink);
  gtk_object_set_data_full(GTK_OBJECT(item), "dest_dir",
g_strdup(dest_dir),
                           free_data);
  gtk_object_set_data_full(GTK_OBJECT(item), "file_list",
g_strdup(file_list),
                           free_data);
                           
  item = add_menu_item(app.drag_op_menu, _("SymLink As..."), drag_op_cb,
symlink_as_cb);
  gtk_object_set_data_full(GTK_OBJECT(item), "dest_dir",
g_strdup(dest_dir),
                           free_data);
  gtk_object_set_data_full(GTK_OBJECT(item), "file_list",
g_strdup(file_list),
                           free_data);  
/* END */       


- Upper menus (Boockmarks, Filters...) improved: I use a lot the 'User' and
'Plugins' submenus from the contextual menu in the file list (right click
over a file). So I put them too in the upper menus of each pane. So I have
in each pane the following menues in the top side: Boockmarks, Filters,
User, Plugins and (the full) Menu. The original ones and the ones that I
put look a bit different, but they works :-D)

For made this, I change the source file menu.c and add the following in the
line 206:

 /* MENUS USUARIO-PLUGINS-STANDAR (functions from emelfm.h file) */

   /* Menu usuario */
  menu = gtk_menu_new();
  add_menu_item(menu_bar, _("User"), show_user_menu_cb, menu);

   /* Menu plugins */
  menu = gtk_menu_new();
  add_menu_item(menu_bar, _("Plugins"), show_plugins_menu_cb, menu);

   /* Menu standar */
  menu = gtk_menu_new();
  add_menu_item(menu_bar, _("Menu"), show_menu_cb, menu);
 
 /* END MENUS USUARIO-PLUGINS-STANDAR */


- I put too the code needed for compress and decompress 7z archives
(http://p7zip.sourceforge.net/). Compress are in boot, the normal mode, and
the multivolume mode. The code is:

->   Source file plugins/pack.c:
- line 33:
enum { TAR_GZ, TAR_BZ2, TAR, ZIP, RAR, RAR_VOL, ARJ, ARJ_VOL, P7ZIP,
P7ZIP_VOL };

- line 98 (aprox) add:
  case P7ZIP:
    g_string_sprintf(command, "7za a -t7z -mx=7 -r -ms=on -m0=LZMA %s.7z ",
entry_text);
    for (; tmp != NULL; tmp = tmp->next)
      g_string_sprintfa(command, "%s ", ((FileInfo *)tmp->data)->filename);
    break;
  case P7ZIP_VOL:
    g_string_sprintf(command, "7za a -t7z -mx=7 -r -ms=on -m0=LZMA -v1423k
%s.7z ", entry_text);
    for (; tmp != NULL; tmp = tmp->next)
      g_string_sprintfa(command, "%s ", ((FileInfo *)tmp->data)->filename);
    break;

- line 184 (aprox) add:
  add_menu_item(menu, _(".7zip"), set_pkg_type, GINT_TO_POINTER(P7ZIP));
  add_menu_item(menu, _(".7zip_VOL"), set_pkg_type,
GINT_TO_POINTER(P7ZIP_VOL));


->   Source file plugins/unpack.c:
- line 58 (aprox) add:
  else if (strstr(last_package, ".7z") != NULL)
    g_string_sprintf(command, "cd %s; 7za a -t7z -mx=7 -r -ms=on -m0=LZMA
%s .", tmp_dir, last_package);

- line 190 (aprox) add:
  else if (strstr(info->filename, ".7z") != NULL)
    g_string_sprintf(command, "cd %s; 7za x %s", tmp_dir, last_package);  


And these are all my changes to emelfm-elm. If the code mailed is not good
(my email program (sylpheed) can broken it), I can attach the files in
other mail, or put them in a website. But I think that there aren't
important, so the code is not good.

And this is all. Excuse my bad english (I'm a spanish speaker) and ask me
if you have some trouble with this code, or some other thing. Greetings,
Martintxo.

Other related posts:

  • » [emelfm] Another user