Enlightenment CVS committal
Author : onefang
Project : e17
Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore_desktop
Modified Files:
Ecore_Desktop.h ecore_desktop.c ecore_desktop_menu.c
ecore_desktop_paths.c ecore_desktop_xmlame.c
Log Message:
Check the timestamps on .desktop files to see if the cache is still valid.
The entire applicition caching system will be rewritten soon, so
consider this a temporary fix.
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_desktop/Ecore_Desktop.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- Ecore_Desktop.h 31 Aug 2006 12:10:09 -0000 1.17
+++ Ecore_Desktop.h 4 Sep 2006 10:57:42 -0000 1.18
@@ -2,6 +2,8 @@
# define _ECORE_DESKTOP_H
#include <Ecore_Data.h>
+#include <sys/types.h>
+
/**
* @file Ecore_Desktop.h
@@ -56,6 +58,8 @@
char *startup;
char *window_class;
int allocated; /* FIXME: NoDisplay, Hidden */
+ /* Actually calling this st_mtime causes compile issues, must be some
strange macros at work. */
+ time_t mtime; /* For checking if the cache is valid.
*/
};
typedef struct _Ecore_Desktop Ecore_Desktop;
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_desktop/ecore_desktop.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -3 -r1.24 -r1.25
--- ecore_desktop.c 3 Sep 2006 17:22:46 -0000 1.24
+++ ecore_desktop.c 4 Sep 2006 10:57:42 -0000 1.25
@@ -1,13 +1,13 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
-#include <ctype.h>
-#include <sys/types.h>
-#include <sys/stat.h>
#include "Ecore_Desktop.h"
#include "ecore_desktop_private.h"
+#include <ctype.h>
+#include <sys/stat.h>
+
Ecore_List *ecore_desktop_paths_config = NULL;
Ecore_List *ecore_desktop_paths_menus = NULL;
Ecore_List *ecore_desktop_paths_directories = NULL;
@@ -165,8 +165,23 @@
ecore_desktop_get(const char *file, const char *lang)
{
Ecore_Desktop *result;
+ struct stat st;
+ int stated = 0;
result = (Ecore_Desktop *) ecore_hash_get(desktop_cache, (char *) file);
+ /* Check if the cache is still valid. */
+ if (result)
+ {
+ if (stat(result->original_path, &st) >= 0)
+ {
+ if(st.st_mtime > result->mtime)
+ {
+ ecore_hash_remove(desktop_cache, result->original_path);
+ result = NULL;
+ stated = 1;
+ }
+ }
+ }
if (!result)
{
result = calloc(1, sizeof(Ecore_Desktop));
@@ -176,6 +191,12 @@
if (lang)
result->original_lang = strdup(lang);
result->data = ecore_desktop_ini_get(result->original_path);
+ /* Timestamp the cache, and no need to stat the file twice if the
cache was stale. */
+ if ((stated) || (stat(result->original_path, &st) >= 0))
+ {
+ result->mtime = st.st_mtime;
+ stated = 1;
+ }
if (result->data)
{
result->group =
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_desktop/ecore_desktop_menu.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- ecore_desktop_menu.c 3 Sep 2006 11:38:56 -0000 1.12
+++ ecore_desktop_menu.c 4 Sep 2006 10:57:42 -0000 1.13
@@ -6,15 +6,15 @@
* optomize into "ugly but fast".
*
*/
-#include <dirent.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <libgen.h>
#include <Ecore.h>
#include "Ecore_Desktop.h"
#include "ecore_desktop_private.h"
+
+#include <dirent.h>
+#include <sys/stat.h>
+#include <libgen.h>
//#define DEBUG 1
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_desktop/ecore_desktop_paths.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- ecore_desktop_paths.c 2 Sep 2006 04:19:25 -0000 1.17
+++ ecore_desktop_paths.c 4 Sep 2006 10:57:42 -0000 1.18
@@ -6,16 +6,16 @@
* excess directory from the paths.
*/
+#include <Ecore.h>
+
+#include "Ecore_Desktop.h"
+#include "ecore_desktop_private.h"
+
#include <dirent.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <libgen.h>
#include <strings.h>
-#include <Ecore.h>
-
-#include "Ecore_Desktop.h"
-#include "ecore_desktop_private.h"
/* This really slows things down and no doubt drags in some KDE bloat at start
up.
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_desktop/ecore_desktop_xmlame.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- ecore_desktop_xmlame.c 14 Aug 2006 04:41:44 -0000 1.2
+++ ecore_desktop_xmlame.c 4 Sep 2006 10:57:42 -0000 1.3
@@ -1,10 +1,10 @@
+#include "Ecore_Desktop.h"
+#include "ecore_desktop_private.h"
+
#include <fcntl.h>
#include <ctype.h>
-#include <sys/types.h>
#include <sys/stat.h>
-#include "Ecore_Desktop.h"
-#include "ecore_desktop_private.h"
/** xmlame.c Extensively Mocked Language Approximately Mangled for
Enlightenment.
*
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs