[packagekit] Problem running example from FAQ

Dorian Perkins dperkins at google.com
Wed Aug 6 18:53:01 PDT 2008


Hello again,

So I have another question now. In reference to the example at hand, the FAQ
mentions:

"

The methods available on this interface are:

   - InstallPackageName("openoffice-clipart")
   - InstallProvideFile("/usr/share/fonts/sarai/Sarai_07.ttf")
   - InstallLocalFile("/home/dave/Desktop/lirc-0.6.6-4.rhfc1.dag.i686.rpm")
   - InstallMimeType("application/x-rpm")
   - InstallFont("lang(en_GB)")

"

However, I'd like to do other tasks such as EnableRepo() and GetRepoList(),
etc. How can I do this? Am I approaching this the wrong way?

Any help is appreciated!

Thanks,
Dorian


On Wed, Aug 6, 2008 at 10:38 AM, Dorian Perkins <dperkins at google.com> wrote:

> Hi Richard,
>
> I actually did have the main braces. Sorry for not mentioning that. I did
> say I was using "exactly" the code from the FAQ, which was inaccurate.
>
> I was still experiencing the following error which caused a SegFault:
>
> ** (process:12751): CRITICAL **: dbus_g_proxy_call: assertion
> `DBUS_IS_G_PROXY (proxy)' failed
> Segmentation Fault
>
> After reading over some DBUS help docs, I found the following function
> fixed that problem:
>
> g_type_init ();
>
> I added that after the variable declarations and now the code works. I am
> assuming you may need to add that to your FAQ example.
>
> Good day,
> Dorian
>
>
> On Tue, Aug 5, 2008 at 11:23 PM, Richard Hughes <hughsient at gmail.com>wrote:
>
>> On Tue, 2008-08-05 at 15:57 -0700, Dorian Perkins wrote:
>> > Hello Again,
>> >
>> > After some help in #packagekit (thanks to james_w), I am currently
>> > using the following compile command:
>> >
>> > gcc $(pkg-config --cflags dbus-glib-1) installer.c
>>
>> Sure, I would use something similar:
>>
>> gcc -o installer -Wall installer.c `pkg-config --cflags --libs
>> dbus-glib-1`
>>
>> > I am currently getting the following compile time errors:
>>
>> Right, the code I put up on the FAQ was meant to be copied and pasted
>> into a program (a snippet), rather than compiled ready to run demo. If
>> you want a demo, just surround it with some main braces like this:
>>
>> #include <dbus/dbus-glib.h>
>>
>> /**
>>  * main:
>>  **/
>> int
>> main (int argc, char *argv[])
>> {
>>         DBusGConnection *connection;
>>        DBusGProxy *proxy;
>>        GError *error = NULL;
>>        gboolean ret;
>>
>>        connection = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
>>        proxy = dbus_g_proxy_new_for_name (connection,
>>                                           "org.freedesktop.PackageKit",
>>                                           "/org/freedesktop/PackageKit",
>>                                           "org.freedesktop.PackageKit");
>>
>>        /* execute sync method */
>>        ret = dbus_g_proxy_call (proxy, "InstallPackageName", &error,
>>                                 G_TYPE_STRING, "openoffice-clipart",
>>                                 G_TYPE_INVALID, G_TYPE_INVALID);
>>        if (!ret) {
>>                g_warning ("failed: %s", error->message);
>>                g_error_free (error);
>>        }
>>         return 0;
>> }
>>
>> > P.S. On a side note, the python example at
>> > http://www.packagekit.org/pk-faq.html#session-methods works just fine.
>> > Not sure why I am having so much trouble getting the C example to
>> > work.
>>
>> I'll make the FAQ clearer, and add the compile line. Apologies for the
>> confusion.
>>
>> Richard.
>>
>>
>>
>> _______________________________________________
>> PackageKit mailing list
>> PackageKit at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/packagekit
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/packagekit/attachments/20080806/378b5188/attachment-0004.htm>


More information about the PackageKit mailing list