Esempio n. 1
0
static Evry_Item_App *
_item_new(Plugin *p, const char *label, const char *id)
{
   Evry_Item_App *app;

   app = EVRY_ITEM_NEW(Evry_Item_App, p, label, NULL, evry_item_app_free);
   EVRY_ACTN(app)->action = &_exec_open_file_action;
   EVRY_ACTN(app)->it1.type = EVRY_TYPE_FILE;
   EVRY_ITEM(app)->id = eina_stringshare_add(id);

   eina_hash_add(p->added, id, app);

   EVRY_ACTN(app)->remember_context = EINA_TRUE;
   EVRY_ITEM(app)->subtype = EVRY_TYPE_ACTION;

   return app;
}
Esempio n. 2
0
static Item_Menu *
_item_menu_add(Plugin *p, Efreet_Menu *menu)
{
   Item_Menu *m;

   m = EVRY_ITEM_NEW(Item_Menu, p, NULL, NULL, NULL);
   EVRY_ITEM(m)->type = EVRY_TYPE_NONE;
   EVRY_ITEM(m)->browseable = EINA_TRUE;
   EVRY_ITEM(m)->label = eina_stringshare_add(menu->name);
   EVRY_ITEM(m)->icon = eina_stringshare_add(menu->icon);
   EVRY_ITEM(m)->usage = -1;

   m->menu = menu;
   p->menu_items = eina_list_append(p->menu_items, m);

   return m;
}
Esempio n. 3
0
static Evry_Item_App *
_item_exe_add(Plugin *p, const char *exe, int match)
{
   Evry_Item_App *app = NULL;

   if ((app = eina_hash_find(p->added, exe)))
     {
        if (eina_list_data_find_list(p->base.items, app))
          return app;
     }

   if (!app)
     {
        app = _item_new(p, ecore_file_file_get(exe), exe);
        app->file = eina_stringshare_ref(EVRY_ITEM(app)->id);
     }

   EVRY_ITEM(app)->fuzzy_match = match;
   EVRY_PLUGIN_ITEM_APPEND(p, app);

   return app;
}
Esempio n. 4
0
void
evry_util_file_detail_set(Evry_Item_File *file)
{
   char *dir = NULL;
   const char *tmp;

   if (EVRY_ITEM(file)->detail)
     return;

   if (!home_dir)
     {
        home_dir = e_user_homedir_get();
        home_dir_len = strlen(home_dir);
     }

   dir = ecore_file_dir_get(file->path);
   if (!dir || !home_dir) return;

   if (!strncmp(dir, home_dir, home_dir_len))
     {
        tmp = dir + home_dir_len;

        if (*(tmp) == '\0')
          snprintf(dir_buf, sizeof(dir_buf), "~%s", tmp);
        else
          snprintf(dir_buf, sizeof(dir_buf), "~%s/", tmp);

        EVRY_ITEM(file)->detail = eina_stringshare_add(dir_buf);
     }
   else
     {
        if (!strncmp(dir, "//", 2))
          EVRY_ITEM(file)->detail = eina_stringshare_add(dir + 1);
        else
          EVRY_ITEM(file)->detail = eina_stringshare_add(dir);
     }

   E_FREE(dir);
}
Esempio n. 5
0
static int
_exec_open_file_action(Evry_Action *act)
{
   return evry->util_exec_app(EVRY_ITEM(act), act->it1.item);
}