After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 644490 - Missing (clipboard) Selection APIs
Missing (clipboard) Selection APIs
Status: RESOLVED NOTABUG
Product: gtk+
Classification: Platform
Component: Widget: Other
3.0.x
Other All
: Normal critical
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2011-03-11 13:10 UTC by Miroslav Rajcic
Modified: 2011-03-11 15:58 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Miroslav Rajcic 2011-03-11 13:10:08 UTC
I resolved the majority of the the issues when porting my program from GTK 
2.x to GTK 3.x. Unfortunately I still have one issue left:

when compiling the program on Feodra 15 alpha (gcc 4.6, GTK3 v3.0.2) I get 
these errors:

./src/clipboard.cpp:442:38: error: invalid use of incomplete type 
'GtkTargetList'
/usr/include/gtk-3.0/gtk/gtkselection.h:48:16: error: forward declaration of 
'GtkTargetList'
./src/clipboard.cpp:445:20: error: invalid use of incomplete type 
'GtkTargetList'
/usr/include/gtk-3.0/gtk/gtkselection.h:48:16: error: forward declaration of 
'GtkTargetList'
./src/clipboard.cpp:447:3: error: 'GtkTargetPair' was not declared in this 
scope
./src/clipboard.cpp:447:18: error: 'pair' was not declared in this scope

The relevant code is this:

#include <gtk/gtk.h>

GtkTargetList *list = gtk_target_list_new (NULL, 0);
.. add text and other targets in the list

// LINE 442: error: invalid use of incomplete type 'GtkTargetList'
int nTargetCnt = g_list_length (list->list);

//LINE 445: error: invalid use of incomplete type 'GtkTargetList'
for (GList *l=list->list; l; l=l->next, i++)

//LINE 447: error: 'GtkTargetPair' was not declared in this scope
GtkTargetPair *pair = (GtkTargetPair *)l->data;

This all works fine with GTK2.x.
I've asked for help in this thread:
http://mail.gnome.org/archives/gtk-app-devel-list/2011-March/msg00049.html

The explanation is that now the GtkTargetList structure should be treated as opaque. This is a problem because now several accessor methods are missing and I see no workaround for my current code (see thread for details on the exact use case).

Missing functions:
- fn. to get the size of GtkTargetList (gtk_target_list_get_n_targets as suggested by Allin Cottrell)
- fn. to access individual entry data in the target list:
gtk_target_list_get_entry_target
gtk_target_list_get_entry_flags
gtk_target_list_get_entry_info
It seems that GtkTargetPair is not declared now, so my guess is that individual structure memeber accessors are needed.
If you decide to make GtkTargetPair visible, one accessor function would be enough.
Comment 1 Matthias Clasen 2011-03-11 15:57:53 UTC
You can just use gtk_target_table_from_list and do whatever you need to do with the table contents