Ethereal-dev: Re: [Ethereal-dev] Copy of the "byte view" contents to the clipboard via the con
Palmer Thomas J Civ HQ SSG/ENEP wrote:
On Tue, Aug 03, 2004 at 12:02:06PM -0500, Palmer Thomas J Civ
HQ SSG/ENEM wrote:
The attached patch enables the copy of the "byte view"
contents to the
clipboard via the context menu.
...if you're using a version of Ethereal built with GTK+ 2.x.
Could support for GTK+ 1.2[.x] be added?
I'm a GTK newbie and I'm struggling to add GTK1.2 support for the clipboard. I have (probably awkwardly) implemented the 1.2 support as:
#if (GTK_MAJOR_VERSION >= 2)
GtkClipboard *cb;
#else
GtkWidget *ge;
#endif
GString *CSV_str = g_string_new("");
<snip>
/* Now that we have the CSV data, copy it into the default clipboard */
#if (GTK_MAJOR_VERSION >= 2)
cb = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); /* Get the default clipboard */
gtk_clipboard_set_text(cb, CSV_str->str, -1); /* Copy the CSV data into the clipboard */
#else
ge=gtk_entry_new_with_max_length(50000);
gtk_entry_set_text((GtkEntry *) ge,(gchar *)CSV_str->str);
gtk_editable_select_region((GtkEditable *) ge, 0, -1);
gtk_editable_copy_clipboard((GtkEditable *)ge);
#endif
g_string_free(CSV_str, TRUE); /* Free the memory */
The problem that I am having is that at runtime, GTK is complaining:
(ethereal.exe:3436): Gtk-CRITICAL **: file gtkwidget.c: line 3732 (gtk_widget_get_parent_window): assertion `widget->parent != NULL' failed
AND the clipboard contains a truncated version of the GString. Any pointers would be greatly appreciated.
It seems, that the ge widget you are using isn't related to a parent
widget (e.g. a container like GtkHBox or such)
Just try to put ge into another widget (maybe hidden), that should avoid
this assert.
I don't know why the clipboard contain only a truncated string after
doing this.
Regards, ULFL