Enlightenment CVS committal

Author  : sebastid
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_apps.c 


Log Message:
It should work now.

===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_apps.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -3 -r1.33 -r1.34
--- e_apps.c    19 Apr 2005 15:11:45 -0000      1.33
+++ e_apps.c    20 Apr 2005 07:28:37 -0000      1.34
@@ -107,10 +107,7 @@
    if (a)
      {
        if (a->deleted)
-         {
-            printf("BUG E_App: Deleted flag shouldn't be needed: %s\n", 
a->path);
-            return NULL;
-         }
+         return NULL;
        e_object_ref(E_OBJECT(a));
        return a;
      }
@@ -162,9 +159,16 @@
 e_app_is_parent(E_App *parent, E_App *app)
 {
    Evas_List *l;
+   E_App *current;
+
+   current = app->parent;
 
-   if (app->parent == parent)
-     return 1;
+   while (current)
+     {
+       if (current == parent)
+         return 1;
+       current = current->parent;
+     }
 
 #if 0
    for (l = app->references; l; l = l->next)
@@ -200,48 +204,51 @@
      }
    a->scanned = 1;
    files = _e_app_dir_file_list_get(a);
-   while ((s = ecore_list_next(files)))
+   if (files)
      {
-       E_App *a2;
-
-       a2 = NULL;
-
-       snprintf(buf, sizeof(buf), "%s/%s", a->path, s);
-       if (ecore_file_exists(buf))
+       while ((s = ecore_list_next(files)))
          {
-            a2 = e_app_new(buf, scan_subdirs);
-            if (a2)
-              {
-                 a2->parent = a;
-                 a->subapps = evas_list_append(a->subapps, a2);
-              }
-         }
-       else
-         {
-            E_App *a3;
-            Evas_List *pl;
+            E_App *a2;
 
-            pl = _e_apps_repositories;
-            while ((!a2) && (pl))
+            a2 = NULL;
+
+            snprintf(buf, sizeof(buf), "%s/%s", a->path, s);
+            if (ecore_file_exists(buf))
               {
-                 snprintf(buf, sizeof(buf), "%s/%s", (char *)pl->data, s);
                  a2 = e_app_new(buf, scan_subdirs);
-                 pl = pl->next;
+                 if (a2)
+                   {
+                      a2->parent = a;
+                      a->subapps = evas_list_append(a->subapps, a2);
+                   }
               }
-            if (a2)
+            else
               {
-                 a2->references = evas_list_append(a2->references, a);
-                 a3 = _e_app_copy(a2);
-                 if (a3)
+                 E_App *a3;
+                 Evas_List *pl;
+
+                 pl = _e_apps_repositories;
+                 while ((!a2) && (pl))
                    {
-                      a3->parent = a;
-                      a->subapps = evas_list_append(a->subapps, a3);
+                      snprintf(buf, sizeof(buf), "%s/%s", (char *)pl->data, s);
+                      a2 = e_app_new(buf, scan_subdirs);
+                      pl = pl->next;
+                   }
+                 if (a2)
+                   {
+                      a3 = _e_app_copy(a2);
+                      if (a3)
+                        {
+                           a3->parent = a;
+                           a->subapps = evas_list_append(a->subapps, a3);
+                           a2->references = evas_list_append(a2->references, 
a3);
+                        }
                    }
               }
+            free(s);
          }
-       free(s);
+       ecore_list_destroy(files);
      }
-   ecore_list_destroy(files);
 }
 
 int
@@ -367,7 +374,7 @@
             ecore_exe_free(exe);
             a->instances = evas_list_remove_list(a->instances, a->instances);
          }
-       /* If this is a copy, it shoudln't have any references! */
+       /* If this is a copy, it shouldn't have any references! */
        if (a->references)
          printf("BUG: A eapp copy shouldn't have any references!\n");
        if (a->parent)
@@ -401,7 +408,9 @@
        /* If this is an original, it wont be deleted until all references
         * are gone */
        if (a->references)
-         printf("BUG: An original eapp shouldn't have any references when 
freed!\n");
+         {
+            printf("BUG: An original eapp shouldn't have any references when 
freed! %d\n", evas_list_count(a->references));
+         }
 
        if (a->parent)
          a->parent->subapps = evas_list_remove(a->parent->subapps, a);
@@ -592,16 +601,19 @@
                    }
                  if (len > 0)
                    {
-                      ecore_list_goto_first(files);
-                      while ((file = ecore_list_current(files)))
+                      if (files)
                         {
-                           if (!strcmp(buf, file))
+                           ecore_list_goto_first(files);
+                           while ((file = ecore_list_current(files)))
                              {
-                                ecore_list_remove(files);
-                                free(file);
-                                break;
+                                if (!strcmp(buf, file))
+                                  {
+                                     ecore_list_remove(files);
+                                     free(file);
+                                     break;
+                                  }
+                                ecore_list_next(files);
                              }
-                           ecore_list_next(files);
                         }
                       ecore_list_append(files2, strdup(buf));
                    }
@@ -627,7 +639,8 @@
        ecore_list_destroy(files);
      }
    files = files2;
-   ecore_list_goto_first(files);
+   if (files)
+     ecore_list_goto_first(files);
    return files;
 }
 
@@ -712,7 +725,13 @@
    char      *file;
    
    app = data;
-   printf("Event: %d %s %s\n", event, path, app->path);
+   if ((!app) || (app->deleted))
+     {
+       printf("Event on a deleted eapp\n");
+       return;
+     }
+
+   printf("Event: %d %s\n", event, path);
 
    /* If this dir isn't scanned yet, no need to report changes! */
    if (!app->scanned)
