/** * a_clipboard_type: * * Return the type of data held in the clipboard if any */ VikClipboardDataType a_clipboard_type ( ) { GtkClipboard *c = gtk_clipboard_get ( GDK_SELECTION_CLIPBOARD ); VikClipboardDataType *vcdt = g_malloc ( sizeof (VikClipboardDataType) ); gtk_clipboard_request_targets ( c, clip_determine_type, vcdt ); gint answer = *vcdt; g_free ( vcdt ); return answer; }
static VALUE rg_request_targets(VALUE self) { VALUE func = rb_block_proc(); G_RELATIVE(self, func); gtk_clipboard_request_targets(_SELF(self), (GtkClipboardTargetsReceivedFunc)clipboard_target_received_func, (gpointer)func); return self; }
/* \brief Checks if the system clipboard contains schematic data. * \par Function Description * Checks whether the current owner of the system clipboard is * advertising gEDA schematic data. * * The check is performed asynchronously. When a response is * recieved, the provided callback is called with a TRUE / FALSE * result. * * \param [in] w_current The current GSCHEM_TOPLEVEL. * \param [in] callback The callback to recieve the response. * \param [in] userdata Arbitrary data to pass the callback. */ void x_clipboard_query_usable (GSCHEM_TOPLEVEL *w_current, void (*callback) (int, void *), void *userdata) { GtkClipboard *clip = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD); struct query_usable *cbinfo; cbinfo = g_new (struct query_usable, 1); cbinfo->callback = callback; cbinfo->userdata = userdata; gtk_clipboard_request_targets (clip, query_usable_targets_cb, cbinfo); }
/** * spice_gtk_session_copy_to_guest: * @self: * * Copy client-side clipboard to guest clipboard. * * Since 0.8 **/ void spice_gtk_session_copy_to_guest(SpiceGtkSession *self) { g_return_if_fail(SPICE_IS_GTK_SESSION(self)); g_return_if_fail(read_only(self) == FALSE); SpiceGtkSessionPrivate *s = self->priv; int selection = VD_AGENT_CLIPBOARD_SELECTION_CLIPBOARD; if (s->clip_hasdata[selection] && !s->clip_grabbed[selection]) { gtk_clipboard_request_targets(s->clipboard, clipboard_get_targets, weak_ref(G_OBJECT(self))); } }
static void _gth_browser_update_paste_command_sensitivity (GthBrowser *browser, GtkClipboard *clipboard) { BrowserData *data; data = g_object_get_data (G_OBJECT (browser), BROWSER_DATA_KEY); g_return_if_fail (data != NULL); data->can_paste = FALSE; set_action_sensitive (data, "Edit_PasteInFolder", FALSE); if (clipboard == NULL) clipboard = gtk_widget_get_clipboard (GTK_WIDGET (browser), GDK_SELECTION_CLIPBOARD); gtk_clipboard_request_targets (clipboard, clipboard_targets_received_cb, g_object_ref (browser)); }
void glide_window_paste_action_activate (GtkAction *a, gpointer user_data) { GlideWindow *w = (GlideWindow *)user_data; GtkClipboard *clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD); if (w->priv->copy_buffer) { GlideActor *n = glide_window_construct_copy_buffer (w); glide_stage_manager_add_actor (w->priv->manager, n); clutter_actor_show (CLUTTER_ACTOR (n)); return; } gtk_clipboard_request_targets (clipboard, glide_window_paste_targets_received, w); }
static void clipboard_owner_change(GtkClipboard *clipboard, GdkEventOwnerChange *event, gpointer user_data) { g_return_if_fail(SPICE_IS_GTK_SESSION(user_data)); SpiceGtkSession *self = user_data; SpiceGtkSessionPrivate *s = self->priv; int selection; selection = get_selection_from_clipboard(s, clipboard); g_return_if_fail(selection != -1); if (s->main == NULL) return; if (s->clip_grabbed[selection]) { s->clip_grabbed[selection] = FALSE; if (spice_main_agent_test_capability(s->main, VD_AGENT_CAP_CLIPBOARD_BY_DEMAND)) spice_main_clipboard_selection_release(s->main, selection); } switch (event->reason) { case GDK_OWNER_CHANGE_NEW_OWNER: if (gtk_clipboard_get_owner(clipboard) == G_OBJECT(self)) break; s->clipboard_by_guest[selection] = FALSE; s->clip_hasdata[selection] = TRUE; if (s->auto_clipboard_enable && !read_only(self)) gtk_clipboard_request_targets(clipboard, clipboard_get_targets, weak_ref(G_OBJECT(self))); break; default: s->clip_hasdata[selection] = FALSE; break; } }
/** * a_clipboard_paste: * * To deal with multiple data types, we first request the type of data on the clipboard, * and handle them in the callback. */ gboolean a_clipboard_paste ( VikLayersPanel *vlp ) { GtkClipboard *c = gtk_clipboard_get ( GDK_SELECTION_CLIPBOARD ); gtk_clipboard_request_targets ( c, clip_receive_targets, vlp ); return TRUE; }