Package: moc
Version: 2.4.1-1
Severity: wishlist
Tags: patch

Hi,
the attached patch modifies add_file_plist() to call add_dir_plist() if
the current item is a directory.
Rationale: suppose I'm browsing through directories, if I press 'a' to
add a file/directory, I know wheter is it a file or a directory thus
there's no point in having a distinct command. Moreover a directory can
be seen as a "file of files" :)

thanks,
filippo

-- System Information:
Debian Release: 4.0
  APT prefers unstable
  APT policy: (600, 'unstable'), (1, 'experimental')
Architecture: powerpc (ppc)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17.14-susp2
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)

Versions of packages moc depends on:
ii  libasoun 1.0.13-2                        ALSA library
ii  libc6    2.3.6.ds1-13                    GNU C Library: Shared libraries
ii  libcomer 1.39+1.40-WIP-2006.11.14+dfsg-1 common error description library
ii  libcurl3 7.15.5-1                        Multi-protocol file transfer libra
ii  libflac7 1.1.2-6                         Free Lossless Audio Codec - runtim
ii  libgnutl 1.4.4-3                         the GNU TLS library - runtime libr
ii  libid3ta 0.15.1b-10                      ID3 tag reading library from the M
ii  libidn11 0.6.5-1                         GNU libidn library, implementation
ii  libjack0 0.101.1-2                       JACK Audio Connection Kit (librari
ii  libkrb53 1.4.4-7                         MIT Kerberos runtime libraries
ii  libmad0  0.15.1b-2.1                     MPEG audio decoder library
ii  libmodpl 1:0.7-5.2                       shared libraries for mod music bas
ii  libmpcde 1.2.2-1                         Musepack (MPC) format library
ii  libncurs 5.5-5                           Shared libraries for terminal hand
ii  libogg0  1.1.3-2                         Ogg Bitstream Library
ii  libsampl 0.1.2-2                         audio rate conversion library
ii  libsndfi 1.0.16-1                        Library for reading/writing audio 
ii  libspeex 1.1.12-3                        The Speex Speech Codec
ii  libstdc+ 4.2-20060923-1                  The GNU Standard C++ Library v3
ii  libtagc0 1.4-4                           TagLib Audio Meta-Data Library (C 
ii  libvorbi 1.1.2.dfsg-1.2                  The Vorbis General Audio Compressi
ii  libvorbi 1.1.2.dfsg-1.2                  The Vorbis General Audio Compressi
ii  zlib1g   1:1.2.3-13                      compression library - runtime

moc recommends no packages.

-- no debconf information
--- moc-2.4.1.orig/interface.c  2006-08-30 21:39:09.000000000 +0200
+++ moc-2.4.1/interface.c       2007-03-05 23:45:57.784937752 +0100
@@ -1627,67 +1627,6 @@
        set_mixer (get_mixer_value() + diff);
 }
 
-/* Add the currently selected file to the playlist. */
-static void add_file_plist ()
-{
-       char *file;
-
-       if (iface_in_plist_menu()) {
-               error ("Can't add to the playlist a file from the "
-                               "playlist.");
-               return;
-       }
-
-       if (iface_curritem_get_type() == F_DIR) {
-               error ("This is a directory.");
-               return;
-       }
-       
-       file = iface_get_curr_file ();
-
-       if (!file)
-               return;
-       
-       if (iface_curritem_get_type() != F_SOUND) {
-               error ("You can only add a file using this command.");
-               free (file);
-               return;
-       }
-
-
-       if (plist_find_fname(playlist, file) == -1) {
-               struct plist_item *item = &dir_plist->items[
-                       plist_find_fname(dir_plist, file)];
-
-               send_int_to_srv (CMD_LOCK);
-
-               if (options_get_int("SyncPlaylist")) {
-                       send_int_to_srv (CMD_CLI_PLIST_ADD);
-                       send_item_to_srv (item);
-               }
-               else {
-                       int added;
-                       
-                       added = plist_add_from_item (playlist, item);
-                       iface_add_to_plist (playlist, added);
-               }
-                               
-               /* Add to the server's playlist if the server has our
-                * playlist */
-               if (get_server_plist_serial() == plist_get_serial(playlist)) {
-                       send_int_to_srv (CMD_LIST_ADD);
-                       send_str_to_srv (file);
-               }
-               send_int_to_srv (CMD_UNLOCK);
-       }
-       else
-               error ("The file is already on the playlist.");
-
-       iface_menu_key (KEY_CMD_MENU_DOWN);
-
-       free (file);
-}
-
 /* Recursively add the content of a directory to the playlist. */
 static void add_dir_plist ()
 {
@@ -1763,6 +1702,67 @@
        free (file);
 }
 
+/* Add the currently selected file to the playlist. */
+static void add_file_plist ()
+{
+       char *file;
+
+       if (iface_in_plist_menu()) {
+               error ("Can't add to the playlist a file from the "
+                               "playlist.");
+               return;
+       }
+
+       if (iface_curritem_get_type() == F_DIR) {
+               add_dir_plist();
+               return;
+       }
+       
+       file = iface_get_curr_file ();
+
+       if (!file)
+               return;
+       
+       if (iface_curritem_get_type() != F_SOUND) {
+               error ("You can only add a file using this command.");
+               free (file);
+               return;
+       }
+
+
+       if (plist_find_fname(playlist, file) == -1) {
+               struct plist_item *item = &dir_plist->items[
+                       plist_find_fname(dir_plist, file)];
+
+               send_int_to_srv (CMD_LOCK);
+
+               if (options_get_int("SyncPlaylist")) {
+                       send_int_to_srv (CMD_CLI_PLIST_ADD);
+                       send_item_to_srv (item);
+               }
+               else {
+                       int added;
+                       
+                       added = plist_add_from_item (playlist, item);
+                       iface_add_to_plist (playlist, added);
+               }
+                               
+               /* Add to the server's playlist if the server has our
+                * playlist */
+               if (get_server_plist_serial() == plist_get_serial(playlist)) {
+                       send_int_to_srv (CMD_LIST_ADD);
+                       send_str_to_srv (file);
+               }
+               send_int_to_srv (CMD_UNLOCK);
+       }
+       else
+               error ("The file is already on the playlist.");
+
+       iface_menu_key (KEY_CMD_MENU_DOWN);
+
+       free (file);
+}
+
 static void toggle_option (const char *name)
 {
        send_int_to_srv (CMD_SET_OPTION);

Reply via email to