Re: [evolution-patches] Patch for bug#36247
- From: Vardhman Jain <vardhman students iiit net>
- To: Jeffrey Stedfast <fejj ximian com>
- Cc: evolution-patches lists ximian com
- Subject: Re: [evolution-patches] Patch for bug#36247
- Date: Sat, 5 Jun 2004 11:30:29 +0530 (IST)
Thanks Jeff, I have now updated the code with your suggestion.
Vardhman
On Fri, 4 Jun 2004, Jeffrey Stedfast wrote:
> Date: Fri, 04 Jun 2004 19:29:45 -0400
> From: Jeffrey Stedfast <fejj ximian com>
> To: Vardhman Jain <vardhman students iiit net>
> Cc: evolution-patches lists ximian com
> Subject: Re: [evolution-patches] Patch for bug#36247
>
> I think what you actually want to do is something more like the
> following:
>
> str = g_strdup_printf ("<b>%s:</b>", _("Starts"));
> write_label_piece (itip, &datetime, buffer, 1024, str, "<br>", FALSE);
> g_free (str);
>
> Using really long variable names is generally frowned upon because it
> means a lot of typing (plus it's kinda ugly).
>
> You also want to avoid using static sized buffers since you don't really
> know how long the translated string will be. I'm sure 1024 is probably
> enough, but it also wastes a lot of space :-)
> Besides, if you were really going to use a static sized buffer with
> sprintf, you'd at the very least want to use snprintf instead.
>
> Jeff
>
> On Sat, 2004-06-05 at 03:50 +0530, Vardhman Jain wrote:
> > To improved the performance of the translation function _(str) for a
> > particular kind of frequently occurring string.
> >
> >
> > Vardhman
> >
>
--
Vardhman Jain
III Year B.Tech. CSE
IIIT-Hyderabad
Address:
Room No 27, NBH, IIIT-Hyderabad,Hyderabad 500019
presence on net:
http://students.iiit.net/~vardhman
Index: gui/e-itip-control.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-itip-control.c,v
retrieving revision 1.145
diff -u -r1.145 e-itip-control.c
--- a/gui/e-itip-control.c 11 May 2004 22:05:03 -0000 1.145
+++ b/gui/e-itip-control.c 5 Jun 2004 05:58:22 -0000
@@ -679,6 +679,7 @@
EItipControlPrivate *priv;
ECalComponentDateTime datetime;
static char buffer[1024];
+ gchar *str;
gboolean wrote = FALSE, task_completed = FALSE;
ECalComponentVType type;
@@ -689,20 +690,24 @@
buffer[0] = '\0';
e_cal_component_get_dtstart (comp, &datetime);
if (datetime.value) {
+ str=g_strdup_printf("<b> %s </b>",_("Start"));
write_label_piece (itip, &datetime, buffer, 1024,
- _("<b>Starts:</b> "),
+ str,
"<br>", FALSE);
gtk_html_write (html, html_stream, buffer, strlen(buffer));
wrote = TRUE;
+ g_free(str);
}
e_cal_component_free_datetime (&datetime);
buffer[0] = '\0';
e_cal_component_get_dtend (comp, &datetime);
if (datetime.value){
- write_label_piece (itip, &datetime, buffer, 1024, _("<b>Ends:</b> "), "<br>", FALSE);
+ str=g_strdup_printf("<b> %s </b>",_("Ends"));
+ write_label_piece (itip, &datetime, buffer, 1024, str, "<br>", FALSE);
gtk_html_write (html, html_stream, buffer, strlen (buffer));
wrote = TRUE;
+ g_free(str);
}
e_cal_component_free_datetime (&datetime);
@@ -719,20 +724,24 @@
if (type == E_CAL_COMPONENT_TODO && datetime.value) {
/* Pass TRUE as is_utc, so it gets converted to the current
timezone. */
+ str=g_strdup_printf("<b> %s </b>",_("Completed"));
datetime.value->is_utc = TRUE;
- write_label_piece (itip, &datetime, buffer, 1024, _("<b>Completed:</b> "), "<br>", FALSE);
+ write_label_piece (itip, &datetime, buffer, 1024, str, "<br>", FALSE);
gtk_html_write (html, html_stream, buffer, strlen (buffer));
wrote = TRUE;
task_completed = TRUE;
+ g_free(str);
}
e_cal_component_free_datetime (&datetime);
buffer[0] = '\0';
e_cal_component_get_due (comp, &datetime);
if (type == E_CAL_COMPONENT_TODO && !task_completed && datetime.value) {
- write_label_piece (itip, &datetime, buffer, 1024, _("<b>Due:</b> "), "<br>", FALSE);
+ str=g_strdup_printf("<b> %s </b>",_("Due"));
+ write_label_piece (itip, &datetime, buffer, 1024, str, "<br>", FALSE);
gtk_html_write (html, html_stream, buffer, strlen (buffer));
wrote = TRUE;
+ g_free(str);
}
e_cal_component_free_datetime (&datetime);
@@ -814,7 +823,7 @@
gchar *html;
const gchar *const_html;
gchar *filename;
-
+ gchar *str;
priv = itip->priv;
if (priv->html == NULL)
@@ -922,9 +931,12 @@
/* Summary */
e_cal_component_get_summary (priv->comp, &text);
- html = text.value ? camel_text_to_html (text.value, CAMEL_MIME_FILTER_TOHTML_CONVERT_NL, 0) : _("<i>None</i>");
+ str=g_strdup_printf("<i> %s </i>",_("None"));
+
+ html = text.value ? camel_text_to_html (text.value, CAMEL_MIME_FILTER_TOHTML_CONVERT_NL, 0) : str;
gtk_html_stream_printf (html_stream, "<b>%s</b><br>%s<br><br>",
_("Summary:"), html);
+ g_free(str);
if (text.value)
g_free (html);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]