Re: [gtk-list] Re: Signals and malloced memory



> (If you could return malloced memory, what happens if there are two
> signal handlers?)

	Is it bad to have *any* return value?  I noticed that the vast
majority of signals use a gtk_marshal_NONE__[...].

	In particular, I'd like to know what to do with an "insert_text"
signal.  GtkEditable uses an in/out pointer for "position":

void       gtk_editable_insert_text   (GtkEditable       *editable,
                                        const gchar      *new_text,
                                        gint              new_text_length,
                                        gint             *position);

	...I thought it made much more sense to simply have:

gint        my_insert_text             (GtkEditable       *editable,
                                        const gchar      *new_text,
                                        gint              new_text_length,
                                        gint              position);

	...and return the actual position of the inserted text, instead of
altering *position.  But was there a special reason the creators of
GtkEditable wanted to have a return type void (as is the case with most
of the signals in Gtk+)?


Thanks,
Derek Simkowiak
dereks@kd-dev.com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]