[gnome-logs] Add wrapped message to detailed event view



commit 31b850a0594367f87506d2f04b3247f45bbb521e
Author: David King <davidk gnome org>
Date:   Tue Oct 1 13:45:14 2013 +0100

    Add wrapped message to detailed event view

 data/gl-style.css  |    2 +-
 src/gl-eventview.c |   20 +++++++++++++++++++-
 2 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/data/gl-style.css b/data/gl-style.css
index 3458ac2..d3d0278 100644
--- a/data/gl-style.css
+++ b/data/gl-style.css
@@ -23,7 +23,7 @@
     padding: 10px;
 }
 
-.detail-catalog, .detail-time {
+.detail-catalog, .detail-message, .detail-time {
     padding: 10px;
 }
 
diff --git a/src/gl-eventview.c b/src/gl-eventview.c
index 03e54cf..8bb0fb8 100644
--- a/src/gl-eventview.c
+++ b/src/gl-eventview.c
@@ -150,6 +150,7 @@ on_listbox_row_activated (GtkListBox *listbox,
     gint ret;
     gchar *cursor;
     gchar *comm;
+    gchar *message;
     gchar *time;
     gchar *catalog;
     gsize length;
@@ -210,6 +211,16 @@ on_listbox_row_activated (GtkListBox *listbox,
         comm = "_COMM=";
     }
 
+    ret = sd_journal_get_data (journal, "MESSAGE", (const void **)&message,
+                               &length);
+
+    if (ret < 0)
+    {
+        g_warning ("Unable to get message from systemd journal: %s",
+                   g_strerror (-ret));
+        goto out;
+    }
+
     ret = sd_journal_get_catalog (journal, &catalog);
 
     if (ret == -ENOENT)
@@ -265,10 +276,17 @@ on_listbox_row_activated (GtkListBox *listbox,
     gtk_grid_attach (GTK_GRID (grid), label, 1, 0, 1, 1);
     g_free (time);
 
-    label = gtk_label_new (catalog);
+    label = gtk_label_new (strchr (message, '=') + 1);
     gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+    gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+    style = gtk_widget_get_style_context (label);
+    gtk_style_context_add_class (style, "detail-message");
     gtk_grid_attach (GTK_GRID (grid), label, 0, 1, 2, 1);
 
+    label = gtk_label_new (catalog);
+    gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+    gtk_grid_attach (GTK_GRID (grid), label, 0, 2, 2, 1);
+
     gtk_widget_show_all (grid);
     stack = GTK_STACK (view);
     gtk_stack_add_named (stack, grid, "detailed");


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