After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 752680 - Don't repeat the date
Don't repeat the date
Status: RESOLVED FIXED
Product: gnome-logs
Classification: Other
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: gnome-logs maintainer(s)
gnome-logs maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2015-07-21 17:32 UTC by Allan Day
Modified: 2018-03-15 10:35 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gnome-logs: show time label only once for similar group of log messages (5.33 KB, patch)
2016-03-12 10:00 UTC, Pranav Ganorkar
none Details | Review
gl-eventviewrow.c: show time label only once for similar group of log messages (4.76 KB, patch)
2018-02-27 17:47 UTC, Ankriti Sachan
rejected Details | Review
screenshot of above patch (158.81 KB, image/png)
2018-02-27 18:06 UTC, Ankriti Sachan
  Details
gl-eventviewrow.c: show time label only once for similar group of log messages (4.56 KB, patch)
2018-02-28 09:59 UTC, Ankriti Sachan
none Details | Review
gnome-logs: show time label once for similar group of log messages (4.83 KB, patch)
2018-03-12 18:33 UTC, Ankriti Sachan
none Details | Review
gnome-logs: show time label only once for similar group of log messages (4.96 KB, patch)
2018-03-14 09:29 UTC, Ankriti Sachan
none Details | Review
Show time label only once for repeated time labels of entries. (5.21 KB, patch)
2018-03-14 14:05 UTC, Ankriti Sachan
none Details | Review
Show time-stamps once for entries with similar time-stamps (5.20 KB, patch)
2018-03-15 09:27 UTC, Ankriti Sachan
committed Details | Review

Description Allan Day 2015-07-21 17:32:55 UTC
You get a lot of log events with the same timestamp. Since every log entry has a time, this leads to a lot of repetition in the UI.

It would be better to only show an entry in the time and date column if the time/date is different from the previous entry.

You can see this in the mockups:

https://raw.githubusercontent.com/gnome-design-team/gnome-mockups/master/logs/logs.png
Comment 1 Kunaal Jain 2015-12-04 07:41:55 UTC
+1, How is gnome logs populated? Any pointer to specific function or file?
Comment 2 Lars Karlitski 2015-12-04 10:53:59 UTC
I agree that this would look much cleaner.

Allan, what do you think should happen when scrolling? In the mockup you linked, the first visible row shows the shared timestamp for the next four rows. When that row scrolls out of view, should we move the timestamp to the next row down? If so, should we move it when it scrolls out of view completely or also when it is only half visible?
Comment 3 Pranav Ganorkar 2016-03-12 10:00:38 UTC
Created attachment 323750 [details] [review]
gnome-logs: show time label only once for similar group of log messages

This patch shows the date only once for a similar group
of log messages having same date.The date is shown only for
the most recent log message having a particular date.
Comment 4 Jonathan Kang 2016-11-28 07:04:48 UTC
(In reply to Kunaal Jain from comment #1)
> +1, How is gnome logs populated? Any pointer to specific function or file?

Logs reads journal from systemd-journald by calling sd_journal_open[1].


*[1] https://www.freedesktop.org/software/systemd/man/sd_journal_open.html
Comment 5 Ankriti Sachan 2018-02-27 17:47:36 UTC
Created attachment 369053 [details] [review]
gl-eventviewrow.c: show time label only once for similar group of log messages

In the above comments, an issue has been pointed out where we have to think about cases when dates go out of view. In this patch, dates have been kept intact with compressed-row-entries headers so that we won't have to scroll much when we have like 30-40 compressed entries. And we often have compressed entries. So, visible date entries will be almost near to each other (not much scrolls required). And with current patch we even decreased repetitions.
So, repetitions exist for headers but less in number.
Comment 6 Ankriti Sachan 2018-02-27 18:06:04 UTC
Created attachment 369055 [details]
screenshot of above patch
Comment 7 Ankriti Sachan 2018-02-28 09:56:01 UTC
Review of attachment 369053 [details] [review]:

Error due to additional g_print.
Comment 8 Ankriti Sachan 2018-02-28 09:59:00 UTC
Created attachment 369087 [details] [review]
gl-eventviewrow.c: show time label only once for similar group of log messages
Comment 9 David King 2018-03-02 11:38:27 UTC
Review of attachment 369087 [details] [review]:

::: src/gl-eventviewrow.c
@@ +374,3 @@
                                          now, priv->clock_format, FALSE);
+    previous_time = gl_util_timestamp_to_display (gl_journal_entry_get_timestamp (previous_entry),
+                                         now, priv->clock_format, FALSE);

Strange indentation here. Where does previous_time get freed?

@@ +379,3 @@
+
+    if (g_strcmp0 (time, previous_time) == 0)
+        priv->time_label = gtk_label_new ("     ");

Why use an empty string in the label?

