Enlightenment CVS committal

Author  : handyande
Project : misc
Module  : engage

Dir     : misc/engage/src


Modified Files:
        Makefile.am config.c e.h e_apps.c e_apps.h e_file.c e_file.h 
        e_object.c e_object.h e_path.h icon.c userconfig.c wm.c 
Added Files:
        e_path.c e_user.c e_user.h 


Log Message:
Move engage to use e17 .eapp format for icons
those not using e17 will need to rebuild your icons
~/.e/apps/engage/mappings => ~/.e/e/applications/all
~/.e/apps/engage/launcher dir should now only contain a .order file referencing 
.eapp s in the e17 all directory
fix a few bugs too
===================================================================
RCS file: /cvsroot/enlightenment/misc/engage/src/Makefile.am,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- Makefile.am 14 Oct 2004 22:38:59 -0000      1.11
+++ Makefile.am 2 Jan 2005 22:54:53 -0000       1.12
@@ -24,6 +24,7 @@
 userconfig.c \
 e_object.c \
 e_file.c \
+e_user.c \
 e_apps.c
 
 if XINERAMA
===================================================================
RCS file: /cvsroot/enlightenment/misc/engage/src/config.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -3 -r1.49 -r1.50
--- config.c    29 Nov 2004 22:16:12 -0000      1.49
+++ config.c    2 Jan 2005 22:54:53 -0000       1.50
@@ -336,13 +336,13 @@
       int len;
       char *full;
       if (icon->launcher) {
-        len = strlen(menu_text_launcher) + strlen(icon->winclass) - 1;
+        len = strlen(menu_text_launcher) + strlen(icon->name) - 1;
        full = malloc(len);
-        snprintf(full, len, menu_text_launcher, icon->winclass);
+        snprintf(full, len, menu_text_launcher, icon->name);
       } else {
-        len = strlen(menu_text_not_launcher) + strlen(icon->winclass) - 1;
+        len = strlen(menu_text_not_launcher) + strlen(icon->name) - 1;
        full = malloc(len);
-        snprintf(full, len, menu_text_not_launcher, icon->winclass);
+        snprintf(full, len, menu_text_not_launcher, icon->name);
       }
       printf("context menu on %s\n", icon->name);
 //      ewl_menu_item_text_set(EWL_MENU_ITEM(menu_app_name), full);
===================================================================
RCS file: /cvsroot/enlightenment/misc/engage/src/e.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- e.h 7 Oct 2004 10:39:45 -0000       1.1
+++ e.h 2 Jan 2005 22:54:53 -0000       1.2
@@ -18,16 +18,34 @@
 #include <Ecore_Con.h>
 #include <Ecore_Ipc.h>
 #include <Ecore_Job.h>
+#include <Ecore_Txt.h>
 #include <Ecore_Config.h>
 #include <Eet.h>
 #include <Edje.h>
 
 #include "config.h"
 
+#ifdef EAPI
+#undef EAPI
+#endif
+#ifdef WIN32
+# ifdef BUILDING_DLL
+#  define EAPI __declspec(dllexport)
+# else
+#  define EAPI __declspec(dllimport)
+# endif
+#else
+# ifdef GCC_HASCLASSVISIBILITY
+#  define EAPI __attribute__ ((visibility("default")))
+# else
+#  define EAPI
+# endif
+#endif
+
 #include "e_object.h"
 #include "e_file.h"
-/*#include "e_user.h"
-#include "e_manager.h"*/
+#include "e_user.h"
+/*#include "e_manager.h"*/
 #include "e_path.h"
 /*#include "e_ipc.h"
 #include "e_error.h"
@@ -43,13 +61,27 @@
 #include "e_int_menus.h"
 #include "e_module.h"*/
 #include "e_apps.h"
