diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2013-05-06 17:51:48 -0500 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2013-05-06 17:51:48 -0500 |
commit | a2c380c8f271486eb6dfeb82a46ca7a95aca85c5 (patch) | |
tree | 798ae901c18c8b5bb36414de46f43a93e99e42ed | |
parent | 76422d4997401b8f278b7316a23a324655c12c92 (diff) | |
download | ayatana-indicator-datetime-a2c380c8f271486eb6dfeb82a46ca7a95aca85c5.tar.gz ayatana-indicator-datetime-a2c380c8f271486eb6dfeb82a46ca7a95aca85c5.tar.bz2 ayatana-indicator-datetime-a2c380c8f271486eb6dfeb82a46ca7a95aca85c5.zip |
in timezone-file, check to see if the new timezone differs from the old one before emitting a property-change notification
-rw-r--r-- | src/timezone-file.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/timezone-file.c b/src/timezone-file.c index c7c2cf6..3a83c5a 100644 --- a/src/timezone-file.c +++ b/src/timezone-file.c @@ -62,15 +62,22 @@ reload (IndicatorDatetimeTimezoneFile * self) if (!g_file_get_contents (p->filename, &new_timezone, NULL, &err)) { - g_warning ("Unable to read timezone file '%s': %s", p->filename, err->message); + g_warning ("%s Unable to read timezone file '%s': %s", G_STRLOC, p->filename, err->message); g_error_free (err); } else { g_strstrip (new_timezone); - g_free (p->timezone); - p->timezone = new_timezone; - indicator_datetime_timezone_notify_timezone (INDICATOR_DATETIME_TIMEZONE(self)); + + if (g_strcmp0 (p->timezone, new_timezone)) + { + g_free (p->timezone); + p->timezone = g_strdup (new_timezone); + g_debug ("%s new timezone set: '%s'", G_STRLOC, p->timezone); + indicator_datetime_timezone_notify_timezone (INDICATOR_DATETIME_TIMEZONE(self)); + } + + g_free (new_timezone); } } @@ -91,13 +98,13 @@ set_filename (IndicatorDatetimeTimezoneFile * self, const char * filename) p->monitor = g_file_monitor_file (p->file, G_FILE_MONITOR_NONE, NULL, &err); if (err != NULL) { - g_warning ("Unable to monitor timezone file '%s': %s", TIMEZONE_FILE, err->message); + g_warning ("%s Unable to monitor timezone file '%s': %s", G_STRLOC, TIMEZONE_FILE, err->message); g_error_free (err); } else { g_signal_connect_swapped (p->monitor, "changed", G_CALLBACK(reload), self); - g_debug ("Monitoring timezone file '%s'", p->filename); + g_debug ("%s Monitoring timezone file '%s'", G_STRLOC, p->filename); } reload (self); |