@@ -786,7 +805,8 @@
                       E_App *a2;
 
                       a2 = l->data;
-                      _e_app_subdir_rescan(a2);
+                      if (a2->parent)
+                        _e_app_subdir_rescan(a2->parent);
                    }
                  _e_app_subdir_rescan(app);
               }
@@ -801,10 +821,18 @@
                  E_App *a2;
 
                  a2 = l->data;
-                 _e_app_subdir_rescan(a2);
+                 if (a2->parent)
+                   _e_app_subdir_rescan(a2->parent);
               }
             if (app->parent)
               _e_app_subdir_rescan(app->parent);
+            else
+              {
+                 /* A main e_app has been deleted!
+                  * We don't unref this, the code which holds this
+                  * eapp must do it. */
+                 _e_app_change(app, E_APP_DEL);
+              }
          }
      }
 }
@@ -819,65 +847,68 @@
    char              *s;
 
    files = _e_app_dir_file_list_get(app);
-   while ((s = ecore_list_next(files)))
+   if (files)
      {
-       E_App *a2;
-
-       a2 = _e_app_subapp_file_find(app, s);
-       if (a2)
-         {
-            subapps = evas_list_append(subapps, a2);
-         }
-       else
+       while ((s = ecore_list_next(files)))
          {
-            /* If we still haven't found it, it is new! */
-            snprintf(buf, sizeof(buf), "%s/%s", app->path, s);
-            a2 = e_app_new(buf, 1);
+            E_App *a2;
+
+            a2 = _e_app_subapp_file_find(app, s);
             if (a2)
               {
-                 a2->parent = app;
-                 ch = calloc(1, sizeof(E_App_Change_Info));
-                 ch->app = a2;
-                 ch->change = E_APP_ADD;
-                 e_object_ref(E_OBJECT(ch->app));
-                 changes = evas_list_append(changes, ch);
-
                  subapps = evas_list_append(subapps, a2);
               }
             else
               {
-                 /* We ask for a reference! */
-                 Evas_List *pl;
-                 E_App *a3;
-
-                 pl = _e_apps_repositories;
-                 while ((!a2) && (pl))
+                 /* If we still haven't found it, it is new! */
+                 snprintf(buf, sizeof(buf), "%s/%s", app->path, s);
+                 a2 = e_app_new(buf, 1);
+                 if (a2)
                    {
-                      snprintf(buf, sizeof(buf), "%s/%s", (char *)pl->data, s);
-                      a2 = e_app_new(buf, 1);
-                      pl = pl->next;
+                      a2->parent = app;
+                      ch = calloc(1, sizeof(E_App_Change_Info));
+                      ch->app = a2;
+                      ch->change = E_APP_ADD;
+                      e_object_ref(E_OBJECT(ch->app));
+                      changes = evas_list_append(changes, ch);
+
+                      subapps = evas_list_append(subapps, a2);
                    }
-                 if (a2)
+                 else
                    {
-                      a2->references = evas_list_append(a2->references, app);
-                      a3 = _e_app_copy(a2);
-                      if (a3)
+                      /* We ask for a reference! */
+                      Evas_List *pl;
+                      E_App *a3;
+
+                      pl = _e_apps_repositories;
+                      while ((!a2) && (pl))
+                        {
+                           snprintf(buf, sizeof(buf), "%s/%s", (char 
*)pl->data, s);
+                           a2 = e_app_new(buf, 1);
+                           pl = pl->next;
+                        }
+                      if (a2)
                         {
-                           a3->parent = app;
-                           ch = calloc(1, sizeof(E_App_Change_Info));
-                           ch->app = a3;
-                           ch->change = E_APP_ADD;
-                           e_object_ref(E_OBJECT(ch->app));
-                           changes = evas_list_append(changes, ch);
+                           a3 = _e_app_copy(a2);
+                           if (a3)
+                             {
+                                a3->parent = app;
+                                ch = calloc(1, sizeof(E_App_Change_Info));
+                                ch->app = a3;
+                                ch->change = E_APP_ADD;
+                                e_object_ref(E_OBJECT(ch->app));
+                                changes = evas_list_append(changes, ch);
 
-                           subapps = evas_list_append(subapps, a3);
+                                subapps = evas_list_append(subapps, a3);
+                                a2->references = 
evas_list_append(a2->references, a3);
+                             }
                         }
                    }
               }
+            free(s);
          }
-       free(s);
+       ecore_list_destroy(files);
      }
-   ecore_list_destroy(files);
    for (l = app->subapps; l; l = l->next)
      {
        E_App *a2;
@@ -906,12 +937,14 @@
    /* FIXME: We only need to tell about order changes if there are! */
    evas_list_free(app->subapps);
    app->subapps = subapps;
+#if 0
    for (l = subapps; l; l = l->next)
      {
        E_App *a;
        a = l->data;
        printf("subapps: %s\n", a->path);
      }
+#endif
    ch = calloc(1, sizeof(E_App_Change_Info));
    ch->app = app;
    ch->change = E_APP_ORDER;




-------------------------------------------------------
This SF.Net email is sponsored by: New Crystal Reports XI.
Version 11 adds new functionality designed to reduce time involved in
creating, integrating, and deploying reporting solutions. Free runtime info,
new features, or free trial, at: http://www.businessobjects.com/devxi/728
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to