Instead of g_spawn_command_line_async(), the following could also be used:
gdk_property_change(gdk_get_default_root_window(), gdk_atom_intern("LDM_LOGOUT_ACTION", FALSE), XA_STRING, 8, GDK_PROP_MODE_REPLACE, (guchar *) "HALT", strlen("HALT"));
...but that would require #including some additional headers, and I didn't want to be intrusive. So IMHO the g_spawn call is just fine.
Instead of g_spawn_ command_ line_async( ), the following could also be used:
gdk_property_ change( gdk_get_ default_ root_window( ), gdk_atom_ intern( "LDM_LOGOUT_ ACTION" , FALSE), XA_STRING, 8, GDK_PROP_ MODE_REPLACE, (guchar *) "HALT", strlen("HALT"));
...but that would require #including some additional headers, and I didn't want to be intrusive. So IMHO the g_spawn call is just fine.