Enlightenment CVS committal

Author  : rephorm
Project : e17
Module  : libs/efreet

Dir     : e17/libs/efreet/src/bin


Modified Files:
        ef_desktop.c 


Log Message:

allow custom types to register a parse function

===================================================================
RCS file: /cvs/e/e17/libs/efreet/src/bin/ef_desktop.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- ef_desktop.c        5 Feb 2007 02:06:05 -0000       1.2
+++ ef_desktop.c        5 Feb 2007 20:23:31 -0000       1.3
@@ -344,14 +344,24 @@
   free(exec);
 }
 
+static void *
+cb_type_parse(Efreet_Desktop *desktop, Efreet_Ini *ini)
+{
+    const char *val;
+    val = efreet_ini_string_get(ini, "X-Test");
+    if (!val) return NULL;
+    return (void *)strdup(val);
+}
+
 int
 ef_cb_desktop_type_parse(void)
 {
     Efreet_Desktop *desktop;
     int ret = 1, my_type;
+    char *val;
 
     /* add my custom desktop type to efreet */
-    my_type = efreet_desktop_type_add("My_Type"); 
+    my_type = efreet_desktop_type_add("My_Type", cb_type_parse, 
(Efreet_Desktop_Type_Free_Cb)free); 
     if (my_type <= EFREET_DESKTOP_TYPE_MAX)
     {
         printf("Error adding desktop type.");
@@ -371,6 +381,13 @@
         return 0;
     }
 
+    val = (char *)efreet_desktop_type_data_get(desktop);
+    if (!val || strcmp(val, "Own key"))
+    {
+        printf("Invalid value of custom key (%s).\n", val);
+        return 0;
+    }
+    
     return 1;
 }
 



-------------------------------------------------------------------------
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
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to