diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/datetime-prefs-locations.c | 3 | ||||
-rw-r--r-- | src/datetime-service.c | 27 | ||||
-rw-r--r-- | src/indicator-datetime.c | 12 | ||||
-rw-r--r-- | src/utils.c | 6 |
4 files changed, 33 insertions, 15 deletions
diff --git a/src/datetime-prefs-locations.c b/src/datetime-prefs-locations.c index af0e10d..d865efe 100644 --- a/src/datetime-prefs-locations.c +++ b/src/datetime-prefs-locations.c @@ -421,6 +421,7 @@ datetime_setup_locations_dialog (CcTimezoneMap * map) { GError * error = NULL; GtkBuilder * builder = gtk_builder_new (); + gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE); gtk_builder_add_from_file (builder, DATETIME_DIALOG_UI_FILE, &error); if (error != NULL) { /* We have to abort, we can't continue without the ui file */ @@ -429,8 +430,6 @@ datetime_setup_locations_dialog (CcTimezoneMap * map) return NULL; } - gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE); - GSettings * conf = g_settings_new (SETTINGS_INTERFACE); #define WIG(name) GTK_WIDGET (gtk_builder_get_object (builder, name)) diff --git a/src/datetime-service.c b/src/datetime-service.c index 80c0b57..25572ee 100644 --- a/src/datetime-service.c +++ b/src/datetime-service.c @@ -1,3 +1,4 @@ +/*-*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* An indicator to time and date related information in the menubar. @@ -430,7 +431,10 @@ static guint ecaltimer = 0; static void start_ecal_timer(void) { - if (ecaltimer != 0) g_source_remove(ecaltimer); + if (ecaltimer != 0) { + g_source_remove(ecaltimer); + ecaltimer = 0; + } if (update_appointment_menu_items(NULL)) ecaltimer = g_timeout_add_seconds(60*5, update_appointment_menu_items, NULL); } @@ -438,7 +442,10 @@ start_ecal_timer(void) static void stop_ecal_timer(void) { - if (ecaltimer != 0) g_source_remove(ecaltimer); + if (ecaltimer != 0) { + g_source_remove(ecaltimer); + ecaltimer = 0; + } } static gboolean idle_start_ecal_timer (gpointer data) @@ -748,9 +755,10 @@ update_appointment_menu_items (gpointer user_data) for (l = comp_instances; l; l = l->next) { const struct comp_instance *ci = l->data; g_object_unref(ci->comp); - g_list_free(comp_instances); - comp_instances = NULL; } + g_list_free(comp_instances); + comp_instances = NULL; + } GSList *cal_list = gconf_client_get_list(gconf, "/apps/evolution/calendar/display/selected_calendars", GCONF_VALUE_STRING, &gerror); if (gerror) { @@ -759,6 +767,7 @@ update_appointment_menu_items (gpointer user_data) gerror = NULL; cal_list = NULL; } + // Generate instances for all sources for (g = e_source_list_peek_groups (sources); g; g = g->next) { ESourceGroup *group = E_SOURCE_GROUP (g->data); @@ -779,6 +788,7 @@ update_appointment_menu_items (gpointer user_data) g_debug("Failed to set ecal default timezone %s", gerror->message); g_error_free(gerror); gerror = NULL; + g_object_unref(ecal); continue; } @@ -786,8 +796,9 @@ update_appointment_menu_items (gpointer user_data) g_debug("Failed to get ecal sources %s", gerror->message); g_error_free(gerror); gerror = NULL; + g_object_unref(ecal); continue; - } + } const gchar *ecal_uid = e_source_peek_uid(source); gboolean match = FALSE; g_debug("Checking ecal_uid is enabled: %s", ecal_uid); @@ -798,10 +809,14 @@ update_appointment_menu_items (gpointer user_data) break; } } - if (!match) continue; + if (!match) { + g_object_unref(ecal); + continue; + } g_debug("ecal_uid is enabled, generating instances"); e_cal_generate_instances (ecal, t1, t2, (ECalRecurInstanceFn) populate_appointment_instances, (gpointer) source); + g_object_unref(ecal); } } g_debug("Number of ECalComponents returned: %d", g_list_length(comp_instances)); diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c index 339ea2f..8e5f421 100644 --- a/src/indicator-datetime.c +++ b/src/indicator-datetime.c @@ -1092,12 +1092,14 @@ guess_label_size (IndicatorDatetime * self) g_debug("Checking against %d possible times", timevals->len); gint check_time; for (check_time = 0; check_time < timevals->len; check_time++) { - gchar longstr[256]; - strftime(longstr, 256, self->priv->time_string, &(g_array_index(timevals, struct tm, check_time))); + struct tm * timeval = &g_array_index(timevals, struct tm, check_time); + GDateTime * dt = g_date_time_new_local(timeval->tm_year, timeval->tm_mon, timeval->tm_mday, timeval->tm_hour, timeval->tm_min, timeval->tm_sec); + gchar * timestr = g_date_time_format(dt, self->priv->time_string); - gchar * utf8 = g_locale_to_utf8(longstr, -1, NULL, NULL, NULL); - gint length = measure_string(style, context, utf8); - g_free(utf8); + gint length = measure_string(style, context, timestr); + + g_free(timestr); + g_date_time_unref(dt); if (length > *max_width) { *max_width = length; diff --git a/src/utils.c b/src/utils.c index 73c8ab2..e6de92a 100644 --- a/src/utils.c +++ b/src/utils.c @@ -161,7 +161,8 @@ T_(const char *msg) char *time_locale = g_strdup(setlocale(LC_TIME, NULL)); char *language = g_strdup(g_getenv("LANGUAGE")); char *rv; - g_unsetenv("LANGUAGE"); + if (language) + g_unsetenv("LANGUAGE"); setlocale(LC_MESSAGES, time_locale); /* Get the LC_TIME version */ @@ -169,7 +170,8 @@ T_(const char *msg) /* Put everything back the way it was */ setlocale(LC_MESSAGES, message_locale); - g_setenv("LANGUAGE", language, TRUE); + if (language) + g_setenv("LANGUAGE", language, TRUE); g_free(message_locale); g_free(time_locale); g_free(language); |