-/*#include "e_utils.h"*/
-
-extern E_Path *path_data;
-extern E_Path *path_images;
-extern E_Path *path_fonts;
-extern E_Path *path_themes;
-extern E_Path *path_init;
+/*#include "e_atoms.h"
+#include "e_utils.h"
+#include "e_canvas.h"
+#include "e_focus.h"
+#include "e_place.h"
+#include "e_resist.h"
+#include "e_startup.h"
+#include "e_iconify.h"*/
+
+typedef struct _E_Before_Idler E_Before_Idler;
+
+EAPI E_Before_Idler *e_main_idler_before_add(int (*func) (void *data), void 
*data, int once);
+EAPI void            e_main_idler_before_del(E_Before_Idler *eb);
+
+extern EAPI E_Path *path_data;
+extern EAPI E_Path *path_images;
+extern EAPI E_Path *path_fonts;
+extern EAPI E_Path *path_themes;
+extern EAPI E_Path *path_icons;
+extern EAPI E_Path *path_init;
+extern EAPI int     restart;
 
 /* convenience macro to compress code and avoid typos */
 #define E_FN_DEL(_fn, _h) \
@@ -59,6 +91,27 @@
    _h = NULL; \
 }
 
+#define E_INTERSECTS(x, y, w, h, xx, yy, ww, hh) \
+(((x) < ((xx) + (ww))) && \
+((y) < ((yy) + (hh))) && \
+(((x) + (w)) > (xx)) && \
+(((y) + (h)) > (yy)))
+
+#define E_SPANS_COMMON(x1, w1, x2, w2) \
+(!((((x2) + (w2)) <= (x1)) || ((x2) >= ((x1) + (w1)))))
+
+#define E_REALLOC(p, s, n) \
+       p = realloc(p, sizeof(s) * n)
+
+#define E_NEW(s, n) \
+       calloc(n, sizeof(s))
+
+#define E_NEW_BIG(s, n) \
+       malloc(n * sizeof(s))
+
+#define E_FREE(p) \
+       { if (p) {free(p); p = NULL;} }
+
 typedef struct _E_Rect E_Rect;
 
 struct _E_Rect
===================================================================
RCS file: /cvsroot/enlightenment/misc/engage/src/e_apps.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- e_apps.c    7 Oct 2004 10:39:45 -0000       1.1
+++ e_apps.c    2 Jan 2005 22:54:53 -0000       1.2
@@ -2,6 +2,7 @@
 
 /* TODO List:
  * 
+ * * if a application .eapp file is added in a different location in a 
monitored app tree but has the same filename as an existing one somewhere else, 
the existing one gets a changed callback, not an dded callback for the new one
  * * track app execution state, visibility state etc. and call callbacks
  * * calls to execute an app or query its runing/starting state etc.
  */
@@ -36,23 +37,44 @@
 
 /* local subsystem globals */
 static Evas_Hash   *_e_apps = NULL;
+static Evas_List   *_e_apps_list = NULL;
 static Ecore_Timer *_e_apps_checker = NULL;
 static int          _e_apps_callbacks_walking = 0;
 static int          _e_apps_callbacks_delete_me = 0;
 static Evas_List   *_e_apps_change_callbacks = NULL;
 static Ecore_Event_Handler *_e_apps_exit_handler = NULL;
