From: Nickolay V. Shmyrev Date: Sat, 4 Jun 2005 13:05:31 +0000 (+0000) Subject: Labels don't expand when the dialogue is resized X-Git-Tag: EVINCE_0_3_3~289 X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=3a5debb394dd45d4b802ab83e1249d9749fc4d84;p=evince.git Labels don't expand when the dialogue is resized strftime result needs to be converted to UTF-8. Thanks to chpe. --- diff --git a/ChangeLog b/ChangeLog index c7561ce2..665f6829 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2005-06-04 Nickolay V. Shmyrev + + * data/evince-properties.glade: + * shell/ev-properties.c: (ev_properties_format_date), + (set_property): + + Labels don't expand when the dialogue is resized. + strftime result needs to be converted to UTF-8. Thanks + to Christian Persch . + 2005-06-04 Marco Pesenti Gritti * data/evince-properties.glade: diff --git a/data/evince-properties.glade b/data/evince-properties.glade index c856b0ea..d900f37a 100644 --- a/data/evince-properties.glade +++ b/data/evince-properties.glade @@ -410,7 +410,7 @@ - + True True @@ -423,7 +423,7 @@ 0.5 0 0 - PANGO_ELLIPSIZE_END + PANGO_ELLIPSIZE_NONE -1 False 0 @@ -431,15 +431,15 @@ 1 2 - 0 - 1 + 6 + 7 fill - + True True @@ -452,7 +452,7 @@ 0.5 0 0 - PANGO_ELLIPSIZE_END + PANGO_ELLIPSIZE_NONE -1 False 0 @@ -460,15 +460,15 @@ 1 2 - 1 - 2 + 7 + 8 fill - + True True @@ -481,7 +481,7 @@ 0.5 0 0 - PANGO_ELLIPSIZE_END + PANGO_ELLIPSIZE_NONE -1 False 0 @@ -489,15 +489,15 @@ 1 2 - 2 - 3 + 8 + 9 fill - + True True @@ -510,7 +510,7 @@ 0.5 0 0 - PANGO_ELLIPSIZE_END + PANGO_ELLIPSIZE_NONE -1 False 0 @@ -518,15 +518,15 @@ 1 2 - 3 - 4 + 9 + 10 fill - + True True @@ -539,7 +539,7 @@ 0.5 0 0 - PANGO_ELLIPSIZE_END + PANGO_ELLIPSIZE_NONE -1 False 0 @@ -547,15 +547,15 @@ 1 2 - 4 - 5 + 10 + 11 fill - + True True @@ -568,7 +568,7 @@ 0.5 0 0 - PANGO_ELLIPSIZE_END + PANGO_ELLIPSIZE_NONE -1 False 0 @@ -576,15 +576,15 @@ 1 2 - 5 - 6 + 11 + 12 fill - + True True @@ -597,7 +597,7 @@ 0.5 0 0 - PANGO_ELLIPSIZE_NONE + PANGO_ELLIPSIZE_END -1 False 0 @@ -605,15 +605,14 @@ 1 2 - 6 - 7 - fill + 5 + 6 - + True True @@ -626,7 +625,7 @@ 0.5 0 0 - PANGO_ELLIPSIZE_NONE + PANGO_ELLIPSIZE_END -1 False 0 @@ -634,15 +633,14 @@ 1 2 - 7 - 8 - fill + 4 + 5 - + True True @@ -655,7 +653,7 @@ 0.5 0 0 - PANGO_ELLIPSIZE_NONE + PANGO_ELLIPSIZE_END -1 False 0 @@ -663,15 +661,14 @@ 1 2 - 8 - 9 - fill + 3 + 4 - + True True @@ -684,7 +681,7 @@ 0.5 0 0 - PANGO_ELLIPSIZE_NONE + PANGO_ELLIPSIZE_END -1 False 0 @@ -692,15 +689,14 @@ 1 2 - 9 - 10 - fill + 2 + 3 - + True True @@ -713,7 +709,7 @@ 0.5 0 0 - PANGO_ELLIPSIZE_NONE + PANGO_ELLIPSIZE_END -1 False 0 @@ -721,15 +717,14 @@ 1 2 - 10 - 11 - fill + 1 + 2 - + True True @@ -742,7 +737,7 @@ 0.5 0 0 - PANGO_ELLIPSIZE_NONE + PANGO_ELLIPSIZE_END -1 False 0 @@ -750,9 +745,8 @@ 1 2 - 11 - 12 - fill + 0 + 1 @@ -785,33 +779,6 @@ tab - - - - - - - - True - Font Properties - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - 0 diff --git a/shell/ev-properties.c b/shell/ev-properties.c index 4d904653..78c2f147 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 *