map-event, unmap-event on a custom widget



I've got a GtkBox-derived widget (RBHeader, for anyone interested) and
it currently animates 25 times per second. Obviously, I want to
disable this timeout when it's not visible so I can keep the CPU from
waking up needlessly.

	g_object_connect (header, "map-event", G_CALLBACK
(rb_header_map_callback), NULL);
	g_object_connect (header, "unmap-event", G_CALLBACK
(rb_header_map_callback), NULL);

static gboolean
rb_header_map_callback (GtkWidget *widget, GdkEvent *event, gpointer user_data)
{
	RBHeader *header = RB_HEADER (widget);
	
	rb_header_set_animation_timeout (header);
	
	return TRUE;
}

I get a runtime warning:

alex fizz:~/Hacking/rhythmbox$ shell/rhythmbox

(lt-rhythmbox:25023): GLib-GObject-WARNING **: IA__g_object_connect:
invalid signal spec "map-event"

(lt-rhythmbox:25023): GLib-GObject-WARNING **: IA__g_object_connect:
invalid signal spec "unmap-event"

In the manual http://library.gnome.org/devel/gtk/unstable/GtkWidget.html#GtkWidget-map-event
it says: "To receive this signal, the GdkWindow associated to the
widget needs to enable the GDK_STRUCTURE_MASK mask. GDK will enable
this mask automatically for all new windows."

But, I don't have a GdkWindow to play with until AFTER the map, I
thought that was the point... So I don't know what to do.

Save me! Thanks

Alex


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