fix bug causing wrong types set in history. and fix old history in cleanup function
authorHannes Janetzek <hannes.janetzek@gmail.com>
Sat, 1 May 2010 15:43:31 +0000 (15:43 +0000)
committerHannes Janetzek <hannes.janetzek@gmail.com>
Sat, 1 May 2010 15:43:31 +0000 (15:43 +0000)
SVN revision: 48507

src/modules/everything-files/e_mod_main.c
src/modules/everything/e_mod_main.c
src/modules/everything/evry_history.c

index e985e59..b9e7af3 100644 (file)
@@ -224,9 +224,10 @@ _scan_func(void *data)
 
        if (!EVRY_ITEM(file)->browseable)
          {
-            if (d->second_run)
-              usleep(2500);
-
+#if _BSD_SOURCE || _XOPEN_SOURCE >= 500
+            /* let main process do its thing while reading mimetypes */
+            usleep(1000);
+#endif
             if ((mime = efreet_mime_type_get(file->path)))
               {
                  file->mime = mime;
@@ -692,6 +693,8 @@ _hist_items_add_cb(const Eina_Hash *hash, const void *key, void *data, void *fda
    if (!hi)
      return EINA_TRUE;
 
+   DBG("add %s %s %s", hi->type, type, (char *) key);
+   
    EINA_LIST_FOREACH(p->files, ll, file)
      if (!strcmp(file->path, key))
        return EINA_TRUE;
index dcf3de9..c6f6d25 100644 (file)
@@ -84,7 +84,7 @@ evry_type_register(const char *type)
 EAPI const char *
 evry_type_get(Evry_Type type)
 {
-   const char *ret = eina_list_nth(_evry_types, type - 1);
+   const char *ret = eina_list_nth(_evry_types, type);
    if (!ret)
      return eina_stringshare_add(""); 
 
index 90d5f6f..a9f7144 100644 (file)
@@ -106,6 +106,40 @@ _hist_cleanup_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata
             hi->last_used = d->time - SEVEN_DAYS/2;
          }
 
+       /* XXX fix history - remove later */
+       if (!hi->type || !strcmp(hi->type, "NONE") || !strcmp(hi->type, ""))
+         {
+            hi->count = 0;
+         }
+       if (hi->count && hi->plugin)
+         {
+            if (!strcmp(hi->plugin, "Files"))
+              {
+                 if (hi->type) eina_stringshare_del(hi->type);
+                 hi->type = eina_stringshare_add("FILE");
+              }
+            else if (!strcmp(hi->plugin, "Tracker"))
+              {
+                 if (hi->type) eina_stringshare_del(hi->type);
+                 hi->type = eina_stringshare_add("FILE");
+              }
+            else if (!strcmp(hi->plugin, "Applications"))
+              {
+                 if (hi->type) eina_stringshare_del(hi->type);
+                 hi->type = eina_stringshare_add("APPLICATION");
+              }
+            else if (!strcmp(hi->plugin, "Open With..."))
+              {
+                 if (hi->type) eina_stringshare_del(hi->type);
+                 hi->type = eina_stringshare_add("APPLICATION");
+              }
+            else if (!strcmp(hi->plugin, "Settings"))
+              {
+                 if (hi->type) eina_stringshare_del(hi->type);
+                 hi->type = eina_stringshare_add("E_SETTINGS");
+              }
+         }
+       
        /* item is transient or too old */
        if (!hi->count || hi->transient)
          {