From 92e73b9d3d2fccd6f6c3f3f719f0fbee18a1ed11 Mon Sep 17 00:00:00 2001 From: ZenWalker Date: Sat, 9 Sep 2017 20:20:41 +0200 Subject: Fix: idle slider display in all languages --- src/mate-screensaver-preferences.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mate-screensaver-preferences.c b/src/mate-screensaver-preferences.c index f48a369..7f63430 100644 --- a/src/mate-screensaver-preferences.c +++ b/src/mate-screensaver-preferences.c @@ -942,7 +942,7 @@ time_to_string_text (long time) char *secs, *mins, *hours, *string; int sec, min, hour; - int inc_len, len_hour, len_minutes; + int inc_len, len_minutes; sec = time % 60; time = time - sec; @@ -965,9 +965,6 @@ time_to_string_text (long time) g_strdup_printf (ngettext ("%d minute", "%d minutes", 59), 59))) - 1; - len_hour = strlen (g_strdup_printf (ngettext ("%d hour", - "%d hours", 1), 1)); - len_minutes = 0; for (int n = 2; n < 60; n++) @@ -990,6 +987,15 @@ time_to_string_text (long time) } } + if ((strlen (g_str_to_ascii (g_strdup_printf (ngettext ("%d minute", + "%d minutes", 1), 1), NULL)) - 2) > len_minutes) + + len_minutes = strlen (g_str_to_ascii (g_strdup_printf (ngettext ("%d minute", + "%d minutes", 1), 1), NULL)) - 2; + + if (len_minutes < 1) + len_minutes = 1; + if (hour > 0) { if (sec > 0) @@ -1023,7 +1029,7 @@ time_to_string_text (long time) if (min < 10) { if (min == 1) - while (strlen (string) != (2 * len_hour + inc_len - 4)) + while (strlen (string) != (len_minutes + inc_len + 3)) { if (strlen (string) % 2 == 0) string = g_strconcat (string, " ", NULL); -- cgit v1.2.1