5
#include <glib-object.h>
11
#include <glib/gi18n.h>
13
#include "update-notifier.h"
14
#include "system-crash.h"
17
ask_invoke_apport_with_pkexec(void)
20
gchar *msg = _("System program problem detected");
21
gchar *descr = _("Do you want to report the problem "
23
dialog = (GtkDialog*)gtk_message_dialog_new (NULL,
24
GTK_DIALOG_DESTROY_WITH_PARENT,
28
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
30
gtk_dialog_add_button(dialog, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
31
gtk_dialog_add_button(dialog, _("Report problem…"), GTK_RESPONSE_ACCEPT);
32
int res = gtk_dialog_run(dialog);
33
gtk_widget_destroy(GTK_WIDGET(dialog));
34
if (res == GTK_RESPONSE_ACCEPT)
40
invoke_with_pkexec(const gchar *cmd)
42
g_debug("invoke_with_pkexec ()");
44
argv[0] = "/usr/bin/pkexec";
45
argv[1] = (gchar*)cmd;
47
g_spawn_async (NULL, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, NULL, NULL);
51
main (int argc, char **argv)
53
bindtextdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
54
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
55
textdomain(GETTEXT_PACKAGE);
57
gtk_init (&argc, &argv);
58
// be nice and always ask first before firing up pkexec
59
if (ask_invoke_apport_with_pkexec()) {
60
invoke_with_pkexec(CRASHREPORT_REPORT_APP);
62
return g_spawn_command_line_async(CRASHREPORT_REPORT_APP, NULL);