gtk_plot_canvas_remove_child() issue

Michael Noble <[email protected]>
Newsgroups gmane.comp.scigraphica.gtkextra
Message-ID <[email protected]>
Hello Folks,

A useful tidbit, posted in the hope of saving others some time.  I've
noticed an issue with gtk_plot_canvas_remove_child in the GtkExtra-2
CVS branch, namely at gtkplotcanvas.c line 2534:

         gtk_signal_emit(GTK_OBJECT(canvas), canvas_signals[DELETE_ITEM],
	                              child, &veto);

In v0.99.17 (the latest public release, based off of Gtk 1.x) the veto
value is returned unmodified (i.e. TRUE) when one has not connected a
callback to the delete_item signal.  This allows execution to enter the
subsequent

        if(veto){
          ...
	}

block and successfully remove the child from the internal canvas child list.

In the GtkExtra-2 branch, however, the veto value is reset to FALSE
when one has not installed a delete_item callback, which is preventing
children from being removed.  This can be verified by adding, say, a 
key_press_event callback to testgtkplot.c, and having it attempt to 
remove the active item if/when the canvas state is GTK_STATE_SELECTED
(much as is done w/in scigraphica).

One simple workaround is to just stub in a delete_item callback, but the
long-term fix would be to migrate the entire GtkExtra-2 codebase away from
gtk_signal_emit() et al, deprecated in Gtk2.x, and towards g_signal_emit()
et al.  Not exactly a small job, I know, but in principle once the first
conversion of each gtk_signal_ variant is done the rest should be more-
or-less mechanical.  I'd be willing to help, time permitting, and am
interested in what others think.

Regards,
Mike


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.