From 6e0ddb9837551bd33b2f0b75a8f83cb3d2d36927 Mon Sep 17 00:00:00 2001 From: monsta Date: Mon, 21 Mar 2016 11:44:04 +0300 Subject: run gksu binary instead of loading libgksu2.so (which is GTK+2 only) --- src/procman_gksu.cpp | 55 ++++++++++++++++------------------------------------ 1 file changed, 17 insertions(+), 38 deletions(-) diff --git a/src/procman_gksu.cpp b/src/procman_gksu.cpp index 58faa0c..33b8eb0 100644 --- a/src/procman_gksu.cpp +++ b/src/procman_gksu.cpp @@ -2,53 +2,32 @@ #include "procman.h" #include "procman_gksu.h" -#include "util.h" -static gboolean (*gksu_run)(const char *, GError **); - - -static void load_gksu(void) -{ - static gboolean init; - - if (init) - return; - - init = TRUE; - - load_symbols("libgksu2.so", - "gksu_run", &gksu_run, - NULL); -} - - - - - -gboolean procman_gksu_create_root_password_dialog(const char *command) +gboolean +procman_gksu_create_root_password_dialog (const char *command) { - GError *e = NULL; - - /* Returns FALSE or TRUE on success, depends on version ... */ - gksu_run(command, &e); - - if (e) { - g_critical("Could not run gksu_run(\"%s\") : %s\n", - command, e->message); - g_error_free(e); + gchar *command_line; + gboolean success; + GError *error = NULL; + + command_line = g_strdup_printf ("gksu '%s'", command); + success = g_spawn_command_line_sync (command_line, NULL, NULL, NULL, &error); + g_free (command_line); + + if (!success) { + g_critical ("Could not run gksu '%s' : %s\n", + command, error->message); + g_error_free (error); return FALSE; } - g_message("gksu_run did fine\n"); + g_debug ("gksu did fine\n"); return TRUE; } - - gboolean -procman_has_gksu(void) +procman_has_gksu (void) { - load_gksu(); - return gksu_run != NULL; + return g_file_test ("/usr/bin/gksu", G_FILE_TEST_EXISTS); } -- cgit v1.2.1