+static Evas_List   *_e_apps_repositories = NULL;
+static E_App       *_e_apps_all = NULL;
 
 /* externally accessible functions */
 int
 e_app_init(void)
 {
+   char *home;
+   char buf[4096];
+   
+   home = e_user_homedir_get();
+   snprintf(buf, sizeof(buf), "%s/.e/e/applications/all", home);
+   free(home);
+   _e_apps_repositories = evas_list_append(_e_apps_repositories, strdup(buf));
    _e_apps_exit_handler = ecore_event_handler_add(ECORE_EVENT_EXE_EXIT, 
_e_apps_cb_exit, NULL);
+   _e_apps_all = e_app_new(buf, 1);
    return 1;
 }
 
 int
 e_app_shutdown(void)
 {
+   if (_e_apps_all)
+     {
+       e_object_unref(E_OBJECT(_e_apps_all));
+       _e_apps_all = NULL;
+     }
+   while (_e_apps_repositories)
+     {
+       free(_e_apps_repositories->data);
+       _e_apps_repositories = evas_list_remove_list(_e_apps_repositories, 
_e_apps_repositories);
+     }
    if (_e_apps_exit_handler)
      {
        ecore_event_handler_del(_e_apps_exit_handler);
@@ -65,7 +87,7 @@
 e_app_new(char *path, int scan_subdirs)
 {
    E_App *a;
-   
+
    a = evas_hash_find(_e_apps, path);
    if (a)
      {
@@ -79,7 +101,7 @@
        char buf[4096];
        
        a->path = strdup(path);
-       snprintf(buf, sizeof(buf), "%s/.directory.eet", path);
+       snprintf(buf, sizeof(buf), "%s/.directory.eapp", path);
        a->directory_mod_time = e_file_mod_time(buf);
        if (e_file_exists(buf))
          _e_app_fields_fill(a, buf);
@@ -91,7 +113,7 @@
      {
        char *p;
        
-       /* check if file ends in .eet */
+       /* check if file ends in .eapp */
        p = strrchr(path, '.');
        if (!p)
          {
@@ -99,7 +121,7 @@
             return NULL;
          }
        p++;
-       if (strcasecmp(p, "eet"))
+       if ((strcasecmp(p, "eapp")))
          {
             free(a);
             return NULL;
@@ -118,6 +140,8 @@
             if (a->comment) free(a->comment);
             if (a->exe) free(a->exe);
             if (a->path) free(a->path);
+            if (a->win_name) free(a->win_name);
+            if (a->win_class) free(a->win_class);
             free(a);
             return NULL;
          }
@@ -128,6 +152,7 @@
        return NULL;
      }
    _e_apps = evas_hash_add(_e_apps, a->path, a);
+   _e_apps_list = evas_list_prepend(_e_apps_list, a);
    _e_app_monitor();
    return a;
 }
@@ -135,8 +160,7 @@
 void
 e_app_subdir_scan(E_App *a, int scan_subdirs)
 {
-   Evas_List *files, *files2 = NULL;
-   FILE *f;
+   Evas_List *files;
    char buf[4096];
 
    E_OBJECT_CHECK(a);
@@ -158,16 +182,26 @@
        char *s;
        
        s = files->data;
+       a2 = NULL;
        if (s[0] != '.')
          {
+            Evas_List *pl;
+                       
             snprintf(buf, sizeof(buf), "%s/%s", a->path, s);
-            free(s);
-            a2 = e_app_new(buf, scan_subdirs);
+            if (e_file_exists(buf)) a2 = e_app_new(buf, scan_subdirs);
+            pl = _e_apps_repositories;
+            while ((!a2) && (pl))
+              {
+                 snprintf(buf, sizeof(buf), "%s/%s", (char *)pl->data, s);
+                 a2 = e_app_new(buf, scan_subdirs);
+                 pl = pl->next;
+              }
             if (a2)
               {
                  a->subapps = evas_list_append(a->subapps, a2);
                  a2->parent = a;
               }
+            free(s);
          }
        files = evas_list_remove_list(files, files);
      }
@@ -243,6 +277,38 @@
      }
 }
 
+E_App *
+e_app_window_name_class_find(char *name, char *class)
+{
+   Evas_List *l;
+   
+   for (l = _e_apps_list; l; l = l->next)
+     {
+       E_App *a;
+       
+       a = l->data;
+       if ((a->win_name) || (a->win_class))
+         {
+            int ok = 0;
+            
+//          printf("%s.%s == %s.%s\n", name, class, a->win_name, a->win_class);
+            if ((!a->win_name) ||
+                ((a->win_name) && (!strcmp(a->win_name, name))))
+              ok++;
+            if ((!a->win_class) ||
+                ((a->win_class) && (!strcmp(a->win_class, class))))
+              ok++;
+            if (ok >= 2)
+              {
+                 _e_apps_list = evas_list_remove_list(_e_apps_list, l);
+                 _e_apps_list = evas_list_prepend(_e_apps_list, a);
+                 return a;
+              }
+         }
+     }
+   return NULL;
+}
+
 /* local subsystem functions */
 static void
 _e_app_free(E_App *a)
@@ -260,17 +326,21 @@
        E_App *a2;
        
        a2 = a->subapps->data;
-       e_object_unref(E_OBJECT(a2));
        a->subapps = evas_list_remove(a->subapps, a2);
+       a2->parent = NULL;
+       e_object_unref(E_OBJECT(a2));
      }
    if (a->parent)
      a->parent->subapps = evas_list_remove(a->parent->subapps, a);
    _e_apps = evas_hash_del(_e_apps, a->path, a);
+   _e_apps_list = evas_list_remove(_e_apps_list, a);
    if (a->name) free(a->name);
    if (a->generic) free(a->generic);
    if (a->comment) free(a->comment);
    if (a->exe) free(a->exe);
    if (a->path) free(a->path);
