Obsolete golang-120
[oi-userland.git] / components / library / ConsoleKit / patches / 20-seattool-2.patch
blob66a4c07c9e43c53e2c87975d17fdb6fb12fa402c
1 diff --git a/tools/ck-seat-tool.c.old b/tools/ck-seat-tool.c
2 index 773afb7..8a0bdd5 100644
3 --- a/tools/ck-seat-tool.c.old
4 +++ b/tools/ck-seat-tool.c
5 @@ -66,7 +66,7 @@ static const GOptionEntry options [] = {
6 { NULL }
7 };
9 -static void
10 +static gboolean
11 add_session (DBusGConnection *connection)
13 DBusGProxy *mgr_proxy = NULL;
14 @@ -92,7 +92,7 @@ add_session (DBusGConnection *connection)
15 CK_MANAGER_PATH,
16 CK_MANAGER_INTERFACE);
17 if (mgr_proxy == NULL) {
18 - return;
19 + return FALSE;
22 if (! IS_STR_SET(seat_id)) {
23 @@ -110,7 +110,7 @@ add_session (DBusGConnection *connection)
24 g_warning ("Unable to add seat: %s", error->message);
25 g_error_free (error);
26 g_object_unref (mgr_proxy);
27 - return;
28 + return FALSE;
31 } else {
32 @@ -133,7 +133,7 @@ add_session (DBusGConnection *connection)
33 g_warning ("Unable to get seat list: %s", error->message);
34 g_error_free (error);
35 g_object_unref (mgr_proxy);
36 - return;
37 + return FALSE;
40 found = FALSE;
41 @@ -163,7 +163,7 @@ add_session (DBusGConnection *connection)
42 g_warning ("Unable to add seat: %s", error->message);
43 g_error_free (error);
44 g_object_unref (mgr_proxy);
45 - return;
46 + return FALSE;
50 @@ -176,7 +176,7 @@ add_session (DBusGConnection *connection)
51 if (seat_proxy == NULL) {
52 g_warning ("Failed to talk to seat '%s'", sid);
53 g_object_unref (mgr_proxy);
54 - return;
55 + return FALSE;
58 variables = g_hash_table_new_full (g_str_hash, g_str_equal,
59 @@ -218,11 +218,15 @@ add_session (DBusGConnection *connection)
60 "Manage",
61 G_TYPE_INVALID,
62 G_TYPE_INVALID);
63 - g_print ("Seat %s with session %s has been added\n", sid, ssid);
64 + /* If a session is successfully added, print sessionid to stdout.
65 + dsession uses the output of "ck-seat-tool -a" to obtain session ID */
66 + g_print ("%s\n", g_basename (ssid));
69 g_object_unref (seat_proxy);
70 g_object_unref (mgr_proxy);
72 + return res;
75 static gboolean
76 @@ -329,7 +332,7 @@ find_seat_id_from_session_id (DBusGConnection *connection,
77 return sid;
80 -static void
81 +static gboolean
82 delete_session (DBusGConnection *connection)
84 DBusGProxy *proxy;
85 @@ -348,7 +351,7 @@ delete_session (DBusGConnection *connection)
86 CK_MANAGER_PATH,
87 CK_MANAGER_INTERFACE);
88 if (proxy == NULL) {
89 - return;
90 + return FALSE;
93 sid = find_seat_id_from_session_id (connection, proxy, ssid, &is_last_session);
94 @@ -374,6 +377,8 @@ delete_session (DBusGConnection *connection)
97 g_object_unref (proxy);
99 + return TRUE;
103 @@ -437,9 +442,15 @@ main (int argc, char *argv[])
106 if (add) {
107 - add_session (connection);
108 + if (add_session (connection))
109 + return 0;
110 + else
111 + exit (1);
112 } else if (delete) {
113 - delete_session (connection);
114 + if (delete_session (connection))
115 + return 0;
116 + else
117 + exit (1);
118 } else {
119 g_warning ("Invaild parameters!");
120 exit (1);