diff options
author | Nickolay V. Shmyrev <nshmyrev@src.gnome.org> | 2005-06-04 13:05:31 (GMT) |
---|---|---|
committer | Nickolay V. Shmyrev <nshmyrev@src.gnome.org> | 2005-06-04 13:05:31 (GMT) |
commit | 3a5debb394dd45d4b802ab83e1249d9749fc4d84 (patch) | |
tree | 8d3a1589d48323abab6aa8fd9eb8d77e47c5861a /shell | |
parent | 0e3d97f97936012684b84e085fa5b1ed33cb9da5 (diff) |
Labels don't expand when the dialogue is resized
strftime result needs to be converted to UTF-8. Thanks to chpe.
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ev-properties.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/shell/ev-properties.c b/shell/ev-properties.c index 4d90465..78c2f14 100644 --- a/shell/ev-properties.c +++ b/shell/ev-properties.c @@ -68,18 +68,21 @@ static const PropertyInfo properties_info[] = { }; /* Returns a locale specific date and time representation */ -static gchar * +static char * ev_properties_format_date (GTime utime) { - struct tm *time; - gchar *date_string; - - date_string = g_new0 (char, 101); - - time = localtime ((const time_t *) &utime); - strftime (date_string, 100, "%c", time); - - return date_string; + time_t time = (time_t) utime; + struct tm t; + char s[256]; + const char *fmt_hack = "%c"; + size_t len; + + if (!localtime_r (&time, &t)) return NULL; + + len = strftime (s, sizeof (s), fmt_hack, &t); + if (len == 0 || s[0] == '\0') return NULL; + + return g_locale_to_utf8 (s, -1, NULL, NULL, NULL); } static void @@ -89,7 +92,8 @@ set_property (GladeXML *xml, Property property, const char *text) widget = glade_xml_get_widget (xml, properties_info[property].label_id); g_return_if_fail (GTK_IS_LABEL (widget)); - gtk_label_set_text (GTK_LABEL (widget), text); + + gtk_label_set_text (GTK_LABEL (widget), text ? text : ""); } GtkDialog * |