Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide
translations



Rockbox mail archive

Subject: Little fix for "Plugins" menu

Little fix for "Plugins" menu

From: DervishD <iaudio_at_dervishd.net>
Date: Sun, 26 Aug 2007 12:30:25 +0200

    Hi all :)

    As I already mentioned, if no files are present in some subdir of
"/.rockbox/rocks/" when browsing it using the "Plugins" submenu in the
root menu, the file browser returns to the root dir or to the last
visited subdir (about this I'm not sure, because all the tests I've made
lately always return to the root dir. I would swear that at some points
I've returned to the directory of the last song I played).

    I think that this can be fixed just by adding a test: if
"rockbox_browse()" returns 0, pretend it returned "GO_TO_PREVIOUS". As
far as I know, this doesn't present any message saying that no files
were found, but I still don't know how to do it safely using gui_splash
or something like that.

    Before making this oneliner patch, and given that I'm a complete
newbie regarding rockbox sources, I would like to know if this patch is
correct or if this is considered a dirty hack. I'm going to change this:

    while (retval == GO_TO_PREVIOUS)
    {
        ...
        switch...
        retval = rockbox_browse(folder, SHOW_PLUGINS);
    }

    to this:

    while (retval == GO_TO_PREVIOUS)
    {
        ...
        switch...
        retval = rockbox_browse(folder, SHOW_PLUGINS);
        retval = retval ? retval : GO_TO_PREVIOUS;
        /*
            Or, if you prefer or if ?: is not considered readable:
            if (retval == 0) retval = GO_TO_PREVIOUS;
        */
    }

    I've read a bit of "rockbox_browse()" , apps/tree.c and
apps/filetree.c, but I still don't know if this is enough to make the
menu stay and avoid going to the root directory when "rocks/games",
"rocks/apps" or "rocks/viewers" is empty or missing (does
"rockbox_browse()" return -1 for missing dirs? I have to check that).

    I'm trying to learn the sources so I can contribute with much more
code that this simple oneliner, so any suggestion is welcome. Thanks in
advance!

    Raúl Núñez de Arenas Coronado

-- 
Linux Registered User 88736 | http://www.dervishd.net
It's my PC and I'll cry if I want to... RAmen!
Received on 2007-08-26

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy