ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
July 17th, 2024 | 10:00am-11:55am SGT (UTC+8) | Online

Ethereal-dev: RE: [Ethereal-dev] Copy of the "byte view" contents to the clipboard via the con

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: "Palmer Thomas J Civ HQ SSG/ENEP" <Thomas.Palmer@xxxxxxxxxxxxx>
Date: Wed, 18 Aug 2004 11:47:03 -0500
> 
> 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.


					tjp