On Sun, 2003-12-14 at 21:24, bulia byak wrote:
I see you could not wait and removed my functions replacing them with yours :) Sorry I'll now overwrite your changes, replacing them with still better functions that have time control (but implemented using your _statusf internally).
Ok. Be advised that the C++ conversion is going on right now; I'll try to merge anything you have committed, but you might want to hang back for a bit until the dust clears.
Right now I have one problem that I need help with. The stupid gtk_timeout_add can only pass one argument to the function it calls, but I need two arguments to remove the message: the statusbar * and the message_id.
You probably really want to use g_timeout_add_full():
g_timeout_add_full(gint priority, gint inteveral, GSourceFunc function, gpointer data, GDestroyNotify notify);
Use G_PRIORITY_DEFAULT for priority; as far as passing both bits of data, just g_malloc() your structure, and specify g_free for notify.
(gtk_timeout_add() is just a wrapper for g_timeout_add(), by the way -- the timeout and event loop stuff was moved into GLib for GTK 2.0)
(In general, actually, you might want to have a look at http://www.gtk.org/api/ and read through some of the changes introduced with GTK2 -- all kinds of good stuff in there.)
Actually, if statusbar * is a GtkStatusbar *, you'll need to make sure you increase the statusbar's refcount before calling g_timeout_add_full, and instead of g_free() use your own function that unrefs the statusbar and then g_free()s the structure.
If you don't handle the refcount properly, it can lead to crashes or memory leaks as the statusbar could potentially be freed to early, or never.
-mental