clipboard: Make a bunch of functions vfuncs
This commit is contained in:
parent
4009c8241b
commit
aee5bcf9e2
@ -163,6 +163,23 @@ static void gtk_clipboard_class_init (GtkClipboardClass *class);
|
|||||||
static void gtk_clipboard_finalize (GObject *object);
|
static void gtk_clipboard_finalize (GObject *object);
|
||||||
static void gtk_clipboard_owner_change (GtkClipboard *clipboard,
|
static void gtk_clipboard_owner_change (GtkClipboard *clipboard,
|
||||||
GdkEventOwnerChange *event);
|
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 clipboard_unset (GtkClipboard *clipboard);
|
||||||
static void selection_received (GtkWidget *widget,
|
static void selection_received (GtkWidget *widget,
|
||||||
@ -204,6 +221,11 @@ gtk_clipboard_class_init (GtkClipboardClass *class)
|
|||||||
|
|
||||||
gobject_class->finalize = gtk_clipboard_finalize;
|
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;
|
class->owner_change = gtk_clipboard_owner_change;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -629,8 +651,12 @@ gtk_clipboard_set_with_data (GtkClipboard *clipboard,
|
|||||||
g_return_val_if_fail (targets != NULL, FALSE);
|
g_return_val_if_fail (targets != NULL, FALSE);
|
||||||
g_return_val_if_fail (get_func != NULL, FALSE);
|
g_return_val_if_fail (get_func != NULL, FALSE);
|
||||||
|
|
||||||
return gtk_clipboard_set_contents (clipboard, targets, n_targets,
|
return GTK_CLIPBOARD_GET_CLASS (clipboard)->set_contents (clipboard,
|
||||||
get_func, clear_func, user_data,
|
targets,
|
||||||
|
n_targets,
|
||||||
|
get_func,
|
||||||
|
clear_func,
|
||||||
|
user_data,
|
||||||
FALSE);
|
FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -672,8 +698,12 @@ gtk_clipboard_set_with_owner (GtkClipboard *clipboard,
|
|||||||
g_return_val_if_fail (get_func != NULL, FALSE);
|
g_return_val_if_fail (get_func != NULL, FALSE);
|
||||||
g_return_val_if_fail (G_IS_OBJECT (owner), FALSE);
|
g_return_val_if_fail (G_IS_OBJECT (owner), FALSE);
|
||||||
|
|
||||||
return gtk_clipboard_set_contents (clipboard, targets, n_targets,
|
return GTK_CLIPBOARD_GET_CLASS (clipboard)->set_contents (clipboard,
|
||||||
get_func, clear_func, owner,
|
targets,
|
||||||
|
n_targets,
|
||||||
|
get_func,
|
||||||
|
clear_func,
|
||||||
|
owner,
|
||||||
TRUE);
|
TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -753,6 +783,12 @@ gtk_clipboard_clear (GtkClipboard *clipboard)
|
|||||||
{
|
{
|
||||||
g_return_if_fail (clipboard != NULL);
|
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)
|
if (clipboard->have_selection)
|
||||||
gtk_selection_owner_set_for_display (clipboard->display,
|
gtk_selection_owner_set_for_display (clipboard->display,
|
||||||
NULL,
|
NULL,
|
||||||
@ -930,14 +966,26 @@ gtk_clipboard_request_contents (GtkClipboard *clipboard,
|
|||||||
GtkClipboardReceivedFunc callback,
|
GtkClipboardReceivedFunc callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
RequestContentsInfo *info;
|
|
||||||
GtkWidget *widget;
|
|
||||||
GtkWidget *clipboard_widget;
|
|
||||||
|
|
||||||
g_return_if_fail (clipboard != NULL);
|
g_return_if_fail (clipboard != NULL);
|
||||||
g_return_if_fail (target != GDK_NONE);
|
g_return_if_fail (target != GDK_NONE);
|
||||||
g_return_if_fail (callback != NULL);
|
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;
|
||||||
|
|
||||||
clipboard_widget = get_clipboard_widget (clipboard->display);
|
clipboard_widget = get_clipboard_widget (clipboard->display);
|
||||||
|
|
||||||
if (get_request_contents_info (clipboard_widget))
|
if (get_request_contents_info (clipboard_widget))
|
||||||
@ -1985,6 +2033,19 @@ void
|
|||||||
gtk_clipboard_set_can_store (GtkClipboard *clipboard,
|
gtk_clipboard_set_can_store (GtkClipboard *clipboard,
|
||||||
const GtkTargetEntry *targets,
|
const GtkTargetEntry *targets,
|
||||||
gint n_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;
|
GtkWidget *clipboard_widget;
|
||||||
int i;
|
int i;
|
||||||
@ -1992,9 +2053,6 @@ gtk_clipboard_set_can_store (GtkClipboard *clipboard,
|
|||||||
{ "SAVE_TARGETS", 0, TARGET_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)
|
if (clipboard->selection != GDK_SELECTION_CLIPBOARD)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -2047,10 +2105,16 @@ gtk_clipboard_selection_notify (GtkWidget *widget,
|
|||||||
void
|
void
|
||||||
gtk_clipboard_store (GtkClipboard *clipboard)
|
gtk_clipboard_store (GtkClipboard *clipboard)
|
||||||
{
|
{
|
||||||
GtkWidget *clipboard_widget;
|
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_CLIPBOARD (clipboard));
|
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)
|
if (clipboard->n_storable_targets < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -59,6 +59,25 @@ struct _GtkClipboardClass
|
|||||||
{
|
{
|
||||||
GObjectClass parent_class;
|
GObjectClass parent_class;
|
||||||
|
|
||||||
|
/* vfuncs */
|
||||||
|
gboolean (* set_contents) (GtkClipboard *clipboard,
|
||||||
|
const GtkTargetEntry *targets,
|
||||||
|
guint n_targets,
|
||||||
|
GtkClipboardGetFunc get_func,
|
||||||
|
GtkClipboardClearFunc clear_func,
|
||||||
|
gpointer user_data,
|
||||||
|
gboolean have_owner);
|
||||||
|
void (* clear) (GtkClipboard *clipboard);
|
||||||
|
void (* request_contents) (GtkClipboard *clipboard,
|
||||||
|
GdkAtom target,
|
||||||
|
GtkClipboardReceivedFunc callback,
|
||||||
|
gpointer user_data);
|
||||||
|
void (* set_can_store) (GtkClipboard *clipboard,
|
||||||
|
const GtkTargetEntry *targets,
|
||||||
|
gint n_targets);
|
||||||
|
void (* store) (GtkClipboard *clipboard);
|
||||||
|
|
||||||
|
/* signals */
|
||||||
void (* owner_change) (GtkClipboard *clipboard,
|
void (* owner_change) (GtkClipboard *clipboard,
|
||||||
GdkEventOwnerChange *event);
|
GdkEventOwnerChange *event);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user