summaryrefslogtreecommitdiff
path: root/src/procman_gksu.cpp
diff options
context:
space:
mode:
authorPerberos <[email protected]>2011-11-08 16:22:08 -0300
committerPerberos <[email protected]>2011-11-08 16:22:08 -0300
commitf45852ab2a7126f354079499fc8b03976c0eab27 (patch)
tree885c32d804d3c970c5da41a5527882e8a956b42d /src/procman_gksu.cpp
downloadmate-system-monitor-f45852ab2a7126f354079499fc8b03976c0eab27.tar.bz2
mate-system-monitor-f45852ab2a7126f354079499fc8b03976c0eab27.tar.xz
initial
Diffstat (limited to 'src/procman_gksu.cpp')
-rw-r--r--src/procman_gksu.cpp54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/procman_gksu.cpp b/src/procman_gksu.cpp
new file mode 100644
index 0000000..d2737cc
--- /dev/null
+++ b/src/procman_gksu.cpp
@@ -0,0 +1,54 @@
+#include <config.h>
+
+#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)
+{
+ 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);
+ return FALSE;
+ }
+
+ g_message("gksu_run did fine\n");
+ return TRUE;
+}
+
+
+
+gboolean
+procman_has_gksu(void)
+{
+ load_gksu();
+ return gksu_run != NULL;
+}
+