summaryrefslogtreecommitdiff
path: root/gtk/gtkclipboard.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2013-08-20 14:44:14 +0200
committerBenjamin Otte <otte@redhat.com>2013-08-20 16:34:29 +0200
commitaee5bcf9e2dabc1eb21280be2c42a1ac9b5ac39d (patch)
treef9134279a998123db733cb999ab838ce97f79b1d /gtk/gtkclipboard.c
parent4009c8241b4edb81e020727afb65822ca95610b9 (diff)
downloadgtk+-aee5bcf9e2dabc1eb21280be2c42a1ac9b5ac39d.tar.gz
clipboard: Make a bunch of functions vfuncs
Diffstat (limited to 'gtk/gtkclipboard.c')
-rw-r--r--gtk/gtkclipboard.c94
1 files changed, 79 insertions, 15 deletions
diff --git a/gtk/gtkclipboard.c b/gtk/gtkclipboard.c
index 6ef8d7dcb2..24073523cf 100644
--- a/gtk/gtkclipboard.c
+++ b/gtk/gtkclipboard.c
@@ -163,6 +163,23 @@ static void gtk_clipboard_class_init (GtkClipboardClass *class);
static void gtk_clipboard_finalize (GObject *object);
static void gtk_clipboard_owner_change (GtkClipboard *clipboard,
GdkEventOwnerChange *event);
+static gboolean gtk_clipboard_set_contents (GtkClipboard *clipboard,
+ const GtkTargetEntry *targets,
+ guint n_targets,
+ GtkClipboardGetFunc get_func,
+ GtkClipboardClearFunc clear_func,
+ gpointer user_data,
+ gboolean have_owner);
+static void gtk_clipboard_real_clear (GtkClipboard *clipboard);
+static void gtk_clipboard_real_request_contents (GtkClipboard *clipboard,
+ GdkAtom target,
+ GtkClipboardReceivedFunc callback,
+ gpointer user_data);
+static void gtk_clipboard_real_set_can_store (GtkClipboard *clipboard,
+ const GtkTargetEntry *targets,
+ gint n_targets);
+static void gtk_clipboard_real_store (GtkClipboard *clipboard);
+
static void clipboard_unset (GtkClipboard *clipboard);
static void selection_received (GtkWidget *widget,
@@ -204,6 +221,11 @@ gtk_clipboard_class_init (GtkClipboardClass *class)
gobject_class->finalize = gtk_clipboard_finalize;
+ class->set_contents = gtk_clipboard_set_contents;
+ class->clear = gtk_clipboard_real_clear;
+ class->request_contents = gtk_clipboard_real_request_contents;
+ class->set_can_store = gtk_clipboard_real_set_can_store;
+ class->store = gtk_clipboard_real_store;
class->owner_change = gtk_clipboard_owner_change;
/**
@@ -629,9 +651,13 @@ gtk_clipboard_set_with_data (GtkClipboard *clipboard,
g_return_val_if_fail (targets != NULL, FALSE);
g_return_val_if_fail (get_func != NULL, FALSE);
- return gtk_clipboard_set_contents (clipboard, targets, n_targets,
- get_func, clear_func, user_data,
- FALSE);
+ return GTK_CLIPBOARD_GET_CLASS (clipboard)->set_contents (clipboard,
+ targets,
+ n_targets,
+ get_func,
+ clear_func,
+ user_data,
+ FALSE);
}
/**
@@ -672,9 +698,13 @@ gtk_clipboard_set_with_owner (GtkClipboard *clipboard,
g_return_val_if_fail (get_func != NULL, FALSE);
g_return_val_if_fail (G_IS_OBJECT (owner), FALSE);
- return gtk_clipboard_set_contents (clipboard, targets, n_targets,
- get_func, clear_func, owner,
- TRUE);
+ return GTK_CLIPBOARD_GET_CLASS (clipboard)->set_contents (clipboard,
+ targets,
+ n_targets,
+ get_func,
+ clear_func,
+ owner,
+ TRUE);
}
/**
@@ -753,6 +783,12 @@ gtk_clipboard_clear (GtkClipboard *clipboard)
{
g_return_if_fail (clipboard != NULL);
+ GTK_CLIPBOARD_GET_CLASS (clipboard)->clear (clipboard);
+}
+
+static void
+gtk_clipboard_real_clear (GtkClipboard *clipboard)
+{
if (clipboard->have_selection)
gtk_selection_owner_set_for_display (clipboard->display,
NULL,
@@ -930,14 +966,26 @@ gtk_clipboard_request_contents (GtkClipboard *clipboard,
GtkClipboardReceivedFunc callback,
gpointer user_data)
{
+ g_return_if_fail (clipboard != NULL);
+ g_return_if_fail (target != GDK_NONE);
+ g_return_if_fail (callback != NULL);
+
+ GTK_CLIPBOARD_GET_CLASS (clipboard)->request_contents (clipboard,
+ target,
+ callback,
+ user_data);
+}
+
+static void
+gtk_clipboard_real_request_contents (GtkClipboard *clipboard,
+ GdkAtom target,
+ GtkClipboardReceivedFunc callback,
+ gpointer user_data)
+{
RequestContentsInfo *info;
GtkWidget *widget;
GtkWidget *clipboard_widget;
- g_return_if_fail (clipboard != NULL);
- g_return_if_fail (target != GDK_NONE);
- g_return_if_fail (callback != NULL);
-
clipboard_widget = get_clipboard_widget (clipboard->display);
if (get_request_contents_info (clipboard_widget))
@@ -1986,15 +2034,25 @@ gtk_clipboard_set_can_store (GtkClipboard *clipboard,
const GtkTargetEntry *targets,
gint n_targets)
{
+ g_return_if_fail (GTK_IS_CLIPBOARD (clipboard));
+ g_return_if_fail (n_targets >= 0);
+
+ GTK_CLIPBOARD_GET_CLASS (clipboard)->set_can_store (clipboard,
+ targets,
+ n_targets);
+}
+
+static void
+gtk_clipboard_real_set_can_store (GtkClipboard *clipboard,
+ const GtkTargetEntry *targets,
+ gint n_targets)
+{
GtkWidget *clipboard_widget;
int i;
static const GtkTargetEntry save_targets[] = {
{ "SAVE_TARGETS", 0, TARGET_SAVE_TARGETS }
};
- g_return_if_fail (GTK_IS_CLIPBOARD (clipboard));
- g_return_if_fail (n_targets >= 0);
-
if (clipboard->selection != GDK_SELECTION_CLIPBOARD)
return;
@@ -2047,10 +2105,16 @@ gtk_clipboard_selection_notify (GtkWidget *widget,
void
gtk_clipboard_store (GtkClipboard *clipboard)
{
- GtkWidget *clipboard_widget;
-
g_return_if_fail (GTK_IS_CLIPBOARD (clipboard));
+ GTK_CLIPBOARD_GET_CLASS (clipboard)->store (clipboard);
+}
+
+static void
+gtk_clipboard_real_store (GtkClipboard *clipboard)
+{
+ GtkWidget *clipboard_widget;
+
if (clipboard->n_storable_targets < 0)
return;