[ABRT PATCH 1/4] move initialization of shortened reporting option to libabrt

Jakub Filak jfilak at redhat.com
Mon May 13 12:24:07 UTC 2013


Related to #594

Signed-off-by: Jakub Filak <jfilak at redhat.com>
---
 src/applet/applet.c   |  4 +---
 src/daemon/abrt.conf  |  8 ++++++++
 src/include/libabrt.h |  2 ++
 src/lib/abrt_conf.c   | 14 ++++++++++++++
 4 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/src/applet/applet.c b/src/applet/applet.c
index 4773d06..f851c8d 100644
--- a/src/applet/applet.c
+++ b/src/applet/applet.c
@@ -117,9 +117,7 @@ static bool is_shortened_reporting_enabled()
     if (configured)
         return string_to_bool(configured);
 
-    /* Default: enabled for GNOME desktop, else disabled */
-    const char *desktop_env = getenv("DESKTOP_SESSION");
-    return (desktop_env && strcasestr(desktop_env, "gnome") != NULL);
+    return g_settings_shortenedreporting;
 }
 
 /*
diff --git a/src/daemon/abrt.conf b/src/daemon/abrt.conf
index 7de4261..d00e84b 100644
--- a/src/daemon/abrt.conf
+++ b/src/daemon/abrt.conf
@@ -35,3 +35,11 @@ AutoreportingEvent = report_uReport
 # Enables automatic running of the event configured in AutoreportingEvent option.
 #
 AutoreportingEnabled = no
+
+# Enables shortened GUI reporting where the reporting is interrupted after
+# AutoreportingEvent is done.
+#
+# Default value: Yes but only if application is running in GNOME desktop
+#                session; otherwise No.
+#
+# ShortenedReporting = yes
diff --git a/src/include/libabrt.h b/src/include/libabrt.h
index ee87fb1..f033e21 100644
--- a/src/include/libabrt.h
+++ b/src/include/libabrt.h
@@ -74,6 +74,8 @@ extern bool          g_settings_delete_uploaded;
 extern bool          g_settings_autoreporting;
 #define g_settings_autoreporting_event abrt_g_settings_autoreporting_event
 extern char *        g_settings_autoreporting_event;
+#define g_settings_shortenedreporting abrt_g_settings_shortenedreporting
+extern bool          g_settings_shortenedreporting;
 
 
 #define load_abrt_conf abrt_load_abrt_conf
diff --git a/src/lib/abrt_conf.c b/src/lib/abrt_conf.c
index 0d5f1bb..7230b77 100644
--- a/src/lib/abrt_conf.c
+++ b/src/lib/abrt_conf.c
@@ -24,6 +24,7 @@ char *        g_settings_dump_location = NULL;
 bool          g_settings_delete_uploaded = 0;
 bool          g_settings_autoreporting = 0;
 char *        g_settings_autoreporting_event = NULL;
+bool          g_settings_shortenedreporting = 0;
 
 void free_abrt_conf_data()
 {
@@ -90,6 +91,19 @@ static void ParseCommon(map_string_t *settings, const char *conf_filename)
     else
         g_settings_autoreporting_event = xstrdup("report_uReport");
 
+    value = get_map_string_item_or_NULL(settings, "ShortenedReporting");
+    if (value)
+    {
+        g_settings_shortenedreporting = string_to_bool(value);
+        remove_map_string_item(settings, "ShortenedReporting");
+    }
+    else
+    {
+        /* Default: enabled for GNOME desktop, else disabled */
+        const char *desktop_env = getenv("DESKTOP_SESSION");
+        g_settings_shortenedreporting = (desktop_env && strcasestr(desktop_env, "gnome") != NULL);
+    }
+
     GHashTableIter iter;
     const char *name;
     /*char *value; - already declared */
-- 
1.8.1.4



More information about the Crash-catcher mailing list