Avoid unnecessary use of gdk conversion routines

We can use use gtk_selection_data_get_uris, instead of
manually doing the conversion ourselves.
This commit is contained in:
Matthias Clasen
2010-12-16 21:45:57 -05:00
parent 05497c799a
commit 61104d58ea

View File

@ -290,30 +290,17 @@ _gtk_quartz_set_selection_data_for_pasteboard (NSPasteboard *pasteboard,
}
else if ([type isEqualTo:NSURLPboardType])
{
gchar **list = NULL;
int count;
gchar **uris;
count = gdk_text_property_to_utf8_list_for_display (display,
gdk_atom_intern_static_string ("UTF8_STRING"),
format,
data,
length,
&list);
if (count > 0)
uris = gtk_selection_data_get_uris (selection_data);
if (uris != NULL)
{
gchar **result;
NSURL *url;
result = g_uri_list_extract_uris (list[0]);
url = [NSURL URLWithString:[NSString stringWithUTF8String:result[0]]];
url = [NSURL URLWithString:[NSString stringWithUTF8String:uris[0]]];
[url writeToPasteboard:pasteboard];
g_strfreev (result);
}
g_strfreev (list);
g_strfreev (uris);
}
else
[pasteboard setData:[NSData dataWithBytesNoCopy:(void *)data