]> Pileus Git - ~andy/gtk/commitdiff
Avoid unnecessary use of gdk conversion routines
authorMatthias Clasen <mclasen@redhat.com>
Fri, 17 Dec 2010 02:45:57 +0000 (21:45 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 21 Dec 2010 17:07:03 +0000 (12:07 -0500)
We can use use gtk_selection_data_get_uris, instead of
manually doing the conversion ourselves.

gtk/gtkquartz.c

index e8945591a4b85104eed90e662b52f019c6ef62b9..5b440e4b416ec274114010c4b99b03874a696e98 100644 (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