Re: map-event, unmap-event on a custom widget

2008-07-26 Thread Tristan Van Berkom
On Sun, Jul 20, 2008 at 12:27 PM, Alexander Jones [EMAIL PROTECTED] wrote:
 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);


I think you mean to be using g_signal_connect(), see the api docs for
http://library.gnome.org/devel/gobject/stable/gobject-The-Base-Object-Type.html#g-object-connect.

Cheers,
-Tristan
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


map-event, unmap-event on a custom widget

2008-07-21 Thread Alexander Jones
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:

[EMAIL PROTECTED]:~/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
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list