Evry_Action.: reorganized and allow to check for subtype
authorHannes Janetzek <hannes.janetzek@gmail.com>
Wed, 28 Apr 2010 12:58:24 +0000 (12:58 +0000)
committerHannes Janetzek <hannes.janetzek@gmail.com>
Wed, 28 Apr 2010 12:58:24 +0000 (12:58 +0000)
- remove trigger from config when length is 0

SVN revision: 48389

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

index 7586178..8305280 100644 (file)
@@ -230,14 +230,7 @@ _finish(Evry_Plugin *plugin)
 static int
 _exec_open_file_action(Evry_Action *act)
 {
-   printf("exec\n");
-
-   printf("exec %p %p\n", act, act->item1);
-
-   printf("exec %s\n", EVRY_ITEM(act)->label);
-   printf("exec %s\n", act->item1->label);
-   
-   return evry_util_exec_app(EVRY_ITEM(act), act->item1);
+   return evry_util_exec_app(EVRY_ITEM(act), act->it1.item);
 }
 
 static Evas_Object *
@@ -770,13 +763,13 @@ _exec_app_check_item(Evry_Action *act, const Evry_Item *it)
 static int
 _exec_app_action(Evry_Action *act)
 {
-   return evry_util_exec_app(act->item1, act->item2);
+   return evry_util_exec_app(act->it1.item, act->it2.item);
 }
 
 static int
 _exec_term_action(Evry_Action *act)
 {
-   GET_APP(app, act->item1);
+   GET_APP(app, act->it1.item);
    Evry_Item_App *tmp;
    char buf[1024];
    int ret;
@@ -812,7 +805,7 @@ _exec_term_check_item(Evry_Action *act __UNUSED__, const Evry_Item *it)
 static int
 _exec_sudo_action(Evry_Action *act)
 {
-   GET_APP(app, act->item1);
+   GET_APP(app, act->it1.item);
    Evry_Item_App *tmp;
    char buf[1024];
    int ret;
@@ -847,7 +840,7 @@ static int
 _edit_app_action(Evry_Action *act)
 {
    Efreet_Desktop *desktop;
-   GET_APP(app, act->item1);
+   GET_APP(app, act->it1.item);
 
    if (app->desktop)
      desktop = app->desktop;
@@ -891,7 +884,7 @@ _new_app_action(Evry_Action *act)
    Efreet_Desktop *desktop;
    int i;
 
-   GET_APP(app, act->item1);
+   GET_APP(app, act->it1.item);
 
    if (app->desktop)
      name = strdup(app->desktop->name);
index 78fd637..da5f327 100644 (file)
@@ -859,9 +859,9 @@ _open_folder_action(Evry_Action *act)
 
    m = e_manager_list();
 
-   GET_FILE(file, act->item1);
+   GET_FILE(file, act->it1.item);
 
-   if (!act->item1->browseable)
+   if (!act->it1.item->browseable)
      {
        path = ecore_file_dir_get(file->path);
        if (!path) return 0;
@@ -879,13 +879,13 @@ _open_folder_action(Evry_Action *act)
 static int
 _open_term_action(Evry_Action *act)
 {
-   GET_FILE(file, act->item1);
+   GET_FILE(file, act->it1.item);
    Evry_Item_App *tmp;
    char cwd[4096];
    char *dir;
    int ret = 0;
 
-   if (act->item1->browseable)
+   if (act->it1.item->browseable)
      dir = strdup(file->path);
    else
      dir = ecore_file_dir_get(file->path);
@@ -919,7 +919,7 @@ _file_trash_action(Evry_Action *act)
    char buf[PATH_MAX];
    int force = (EVRY_ITEM_DATA_INT_GET(act) == ACT_DELETE);
 
-   GET_FILE(file, act->item1);
+   GET_FILE(file, act->it1.item);
 
    if (!file->url)
      {
@@ -948,8 +948,8 @@ _file_trash_action(Evry_Action *act)
 static int
 _file_copy_action(Evry_Action *act)
 {
-   GET_FILE(file, act->item1);
-   GET_FILE(dst, act->item2);
+   GET_FILE(file, act->it1.item);
+   GET_FILE(dst, act->it2.item);
 
    char *path;
    char buf[PATH_MAX];
@@ -962,7 +962,7 @@ _file_copy_action(Evry_Action *act)
 
    if (!path) return 0;
 
-   snprintf(buf, sizeof(buf), "%s/%s", path, act->item1->label);
+   snprintf(buf, sizeof(buf), "%s/%s", path, act->it1.item->label);
    free(path);
 
    if (EVRY_ITEM_DATA_INT_GET(act) == ACT_COPY)
index 25aa45c..b050c6e 100644 (file)
@@ -91,7 +91,7 @@ _action(Evry_Action *act)
    char buf[1024];
    int found = 0;
 
-   eci = act->item1->data;
+   eci = act->it1.item->data;
    con = e_container_current_get(e_manager_current_get());
 
    EINA_LIST_FOREACH(e_configure_registry, l, ecat)
index d48bb01..98a8b55 100644 (file)
@@ -36,10 +36,10 @@ static Evry_Action *_act;
 static int
 _action(Evry_Action *act)
 {
-   if (!evry_item_type_check(act->item1, "FILE", NULL))
+   if (!evry_item_type_check(act->it1.item, "FILE", NULL))
      return 0;
 
-   GET_FILE(file, act->item1);
+   GET_FILE(file, act->it1.item);
 
    if (import)
      {
index beddfb4..bd3e683 100644 (file)
@@ -286,7 +286,7 @@ _act_border(Evry_Action *act)
 {
    int action = EVRY_ITEM_DATA_INT_GET(act);
 
-   E_Border *bd = act->item1->data;
+   E_Border *bd = act->it1.item->data;
    E_Zone *zone = e_util_zone_current_get(e_manager_current_get());
 
    int focus = 0;
index 05b3dc8..35e779a 100644 (file)
@@ -168,11 +168,19 @@ struct _Evry_Action
   /* identifier */
   const char *name;
 
-  const char *type_in1;
-  const char *type_in2;
-
-  const Evry_Item *item1;
-  const Evry_Item *item2;
+  struct 
+  {
+    const Evry_Item *item;
+    const char *type;
+    const char *subtype;
+  } it1;
+
+  struct 
+  {
+    const Evry_Item *item;
+    const char *type;
+    const char *subtype;
+  } it2;
 
   int  (*action)     (Evry_Action *act);
   int  (*check_item) (Evry_Action *act, const Evry_Item *it);
index 832be9f..bf82351 100644 (file)
@@ -112,8 +112,6 @@ EAPI int
 e_modapi_shutdown(E_Module *m __UNUSED__)
 {
    E_Config_Dialog *cfd;
-   printf("________________________________________________\n");
-
    evry_shutdown();
 
    view_thumb_shutdown();
@@ -148,7 +146,6 @@ e_modapi_shutdown(E_Module *m __UNUSED__)
    E_CONFIG_DD_FREE(plugin_conf_edd);
    E_CONFIG_DD_FREE(plugin_setting_edd);
    e_datastore_del("everything_loaded");
-   printf("________________________________________________\n");
    return 1;
 }
 
@@ -500,6 +497,11 @@ evry_plugin_register(Evry_Plugin *p, int type, int priority)
          }
        conf[type] = eina_list_append(conf[type], pc);
      }
+   if (pc->trigger && strlen(pc->trigger) == 0)
+     {
+       eina_stringshare_del(pc->trigger);
+       pc->trigger = NULL;
+     }
 
    p->config = pc;
    pc->plugin = p;
@@ -531,10 +533,10 @@ evry_plugin_unregister(Evry_Plugin *p)
 
    if (l && eina_list_data_find_list(l, p->config))
      {
-       /* char buf[256];
-        * snprintf(buf, sizeof(buf), _("Show %s Plugin"), p->name);
-        * 
-        * e_action_predef_name_del(_("Everything"), buf); */
+       char buf[256];
+       snprintf(buf, sizeof(buf), _("Show %s Plugin"), p->name);
+       
+       e_action_predef_name_del(_("Everything"), buf);
      }
 }
 
index 634dc70..479411d 100644 (file)
@@ -1203,8 +1203,6 @@ _evry_state_pop(Evry_Selector *sel)
    EINA_LIST_FREE(s->plugins, p)
      p->finish(p);
 
-   /* sel->aggregator->finish(sel->aggregator); */
-
    if (s->sel_items)
      eina_list_free(s->sel_items);
 
index c7c54ea..5b3b5d9 100644 (file)
@@ -167,8 +167,8 @@ _basic_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
          {
             if (pc->trigger)
               eina_stringshare_del(pc->trigger);
-
-            if (cfdata->page[i].trigger[i])
+            
+            if (cfdata->page[i].trigger[0])
               pc->trigger = eina_stringshare_add(cfdata->page[i].trigger);
             else
               pc->trigger = NULL;
index 69030c7..d0cb4cb 100644 (file)
@@ -65,8 +65,8 @@ _begin(Evry_Plugin *plugin, const Evry_Item *it)
 
    EINA_LIST_FOREACH(evry_conf->actions, l, act)
      {
-       if ((!act->type_in1) ||
-           ((act->type_in1 == type) &&
+       if ((!act->it1.type) ||
+           ((act->it1.type == type) &&
             (!act->check_item || act->check_item(act, it))))
          {
             act->base.plugin = plugin;
@@ -193,8 +193,8 @@ _action_free_cb(Evry_Item *it)
    GET_ACTION(act, it);
 
    if (act->name)     eina_stringshare_del(act->name);
-   if (act->type_in1) eina_stringshare_del(act->type_in1);
-   if (act->type_in2) eina_stringshare_del(act->type_in2);
+   if (act->it1.type) eina_stringshare_del(act->it1.type);
+   if (act->it2.type) eina_stringshare_del(act->it2.type);
 
    E_FREE(act);
 }
@@ -214,8 +214,8 @@ evry_action_new(const char *name, const char *label,
 
    act->name = eina_stringshare_add(name);
 
-   act->type_in1 = (type_in1 ? eina_stringshare_add(type_in1) : NULL);
-   act->type_in2 = (type_in2 ? eina_stringshare_add(type_in2) : NULL);
+   act->it1.type = (type_in1 ? eina_stringshare_add(type_in1) : NULL);
+   act->it2.type = (type_in2 ? eina_stringshare_add(type_in2) : NULL);
 
    act->action = action;
    act->check_item = check_item;
index efed943..ebe8805 100644 (file)
@@ -7,7 +7,7 @@ static Ecore_X_Window clipboard_win = 0;
 static int
 _action(Evry_Action *act)
 {
-   const Evry_Item *it = act->item1;
+   const Evry_Item *it = act->it1.item;
 
    ecore_x_selection_primary_set(clipboard_win, it->label, strlen(it->label));
    ecore_x_selection_clipboard_set(clipboard_win, it->label, strlen(it->label));