<div dir="ltr">Hi Richard,<br><br>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.<br><br>I was still experiencing the following error which caused a SegFault:<br>
<br>** (process:12751): CRITICAL **: dbus_g_proxy_call: assertion `DBUS_IS_G_PROXY (proxy)' failed<br>Segmentation Fault<br><br>After reading over some DBUS help docs, I found the following function fixed that problem:<br>
<br>g_type_init ();<br><br>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.<br><br>Good day,<br>Dorian<br><br><div class="gmail_quote">On Tue, Aug 5, 2008 at 11:23 PM, Richard Hughes <span dir="ltr"><<a href="mailto:hughsient@gmail.com">hughsient@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">On Tue, 2008-08-05 at 15:57 -0700, Dorian Perkins wrote:<br>
> Hello Again,<br>
><br>
> After some help in #packagekit (thanks to james_w), I am currently<br>
> using the following compile command:<br>
><br>
> gcc $(pkg-config --cflags dbus-glib-1) installer.c<br>
<br>
</div>Sure, I would use something similar:<br>
<br>
gcc -o installer -Wall installer.c `pkg-config --cflags --libs dbus-glib-1`<br>
<div class="Ih2E3d"><br>
> I am currently getting the following compile time errors:<br>
<br>
</div>Right, the code I put up on the FAQ was meant to be copied and pasted<br>
into a program (a snippet), rather than compiled ready to run demo. If<br>
you want a demo, just surround it with some main braces like this:<br>
<div class="Ih2E3d"><br>
#include <dbus/dbus-glib.h><br>
<br>
</div>/**<br>
* main:<br>
**/<br>
int<br>
main (int argc, char *argv[])<br>
{<br>
<div class="Ih2E3d"> DBusGConnection *connection;<br>
DBusGProxy *proxy;<br>
GError *error = NULL;<br>
gboolean ret;<br>
<br>
connection = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);<br>
proxy = dbus_g_proxy_new_for_name (connection,<br>
"org.freedesktop.PackageKit",<br>
"/org/freedesktop/PackageKit",<br>
"org.freedesktop.PackageKit");<br>
<br>
/* execute sync method */<br>
ret = dbus_g_proxy_call (proxy, "InstallPackageName", &error,<br>
G_TYPE_STRING, "openoffice-clipart",<br>
G_TYPE_INVALID, G_TYPE_INVALID);<br>
if (!ret) {<br>
g_warning ("failed: %s", error->message);<br>
g_error_free (error);<br>
}<br>
</div> return 0;<br>
<div class="Ih2E3d">}<br>
<br>
> P.S. On a side note, the python example at<br>
> <a href="http://www.packagekit.org/pk-faq.html#session-methods" target="_blank">http://www.packagekit.org/pk-faq.html#session-methods</a> works just fine.<br>
> Not sure why I am having so much trouble getting the C example to<br>
> work.<br>
<br>
</div>I'll make the FAQ clearer, and add the compile line. Apologies for the<br>
confusion.<br>
<br>
Richard.<br>
<br>
<br>
<br>
_______________________________________________<br>
PackageKit mailing list<br>
<a href="mailto:PackageKit@lists.freedesktop.org">PackageKit@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/packagekit" target="_blank">http://lists.freedesktop.org/mailman/listinfo/packagekit</a><br>
</blockquote></div><br></div>