'everyhing'
authorHannes Janetzek <hannes.janetzek@gmail.com>
Sun, 25 Apr 2010 00:31:11 +0000 (00:31 +0000)
committerHannes Janetzek <hannes.janetzek@gmail.com>
Sun, 25 Apr 2010 00:31:11 +0000 (00:31 +0000)
- when trigger active clear input without clearing the trigger
- nicer macro for EVRY_PLUGIN_NEW

SVN revision: 48294

src/modules/everything-apps/e_mod_main.c
src/modules/everything-aspell/e_mod_main.c
src/modules/everything-calc/e_mod_main.c
src/modules/everything-files/e_mod_main.c
src/modules/everything-settings/e_mod_main.c
src/modules/everything-wallpaper/e_mod_main.c
src/modules/everything-windows/e_mod_main.c
src/modules/everything/Evry.h
src/modules/everything/evry.c
src/modules/everything/evry_plug_aggregator.c
src/modules/everything/evry_plug_text.c

index 13a4e1d..a8a7590 100644 (file)
@@ -963,25 +963,26 @@ _new_app_action(Evry_Action *act)
 static Eina_Bool
 _plugins_init(void)
 {
+   Evry_Plugin *p;
+   
    if (!evry_api_version_check(EVRY_API_VERSION))
      return EINA_FALSE;
 
-   p1 = E_NEW(Plugin, 1);
-   EVRY_PLUGIN_NEW(EVRY_PLUGIN(p1), N_("Applications"), type_subject, "", "APPLICATION",
-             _begin, _cleanup, _fetch, _icon_get, NULL);
-   EVRY_PLUGIN(p1)->complete = &_complete;
-   EVRY_PLUGIN(p1)->config_path = "extensions/everything-apps";
-   
-   p2 = E_NEW(Plugin, 1);
-   EVRY_PLUGIN_NEW(EVRY_PLUGIN(p2), N_("Open With..."), type_action, "FILE", "",
-             _begin_open_with, _cleanup, _fetch,
-             _icon_get, NULL);
-
-   EVRY_PLUGIN(p2)->action = &_open_with_action;
-   EVRY_PLUGIN(p2)->config_path = "extensions/everything-apps";
+   p = EVRY_PLUGIN_NEW(Plugin, N_("Applications"), type_subject, "", "APPLICATION",
+                      _begin, _cleanup, _fetch, _icon_get, NULL);
+   p->complete = &_complete;
+   p->config_path = "extensions/everything-apps";
+   evry_plugin_register(p, 1);
+   p1 = (Plugin *) p;
    
-   evry_plugin_register(EVRY_PLUGIN(p1), 1);
-   evry_plugin_register(EVRY_PLUGIN(p2), 1);
+   p = EVRY_PLUGIN_NEW(Plugin, N_("Open With..."), type_action, "FILE", "",
+                      _begin_open_with, _cleanup, _fetch,
+                      _icon_get, NULL);
+
+   p->action = &_open_with_action;
+   p->config_path = "extensions/everything-apps";
+   evry_plugin_register(p, 1);
+   p2 = (Plugin *) p;
 
    act = EVRY_ACTION_NEW(N_("Launch"), "APPLICATION", NULL,
                    "everything-launch", _exec_app_action, _exec_app_check_item);
index 0c8093b..17cf1e0 100644 (file)
@@ -321,28 +321,53 @@ _cleanup(Evry_Plugin *plugin)
      }
 }
 
