summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormonsta <[email protected]>2016-03-21 11:44:04 +0300
committermonsta <[email protected]>2016-03-21 11:44:04 +0300
commit6e0ddb9837551bd33b2f0b75a8f83cb3d2d36927 (patch)
tree45e8bd8ef7a8ff048c9ff25ad62db44bba0f5eed
parent5e53cbbdfaa20f43e99924b4fe4b86ec943451ea (diff)
downloadmate-system-monitor-6e0ddb9837551bd33b2f0b75a8f83cb3d2d36927.tar.bz2
mate-system-monitor-6e0ddb9837551bd33b2f0b75a8f83cb3d2d36927.tar.xz
run gksu binary instead of loading libgksu2.so (which is GTK+2 only)
-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);
}