Exemplo n.º 1
0
/**
 * same as snprintf("~/.e/e/"fmt, ...).
 */
EAPI size_t
e_user_dir_snprintf(char *dst, size_t size, const char *fmt, ...)
{
   size_t off, ret;
   va_list ap;

   if (!_e_user_dir)
     e_user_dir_get();
   if (!_e_user_dir)
     return 0;

   va_start(ap, fmt);

   off = _e_user_dir_len + 1;
   if (size < _e_user_dir_len + 2)
     {
	if (size > 1)
	  {
	     memcpy(dst, _e_user_dir, size - 1);
	     dst[size - 1] = '\0';
	  }
	ret = off + vsnprintf(dst + off, size - off, fmt, ap);
	va_end(ap);
	return ret;
     }

   memcpy(dst, _e_user_dir, _e_user_dir_len);
   dst[_e_user_dir_len] = '/';

   ret = off + vsnprintf(dst + off, size - off, fmt, ap);
   va_end(ap);
   return ret;
}
Exemplo n.º 2
0
/**
 * Concatenate '~/.e/e' and @a path.
 *
 * @return similar to snprintf(), this returns the number of bytes written or
 *     that would be required to write if greater or equal than size.
 */
EAPI size_t
e_user_dir_concat_len(char *dst, size_t size, const char *path, size_t path_len)
{
   if (!_e_user_dir)
     e_user_dir_get();

   return eina_str_join_len(dst, size, '/', _e_user_dir, _e_user_dir_len, path, path_len);
}
Exemplo n.º 3
0
void
ngi_launcher_new(Ng *ng, Config_Box *cfg)
{
   char buf[4096];
   Ecore_Event_Handler *h;
   Ngi_Box *box = ngi_box_new(ng);

   box->cfg = cfg;
   cfg->box = box;

   const char *drop[] =
     { "enlightenment/desktop",
       "enlightenment/border",
       "text/uri-list" };

   box->drop_handler = e_drop_handler_add
     (ng->win->drop_win, box,
      _cb_drop_enter, _cb_drop_move,
      _cb_drop_leave, _cb_drop_end,
      drop, 3, 0, 0, 0, 0);

   h = ecore_event_handler_add(E_EVENT_CONFIG_ICON_THEME, _cb_icons_update, box);
   if (h) box->handlers = eina_list_append(box->handlers, h);
   h = ecore_event_handler_add(EFREET_EVENT_ICON_CACHE_UPDATE, _cb_icons_update, box);
   if (h) box->handlers = eina_list_append(box->handlers, h);
   h = ecore_event_handler_add(EFREET_EVENT_DESKTOP_CACHE_UPDATE, _cb_icons_update, box);
   if (h) box->handlers = eina_list_append(box->handlers, h);
  
   if (!cfg->launcher_app_dir || strlen(cfg->launcher_app_dir) == 0)
     return;

   if (cfg->launcher_app_dir[0] != '/')
     {
        snprintf(buf, sizeof(buf), "%s/applications/bar/%s/.order",
                 e_user_dir_get(), cfg->launcher_app_dir);
     }
   else
     snprintf(buf, sizeof(buf), "%s", cfg->launcher_app_dir);

   box->apps = e_order_new(buf);
   e_order_update_callback_set(box->apps, _app_change_cb, box);

   _box_fill(box);
}