[packagekit] pk_backend_message enums

Duncan Mac-Vicar Prett dmacvicar at suse.de
Tue Aug 19 03:48:26 PDT 2008


Hi guys

As discussed yesterday with Richard, the current pk_backend_message enum 
and the signature of the signal don't play very well.

My usecase is a ZYpp specific API that allows to warn the user that a 
repository mirror could be dead, by reading a generated timestamp (which 
is the older of all repomd.xml <timestamp> tags for rpm-md) plus a 
expire attribute. Our main repos would regenerate the generated 
timestamps from time to time, so a broken mirror can be detected.

If we detect that a repo may be outdated, we want to tell the user. May 
be in the future there will be new features that require some custom 
message to the user.

In its current form pk_backend_message gets an enum WARNING or NOTIFY 
(IIRC) and a message. The surprise is that the message is not 
translated, so you can't show it to the user, basically means the only 
thing you can do is to handle the enum in the client and tell the user 
"hey, warning!"

There are two ways of solving this.

- keep the enum as a hint for the icon or severity to use when showing 
the message, but make the text translated in the backend so it can be 
shown in the client. This allows for more flexibility of backend to show 
custom messages that PK does not know about yet. (otherwse we need PK 
enhancements every time the backend does an improvement )
- add the enums, and handle the texts in the client. This allows for 
different texts per client.
  In this case I would question if errors should be separated from 
messages then...
  And in this case, I would request an enum for my use case

  PK_MESSAGE_WARNING_MAYBE_BROKEN_MIRROR ?

- A third option is to add the enum, but add also a 3rd signal that 
receives a translated text, and accepts WARNING or NOTIFICATION, 
allowing to extend the backend without touching packagekit until the 
right enum is added.

cheers!
Duncan




More information about the PackageKit mailing list