]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkclipboard.c
Replace a lot of idle and timeout calls by the new gdk_threads api.
[~andy/gtk] / gtk / gtkclipboard.c
index 3e501294e71f8c8e9a6c3b06132c152a198efe7e..a2f0fcb765d40d07d37712cc26661b37c422b60d 100644 (file)
@@ -149,23 +149,13 @@ static GQuark request_contents_key_id = 0;
 static const gchar clipboards_owned_key[] = "gtk-clipboards-owned";
 static GQuark clipboards_owned_key_id = 0;
 
-static GObjectClass *parent_class;
 static guint         clipboard_signals[LAST_SIGNAL] = { 0 };
 
-GType
-gtk_clipboard_get_type (void)
+G_DEFINE_TYPE (GtkClipboard, gtk_clipboard, G_TYPE_OBJECT)
+
+static void
+gtk_clipboard_init (GtkClipboard *object)
 {
-  static GType clipboard_type = 0;
-  
-  if (!clipboard_type)
-    clipboard_type = g_type_register_static_simple (G_TYPE_OBJECT, 
-                                                   I_("GtkClipboard"),
-                                                   sizeof (GtkClipboardClass),
-                                                   (GClassInitFunc)gtk_clipboard_class_init,
-                                                   sizeof (GtkClipboard),
-                                                   NULL, 0);
-  
-  return clipboard_type;
 }
 
 static void
@@ -173,8 +163,6 @@ gtk_clipboard_class_init (GtkClipboardClass *class)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (class);
 
-  parent_class = g_type_class_peek_parent (class);
-  
   gobject_class->finalize = gtk_clipboard_finalize;
 
   class->owner_change = gtk_clipboard_owner_change;
@@ -226,7 +214,7 @@ gtk_clipboard_finalize (GObject *object)
   
   g_free (clipboard->storable_targets);
 
-  G_OBJECT_CLASS (parent_class)->finalize (object);
+  G_OBJECT_CLASS (gtk_clipboard_parent_class)->finalize (object);
 }
 
 static void
@@ -1349,6 +1337,7 @@ clipboard_rich_text_received_func (GtkClipboard *clipboard,
  * gtk_clipboard_wait_for_rich_text:
  * @clipboard: a #GtkClipboard
  * @buffer: a #GtkTextBuffer
+ * @format: return location for the format of the returned data
  * @length: return location for the length of the returned data
  *
  * Requests the contents of the clipboard as rich text.  This function
@@ -1873,6 +1862,8 @@ gtk_clipboard_store (GtkClipboard *clipboard)
   if (!gdk_display_supports_clipboard_persistence (clipboard->display))
     return;
 
+  g_object_ref (clipboard);
+
   clipboard_widget = get_clipboard_widget (clipboard->display);
   clipboard->notify_signal_id = g_signal_connect (clipboard_widget, "selection_notify_event",
                                                  G_CALLBACK (gtk_clipboard_selection_notify), clipboard);
@@ -1904,6 +1895,8 @@ gtk_clipboard_store (GtkClipboard *clipboard)
   clipboard->notify_signal_id = 0;
   
   clipboard->storing_selection = FALSE;
+
+  g_object_unref (clipboard);
 }
 
 /* Stores all clipboard selections on all displays, called from