From fb31765cbe33890f325a87015507364156741321 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:59:44 +0200 Subject: Adding upstream version 42.0. Signed-off-by: Daniel Baumann --- src/gsm_gksu.cpp | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/gsm_gksu.cpp (limited to 'src/gsm_gksu.cpp') diff --git a/src/gsm_gksu.cpp b/src/gsm_gksu.cpp new file mode 100644 index 0000000..d2146dd --- /dev/null +++ b/src/gsm_gksu.cpp @@ -0,0 +1,55 @@ +/* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +#include + +#include "application.h" +#include "gsm_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 gsm_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; +} + -- cgit v1.2.3