Reply
Thread Tools
Posts: 35 | Thanked: 5 times | Joined on Sep 2007
#1
Hi,

How do the events work in hildon home plugin? Does it have similar destroy and delete events as normal gtk applications? I use the gobject timers and I think they keep on running after I have closed the plugin. So I guess they should be disabled somehow. Can anybody help with this? I'm developing with python btw.
 
Posts: 99 | Thanked: 65 times | Joined on Jan 2008 @ Finland
#2
I can't help with Python, but the idea should be the same as with C. Home plugins have their class-destroy function called on unload. In C, you would basically do this:

Code:
static void
my_destroy_function(GtkObject *obj)
{
        g_source_remove(foo);
}

static void
example_class_init(MyClass *class)
{
        /* foo */
        GTK_OBJECT_CLASS(class)->destroy = my_destroy_function;
        /* bar */
}
 
Posts: 35 | Thanked: 5 times | Joined on Sep 2007
#3
ok... thanks. IIRC I saw something similar for python somewhere. I'll go find it.
 
Posts: 87 | Thanked: 98 times | Joined on Oct 2007 @ Austria
#4
Originally Posted by icer View Post
How do the events work in hildon home plugin? Does it have similar destroy and delete events as normal gtk applications? I use the gobject timers and I think they keep on running after I have closed the plugin. So I guess they should be disabled somehow. Can anybody help with this? I'm developing with python btw.
I've noticed too that timers keep running, and I found the "unrealize" signal to work well for cancelling them:

Code:
...

        self.timer = gobject.timeout_add(delay, self.update)
        self.connect ("unrealize", self.unrealize)

...

    def unrealize(self, widget):
        if self.timer:
            gobject.source_remove(self.timer)
 
Posts: 35 | Thanked: 5 times | Joined on Sep 2007
#5
Great! That should do it! I'll test it tomorrow.
 
Reply


 
Forum Jump


All times are GMT. The time now is 02:09.