2010-05-14 15:06:06 -07:00
|
|
|
#include "e_mod_main.h"
|
2010-04-10 14:38:36 -07:00
|
|
|
|
|
|
|
static Evry_Action *act;
|
|
|
|
static Ecore_X_Window clipboard_win = 0;
|
|
|
|
|
|
|
|
static int
|
|
|
|
_action(Evry_Action *act)
|
|
|
|
{
|
2010-04-28 05:58:24 -07:00
|
|
|
const Evry_Item *it = act->it1.item;
|
2010-04-23 17:54:12 -07:00
|
|
|
|
2010-04-10 14:38:36 -07:00
|
|
|
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 int
|
|
|
|
_check_item(Evry_Action *act __UNUSED__, const Evry_Item *it)
|
|
|
|
{
|
|
|
|
return (it && it->label && (strlen(it->label) > 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
Eina_Bool
|
|
|
|
evry_plug_clipboard_init(void)
|
|
|
|
{
|
|
|
|
if (!evry_api_version_check(EVRY_API_VERSION))
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
Ecore_X_Window win = ecore_x_window_new(0, 0, 0, 1, 1);
|
|
|
|
if (!win) return EINA_FALSE;
|
|
|
|
|
2010-09-08 16:59:07 -07:00
|
|
|
//FIXME: Icon name doesn't follow FDO Spec
|
2010-04-28 09:39:50 -07:00
|
|
|
act = EVRY_ACTION_NEW(N_("Copy to Clipboard"),
|
|
|
|
EVRY_TYPE_TEXT, 0,
|
|
|
|
"everything-clipboard",
|
|
|
|
_action, _check_item);
|
2010-05-16 15:04:34 -07:00
|
|
|
act->remember_context = EINA_TRUE;
|
2010-04-10 14:38:36 -07:00
|
|
|
evry_action_register(act, 10);
|
|
|
|
|
|
|
|
clipboard_win = win;
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
evry_plug_clipboard_shutdown(void)
|
|
|
|
{
|
|
|
|
ecore_x_window_free(clipboard_win);
|
|
|
|
evry_action_free(act);
|
|
|
|
}
|