Elm entry: Fixed 'Paste' to only show if there clipboard isn't empty.

SVN revision: 62193
This commit is contained in:
Tom Hacohen 2011-08-08 07:51:02 +00:00
parent cd80368508
commit 6c47d15666
3 changed files with 12 additions and 1 deletions

View File

@ -389,6 +389,16 @@ static Ecore_Event_Handler *handler_status = NULL;
/* Stringshared, so I can just compare pointers later */
static const char *text_uri;
Eina_Bool
elm_selection_selection_has_owner(void)
{
#ifdef HAVE_ELEMENTARY_X
return !!ecore_x_selection_owner_get(clipboard_atom);
#else
return EINA_FALSE;
#endif
}
Eina_Bool
elm_selection_set(Elm_Sel_Type selection, Evas_Object *widget, Elm_Sel_Format format, const char *selbuf)
{

View File

@ -1078,7 +1078,7 @@ _menu_press(Evas_Object *obj)
elm_hoversel_item_add(wd->hoversel, E_("Select"), NULL, ELM_ICON_NONE,
_select, obj);
}
if (1) // need way to detect if someone has a selection
if (elm_selection_selection_has_owner())
{
if (wd->editable)
elm_hoversel_item_add(wd->hoversel, E_("Paste"), NULL, ELM_ICON_NONE,

View File

@ -673,6 +673,7 @@ struct _Elm_Selection_Data
Eina_Bool elm_selection_set(Elm_Sel_Type selection, Evas_Object *widget, Elm_Sel_Format format, const char *buf);
Eina_Bool elm_selection_clear(Elm_Sel_Type selection, Evas_Object *widget);
Eina_Bool elm_selection_get(Elm_Sel_Type selection, Elm_Sel_Format format, Evas_Object *widget, Elm_Drop_Cb datacb, void *udata);
Eina_Bool elm_selection_selection_has_owner(void);
Eina_Bool elm_drop_target_add(Evas_Object *widget, Elm_Sel_Type, Elm_Drop_Cb, void *);
Eina_Bool elm_drop_target_del(Evas_Object *widget);
Eina_Bool elm_drag_start(Evas_Object *, Elm_Sel_Format, const char *, void (*)(void *,Evas_Object*),void*);