Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        backgrounds.c backgrounds.h menus-misc.c menus.c menus.h 


Log Message:
Don't scan background directory at startup but when needed (menu or config 
dialog).

===================================================================
RCS file: /cvs/e/e16/e/src/backgrounds.c,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -3 -r1.89 -r1.90
--- backgrounds.c       15 Feb 2007 03:30:17 -0000      1.89
+++ backgrounds.c       25 Feb 2007 01:38:30 -0000      1.90
@@ -2092,6 +2092,8 @@
    int                 num;
    char                s[1024];
 
+   ScanBackgroundMenu();
+
    if (!bg)
       bg = DeskBackgroundGet(DesksGetCurrent());
    if (!bg)
===================================================================
RCS file: /cvs/e/e16/e/src/backgrounds.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- backgrounds.h       13 Jan 2007 19:14:26 -0000      1.13
+++ backgrounds.h       25 Feb 2007 01:38:30 -0000      1.14
@@ -57,4 +57,6 @@
 void                BackgroundsInvalidate(int refresh);
 int                 BackgroundsConfigLoad(FILE * fs);
 
+void                ScanBackgroundMenu(void);
+
 #endif /* _BACKGROUNDS_H_ */
===================================================================
RCS file: /cvs/e/e16/e/src/menus-misc.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -3 -r1.40 -r1.41
--- menus-misc.c        17 Jan 2007 01:10:43 -0000      1.40
+++ menus-misc.c        25 Feb 2007 01:38:30 -0000      1.41
@@ -35,6 +35,8 @@
 #include <errno.h>
 #include <sys/stat.h>
 
+static char         menu_scan_recursive = 0;
+
 static Menu        *MenuCreateFromFlatFile(const char *name, Menu * parent,
                                           MenuStyle * ms, const char *file);
 static Menu        *MenuCreateFromDirectory(const char *name, Menu * parent,
@@ -269,13 +271,20 @@
    MenuSetData(m, Estrdup(dir));
    MenuSetLoader(m, MenuLoadFromDirectory);
 
-   /* Hmmm... Make sure background dirs are scanned during startup */
-   if (Mode.wm.startup)
+   if (menu_scan_recursive)
       MenuLoadFromDirectory(m);
 
    calls--;
 
    return m;
+}
+
+void
+ScanBackgroundMenu(void)
+{
+   menu_scan_recursive = 1;
+   MenuLoad(MenuFind("BACKGROUNDS_MENU"));
+   menu_scan_recursive = 0;
 }
 
 static void
===================================================================
RCS file: /cvs/e/e16/e/src/menus.c,v
retrieving revision 1.269
retrieving revision 1.270
diff -u -3 -r1.269 -r1.270
--- menus.c     17 Jan 2007 01:10:43 -0000      1.269
+++ menus.c     25 Feb 2007 01:38:30 -0000      1.270
@@ -257,6 +257,15 @@
 
 static void         MenuShowMasker(Menu * m);
 
+int
+MenuLoad(Menu * m)
+{
+   if (!m || !m->loader)
+      return 0;
+
+   return m->loader(m);
+}
+
 static void
 MenuShow(Menu * m, char noshow)
 {
@@ -269,11 +278,8 @@
    if (m->shown || !m->style)
       return;
 
-   if (m->loader)
-     {
-       if (m->loader(m))
-          MenuRealize(m);
-     }
+   if (MenuLoad(m))
+      MenuRealize(m);
 
    if (m->num <= 0)
       return;
@@ -1042,7 +1048,7 @@
    return 1;
 }
 
-static Menu        *
+Menu               *
 MenuFind(const char *name)
 {
    Menu               *m;
===================================================================
RCS file: /cvs/e/e16/e/src/menus.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- menus.h     13 Jan 2007 19:14:28 -0000      1.9
+++ menus.h     25 Feb 2007 01:38:30 -0000      1.10
@@ -43,6 +43,8 @@
 void                MenuHide(Menu * m);
 void                MenuEmpty(Menu * m, int destroying);
 void                MenuRepack(Menu * m);
+int                 MenuLoad(Menu * m);
+Menu               *MenuFind(const char *name);
 MenuItem           *MenuItemCreate(const char *text, ImageClass * ic,
                                   const char *action_params, Menu * child);
 void                MenuSetInternal(Menu * m);



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to