make clipboard action remember context.
authorHannes Janetzek <hannes.janetzek@gmail.com>
Sun, 16 May 2010 22:04:34 +0000 (22:04 +0000)
committerHannes Janetzek <hannes.janetzek@gmail.com>
Sun, 16 May 2010 22:04:34 +0000 (22:04 +0000)
cleanups & tweaks

SVN revision: 48927

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/evry.c
src/modules/everything/evry_plug_clipboard.c

index e4c25e8..4e13bc3 100644 (file)
@@ -258,7 +258,7 @@ _icon_get(Evry_Item *it, Evas *e)
    Evas_Object *o = NULL;
 
    if (app->desktop)
-     o = e_util_desktop_icon_add(app->desktop, 64, e);
+     o = e_util_desktop_icon_add(app->desktop, 128, e);
 
    if (!o)
      o = evry->icon_theme_get("system-run", e);
index 4ff238a..a88b945 100644 (file)
@@ -7,21 +7,12 @@
 #include "evry_api.h"
 #include <ctype.h>
 
-static const char TRIGGER[] = "s ";
-static const char LANG_MODIFIER[] = "lang=";
+#define CMD_ASPELL   1
+#define CMD_HUNSPELL 2
 
 typedef struct _Plugin Plugin;
 typedef struct _Module_Config Module_Config;
 
-static const Evry_API *evry = NULL;
-static Evry_Module *evry_module = NULL;
-static Module_Config *_conf;
-static char _config_path[] =  "extensions/everthing-aspell";
-static char _config_domain[] = "module.everyhing-aspell";
-static char _module_icon[] = "accessories-dictionary";
-
-static E_Config_DD *_conf_edd = NULL;
-
 struct _Plugin
 {
   Evry_Plugin base;
@@ -48,15 +39,23 @@ struct _Module_Config
   E_Module *module;
 };
 
-static Plugin *_plug = NULL;
-
 static char *commands[] =
   {
     "aspell -a --encoding=UTF-8 %s %s",
     "hunspell -a -i utf-8 %s %s"
   };
-#define CMD_ASPELL   1
-#define CMD_HUNSPELL 2
+
+static const Evry_API *evry = NULL;
+static Evry_Module *evry_module = NULL;
+static Module_Config *_conf;
+static Evry_Plugin *_plug = NULL;
+static char _config_path[] =  "extensions/everthing-aspell";
+static char _config_domain[] = "module.everyhing-aspell";
+static char _module_icon[] = "accessories-dictionary";
+static E_Config_DD *_conf_edd = NULL;
+
+static const char TRIGGER[] = "s ";
+static const char LANG_MODIFIER[] = "lang=";
 
 static Eina_Bool
 _exe_restart(Plugin *p)
@@ -378,8 +377,6 @@ _cleanup(Evry_Plugin *plugin)
 static int
 _plugins_init(const Evry_API *_api)
 {
-   Evry_Plugin *p;
-
    if (evry_module->active)
      return EINA_TRUE;
 
@@ -388,27 +385,25 @@ _plugins_init(const Evry_API *_api)
    if (!evry->api_version_check(EVRY_API_VERSION))
      return EINA_FALSE;
 
-   p = EVRY_PLUGIN_NEW(Plugin, N_("Spell Checker"),
+   _plug = EVRY_PLUGIN_NEW(Plugin, N_("Spell Checker"),
                       _module_icon,
                       EVRY_TYPE_TEXT,
                       NULL, _cleanup, _fetch, NULL);
-   p->config_path = _config_path;
-   p->history     = EINA_FALSE;
-   p->async_fetch = EINA_TRUE;
+   _plug->config_path = _config_path;
+   _plug->history     = EINA_FALSE;
+   _plug->async_fetch = EINA_TRUE;
 
-   if (evry->plugin_register(p, EVRY_PLUGIN_SUBJECT, 100))
+   if (evry->plugin_register(_plug, EVRY_PLUGIN_SUBJECT, 100))
      {
-       Plugin_Config *pc = p->config;
+       Plugin_Config *pc = _plug->config;
        pc->view_mode = VIEW_MODE_LIST;
-       pc->aggregate = EINA_FALSE;
+       pc->aggregate = EINA_TRUE;
        pc->top_level = EINA_FALSE;
        pc->trigger = eina_stringshare_add(TRIGGER);
-       pc->trigger_only = EINA_TRUE;
-       pc->min_query = 2;
+       /* pc->trigger_only = EINA_TRUE; */
+       pc->min_query = 4;
      }
 
-   _plug = (Plugin *) p;
-
    return EINA_TRUE;
 }
 
@@ -492,7 +487,6 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
    e_widget_disabled_set(ow, 1);
    e_widget_framelist_object_append(of, ow);
 
-
    ow = e_widget_label_add(evas, _("Language"));
    e_widget_framelist_object_append(of, ow);
    ow = e_widget_entry_add(evas, &cfdata->lang, NULL, NULL, NULL);
index a6c18b0..e1170a0 100644 (file)
@@ -115,6 +115,9 @@ _cb_action_performed(void *data, int type, void *event)
    if (!ev->it1 || !(ev->it1->plugin == p))
      return 1;
 
+   if (!p->items)
+     return 1;
+   
    /* remove duplicates */
    if (p->items->next)
      {
@@ -123,14 +126,11 @@ _cb_action_performed(void *data, int type, void *event)
        EINA_LIST_FOREACH(p->items->next, l, it2)
          {
             if (!strcmp(it->label, it2->label))
-              break;
-            it2 = NULL;
-         }
-
-       if (it2)
-         {
-            p->items = eina_list_remove(p->items, it2);
-            EVRY_ITEM_FREE(it2);
+              {
+                 p->items = eina_list_promote_list(p->items, l);
+                 EVRY_PLUGIN_UPDATE(p, EVRY_UPDATE_ADD);
+                 return 1;
+              }
          }
      }
 
index 28fe058..c203343 100644 (file)
@@ -1644,7 +1644,8 @@ _evry_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *event)
        if (!s->cur_item)
          goto end;
 
-       int delete = (!strcmp(ev->key, "Delete") && (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT));
+       int delete = (!strcmp(ev->key, "Delete") &&
+                     (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT));
        int promote = (!strcmp(ev->key, "Insert"));
 
        _evry_cheat_history(s, promote, delete);
index 5ad691a..abaec77 100644 (file)
@@ -34,7 +34,7 @@ evry_plug_clipboard_init(void)
                         EVRY_TYPE_TEXT, 0,
                         "everything-clipboard",
                         _action, _check_item);
-
+   act->remember_context = EINA_TRUE;
    evry_action_register(act, 10);
 
    clipboard_win = win;