24
25
// check for system crashes
25
gchar *argv[] = { CRASHREPORT_HELPER, "--system", NULL };
26
if(!g_spawn_sync(NULL,
29
G_SPAWN_STDOUT_TO_DEV_NULL|G_SPAWN_STDERR_TO_DEV_NULL,
26
if(!g_spawn_command_line_sync(CRASHREPORT_HELPER " --system", NULL, NULL,
36
28
g_warning("Can not run %s\n", CRASHREPORT_HELPER);
40
32
return exitcode == 0;
44
ask_invoke_apport_with_gksu()
47
gchar *msg = _("System program problem detected");
48
gchar *descr = _("Do you want to report the problem "
50
dialog = (GtkDialog*)gtk_message_dialog_new (NULL,
51
GTK_DIALOG_DESTROY_WITH_PARENT,
55
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
57
gtk_dialog_add_button(dialog, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
58
gtk_dialog_add_button(dialog, _("Report problem…"), GTK_RESPONSE_ACCEPT);
59
int res = gtk_dialog_run(dialog);
60
gtk_widget_destroy(GTK_WIDGET(dialog));
61
if (res == GTK_RESPONSE_ACCEPT)
67
36
run_apport(TrayApplet *ta)
69
38
g_debug("fire up the crashreport tool\n");
70
// be nice and always ask first before firing up gksu with its fullscreen
72
if (check_system_crashes() && ask_invoke_apport_with_gksu()) {
73
invoke_with_gksu(CRASHREPORT_REPORT_APP,
74
_("<span weight=\"bold\" size=\"larger\">Please enter your password to access problem reports of system programs</span>"),
77
return g_spawn_command_line_async(CRASHREPORT_REPORT_APP, NULL);
39
if (check_system_crashes()) {
40
invoke_with_gksu(CRASHREPORT_REPORT_APP,
41
_("<span weight=\"bold\" size=\"larger\">Please enter your password to access problem reports of system programs</span>"),
45
return g_spawn_command_line_async(CRASHREPORT_REPORT_APP, NULL);
142
109
// Check whether the user doesn't want notifications
143
110
if (!gconf_client_get_bool ((GConfClient*) ta->user_data,
144
111
GCONF_KEY_APPORT_NOTIFICATIONS, NULL)) {
145
g_debug("apport notifications disabled in gconf, not displaying crashes");
112
g_debug("apport notifications disabled in gconf, not displaying crashes");
149
116
// check for (new) reports by calling CRASHREPORT_HELPER
150
117
// and checking the return code
152
gchar *argv[] = { CRASHREPORT_HELPER, NULL };
153
if(!g_spawn_sync(NULL,
156
G_SPAWN_STDOUT_TO_DEV_NULL|G_SPAWN_STDERR_TO_DEV_NULL,
119
if(!g_spawn_command_line_sync(CRASHREPORT_HELPER, NULL, NULL,
163
121
g_warning("Can not run %s\n", CRASHREPORT_HELPER);
167
125
system_crashes = check_system_crashes();
168
126
crashreports_found = !exitcode || system_crashes;
170
// in autolaunch mode, just open windows,
171
gboolean autolaunch = gconf_client_get_bool((GConfClient*) ta->user_data,
172
GCONF_KEY_AUTO_LAUNCH, NULL);
174
if (crashreports_found > 0) {
175
g_debug("autolaunch mode, just running apport now");
176
crashreports_found=0;
183
// non-autolaunch will always use the notification area
128
// crashreport found and first run: show notification bubble and
184
130
gboolean visible = gtk_status_icon_get_visible(ta->tray_icon);
187
if(crashreports_found > 0 && !visible) {
132
// g_print("reports: %i, visible: %i\n",crashreports_found,visible);
134
if((crashreports_found > 0) && (system_crashes || first_run)) {
188
135
gtk_status_icon_set_tooltip(ta->tray_icon,
189
136
_("Crash report detected"));
190
137
gtk_status_icon_set_visible(ta->tray_icon, TRUE);
192
139
* if we've just logged in */
193
140
g_timeout_add(5000, (GSourceFunc)(show_notification), ta);
142
// crashreport found and already visible
143
else if((crashreports_found > 0) && !(system_crashes || first_run)) {
145
// if apport was run, we don't care anymore and hide the icon
146
crashreports_found=0;
196
149
// no crashreports, but visible
197
150
if((crashreports_found == 0) && visible) {