summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Uebernickel <lars@uebernic.de>2015-09-15 23:53:48 +0200
committerDavid King <davidk@gnome.org>2015-09-25 16:30:23 +0100
commit5244716c4abd106ad49d5101c6b77fbdc3a4c3bb (patch)
treeb770e5b4f42fd26a7e4141055df008058a4ddc06
parent36e130156b71b5bde85454102fa636c9ba043cad (diff)
downloadgnome-logs-5244716c4abd106ad49d5101c6b77fbdc3a4c3bb.tar.gz
Fix boot menu when only one boot exists
The boot menu and subtitle were empty when only a single boot existed in the journal. Turn around loop logic to make it more clear and get rid of this edge case. https://bugzilla.gnome.org/show_bug.cgi?id=755085
-rw-r--r--src/gl-eventtoolbar.c4
-rw-r--r--src/gl-journal.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/gl-eventtoolbar.c b/src/gl-eventtoolbar.c
index c650e23..951b320 100644
--- a/src/gl-eventtoolbar.c
+++ b/src/gl-eventtoolbar.c
@@ -84,7 +84,7 @@ gl_event_toolbar_add_boots (GlEventToolbar *toolbar,
boot_menu = g_menu_new ();
section = g_menu_new ();
- for (i = boot_ids->len - 1; i >= boot_ids->len - 5 && i >= 0; i--)
+ for (i = MAX (boot_ids->len, 5) - 5; i < boot_ids->len; i++)
{
gchar *boot_match;
gchar *time_display;
@@ -106,7 +106,7 @@ gl_event_toolbar_add_boots (GlEventToolbar *toolbar,
variant = g_variant_new_string (boot_match);
g_menu_item_set_action_and_target_value (item, "win.view-boot",
variant);
- g_menu_append_item (section, item);
+ g_menu_prepend_item (section, item);
g_free (time_display);
g_object_unref (item);
diff --git a/src/gl-journal.c b/src/gl-journal.c
index a9a459e..6b3d4d5 100644
--- a/src/gl-journal.c
+++ b/src/gl-journal.c
@@ -76,7 +76,7 @@ gl_journal_get_current_boot_time (GlJournal *journal,
boot_ids = gl_journal_get_boot_ids (journal);
- for (i = boot_ids->len - 1; i >= boot_ids->len - 5 && i >= 0; i--)
+ for (i = 0; i < boot_ids->len; i++)
{
GlJournalBootID *boot_id;