|
Lines 541-547
request_restart_priv (GsmConsolekit *manager,
Link Here
|
| 541 |
g_free (error_message); |
541 |
g_free (error_message); |
| 542 |
} |
542 |
} |
| 543 |
#else |
543 |
#else |
| 544 |
g_assert_not_reached (); |
544 |
g_warning ("Failed to restart and Policykit support not enabled"); |
| 545 |
#endif /* HAVE POLKIT */ |
545 |
#endif /* HAVE POLKIT */ |
| 546 |
} |
546 |
} |
| 547 |
|
547 |
|
|
Lines 581-587
request_stop_priv (GsmConsolekit *manager,
Link Here
|
| 581 |
} |
581 |
} |
| 582 |
} |
582 |
} |
| 583 |
#else |
583 |
#else |
| 584 |
g_assert_not_reached (); |
584 |
g_warning ("Failed to shutdown and Policykit support not enabled"); |
| 585 |
#endif /* HAVE POLKIT */ |
585 |
#endif /* HAVE POLKIT */ |
| 586 |
} |
586 |
} |
| 587 |
|
587 |
|
|
Lines 974-979
gsm_consolekit_can_do_action (GsmConsolekit *manager,
Link Here
|
| 974 |
|
974 |
|
| 975 |
return result != POLKIT_RESULT_NO && result != POLKIT_RESULT_UNKNOWN; |
975 |
return result != POLKIT_RESULT_NO && result != POLKIT_RESULT_UNKNOWN; |
| 976 |
} |
976 |
} |
|
|
977 |
#else |
| 978 |
static gboolean |
| 979 |
gsm_consolekit_can_do_action (GsmConsolekit *manager, |
| 980 |
const char *action_id) |
| 981 |
{ |
| 982 |
/* if we got here, res was true */ |
| 983 |
return TRUE; |
| 984 |
} |
| 985 |
#endif |
| 977 |
|
986 |
|
| 978 |
static gboolean |
987 |
static gboolean |
| 979 |
gsm_consolekit_is_session_for_other_user (GsmConsolekit *manager, |
988 |
gsm_consolekit_is_session_for_other_user (GsmConsolekit *manager, |
|
Lines 1091-1096
gsm_consolekit_is_single_user (GsmConsolekit *manager)
Link Here
|
| 1091 |
return single; |
1100 |
return single; |
| 1092 |
} |
1101 |
} |
| 1093 |
|
1102 |
|
|
|
1103 |
#ifdef HAVE_POLKIT_GNOME |
| 1094 |
static void |
1104 |
static void |
| 1095 |
obtain_privileges_cb (PolKitAction *action, |
1105 |
obtain_privileges_cb (PolKitAction *action, |
| 1096 |
gboolean gained_privilege, |
1106 |
gboolean gained_privilege, |
|
Lines 1202-1209
gsm_consolekit_get_restart_privileges (GsmConsolekit *manager)
Link Here
|
| 1202 |
"org.freedesktop.consolekit.system.restart", |
1212 |
"org.freedesktop.consolekit.system.restart", |
| 1203 |
"org.freedesktop.consolekit.system.restart-multiple-users"); |
1213 |
"org.freedesktop.consolekit.system.restart-multiple-users"); |
| 1204 |
#else |
1214 |
#else |
| 1205 |
g_debug ("GsmConsolekit: built without PolicyKit-gnome support"); |
1215 |
g_signal_emit (G_OBJECT (manager), |
| 1206 |
return FALSE; |
1216 |
signals [PRIVILEGES_COMPLETED], |
|
|
1217 |
0, TRUE, FALSE, FALSE); |
| 1218 |
g_debug ("GsmConsolekit: built without PolicyKit-gnome support, granting anyway"); |
| 1219 |
return TRUE; |
| 1207 |
#endif |
1220 |
#endif |
| 1208 |
} |
1221 |
} |
| 1209 |
|
1222 |
|
|
Lines 1215-1247
gsm_consolekit_get_stop_privileges (GsmConsolekit *manager)
Link Here
|
| 1215 |
"org.freedesktop.consolekit.system.stop", |
1228 |
"org.freedesktop.consolekit.system.stop", |
| 1216 |
"org.freedesktop.consolekit.system.stop-multiple-users"); |
1229 |
"org.freedesktop.consolekit.system.stop-multiple-users"); |
| 1217 |
#else |
1230 |
#else |
| 1218 |
g_debug ("GsmConsolekit: built without PolicyKit-gnome support"); |
1231 |
g_signal_emit (G_OBJECT (manager), |
| 1219 |
return FALSE; |
1232 |
signals [PRIVILEGES_COMPLETED], |
|
|
1233 |
0, TRUE, FALSE, FALSE); |
| 1234 |
g_debug ("GsmConsolekit: built without PolicyKit-gnome support, granting anyway"); |
| 1235 |
return TRUE; |
| 1220 |
#endif |
1236 |
#endif |
| 1221 |
} |
1237 |
} |
| 1222 |
|
1238 |
|
| 1223 |
gboolean |
1239 |
gboolean |
| 1224 |
gsm_consolekit_can_restart (GsmConsolekit *manager) |
1240 |
gsm_consolekit_can_restart (GsmConsolekit *manager) |
| 1225 |
{ |
1241 |
{ |
| 1226 |
#ifdef HAVE_POLKIT_GNOME |
|
|
| 1227 |
return gsm_consolekit_can_do_action (manager, "org.freedesktop.consolekit.system.restart") || |
1242 |
return gsm_consolekit_can_do_action (manager, "org.freedesktop.consolekit.system.restart") || |
| 1228 |
gsm_consolekit_can_do_action (manager, "org.freedesktop.consolekit.system.restart-multiple-users"); |
1243 |
gsm_consolekit_can_do_action (manager, "org.freedesktop.consolekit.system.restart-multiple-users"); |
| 1229 |
#else |
|
|
| 1230 |
g_debug ("GsmConsolekit: built without PolicyKit-gnome support - cannot restart system"); |
| 1231 |
return FALSE; |
| 1232 |
#endif |
| 1233 |
} |
1244 |
} |
| 1234 |
|
1245 |
|
| 1235 |
gboolean |
1246 |
gboolean |
| 1236 |
gsm_consolekit_can_stop (GsmConsolekit *manager) |
1247 |
gsm_consolekit_can_stop (GsmConsolekit *manager) |
| 1237 |
{ |
1248 |
{ |
| 1238 |
#ifdef HAVE_POLKIT_GNOME |
|
|
| 1239 |
return gsm_consolekit_can_do_action (manager, "org.freedesktop.consolekit.system.stop") || |
1249 |
return gsm_consolekit_can_do_action (manager, "org.freedesktop.consolekit.system.stop") || |
| 1240 |
gsm_consolekit_can_do_action (manager, "org.freedesktop.consolekit.system.stop-multiple-users"); |
1250 |
gsm_consolekit_can_do_action (manager, "org.freedesktop.consolekit.system.stop-multiple-users"); |
| 1241 |
#else |
|
|
| 1242 |
g_debug ("GsmConsolekit: built without PolicyKit-gnome support - cannot stop system"); |
| 1243 |
return FALSE; |
| 1244 |
#endif |
| 1245 |
} |
1251 |
} |
| 1246 |
|
1252 |
|
| 1247 |
gchar * |
1253 |
gchar * |
| 1248 |
- |
|
|