+   if (a->win_name) free(a->win_name);
+   if (a->win_class) free(a->win_class);
    free(a);
    _e_app_monitor();
 }
@@ -278,45 +348,114 @@
 static void
 _e_app_fields_fill(E_App *a, char *path)
 {
+   Eet_File *ef;
    char buf[4096];
-   char *str;
+   char *str, *v;
    char *lang;
+   int size;
    
    /* get our current language */
    lang = getenv("LANG");
    /* if its "C" its the default - so drop it */
    if ((lang) && (!strcmp(lang, "C")))
      lang = NULL;
-   /* get fields (language local preferred) */
+   ef = eet_open(a->path, EET_FILE_MODE_READ);
+   if (!ef) return;
+
    if (lang)
      {
-       snprintf(buf, sizeof(buf), "app/name[%s]", lang);
-       a->name = edje_file_data_get(path, buf);
+       snprintf(buf, sizeof(buf), "app/info/name[%s]", lang);
+       v = eet_read(ef, buf, &size);
+       if (!v) v = eet_read(ef, "app/info/name", &size);
      }
-   if (!a->name) a->name = edje_file_data_get(path, "app/name");
+   else
+     v = eet_read(ef, "app/info/name", &size);
+
+   if (v)
+     {
+       str = malloc(size + 1);
+       memcpy(str, v, size);
+       str[size] = 0;
+       a->name = str;
+       free(v);
+     }
+
    if (lang)
      {
-       snprintf(buf, sizeof(buf), "app/generic[%s]", lang);
-       a->generic = edje_file_data_get(path, buf);
+       snprintf(buf, sizeof(buf), "app/info/generic[%s]", lang);
+       v = eet_read(ef, buf, &size);
+       if (!v) v = eet_read(ef, "app/info/generic", &size);
      }
-   if (!a->generic) a->generic = edje_file_data_get(path, "app/generic");
+   else
+     v = eet_read(ef, "app/info/generic", &size);
+
+   if (v)
+     {
+       str = malloc(size + 1);
+       memcpy(str, v, size);
+       str[size] = 0;
+       a->generic = str;
+       free(v);
+     }
+
    if (lang)
      {
-       snprintf(buf, sizeof(buf), "app/comment[%s]", lang);
-       a->comment = edje_file_data_get(path, buf);
+       snprintf(buf, sizeof(buf), "app/info/comment[%s]", lang);
+       v = eet_read(ef, buf, &size);
+       if (!v) v = eet_read(ef, "app/info/comment", &size);
      }
-   if (!a->comment) a->comment = edje_file_data_get(path, "app/comment");
-   
-   a->exe = edje_file_data_get(path, "app/exe");
-   a->winclass = edje_file_data_get(path, "app/window/class");
-   a->winname = edje_file_data_get(path, "app/window/name");
-   
-   str = edje_file_data_get(path, "app/startup_notify");       
-   if (str)
+   else
+     v = eet_read(ef, "app/info/comment", &size);
+
+   if (v)
+     {
+       str = malloc(size + 1);
+       memcpy(str, v, size);
+       str[size] = 0;
+       a->comment = str;
+       free(v);
+     }
+
+   v = eet_read(ef, "app/info/exe", &size);
+   if (v)
+     {
+       str = malloc(size + 1);
+       memcpy(str, v, size);
+       str[size] = 0;
+       a->exe = str;
+       free(v);
+     }
+   v = eet_read(ef, "app/window/name", &size);
+   if (v)
      {
-       a->startup_notify = atoi(str);
-       free(str);
+       str = malloc(size + 1);
+       memcpy(str, v, size);
+       str[size] = 0;
+       a->win_name = str;
+       free(v);
      }
+   v = eet_read(ef, "app/window/class", &size);
+   if (v)
+     {
+       str = malloc(size + 1);
+       memcpy(str, v, size);
+       str[size] = 0;
+       a->win_class = str;
+       free(v);
+     }
+   v = eet_read(ef, "app/info/startup_notify", &size);
+   if (v)
+     {
+       a->startup_notify = *v;
+       free(v);
+     }
+   v = eet_read(ef, "app/info/wait_exit", &size);
+   if (v)
+     {
+       a->wait_exit = *v;
+       free(v);
+     }
+   eet_close(ef);
 }
 
 static void
@@ -342,6 +481,16 @@
        free(a->exe);
        a->exe = NULL;
      }
