[Xfce4-commits] [apps/xfce4-screensaver] 310/425: Fix: idle slider display bug
noreply at xfce.org
noreply at xfce.org
Mon Oct 15 01:52:37 CEST 2018
This is an automated email from the git hooks/post-receive script.
b l u e s a b r e p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository apps/xfce4-screensaver.
commit 52df89dc6ce7c3c58dcac6b781b8ff540336fce8
Author: ZenWalker <scow at riseup.net>
Date: Wed Sep 6 16:22:42 2017 +0200
Fix: idle slider display bug
Fixes #101
---
src/mate-screensaver-preferences.c | 63 ++++++++++++++++++++++++++++++++++++++
1 file changed, 63 insertions(+)
diff --git a/src/mate-screensaver-preferences.c b/src/mate-screensaver-preferences.c
index d3a11a7..f48a369 100644
--- a/src/mate-screensaver-preferences.c
+++ b/src/mate-screensaver-preferences.c
@@ -942,6 +942,8 @@ time_to_string_text (long time)
char *secs, *mins, *hours, *string;
int sec, min, hour;
+ int inc_len, len_hour, len_minutes;
+
sec = time % 60;
time = time - sec;
min = (time % (60 * 60)) / 60;
@@ -957,6 +959,37 @@ time_to_string_text (long time)
secs = g_strdup_printf (ngettext ("%d second",
"%d seconds", sec), sec);
+ inc_len = strlen (g_strdup_printf (_("%s %s"),
+ g_strdup_printf (ngettext ("%d hour",
+ "%d hours", 1), 1),
+ 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++)
+ {
+ if (n < 10)
+ {
+ if ((strlen (g_str_to_ascii (g_strdup_printf (ngettext ("%d minute",
+ "%d minutes", n), n), NULL)) - 2) > len_minutes)
+
+ len_minutes = strlen (g_str_to_ascii (g_strdup_printf (ngettext ("%d minute",
+ "%d minutes", n), n), NULL)) - 2;
+ }
+ else
+ {
+ if ((strlen (g_str_to_ascii (g_strdup_printf (ngettext ("%d minute",
+ "%d minutes", n), n), NULL)) - 3) > len_minutes)
+
+ len_minutes = strlen (g_str_to_ascii (g_strdup_printf (ngettext ("%d minute",
+ "%d minutes", n), n), NULL)) - 3;
+ }
+ }
+
if (hour > 0)
{
if (sec > 0)
@@ -986,6 +1019,36 @@ time_to_string_text (long time)
{
/* minutes */
string = g_strdup_printf (_("%s"), mins);
+
+ if (min < 10)
+ {
+ if (min == 1)
+ while (strlen (string) != (2 * len_hour + inc_len - 4))
+ {
+ if (strlen (string) % 2 == 0)
+ string = g_strconcat (string, " ", NULL);
+ else
+ string = g_strconcat (" " , string, NULL);
+ }
+ else
+ while (strlen (string) != (len_minutes + inc_len))
+ {
+ if (strlen (string) % 2 == 0)
+ string = g_strconcat (string, " ", NULL);
+ else
+ string = g_strconcat (" " , string, NULL);
+ }
+ }
+ else
+ {
+ while (strlen (string) != (len_minutes + inc_len - 1))
+ {
+ if (strlen (string) % 2 == 0)
+ string = g_strconcat (string, " ", NULL);
+ else
+ string = g_strconcat (" " , string, NULL);
+ }
+ }
}
}
else
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list