[gnome-logs/wip/detail: 3/3] Show priority, kernel device and audit session



commit 3da5a84367526d11d4d67e1c110375b3a078c8bf
Author: David King <davidk gnome org>
Date:   Thu Nov 21 13:16:12 2013 +0000

    Show priority, kernel device and audit session

 data/gl-style.css        |    2 +-
 src/gl-eventviewdetail.c |   78 +++++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 71 insertions(+), 9 deletions(-)
---
diff --git a/data/gl-style.css b/data/gl-style.css
index fe0ac6a..bf03a59 100644
--- a/data/gl-style.css
+++ b/data/gl-style.css
@@ -12,7 +12,7 @@
     padding: 10px;
 }
 
-.detail-catalog, .detail-message, .detail-time {
+.detail-audit_session, .detail-catalog, .detail-kernel_device, .detail-message, .detail-priority, 
.detail-time {
     padding: 10px;
 }
 
diff --git a/src/gl-eventviewdetail.c b/src/gl-eventviewdetail.c
index c514b6d..9c2981a 100644
--- a/src/gl-eventviewdetail.c
+++ b/src/gl-eventviewdetail.c
@@ -18,6 +18,8 @@
 
 #include "gl-eventviewdetail.h"
 
+#include <glib/gi18n.h>
+
 #include "gl-enums.h"
 
 enum
@@ -43,7 +45,7 @@ gl_event_view_detail_create_detail (GlEventViewDetail *detail)
 {
     GlEventViewDetailPrivate *priv;
     GlJournalResult *result;
-    gchar *time;
+    gchar *str;
     gboolean rtl;
     GtkWidget *grid;
     GtkWidget *label;
@@ -58,21 +60,27 @@ gl_event_view_detail_create_detail (GlEventViewDetail *detail)
     grid = gtk_grid_new ();
     label = gtk_label_new (result->comm);
     gtk_widget_set_direction (label, GTK_TEXT_DIR_LTR);
-    gtk_widget_set_hexpand (label, TRUE);
     gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
     context = gtk_widget_get_style_context (label);
     gtk_style_context_add_class (context, "detail-comm");
     gtk_grid_attach (GTK_GRID (grid), label, rtl ? 1 : 0, 0, 1, 1);
 
-    time = gl_util_timestamp_to_display (result->timestamp,
+    str = gl_util_timestamp_to_display (result->timestamp,
                                          priv->clock_format);
-    label = gtk_label_new (time);
-    gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+    label = gtk_label_new (str);
+    gtk_widget_set_hexpand (label, TRUE);
+    gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
     gtk_label_set_selectable (GTK_LABEL (label), TRUE);
     context = gtk_widget_get_style_context (label);
     gtk_style_context_add_class (context, "detail-time");
     gtk_grid_attach (GTK_GRID (grid), label, rtl ? 0 : 1, 0, 1, 1);
-    g_free (time);
+    g_free (str);
+
+    label = gtk_label_new (_("Message"));
+    gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
+    context = gtk_widget_get_style_context (label);
+    gtk_style_context_add_class (context, "dim-label");
+    gtk_grid_attach (GTK_GRID (grid), label, rtl ? 1 : 0, 1, 1, 1);
 
     label = gtk_label_new (result->message);
     gtk_widget_set_direction (label, GTK_TEXT_DIR_LTR);
@@ -82,7 +90,23 @@ gl_event_view_detail_create_detail (GlEventViewDetail *detail)
     context = gtk_widget_get_style_context (label);
     gtk_style_context_add_class (context, "detail-message");
     gtk_style_context_add_class (context, "event-monospace");
-    gtk_grid_attach (GTK_GRID (grid), label, 0, 1, 2, 1);
+    gtk_grid_attach (GTK_GRID (grid), label, rtl ? 0 : 1, 1, 1, 1);
+
+    /* TODO: Give a user-friendly representation of the priority. */
+    label = gtk_label_new (_("Priority"));
+    gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
+    context = gtk_widget_get_style_context (label);
+    gtk_style_context_add_class (context, "dim-label");
+    gtk_grid_attach (GTK_GRID (grid), label, rtl ? 1 : 0, 2, 1, 1);
+
+    str = g_strdup_printf ("%d", result->priority);
+    label = gtk_label_new (str);
+    gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+    gtk_label_set_selectable (GTK_LABEL (label), TRUE);
+    context = gtk_widget_get_style_context (label);
+    gtk_style_context_add_class (context, "detail-priority");
+    gtk_grid_attach (GTK_GRID (grid), label, rtl ? 0 : 1, 2, 1, 1);
+    g_free (str);
 
     label = gtk_label_new (result->catalog);
     gtk_widget_set_direction (label, GTK_TEXT_DIR_LTR);
@@ -90,7 +114,45 @@ gl_event_view_detail_create_detail (GlEventViewDetail *detail)
     gtk_label_set_selectable (GTK_LABEL (label), TRUE);
     context = gtk_widget_get_style_context (label);
     gtk_style_context_add_class (context, "detail-catalog");
-    gtk_grid_attach (GTK_GRID (grid), label, 0, 2, 2, 1);
+    gtk_grid_attach (GTK_GRID (grid), label, 0, 3, 2, 1);
+
+    if (result->kernel_device && *result->kernel_device)
+    {
+        gtk_grid_insert_row (GTK_GRID (grid), 2);
+
+        label = gtk_label_new (_("Kernel Device"));
+        gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
+        context = gtk_widget_get_style_context (label);
+        gtk_style_context_add_class (context, "dim-label");
+        gtk_grid_attach (GTK_GRID (grid), label, rtl ? 1 : 0, 2, 1, 1);
+
+        label = gtk_label_new (result->kernel_device);
+        gtk_widget_set_direction (label, GTK_TEXT_DIR_LTR);
+        gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+        gtk_label_set_selectable (GTK_LABEL (label), TRUE);
+        context = gtk_widget_get_style_context (label);
+        gtk_style_context_add_class (context, "detail-kernel_device");
+        gtk_grid_attach (GTK_GRID (grid), label, rtl ? 0 : 1, 2, 1, 1);
+    }
+
+    if (result->audit_session && *result->audit_session)
+    {
+        gtk_grid_insert_row (GTK_GRID (grid), 2);
+
+        label = gtk_label_new (_("Audit Session"));
+        gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
+        context = gtk_widget_get_style_context (label);
+        gtk_style_context_add_class (context, "dim-label");
+        gtk_grid_attach (GTK_GRID (grid), label, rtl ? 1 : 0, 2, 1, 1);
+
+        label = gtk_label_new (result->audit_session);
+        gtk_widget_set_direction (label, GTK_TEXT_DIR_LTR);
+        gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+        gtk_label_set_selectable (GTK_LABEL (label), TRUE);
+        context = gtk_widget_get_style_context (label);
+        gtk_style_context_add_class (context, "detail-kernel_device");
+        gtk_grid_attach (GTK_GRID (grid), label, rtl ? 0 : 1, 2, 1, 1);
+    }
 
     gtk_widget_show_all (grid);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]