Mr. Picklesworth
August 30th, 2008, 05:34 PM
I decided that some must-have functionality for Parcellite is the ability to drop text onto it as an alternative to the usual copy shortcut.
Here is the important part, in main.c (see last two lines)...
/* Create status icon */
if (!prefs.noicon)
{
status_icon = gtk_status_icon_new_from_stock(GTK_STOCK_PASTE);
gtk_status_icon_set_tooltip(GTK_STATUS_ICON(status _icon), _("Clipboard Manager"));
g_signal_connect(G_OBJECT(status_icon), "activate", G_CALLBACK(check_click), NULL);
g_signal_connect(G_OBJECT(status_icon), "popup-menu", G_CALLBACK(show_parcellite_menu), NULL);
gtk_drag_dest_set(GTK_STATUS_ICON(status_icon), GTK_DEST_DEFAULT_ALL, dnd_target_table, G_N_ELEMENTS (dnd_target_table), GDK_ACTION_COPY);
g_signal_connect(G_OBJECT(status_icon), "drag-data-received", G_CALLBACK(dnd_receive_data), NULL);
}
However, I get this error:
(parcellite:15560): Gtk-CRITICAL **: gtk_drag_dest_set: assertion `GTK_IS_WIDGET (widget)' failed
(parcellite:15560): GLib-GObject-WARNING **: /build/buildd/glib2.0-2.16.4/gobject/gsignal.c:1669: signal `drag-data-received' is invalid for instance `0x65e640'
Some poking in documentation tells me that GTK_STATUS_ICON is descended straight from G_OBJECT, rather than any GTK widgets.
However, some more poking with wininfo reminded me that each status icon is indeed its own X window. Thus, in theory, this could work if I only knew which widget to use!
I can think of no examples for this functionality off hand, but I really really want it!
Will I have to implement the drag and drop stuff with a lower level API, or is there a really obvious solution? :)
Thanks!
Here is the important part, in main.c (see last two lines)...
/* Create status icon */
if (!prefs.noicon)
{
status_icon = gtk_status_icon_new_from_stock(GTK_STOCK_PASTE);
gtk_status_icon_set_tooltip(GTK_STATUS_ICON(status _icon), _("Clipboard Manager"));
g_signal_connect(G_OBJECT(status_icon), "activate", G_CALLBACK(check_click), NULL);
g_signal_connect(G_OBJECT(status_icon), "popup-menu", G_CALLBACK(show_parcellite_menu), NULL);
gtk_drag_dest_set(GTK_STATUS_ICON(status_icon), GTK_DEST_DEFAULT_ALL, dnd_target_table, G_N_ELEMENTS (dnd_target_table), GDK_ACTION_COPY);
g_signal_connect(G_OBJECT(status_icon), "drag-data-received", G_CALLBACK(dnd_receive_data), NULL);
}
However, I get this error:
(parcellite:15560): Gtk-CRITICAL **: gtk_drag_dest_set: assertion `GTK_IS_WIDGET (widget)' failed
(parcellite:15560): GLib-GObject-WARNING **: /build/buildd/glib2.0-2.16.4/gobject/gsignal.c:1669: signal `drag-data-received' is invalid for instance `0x65e640'
Some poking in documentation tells me that GTK_STATUS_ICON is descended straight from G_OBJECT, rather than any GTK widgets.
However, some more poking with wininfo reminded me that each status icon is indeed its own X window. Thus, in theory, this could work if I only knew which widget to use!
I can think of no examples for this functionality off hand, but I really really want it!
Will I have to implement the drag and drop stuff with a lower level API, or is there a really obvious solution? :)
Thanks!