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
{
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;
g_free (clipboard->storable_targets);
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (gtk_clipboard_parent_class)->finalize (object);
}
static void
* 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
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);
clipboard->notify_signal_id = 0;
clipboard->storing_selection = FALSE;
+
+ g_object_unref (clipboard);
}
/* Stores all clipboard selections on all displays, called from