::: src/gl-journal-model.c
@@ +34,2 @@
     GlJournalEntry *journal_entry;
+    GlJournalEntry *previous_journal_entry;

It seems odd to keep a pointer to the previous entry, when the model itself can be queried for any entry (using g_list_model_get_item() or simiar). Can you adapt the patch to not modify the journal model?

@@ +1179,2 @@
   g_clear_object (&row_entry->journal_entry);
+  g_clear_object (&row_entry->previous_journal_entry);

gl_row_entry_get_journal_entry() does not increment the reference count, so why is g_clear_object() used here?
Comment 10 Ankriti Sachan 2018-03-12 18:33:37 UTC
Created attachment 369587 [details] [review]
gnome-logs: show time label once for similar group of log messages
Comment 11 Jonathan Kang 2018-03-13 09:07:33 UTC
Review of attachment 369587 [details] [review]:

::: src/gl-eventviewrow.c
@@ +374,3 @@
+    if(gl_journal_entry_get_display_time_label (entry))
+    {
+        priv->time_label = gtk_label_new (time);

This is duplicated with line 374.

@@ +379,3 @@
+    {
+        priv->time_label = gtk_label_new ("      ");/*space necessary to avoid message_label
+						      in time_label space*/

Please follow the code style for comments in the project.

::: src/gl-journal-model.c
@@ +100,3 @@
+    gchar *previous_entry_time_label;
+    gchar *current_entry_time_label;
+    GDateTime *now;

Declaring these values in the block where they are used can be better option.

@@ +167,3 @@
+
+                previous_entry_time_label = gl_util_timestamp_to_display (gl_journal_entry_get_timestamp (previous_entry),
+                                         				  now, GL_UTIL_CLOCK_FORMAT_12HR, FALSE);

The clock format should not be fixed. You should get the value from GSettings schema.
There are related codes in gl-util.c which you can refer to.

Emm. this shouldn't be much of a problem, as we're just comparing these two strings.
Comment 12 Ankriti Sachan 2018-03-14 09:29:45 UTC
Created attachment 369649 [details] [review]
gnome-logs: show time label only once for similar group of log messages
Comment 13 David King 2018-03-14 11:47:52 UTC
Review of attachment 369649 [details] [review]:

No need to use "gnome-logs" in the commit message. Also, you should give a link to the bug in the description.

::: src/gl-eventviewrow.c
@@ +372,3 @@
     g_date_time_unref (now);
+
+    if(gl_journal_entry_get_display_time_label (entry))

Missing a space before the "if".

@@ +378,3 @@
+    else
+    {
+	/*blank space necessary to avoid message_label to extend in place of time_label*/

Missing spaces around the comment, and a full stop.

::: src/gl-journal-model.c
@@ +174,3 @@
+
+                /* TODO: Timestamp should be compared directly in future. */
+                if(g_strcmp0 (previous_entry_time_label, current_entry_time_label) == 0)

Missing a space after the "if", and curly braces around the statements (or you could instead use a ternary expression).

::: src/gl-journal.c
@@ +884,3 @@
+gl_journal_entry_set_display_time_label (GlJournalEntry *entry, gboolean value)
+{
+  entry->display_time_label = value;

Missing a g_return_if_fail() check.
Comment 14 Ankriti Sachan 2018-03-14 14:05:48 UTC
Created attachment 369676 [details] [review]
Show time label only once for repeated time labels of entries.

This patch shows time labels only for those entries whose time label is different from their previous one.
Comment 15 David King 2018-03-15 08:43:51 UTC
Review of attachment 369676 [details] [review]:

Try to keep the first line of the commit message under 50 characters, and do not end it with a full stop.

::: src/gl-eventviewrow.c
@@ +380,3 @@
+	/* Blank space is necessary to avoid message_label to extend in place of time_label. */
+        priv->time_label = gtk_label_new ("      ");
+    }

Leave a blank line after the closing curly brace.

::: src/gl-journal.c
@@ +884,3 @@
+gl_journal_entry_set_display_time_label (GlJournalEntry *entry, gboolean value)
+{
+  g_return_val_if_fail (GL_IS_JOURNAL_ENTRY (entry), NULL);

You cannot return a value from a function that returns void. Did this not generate a compiler warning?
Comment 16 Ankriti Sachan 2018-03-15 09:27:53 UTC
Created attachment 369716 [details] [review]
Show time-stamps once for entries with similar time-stamps

This patch shows time labels only for those entries whose time label is different from their previous one.
Comment 17 David King 2018-03-15 10:34:52 UTC
Review of attachment 369716 [details] [review]:

I pushed a slightly-modified patch to master as commit 1f529a54536d78d50abb9671bb182429a4179a4a. I fixed a few lines with tabs used as indentation, and reflowed the commit message. Otherwise, it was perfect!