'everything' use an indicator to show when a trigger is active
authorHannes Janetzek <hannes.janetzek@gmail.com>
Fri, 23 Apr 2010 00:49:29 +0000 (00:49 +0000)
committerHannes Janetzek <hannes.janetzek@gmail.com>
Fri, 23 Apr 2010 00:49:29 +0000 (00:49 +0000)
SVN revision: 48240

src/modules/everything/Evry.h
src/modules/everything/evry.c

index c8c5efa..77637ae 100644 (file)
@@ -250,6 +250,7 @@ struct _Evry_State
   Evry_View *view;
 
   Eina_Bool changed;
+  Eina_Bool trigger_active;
 };
 
 struct _Evry_View
index d3f1507..57e0740 100644 (file)
@@ -1880,30 +1880,53 @@ _evry_matches_update(Evry_Selector *sel, int async)
    Evry_Plugin *p;
    Eina_List *l;
    const char *input;
-   s->changed = 1;
-
-   EINA_LIST_FREE(s->cur_plugins, p);
-
+   s->changed = 1;   
+   
    if (s->inp[0])
      input = s->inp;
    else
      input = NULL;
 
-   if (input)
+   if (!input || !s->trigger_active)
+     { 
+       EINA_LIST_FREE(s->cur_plugins, p);
+       s->trigger_active = EINA_FALSE;
+     }
+   else
      {
+       EINA_LIST_FOREACH(s->cur_plugins, l, p)
+         p->fetch(p, s->input);
+     }
+
+   if (!s->cur_plugins && input)
+     {
+       int len_trigger = 0;
+       
        EINA_LIST_FOREACH(s->plugins, l, p)
          {
             /* input matches plugin trigger? */
             if (!p->trigger) continue;
+            int len = strlen(p->trigger);
+
+            if (len_trigger && len != len_trigger)
+              continue;
 
-            if ((strlen(s->inp) >= strlen(p->trigger)) &&
-                (!strncmp(s->inp, p->trigger, strlen(p->trigger))))
+            if ((strlen(s->inp) >= len) &&
+                (!strncmp(s->inp, p->trigger, len)))
               {
+                len_trigger = len;
                  s->cur_plugins = eina_list_append(s->cur_plugins, p);
-                 s->input = s->inp + strlen(p->trigger);
-                 p->fetch(p, s->input);
+                 p->fetch(p, s->input + len);
               }
          }
+       if (s->cur_plugins)
+         {
+            s->trigger_active = EINA_TRUE;
+            s->inp[0] = '>';
+            s->inp[1] = '\0';
+            s->input = s->inp + 1;
+            _evry_update_text_label(s); 
+         }
      }
    
    if (!s->cur_plugins)