+   if (a->win_name)
+     {
+       free(a->win_name);
+       a->win_name = NULL;
+     }
+   if (a->win_class)
+     {
+       free(a->win_class);
+       a->win_class = NULL;
+     }
 }
 
 static Evas_List *
@@ -364,21 +513,24 @@
             len = strlen(buf);
             if (len > 0)
               {
-                 int ok = 0;
-                 
-                 if (buf[len - 1] == '\n') buf[len - 1] = 0;
-                 for (l = files; l; l = l->next)
+                 if (buf[len - 1] == '\n')
+                   {
+                      buf[len - 1] = 0;
+                      len--;
+                   }
+                 if (len > 0)
                    {
-                      if (!strcmp(buf, l->data))
+                      for (l = files; l; l = l->next)
                         {
-                           free(l->data);
-                           files = evas_list_remove_list(files, l);
-                           ok = 1;
-                           break;
+                           if (!strcmp(buf, l->data))
+                             {
+                                free(l->data);
+                                files = evas_list_remove_list(files, l);
+                                break;
+                             }
                         }
+                      files2 = evas_list_append(files2, strdup(buf));
                    }
-                 if (ok)
-                   files2 = evas_list_append(files2, strdup(buf));
               }
          }
        fclose(f);
@@ -484,7 +636,6 @@
    while (changes)
      {
        E_App_Change_Info *ch;
-       Evas_List *l;
        
        ch = changes->data;
        changes = evas_list_remove_list(changes, changes);
@@ -552,7 +703,7 @@
        mod_time = e_file_mod_time(a->path);
        snprintf(buf, sizeof(buf), "%s/.order", a->path);
        order_mod_time = e_file_mod_time(buf);
-       snprintf(buf, sizeof(buf), "%s/.directory.eet", a->path);
+       snprintf(buf, sizeof(buf), "%s/.directory.eapp", a->path);
        directory_mod_time = e_file_mod_time(buf);
        if ((mod_time != a->mod_time) ||
            (order_mod_time != a->order_mod_time) ||
@@ -579,7 +730,7 @@
                    }
                  if (directory_mod_time != a->directory_mod_time)
                    {
-                      snprintf(buf, sizeof(buf), "%s/.directory.eet", a->path);
+                      snprintf(buf, sizeof(buf), "%s/.directory.eapp", 
a->path);
                       _e_app_fields_empty(a);
                       _e_app_fields_fill(a, buf);
                       ch = calloc(1, sizeof(E_App_Change_Info));
===================================================================
RCS file: /cvsroot/enlightenment/misc/engage/src/e_apps.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- e_apps.h    7 Oct 2004 10:39:45 -0000       1.1
+++ e_apps.h    2 Jan 2005 22:54:53 -0000       1.2
@@ -25,8 +25,9 @@
    char          *comment; /* a longer description */
    char          *exe; /* command to execute, NULL if directory */
    char          *path; /* path to .eet containing icons etc. etc. */
-   char          *winclass; /* window class for mappings */
-   char          *winname; /* window name for mappings */
+
+   char          *win_name; /* window name */
+   char          *win_class; /* window class */
    
    Evas_List     *subapps; /* if this a directory, a list of more E_App's */
    
@@ -37,20 +38,24 @@
    Evas_List     *instances; /* a list of all the exe handles for executions */
    
    unsigned char  startup_notify : 1; /* disable while starting etc. */
+   unsigned char  wait_exit : 1; /* wait for app to exit before execing next */
    unsigned char  starting : 1; /* this app is starting */
 
    unsigned char  scanned : 1; /* have we scanned a subdir app yet */
 };
 
-int    e_app_init(void);
-int    e_app_shutdown(void);
+EAPI int    e_app_init(void);
+EAPI int    e_app_shutdown(void);
 
-E_App *e_app_new(char *path, int scan_subdirs);
-void   e_app_subdir_scan(E_App *a, int scan_subdirs);
-int    e_app_exec(E_App *a);
-int    e_app_starting_get(E_App *a);
-int    e_app_running_get(E_App *a);
+EAPI E_App *e_app_new(char *path, int scan_subdirs);
+EAPI void   e_app_subdir_scan(E_App *a, int scan_subdirs);
+EAPI int    e_app_exec(E_App *a);
+EAPI int    e_app_starting_get(E_App *a);
+EAPI int    e_app_running_get(E_App *a);
     
-void   e_app_change_callback_add(void (*func) (void *data, E_App *a, 
E_App_Change ch), void *data);
-void   e_app_change_callback_del(void (*func) (void *data, E_App *a, 
E_App_Change ch), void *data);
+EAPI void   e_app_change_callback_add(void (*func) (void *data, E_App *a, 
E_App_Change ch), void *data);
+EAPI void   e_app_change_callback_del(void (*func) (void *data, E_App *a, 
E_App_Change ch), void *data);
+
+EAPI E_App *e_app_window_name_class_find(char *name, char *class);
+
 #endif
===================================================================
RCS file: /cvsroot/enlightenment/misc/engage/src/e_file.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- e_file.c    7 Oct 2004 10:39:45 -0000       1.1
+++ e_file.c    2 Jan 2005 22:54:53 -0000       1.2
@@ -90,7 +90,6 @@
 e_file_realpath(char *file)
 {
    char  buf[PATH_MAX];
-   char *f;
    struct stat st;
 
    if (!realpath(file, buf) || stat(buf, &st)) return strdup("");
@@ -112,7 +111,6 @@
 e_file_get_dir(char *file)
 {
    char               *p;
-   char               *f;
    char                buf[PATH_MAX];
 
    strncpy(buf, file, PATH_MAX);
@@ -157,7 +155,6 @@
 e_file_readlink(char *link)
 {
    char                buf[PATH_MAX];
-   char               *f;
    int                 count;
 
    if ((count = readlink(link, buf, sizeof(buf))) < 0) return NULL;
===================================================================
RCS file: /cvsroot/enlightenment/misc/engage/src/e_file.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- e_file.h    7 Oct 2004 10:39:45 -0000       1.1
+++ e_file.h    2 Jan 2005 22:54:53 -0000       1.2
@@ -5,18 +5,18 @@
 #include <sys/stat.h>
 #include <Evas.h>
 
-time_t     e_file_mod_time(char *file);
-int        e_file_exists(char *file);
-int        e_file_is_dir(char *file);
-int        e_file_mkdir(char *dir);
-int        e_file_mkpath(char *path);
-int        e_file_cp(char *src, char *dst);
-char      *e_file_realpath(char *file);
-char      *e_file_get_file(char *path);
-char      *e_file_get_dir(char *path);
+EAPI time_t     e_file_mod_time(char *file);
+EAPI int        e_file_exists(char *file);
+EAPI int        e_file_is_dir(char *file);
+EAPI int        e_file_mkdir(char *dir);
+EAPI int        e_file_mkpath(char *path);
+EAPI int        e_file_cp(char *src, char *dst);
+EAPI char      *e_file_realpath(char *file);
+EAPI char      *e_file_get_file(char *path);
+EAPI char      *e_file_get_dir(char *path);
 
-int        e_file_can_exec(struct stat *st);
-char      *e_file_readlink(char *link);
-Evas_List *e_file_ls(char *dir);
+EAPI int        e_file_can_exec(struct stat *st);
+EAPI char      *e_file_readlink(char *link);
+EAPI Evas_List *e_file_ls(char *dir);
 
 #endif
===================================================================
RCS file: /cvsroot/enlightenment/misc/engage/src/e_object.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- e_object.c  7 Oct 2004 10:39:45 -0000       1.1
+++ e_object.c  2 Jan 2005 22:54:53 -0000       1.2
@@ -1,5 +1,16 @@
 #include "e.h"
 
+/* TODO List:
+ * 
+ * * fix a lot of parts of e17's code to use e_object_del NOT e_object_unref.
+ *   there is a subtle difference. unref means u had a reference and you stop
+ *   referencing the object - thats ALL. if you created it and now literally
+ *   want to destroy it - del is the way to go. there is a separate handler for
+ *   this so on del it can go and clean up objects that may reference this one
+ *   etc.
+ * 
+ */
+
 /* yes - i know. glibc specific... but i like being able to do my own */
 /* backtraces! NB: you need CFLAGS="-rdynamic -g" LDFLAGS="-rdynamic -g" */
 #ifdef OBJECT_PARANOIA_CHECK
@@ -22,7 +33,7 @@
    E_Object *obj;
    
    obj = calloc(1, size);
-   if (!obj) return;
+   if (!obj) return NULL;
    obj->magic = E_OBJECT_MAGIC;
    obj->references   = 1;
    obj->cleanup_func = cleanup_func;
@@ -66,14 +77,19 @@
 {
    E_OBJECT_CHECK(obj);
    obj->references++;
+   return obj->references;
 }
 
 int
 e_object_unref(E_Object *obj)
 {
+   int ref;
+   
    E_OBJECT_CHECK(obj);
    obj->references--;
+   ref = obj->references;
    if (obj->references <= 0) e_object_free(obj);
+   return ref;
 }
 
 int
===================================================================
RCS file: /cvsroot/enlightenment/misc/engage/src/e_object.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- e_object.h  7 Oct 2004 10:39:45 -0000       1.1
+++ e_object.h  2 Jan 2005 22:54:53 -0000       1.2
@@ -55,17 +55,17 @@
    unsigned char           deleted : 1;
 };
 
-void *e_object_alloc               (int size, E_Object_Cleanup_Func 
cleanup_func);
-void  e_object_del                 (E_Object *obj);
-int   e_object_del_get             (E_Object *obj);
-void  e_object_del_func_set        (E_Object *obj, E_Object_Cleanup_Func 
del_func);
-void  e_object_free                (E_Object *obj);
-int   e_object_ref                 (E_Object *obj);
-int   e_object_unref               (E_Object *obj);
-int   e_object_ref_get             (E_Object *obj);
-int   e_object_error               (E_Object *obj);
-void  e_object_data_set            (E_Object *obj, void *data);
-void *e_object_data_get            (E_Object *obj);
-void  e_object_free_attach_func_set(E_Object *obj, void (*func) (void *obj));
+EAPI void *e_object_alloc               (int size, E_Object_Cleanup_Func 
cleanup_func);
+EAPI void  e_object_del                 (E_Object *obj);
+EAPI int   e_object_del_get             (E_Object *obj);
+EAPI void  e_object_del_func_set        (E_Object *obj, E_Object_Cleanup_Func 
del_func);
+EAPI void  e_object_free                (E_Object *obj);
+EAPI int   e_object_ref                 (E_Object *obj);
+EAPI int   e_object_unref               (E_Object *obj);
+EAPI int   e_object_ref_get             (E_Object *obj);
+EAPI int   e_object_error               (E_Object *obj);
+EAPI void  e_object_data_set            (E_Object *obj, void *data);
+EAPI void *e_object_data_get            (E_Object *obj);
+EAPI void  e_object_free_attach_func_set(E_Object *obj, void (*func) (void 
*obj));
 
 #endif
===================================================================
RCS file: /cvsroot/enlightenment/misc/engage/src/e_path.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- e_path.h    7 Oct 2004 10:39:45 -0000       1.1
+++ e_path.h    2 Jan 2005 22:54:53 -0000       1.2
@@ -12,11 +12,11 @@
    Evas_List *dir_list;
 };
 
-E_Path     *e_path_new(void);
-void        e_path_path_append(E_Path *ep, const char *path);
-void        e_path_path_prepend(E_Path *ep, const char *path);
-void        e_path_path_remove(E_Path *ep, const char *path);
-const char *e_path_find(E_Path *ep, const char *file);
+EAPI E_Path     *e_path_new(void);
+EAPI void        e_path_path_append(E_Path *ep, const char *path);
+EAPI void        e_path_path_prepend(E_Path *ep, const char *path);
+EAPI void        e_path_path_remove(E_Path *ep, const char *path);
+EAPI char        *e_path_find(E_Path *ep, const char *file); /* for conveience 
this doesnt return a malloc'd string. it's a static buffer, so a new call will 
replace this buffer, but thsi means there is no need to free the return */
 
-void        e_path_evas_append(E_Path *ep, Evas *evas);
+EAPI void        e_path_evas_append(E_Path *ep, Evas *evas);
 #endif
===================================================================
RCS file: /cvsroot/enlightenment/misc/engage/src/icon.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -3 -r1.41 -r1.42
--- icon.c      13 Oct 2004 13:52:15 -0000      1.41
+++ icon.c      2 Jan 2005 22:54:53 -0000       1.42
@@ -38,7 +38,8 @@
   ret = od_icon_new(app, name_override, class_override, application_link);
 
   ret->data.applnk.command = strdup(app->exe);
-  ret->data.applnk.winclass = strdup(class_override? class_override : 
app->winclass);
+  if (app->win_class)
+    ret->data.applnk.winclass = strdup(class_override? class_override : 
app->win_class);
   ret->data.applnk.count = 0;
   return ret;
 }
@@ -46,7 +47,8 @@
 OD_Icon        *
 od_icon_new_sysicon(const char *name, const char *icon_name)
 {
-  OD_Icon        *ret = od_icon_new(od_unmatched_app, name, NULL, system_icon);
+  OD_Icon        *ret = od_icon_new(od_unmatched_app, (char *)name, NULL,
+      system_icon);
   ret->icon_file = strdup(icon_name);
   od_icon_reload(ret);
   return ret;
@@ -262,13 +264,14 @@
 od_icon_new(E_App *app, char *name_override, char *class_override, int type)
 {
   OD_Icon        *ret = NULL;
-  assert(app->winclass);
+//  assert(app->win_class);
   assert(app->name);
   assert(app->path);
 
   ret = (OD_Icon *) malloc(sizeof(OD_Icon));
   memset(ret, 0, sizeof(OD_Icon));
-  ret->winclass = strdup(class_override ? class_override : app->winclass);
+  if (app->win_class) 
+    ret->winclass = strdup(class_override ? class_override : app->win_class);
   ret->name = strdup(name_override ? name_override : app->name);
   ret->icon_file = strdup(app->path);
   ret->icon = edje_object_add(evas);
@@ -355,8 +358,10 @@
 #endif
   while (item) {
     app = item->data;
-    if (strcmp(winclass, app->winclass) == 0) {
-      break;
+    if (app->win_class) {
+      if (strcmp(winclass, app->win_class) == 0) {
+        break;
+      }
     }
     item = item->next;
   }
===================================================================
RCS file: /cvsroot/enlightenment/misc/engage/src/userconfig.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- userconfig.c        11 Oct 2004 18:37:21 -0000      1.10
+++ userconfig.c        2 Jan 2005 22:54:53 -0000       1.11
@@ -16,7 +16,7 @@
 {
   Evas_List      *l;
 
-  od_unmatched_app = e_app_new(PACKAGE_DATA_DIR "/icons/xapp.eet", 0);
+  od_unmatched_app = e_app_new(PACKAGE_DATA_DIR "/icons/xapp.eapp", 0);
   if (!od_unmatched_app) {
     printf("ERROR, you must make install\n");
     ecore_main_loop_quit();
@@ -55,7 +55,7 @@
       case E_APP_DEL:
         l = dock.applnks;
         while (l) {
-          if (strcmp(((OD_Icon *) l->data)->winclass, a->winclass) == 0) {
+          if (strcmp(((OD_Icon *) l->data)->winclass, a->win_class) == 0) {
             tmp = l->data;
             break;
           }
@@ -74,7 +74,7 @@
         l = dock.applnks;
         tmp = NULL;
         while (l) {
-          if (strcmp(((OD_Icon *) l->data)->winclass, a->winclass) == 0) {
+          if (strcmp(((OD_Icon *) l->data)->winclass, a->win_class) == 0) {
              tmp = l->data;
              break;
           }
@@ -162,7 +162,7 @@
 {
   char            filename[PATH_MAX];
 
-  snprintf(filename, PATH_MAX, "%s/.e/apps/engage/mapping", getenv("HOME"));
+  snprintf(filename, PATH_MAX, "%s/.e/e/applications/all", getenv("HOME"));
   userconfig_mappings_load(filename);
 
   snprintf(filename, PATH_MAX, "%s/.e/apps/engage/launcher", getenv("HOME"));
===================================================================
RCS file: /cvsroot/enlightenment/misc/engage/src/wm.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- wm.c        13 Oct 2004 13:45:56 -0000      1.20
+++ wm.c        2 Jan 2005 22:54:53 -0000       1.21
@@ -362,7 +362,8 @@
 
       while (item) {
         OD_Icon        *applnk = (OD_Icon *) item->data;
-        if (strcmp(applnk->data.applnk.winclass, winclass) == 0) {
+        if (applnk->data.applnk.winclass &&
+            strcmp(applnk->data.applnk.winclass, winclass) == 0) {
           owd->applnk = applnk;
           break;
         }




-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to