Remove obsolete ami_selection_to_text

This commit is contained in:
Chris Young 2013-02-22 19:06:13 +00:00
parent 84fca8a29c
commit 5d34d48a4b
3 changed files with 4 additions and 41 deletions

View File

@ -286,35 +286,6 @@ void gui_set_clipboard(const char *buffer, size_t length,
}
}
struct ami_text_selection *ami_selection_to_text(struct gui_window_2 *gwin)
{
struct ami_text_selection *sel;
int len;
char *ss;
sel = AllocVec(sizeof(struct ami_text_selection),
MEMF_PRIVATE | MEMF_CLEAR);
if (sel) {
/* Get selection string */
ss = browser_window_get_selection(gwin->bw);
if (ss == NULL)
return sel;
len = strlen(ss);
if (len > sizeof(sel->text))
len = sizeof(sel->text) - 1;
memcpy(sel->text, ss, len);
sel->length = len;
sel->text[sel->length] = '\0';
free(ss);
}
return sel;
}
void ami_drag_selection(struct gui_window *g)
{
int x;

View File

@ -26,18 +26,11 @@ struct selection;
struct gui_window;
struct gui_window_2;
struct ami_text_selection
{
char text[1024];
int length;
};
void ami_clipboard_init(void);
void ami_clipboard_free(void);
void ami_drag_selection(struct gui_window *g);
bool ami_easy_clipboard(char *text);
bool ami_easy_clipboard_bitmap(struct bitmap *bitmap);
struct ami_text_selection *ami_selection_to_text(struct gui_window_2 *gwin);
#ifdef WITH_NS_SVG
bool ami_easy_clipboard_svg(struct hlcache_handle *c);
#endif

View File

@ -989,13 +989,13 @@ static uint32 ami_context_menu_hook(struct Hook *hook,Object *item,APTR reserved
case CMID_SELSEARCH:
{
struct ami_text_selection *sel;
char *sel;
char *urltxt;
nsurl *url;
if(sel = ami_selection_to_text(gwin))
if(sel = browser_window_get_selection(gwin->bw))
{
urltxt = search_web_from_term(sel->text);
urltxt = search_web_from_term(sel);
if (nsurl_create(urltxt, &url) != NSERROR_OK) {
warn_user("NoMemory", 0);
@ -1010,8 +1010,7 @@ static uint32 ami_context_menu_hook(struct Hook *hook,Object *item,APTR reserved
NULL);
nsurl_unref(url);
}
FreeVec(sel);
free(sel);
}
}
break;