[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [platform-swt-dev] GTK in CVS
|
Steve_Northover@xxxxxxx writes:
> I tried out the g_log stuff and it didn't seem to work. Can you show
> me what I'm doing wrong?
Here is some sample code that works for me:
#include <gtk/gtk.h>
#include <stdio.h>
void
log_func (const gchar *log_domain,
GLogLevelFlags log_level,
const gchar *message,
gpointer user_data)
{
printf("HA-HA-HA\n");
}
int
main (int argc, char **argv)
{
gtk_init (&argc, &argv);
/* Use G_LOG_LEVEL_MASK to get all log levels, instead of just
* CRITICAL/WARNING.
*/
g_log_set_handler ("Gtk",
G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING |
G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
log_func, NULL);
gtk_widget_show (NULL);
return 0;
}
I apologize for this API, it's sort of strange IMO. It's documented
here:
http://developer.gnome.org/doc/API/2.0/glib/glib-message-logging.html
You may want to set a handler for the "Gdk" domain as well as "Gtk".
> int handle = OS.gtk_window_new (OS.GTK_WINDOW_TOPLEVEL);
BTW, I've noticed some code that appears to stuff pointers into the
Java "int" type - isn't this going to blow up on 64-bit platforms?
Or am I misunderstanding the code?
Havoc