Is there any good way to manage the GtkTargets of GtkClipboard?



Owen Taylor wrote:

Robin Lu <robin lu sun com> writes:

GTK developers or who may concern,

As I am using the new API for GtkClipboard, I found there's no API to
add GtkTargets to GtkClipboard. I can only set the targets when I set
the GtkClipboard. But as I do not have a regular GtkTargetEntry list
while coding and it's very complex to maintain a dynamic
GtkTargetEntry list for it's more like a type without any 'member
function' to support. Furthermore, if I turn back to use the
gtk_selection_add_target, I have to use my own widget which make me
have to abandon GtkClipboard at all.

So, do you have any workaround solution on such kind of issue?

The set of targets on a clipboard is part of the contents of the clipboard, so if you change the set of targets, you need to reclaim
ownership.

Is it really that hard to create a GtkTargetEntry array when you need
it? It's quite unusual to need dynamic sets of targets, so I'm
a little unwilling to add extra API in this area.

Regards,
                                       Owen
The problem is: when I claim an ownership of the clipboard, there's no convenient way
to manage the targets. I can only use a GtkTargetEntry array, am I right?

To create a GtkTargetEntry array is quite easy, especially for a static one. But what I need is a dynamic one. That does not mean I need add new target without reclaim the ownership. I just have to collect the information about targets before set the clipboard and I may get different targets every time. I don't think it is an unusual requirement. Sure, I can write my own code for dynamic GtkTargetEntry array - create the array, create every gchar array, copy the string, delete the string, delete the whole array. I
noticed even Gtk itself don't have enegy to do that.

I understand your unwillingness to add such kind of API. It may be a bad one to break the consistence of clipboard from the other point of view. I sugest to add one more API
of set the clipboard with GtkTargetList like:
gboolean gtk_clipboard_set_with_XXX ( GtkClipboard *clipboard,
   const GtkTargetList *targets,
   guint n_targets,
   .... );

At least I can have some API binding with GtkTargetList.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]