summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClement Lefebvre <[email protected]>2019-12-11 15:47:51 +0000
committermonsta <[email protected]>2019-12-13 15:19:22 +0300
commit7f564d47dc11221d849da5c2d57412722c016514 (patch)
treea170565460a054fff765dfe604871b15d54f427b
parent1b8b948b13aa7d04e247fae09ddd31f250c433c3 (diff)
downloadmate-panel-7f564d47dc11221d849da5c2d57412722c016514.tar.bz2
mate-panel-7f564d47dc11221d849da5c2d57412722c016514.tar.xz
Clock applet: Fix string comparison
-rw-r--r--applets/clock/clock.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/applets/clock/clock.c b/applets/clock/clock.c
index 3d462a9a..21f0d3e6 100644
--- a/applets/clock/clock.c
+++ b/applets/clock/clock.c
@@ -428,6 +428,7 @@ get_updated_timeformat (ClockData *cd)
char *clock_format;
const gchar *env_language;
const gchar *env_lc_time;
+ gboolean use_lctime;
/* Override LANGUAGE with the LC_TIME environment variable
* This is needed for gettext to fetch our clock format
@@ -435,7 +436,9 @@ get_updated_timeformat (ClockData *cd)
*/
env_language = g_getenv("LANGUAGE");
env_lc_time = g_getenv("LC_TIME");
- if (env_language != NULL && env_lc_time != NULL && env_language != env_lc_time) {
+ use_lctime = (env_language != NULL) && (env_lc_time != NULL) && (g_strcmp0 (env_language, env_lc_time) != 0);
+
+ if (use_lctime) {
g_setenv("LANGUAGE", env_lc_time, TRUE);
}
@@ -480,7 +483,7 @@ get_updated_timeformat (ClockData *cd)
}
/* Set back LANGUAGE the way it was before */
- if (env_language != NULL && env_lc_time != NULL && env_language != env_lc_time) {
+ if (use_lctime) {
g_setenv("LANGUAGE", env_language, TRUE);
}