]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkclipboard-quartz.c
Some GtkAboutDialog doc additions
[~andy/gtk] / gtk / gtkclipboard-quartz.c
index 2868747826b683bf7b867936e7ed084371c7c43e..ee7766e799b789ea268f07384c8df67a2fcc09de 100644 (file)
@@ -31,8 +31,9 @@
 #include "gtkmarshalers.h"
 #include "gtkintl.h"
 #include "gtktextbuffer.h"
+#include "gtkselectionprivate.h"
 #include "gtkquartz.h"
-#include "gtkalias.h"
+
 
 enum {
   OWNER_CHANGE,
@@ -109,9 +110,10 @@ struct _GtkClipboardClass
       clipboard->get_func (clipboard, &selection_data,
                            info,
                            clipboard->user_data);
-      _gtk_quartz_set_selection_data_for_pasteboard (clipboard->pasteboard,
-                                                     &selection_data);
+
+      if (selection_data.length >= 0)
+        _gtk_quartz_set_selection_data_for_pasteboard (clipboard->pasteboard,
+                                                       &selection_data);
 
       g_free (selection_data.data);
     }
@@ -252,7 +254,7 @@ gtk_clipboard_get_for_display (GdkDisplay *display,
                               GdkAtom     selection)
 {
   g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
-  g_return_val_if_fail (!display->closed, NULL);
+  g_return_val_if_fail (!gdk_display_is_closed (display), NULL);
 
   return clipboard_peek (display, selection, FALSE);
 }
@@ -328,15 +330,13 @@ gtk_clipboard_set_contents (GtkClipboard         *clipboard,
                            gboolean              have_owner)
 {
   GtkClipboardOwner *owner;
-  NSArray *types;
+  NSSet *types;
   NSAutoreleasePool *pool;
 
   pool = [[NSAutoreleasePool alloc] init];
 
   owner = [[GtkClipboardOwner alloc] initWithClipboard:clipboard];
 
-  types = _gtk_quartz_target_entries_to_pasteboard_types (targets, n_targets);
-
   if (!(clipboard->have_owner && have_owner) ||
       clipboard->user_data != user_data)
     {
@@ -351,10 +351,14 @@ gtk_clipboard_set_contents (GtkClipboard         *clipboard,
               clipboard->user_data != user_data)
             {
               (*clear_func) (clipboard, user_data);
+              [pool release];
               return FALSE;
             }
           else
-            return TRUE;
+            {
+              [pool release];
+              return TRUE;
+            }
         }
     }
 
@@ -369,8 +373,10 @@ gtk_clipboard_set_contents (GtkClipboard         *clipboard,
     gtk_target_list_unref (clipboard->target_list);
   clipboard->target_list = gtk_target_list_new (targets, n_targets);
 
-  [clipboard->pasteboard declareTypes:types owner:owner];
+  types = _gtk_quartz_target_entries_to_pasteboard_types (targets, n_targets);
 
+  [clipboard->pasteboard declareTypes:[types allObjects] owner:owner];
+  [types release];
   [pool release];
 
   return TRUE;
@@ -1007,6 +1013,3 @@ _gtk_clipboard_store_all (void)
 {
   /* FIXME: Implement */
 }
-
-#define __GTK_CLIPBOARD_C__
-#include "gtkaliasdef.c"