]> 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 8eceb1dd8b1f4a9fbdb62e372c84cd02d011ea74..a2f0fcb765d40d07d37712cc26661b37c422b60d 100644 (file)
@@ -149,34 +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)
-    {
-      static const GTypeInfo clipboard_info =
-      {
-       sizeof (GtkClipboardClass),
-       NULL,           /* base_init */
-       NULL,           /* base_finalize */
-       (GClassInitFunc) gtk_clipboard_class_init,
-       NULL,           /* class_finalize */
-       NULL,           /* class_data */
-       sizeof (GtkClipboard),
-       0,              /* n_preallocs */
-       (GInstanceInitFunc) NULL,
-      };
-      
-      clipboard_type = g_type_register_static (G_TYPE_OBJECT, I_("GtkClipboard"),
-                                              &clipboard_info, 0);
-    }
-  
-  return clipboard_type;
 }
 
 static void
@@ -184,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;
@@ -237,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
@@ -1360,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
@@ -1884,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);
@@ -1915,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