summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/procman_gksu.cpp55
1 files 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);
}