Add MenuCreateFromBackgrounds, eliminate menus.cfg.

SVN revision: 44129
This commit is contained in:
Kim Woelders 2009-12-02 19:20:32 +00:00
parent 9758c0f786
commit 35c6792623
6 changed files with 26 additions and 20 deletions

View File

@ -3,7 +3,7 @@ SUBDIRS = pix
configdir = $(pkgdatadir)/config
config_DATA = \
definitions \
actionclasses.cfg bindings.cfg matches.cfg menus.cfg \
actionclasses.cfg bindings.cfg matches.cfg \
e16keyedit.db \
fonts.xft.cfg fonts.pango.cfg

View File

@ -1,5 +1,5 @@
"Desktop Operations" "ROOT"
"Backgrounds" NULL menu BACKGROUNDS_MENU
"Backgrounds" NULL menu backgrounds
"Cleanup Desktop" NULL "desk arrange"
"Goto Next Desktop" NULL "desk next"
"Goto Previous Desktop" NULL "desk prev"

View File

@ -1,9 +0,0 @@
#include <definitions>
__E_CFG_VERSION 0
/* recursively scan $HOME/.e16/backgrounds and build menu if images
* are there */
BEGIN_NEW_DIRSCAN_MENU("BACKGROUNDS_MENU", "ROOT_IMAGE", ECONFDIR"/backgrounds")
ADD_MENU_TITLE("Backgrounds")
END_MENU

View File

@ -74,8 +74,6 @@ _("Go Forward a Desktop"),
/* fonts.pango.cfg */
/* fonts.xft.cfg */
/* matches.cfg */
/* menus.cfg */
_("Backgrounds"),
/* desktop.menu */
_("Desktop Operations"),
_("Backgrounds"),

View File

@ -251,7 +251,7 @@ void
ScanBackgroundMenu(void)
{
menu_scan_recursive = 1;
MenuLoad(MenuFind("BACKGROUNDS_MENU", NULL));
MenuLoad(MenuFind("backgrounds", NULL));
Mode.backgrounds.force_scan = 0;
menu_scan_recursive = 0;
}
@ -422,6 +422,24 @@ MenuCreateFromFlatFile(const char *name, Menu * parent, MenuStyle * ms,
return m;
}
static Menu *
MenuCreateFromBackgrounds(const char *name, MenuStyle * ms)
{
Menu *m;
char s[FILEPATH_LEN_MAX];
Esnprintf(s, sizeof(s), "%s/backgrounds", EDirUser());
m = MenuCreateFromDirectory(name, NULL, ms, s);
if (!m)
return NULL;
MenuSetTitle(m, _("Backgrounds"));
MenuSetInternal(m);
return m;
}
static int
MenuLoadFromThemes(Menu * m)
{
@ -702,6 +720,10 @@ MenusCreateInternal(const char *type, const char *name, const char *style,
SoundPlay(SOUND_SCANNING);
m = MenuCreateFromDirectory(name, NULL, ms, prm);
}
else if (!strcmp(type, "backgrounds"))
{
m = MenuCreateFromBackgrounds(name, ms);
}
else if (!strcmp(type, "borders"))
{
m = MenuCreateFromBorders(name, ms);

View File

@ -2045,10 +2045,6 @@ MenusSighan(int sig, void *prm __UNUSED__)
switch (sig)
{
case ESIGNAL_CONFIGURE:
ConfigFileLoad("menus.cfg", NULL, MenuConfigLoad, 1);
break;
case ESIGNAL_START:
TIMER_ADD(menu_unload_timer, 1. * MENU_UNLOAD_CHECK_INTERVAL,
MenusTimeout, NULL);
@ -2199,7 +2195,6 @@ MenusIpc(const char *params)
else if (!strncmp(cmd, "reload", 2))
{
MenusDestroyLoaded();
ConfigFileLoad("menus.cfg", NULL, MenuConfigLoad, 1);
}
else if (!strncmp(cmd, "show", 2))
{
@ -2221,7 +2216,7 @@ static const IpcItem MenusIpcArray[] = {
"menus", "mnu",
"Menu functions",
" menus list Show existing menus\n"
" menus reload Reload menus.cfg without restarting\n"
" menus reload Force menu refresh\n"
" menus show <name> Show named menu\n"}
,
};