reloading a status bar plugin

reloading a status bar plugin

Daniele Maio
Karma: 576
2010-02-23 19:06 UTC
Hello,

I've created a statusbar plugin, now I want to reload it (eg. when the
configuration file changes).
What is the best way to do that ?



Best Regards,
Daniele Maio.

  •  Reply

Re: reloading a status bar plugin

2010-02-24 12:00 UTC
On Tue, 2010-02-23 at 20:06 +0100, ext b0unc3 wrote:
> Hello,
>
> I've created a statusbar plugin, now I want to reload it (eg. when the
> configuration file changes).
> What is the best way to do that ?

If the plugin can be unloaded and reloaded cleanly (meaning, it does not
crash hildon-status-menu :)), you could touch the .desktop file in some
way (e.g. increase version number inside the file) to make HSM unload
and reload you.

If your plugin is not unloadable, you can do this ugly trick (other
plugins can react to this somehow):

dsmetool -k /usr/bin/hildon-status-menu
dsmetool -t /usr/bin/hildon-status-menu

-Kimmo

>
>
>
> Best Regards,
> Daniele Maio.

  •  Reply

Re: reloading a status bar plugin

Daniele Maio
Karma: 576
2010-02-24 12:21 UTC
2010/2/24 Kimmo Hämäläinen <kimmo.hamalainen@nokia.com>

> On Tue, 2010-02-23 at 20:06 +0100, ext b0unc3 wrote:
> > Hello,
> >
> > I've created a statusbar plugin, now I want to reload it (eg. when the
> > configuration file changes).
> > What is the best way to do that ?
>
> If the plugin can be unloaded and reloaded cleanly (meaning, it does not
> crash hildon-status-menu :)), you could touch the .desktop file in some
> way (e.g. increase version number inside the file) to make HSM unload
> and reload you.
>

I cannot change the .desktop contents by user.


>
> If your plugin is not unloadable, you can do this ugly trick (other
> plugins can react to this somehow):
>
> dsmetool -k /usr/bin/hildon-status-menu
> dsmetool -t /usr/bin/hildon-status-menu
>

This is the current way I'm doing that, but, as you said, it's ugly.


>
> -Kimmo
>
> >
> >
> >
> > Best Regards,
> > Daniele Maio.
>
>

  •  Reply

Re: reloading a status bar plugin

Philipp Zabel
Karma: 409
2010-02-24 12:27 UTC
2010/2/24 b0unc3 <b0unc3@email.it>:
>
>
> 2010/2/24 Kimmo Hämäläinen <kimmo.hamalainen@nokia.com>
>>
>> On Tue, 2010-02-23 at 20:06 +0100, ext b0unc3 wrote:
>> > Hello,
>> >
>> > I've created a statusbar plugin, now I want to reload it (eg. when the
>> > configuration file changes).
>> > What is the best way to do that ?
>>
>> If the plugin can be unloaded and reloaded cleanly (meaning, it does not
>> crash hildon-status-menu :)), you could touch the .desktop file in some
>> way (e.g. increase version number inside the file) to make HSM unload
>> and reload you.
>
> I cannot change the .desktop contents by user.

You could touch it with sudo some-helper-script added to the sudoers file.
But I wonder, why do you need to reload the plugin at all? Can't you
just reload the configuration from the running status menu applet and
adapt it accordingly?

regards
Philipp
  •  Reply

Re: reloading a status bar plugin

2010-02-24 12:32 UTC
On Wed, 2010-02-24 at 13:21 +0100, ext b0unc3 wrote:
...
>
> dsmetool -k /usr/bin/hildon-status-menu
> dsmetool -t /usr/bin/hildon-status-menu
>
> This is the current way I'm doing that, but, as you said, it's ugly.

Yes, because The Right Way is for your plugin to load the new settings
without requiring reloading of the plugin. That should be doable for all
settings, no? You can look e.g. hildon-desktop that reloads
its /usr/share/hildon-desktop/transitions.ini configuration on-the-fly.
Using Gconf settings (and handling change notifications for them) is
another alternative.

-Kimmo


  •  Reply

Re: reloading a status bar plugin

Daniele Maio
Karma: 576
2010-02-25 00:21 UTC
2010/2/24 Kimmo Hämäläinen <kimmo.hamalainen@nokia.com>

> On Wed, 2010-02-24 at 13:21 +0100, ext b0unc3 wrote:
> ...
> >
> > dsmetool -k /usr/bin/hildon-status-menu
> > dsmetool -t /usr/bin/hildon-status-menu
> >
> > This is the current way I'm doing that, but, as you said, it's ugly.
>
> Yes, because The Right Way is for your plugin to load the new settings
> without requiring reloading of the plugin. That should be doable for all
> settings, no? You can look e.g. hildon-desktop that reloads
> its /usr/share/hildon-desktop/transitions.ini configuration on-the-fly.
> Using Gconf settings (and handling change notifications for them) is
> another alternative.
>

Yes GConf is the best alternative nowdays (it works like a charm now :)). I
didn't know why I haven't think to use it before.
Btw, thanks for your help.


>
> -Kimmo
>
>
> Best Regards,
Daniele Maio.

  •  Reply