summaryrefslogtreecommitdiff
path: root/src/procman_gksu.cpp
blob: 33b8eb02b0a0380510411180991c7200677c4d2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <config.h>

#include "procman.h"
#include "procman_gksu.h"

gboolean
procman_gksu_create_root_password_dialog (const char *command)
{
    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_debug ("gksu did fine\n");
    return TRUE;
}

gboolean
procman_has_gksu (void)
{
    return g_file_test ("/usr/bin/gksu", G_FILE_TEST_EXISTS);
}