1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#include <dbus/dbus-glib.h>
/**
* main:
**/
int
main (int argc, char *argv[])
{
DBusGConnection *connection;
DBusGProxy *proxy;
GError *error = NULL;
gboolean ret;
guint32 xid = 0;
guint32 timestamp = 0;
/* init the types system */
g_type_init ();
/* get a session bus connection */
connection = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
/* connect to PackageKit */
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_UINT, xid, /* window xid, 0 for none */
G_TYPE_UINT, timestamp, /* action timestamp,, 0 for unknown */
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;
}
|