Debian Codegraph @

docs/html/files/session.c

raw
1 #include <gio/gio.h>
2
3 int
4 main (int argc, char *argv[])
5 {
6 const gchar *packages[] = {"openoffice-clipart",
7 "openoffice-clipart-extras",
8 NULL};
9 GDBusProxy *proxy = NULL;
10 GError *error = NULL;
11 guint32 xid = 0;
12 GVariant *retval = NULL;
13
14 /* get a session bus proxy */
15 proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
16 G_DBUS_PROXY_FLAGS_NONE, NULL,
17 "org.freedesktop.PackageKit",
18 "/org/freedesktop/PackageKit",
19 "org.freedesktop.PackageKit.Modify",
20 NULL, &error);
21 if (proxy == NULL) {
22 g_warning ("failed: %s", error->message);
23 g_error_free (error);
24 goto out;
25 }
26
27 /* get the window ID, or use 0 for non-modal */
28 //xid = GDK_WINDOW_XID (gtk_widget_get_window (dialog));
29
30 /* issue the sync request */
31 retval = g_dbus_proxy_call_sync (proxy,
32 "InstallPackageNames",
33 g_variant_new ("(u^a&ss)",
34 xid,
35 packages,
36 "hide-finished"),
37 G_DBUS_CALL_FLAGS_NONE,
38 -1, /* timeout */
39 NULL, /* cancellable */
40 &error);
41 if (retval == NULL) {
42 g_warning ("failed: %s", error->message);
43 g_error_free (error);
44 goto out;
45 }
46 out:
47 if (proxy != NULL)
48 g_object_unref (proxy);
49 if (retval != NULL)
50 g_object_unref (retval);
51 return 0;
52 }
53