+/* static int
+ * _action(Evry_Action *act)
+ * {
+ *    const Evry_Item *it = act->item2;
+ *    if (!it) return 0;
+ *    
+ *    ecore_x_selection_primary_set(clipboard_win, it->label, strlen(it->label));
+ *    ecore_x_selection_clipboard_set(clipboard_win, it->label, strlen(it->label));
+ * 
+ *    return 1;
+ * } */
+
+  
 static Eina_Bool
 _plugins_init(void)
 {
-   Plugin *p;
+   Evry_Plugin *p;
 
    if (!evry_api_version_check(EVRY_API_VERSION))
      return EINA_FALSE;
 
-   p = E_NEW(Plugin, 1);
-
-   EVRY_PLUGIN_NEW(p, N_("Spell Checker"), type_subject, "", "TEXT",
+   p = EVRY_PLUGIN_NEW(Plugin, N_("Spell Checker"), type_subject, "", "TEXT",
                   NULL, _cleanup, _fetch, NULL, NULL);
 
-   EVRY_PLUGIN(p)->aggregate   = EINA_FALSE;
-   EVRY_PLUGIN(p)->history     = EINA_FALSE;
-   EVRY_PLUGIN(p)->async_fetch = EINA_TRUE;
-   EVRY_PLUGIN(p)->icon        = "accessories-dictionary";
-   EVRY_PLUGIN(p)->trigger     = TRIGGER;
+   p->aggregate   = EINA_FALSE;
+   p->history     = EINA_FALSE;
+   p->async_fetch = EINA_TRUE;
+   p->icon        = "accessories-dictionary";
+   p->trigger     = TRIGGER;
    
-   evry_plugin_register(EVRY_PLUGIN(p), 100);
-
-   _plug = p;
+   evry_plugin_register(p, 100);
+   _plug = (Plugin *) p;
+
+   /* TODO show spell check action for given text */
+   /* p = EVRY_PLUGIN_NEW2(Plugin, N_("Spell Checker"), type_object, "", "TEXT",
+    *                  _begin, _cleanup, _fetch, NULL, NULL);
+    * 
+    * p->aggregate   = EINA_FALSE;
+    * p->history     = EINA_FALSE;
+    * p->async_fetch = EINA_TRUE;
+    * p->icon        = "accessories-dictionary";
+    * p->trigger     = TRIGGER;
+    * 
+    * evry_plugin_register(p, 100);
+    * _plug2 = (Plugin *) p;
+    * 
+    * _act = EVRY_ACTION_NEW(N_("Spell Checker"), "TEXT", "ASPELL", _action, NULL); */
 
    return EINA_TRUE;
 }
index 52a7358..1e8b4a2 100644 (file)
@@ -229,7 +229,7 @@ _plugins_init(void)
    if (!evry_api_version_check(EVRY_API_VERSION))
      return EINA_FALSE;
 
-   p1 = EVRY_PLUGIN_NEW(NULL, N_("Calculator"), type_subject, NULL, "TEXT",
+   p1 = EVRY_PLUGIN_NEW(Evry_Plugin, N_("Calculator"), type_subject, NULL, "TEXT",
                        _begin, _cleanup, _fetch, NULL, NULL);
 
    p1->view_mode   = VIEW_MODE_LIST;
index b34325b..450f6b1 100644 (file)
@@ -704,12 +704,12 @@ _plugins_init(void)
    if (!evry_api_version_check(EVRY_API_VERSION))
      return EINA_FALSE;
 
-   p1 = EVRY_PLUGIN_NEW(NULL, N_("Files"), type_subject, "FILE", "FILE",
+   p1 = EVRY_PLUGIN_NEW(Evry_Plugin, N_("Files"), type_subject, "FILE", "FILE",
                        _begin, _cleanup, _fetch, _icon_get, NULL);
    EVRY_PLUGIN(p1)->config_path = "extensions/everything-files";
    evry_plugin_register(p1, 3);
    
-   p2 = EVRY_PLUGIN_NEW(NULL, N_("Files"), type_object, "FILE", "FILE",
+   p2 = EVRY_PLUGIN_NEW(Evry_Plugin, N_("Files"), type_object, "FILE", "FILE",
                        _begin, _cleanup, _fetch, _icon_get, NULL);
    EVRY_PLUGIN(p2)->config_path = "extensions/everything-files";
    evry_plugin_register(p2, 1);
index 7b30f65..b56782c 100644 (file)
@@ -123,7 +123,7 @@ _plugins_init(void)
    if (!evry_api_version_check(EVRY_API_VERSION))
      return EINA_FALSE;
 
-   p = EVRY_PLUGIN_NEW(NULL, N_("Settings"), type_subject, NULL, "E_SETTINGS",
+   p = EVRY_PLUGIN_NEW(Evry_Plugin, N_("Settings"), type_subject, NULL, "E_SETTINGS",
                       NULL, _cleanup, _fetch, _item_icon_get, NULL);
 
    evry_plugin_register(p, 10);
index 26df955..65ea536 100644 (file)
@@ -205,11 +205,11 @@ _plugins_init(void)
    if (!evry_api_version_check(EVRY_API_VERSION))
      return EINA_FALSE;
 
-   _plug = EVRY_PLUGIN_NEW(NULL, N_("Wallpaper"), type_action, "FILE", "",
+   _plug = EVRY_PLUGIN_NEW(Evry_Plugin, N_("Wallpaper"), type_action, "FILE", "",
                            _begin, _cleanup, _fetch, _icon_get, NULL);
    
-   EVRY_PLUGIN(_plug)->icon = "preferences-desktop-wallpaper";
-   EVRY_PLUGIN(_plug)->action = &_action;
+   _plug->icon = "preferences-desktop-wallpaper";
+   _plug->action = &_action;
    
    evry_plugin_register(_plug, 10);
    
index 9d72abd..d539374 100644 (file)
@@ -492,14 +492,13 @@ _plugins_init(void)
    if (!evry_api_version_check(EVRY_API_VERSION))
      return EINA_FALSE;
 
-   p1 = EVRY_PLUGIN_NEW(NULL, N_("Windows"), type_subject, NULL, "BORDER",
-                           _begin, _cleanup, _fetch, _item_icon_get, NULL);
+   p1 = EVRY_PLUGIN_NEW(Evry_Plugin, N_("Windows"), type_subject, NULL, "BORDER",
+                       _begin, _cleanup, _fetch, _item_icon_get, NULL);
    p1->transient = EINA_TRUE;
    evry_plugin_register(p1, 2);
 
-   
-   p2 = EVRY_PLUGIN_NEW(NULL, N_("Window Action"), type_action, "BORDER", NULL,
-                            _act_begin, _act_cleanup, _act_fetch, _act_item_icon_get, NULL);
+   p2 = EVRY_PLUGIN_NEW(Evry_Plugin, N_("Window Action"), type_action, "BORDER", NULL,
+                       _act_begin, _act_cleanup, _act_fetch, _act_item_icon_get, NULL);
    
    EVRY_PLUGIN(p2)->action = &_act_action;
    
index f7bdf78..7fd453c 100644 (file)
@@ -435,8 +435,11 @@ EAPI void evry_history_unload(void);
 EAPI History_Item *evry_history_add(Eina_Hash *hist, Evry_Item *it, const char *ctxt, const char *input);
 EAPI int  evry_history_item_usage_set(Eina_Hash *hist, Evry_Item *it, const char *input, const char *ctxt);
 
+/* #define EVRY_PLUGIN_NEW(_base, _name, _type, _in, _out, _begin, _cleanup, _fetch, _icon_get, _free) \
+ *   evry_plugin_new(EVRY_PLUGIN(_base), _name, _(_name), _type, _in, _out, _begin, _cleanup, _fetch, _icon_get, _free) \ */
+
 #define EVRY_PLUGIN_NEW(_base, _name, _type, _in, _out, _begin, _cleanup, _fetch, _icon_get, _free) \
-  evry_plugin_new(EVRY_PLUGIN(_base), _name, _(_name), _type, _in, _out, _begin, _cleanup, _fetch, _icon_get, _free) \
+  evry_plugin_new(EVRY_PLUGIN(E_NEW(_base, 1)), _name, _(_name), _type, _in, _out, _begin, _cleanup, _fetch, _icon_get, _free) \
 
 EAPI Evry_Plugin *evry_plugin_new(Evry_Plugin *base, const char *name, const char *label, int type,
                                  const char *type_in, const char *type_out,
index 1ed84b1..77bad60 100644 (file)
@@ -1651,19 +1651,19 @@ _evry_clear(Evry_Selector *sel)
 {
    Evry_State *s = sel->state;
 
-   if ((s->plugin && s->plugin->trigger && s->inp) &&
-       (!strncmp(s->plugin->trigger, s->inp,
-                strlen(s->plugin->trigger))))
+   if (s->inp && s->inp[0] != 0)
      {
-       s->input[strlen(s->plugin->trigger)] = 0;
-       _evry_update(sel, 1);
-       return 1;
-     }
-   else if (s->inp && s->inp[0] != 0)
-     {
-       s->inp[0] = 0;
-       s->input = s->inp;
-
+       if (s->trigger_active && s->inp[1] != 0)
+         {
+            s->inp[1] = 0;
+            s->input = s->inp + 1;
+         }
+       else
+         {
+            s->inp[0] = 0;
+            s->input = s->inp;
+         }
+       
        _evry_update(sel, 1);
        if (!list->visible && evry_conf->hide_input)
          edje_object_signal_emit(list->o_main, "e,state,entry_hide", "e");
index 0f3eb55..fe66385 100644 (file)
@@ -295,17 +295,17 @@ _icon_get(Evry_Plugin *plugin, const Evry_Item *it, Evas *e)
 Evry_Plugin *
 evry_plug_aggregator_new(Evry_Selector *sel, int type)
 {
-   Plugin *p;
+   Evry_Plugin *p;
 
-   p = E_NEW(Plugin, 1);
-   EVRY_PLUGIN_NEW(EVRY_PLUGIN(p), N_("All"), type, "", "",
+   p = EVRY_PLUGIN_NEW(Plugin, N_("All"), type, "", "",
                   NULL, _cleanup, _fetch, _icon_get, NULL);
 
-   EVRY_PLUGIN(p)->action = &_action;
-   EVRY_PLUGIN(p)->history = EINA_FALSE;
-
-   evry_plugin_register(EVRY_PLUGIN(p), -1);
-   p->selector = sel;
+   p->action = &_action;
+   p->history = EINA_FALSE;
+   evry_plugin_register(p, -1);
+   
+   PLUGIN(pa, p);
+   pa->selector = sel;
 
-   return EVRY_PLUGIN(p);
+   return p;
 }
index 5194a3c..7db0900 100644 (file)
@@ -41,10 +41,10 @@ _fetch(Evry_Plugin *p, const char *input)
 Eina_Bool
 evry_plug_text_init(void)
 {
-  p1 = EVRY_PLUGIN_NEW(NULL, N_("Text"), type_subject, NULL, "TEXT",
+  p1 = EVRY_PLUGIN_NEW(Evry_Plugin, N_("Text"), type_subject, NULL, "TEXT",
                       NULL, _cleanup, _fetch, NULL, NULL);
 
-  p2 = EVRY_PLUGIN_NEW(NULL, N_("Text"), type_object,  NULL, "TEXT",
+  p2 = EVRY_PLUGIN_NEW(Evry_Plugin, N_("Text"), type_object,  NULL, "TEXT",
                       NULL, _cleanup, _fetch, NULL, NULL);
 
   p1->icon = "accessories-text-editor";