[packagekit] backend authors: table-of-vfuncs no longer required

Richard Hughes hughsient at gmail.com
Tue Sep 21 09:39:08 PDT 2010


Each backend has the same boilerplate code, which they don't actually
need these days. In each backend we've got:

PK_BACKEND_OPTIONS (
       "Sample",                                  /* description */
       "Richard Hughes <richard at hughsie.com>", /* author */
       backend_initialize,                     /* initalize */
       backend_destroy,                        /* destroy */
...
}

i.e. a huge vfunc table. Using GModule, we can look up the symbol
names directly, and if they are the same as the PkBackend ones then we
can resolve them without this mega-vfunc.

If you want to convert your module then you can look at the following
commit for what you need to do:

commit d3b1558ef1ce71068ac57638c55a1932c31c3cb9
Author: Richard Hughes <richard at hughsie.com>
Date:   Tue Sep 21 17:04:04 2010 +0100

    dummy: Remove the table-of-vfuncs from the dummy backend

:100644 100644 3dc827c... bc7243d... M  backends/dummy/pk-backend-dummy.c

i.e. add some pk_ prefixes, remove some statics, add a get_author()
and get_description(), make sure the method names are correct and
delete the vfunc. If you want to continue using the vfunc, well,
that's fine as well. PkBackend supports both types.

Comments as always welcome.

Richard.



More information about the PackageKit mailing list