aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorPhilip Van Hoof <pvanhoof@gnome.org>2005-05-09 17:07:35 +0800
committerPhilip Van Hoof <pvanhoof@src.gnome.org>2005-05-09 17:07:35 +0800
commit71b1d2839752a246a4bc7855da634ebb7eab0ba0 (patch)
tree0f8c6beb6e0ce3c538269194825af785adbbe72a /plugins
parent11ab256b53c3542ef5e838ff89ca4f4cd212691e (diff)
downloadgsoc2013-evolution-71b1d2839752a246a4bc7855da634ebb7eab0ba0.tar.gz
gsoc2013-evolution-71b1d2839752a246a4bc7855da634ebb7eab0ba0.tar.zst
gsoc2013-evolution-71b1d2839752a246a4bc7855da634ebb7eab0ba0.zip
Fixes for Bug #73099 and Bug #73098 Changed malloc to g_malloc and char to
2005-03-02 Philip Van Hoof <pvanhoof@gnome.org> * rdf-format.c: Fixes for Bug #73099 and Bug #73098 * csv-format.c: Changed malloc to g_malloc and char to gchar * csv-format.c: Fixes for Bug #73099 and Bug #73098 svn path=/trunk/; revision=29314
Diffstat (limited to 'plugins')
-rw-r--r--plugins/save-calendar/ChangeLog6
-rw-r--r--plugins/save-calendar/csv-format.c80
-rw-r--r--plugins/save-calendar/rdf-format.c25
3 files changed, 77 insertions, 34 deletions
diff --git a/plugins/save-calendar/ChangeLog b/plugins/save-calendar/ChangeLog
index d627f5072a..d3cd35f256 100644
--- a/plugins/save-calendar/ChangeLog
+++ b/plugins/save-calendar/ChangeLog
@@ -1,3 +1,9 @@
+2005-03-02 Philip Van Hoof <pvanhoof@gnome.org>
+
+ * rdf-format.c: Fixes for Bug #73099 and Bug #73098
+ * csv-format.c: Changed malloc to g_malloc and char to gchar
+ * csv-format.c: Fixes for Bug #73099 and Bug #73098
+
2005-05-06 Not Zed <NotZed@Ximian.com>
* Makefile.am:
diff --git a/plugins/save-calendar/csv-format.c b/plugins/save-calendar/csv-format.c
index 2acf1eee27..2f9f2ec53e 100644
--- a/plugins/save-calendar/csv-format.c
+++ b/plugins/save-calendar/csv-format.c
@@ -34,6 +34,8 @@
#include <gtk/gtkstock.h>
#include <gtk/gtk.h>
#include <libedataserver/e-source.h>
+#include <libecal/e-cal-time-util.h>
+#include <libedataserver/e-util.h>
#include <libedataserverui/e-source-selector.h>
#include <libecal/e-cal.h>
#include "calendar/common/authentication.h"
@@ -156,25 +158,34 @@ add_nummeric_to_csv (GString *line, gint *nummeric, CsvConfig *config)
static GString *
add_time_to_csv (GString *line, icaltimetype *time, CsvConfig *config)
{
- /*
- * Perhaps we should check for quotes, delimiter and newlines in the
- * resulting string: The translators can put it there!
- *
- * Or perhaps we shouldn't make this translatable?
- * Or perhaps there is a library-function to do this?
- */
if (time) {
- g_string_append_printf (line, _("%s%d/%s%d/%s%d %s%d:%s%d:%s%d"),
- (time->month < 10)?"0":"", time->month,
- (time->day < 10)?"0":"", time->day,
- (time->year < 10)?"0":"", time->year,
- (time->hour < 10)?"0":"", time->hour,
- (time->minute < 10)?"0":"", time->minute,
- (time->second < 10)?"0":"", time->second);
+ gboolean needquotes = FALSE;
+ struct tm mytm = icaltimetype_to_tm (time);
+ gchar *str = (gchar*) g_malloc (sizeof (gchar) * 200);
+
+ /*
+ * Translator: the %F %T is the thirth argument for a strftime function.
+ * It lets you define the formatting of the date in the csv-file.
+ * */
+ e_utf8_strftime (str, 200, _("%F %T"), &mytm);
+
+ needquotes = string_needsquotes (str, config);
+
+ if (needquotes)
+ line = g_string_append (line, config->quote);
+
+ line = g_string_append (line, str);
+
+ if (needquotes)
+ line = g_string_append (line, config->quote);
+
+ g_free (str);
+
}
line = g_string_append (line, config->delimiter);
+
return line;
}
@@ -353,7 +364,7 @@ do_save_calendar_csv (FormatHandler *handler, EPlugin *ep, ECalPopupTargetSource
result = gnome_vfs_open_uri (&handle, uri, GNOME_VFS_OPEN_READ);
if (result == GNOME_VFS_OK)
- doit = e_error_run(gtk_widget_get_toplevel (GTK_WIDGET (target->selector)),
+ doit = e_error_run(GTK_WINDOW(gtk_widget_get_toplevel (GTK_WIDGET (target->selector))),
E_ERROR_ASK_FILE_EXISTS_OVERWRITE, dest_uri, NULL) == GTK_RESPONSE_OK;
if (doit) {
@@ -367,16 +378,37 @@ do_save_calendar_csv (FormatHandler *handler, EPlugin *ep, ECalPopupTargetSource
if (result == GNOME_VFS_OK && doit && e_cal_get_object_list_as_comp (source_client, "#t", &objects, NULL)) {
if (config->header) {
+
+ gint i=0;
+
+ static gchar *labels[] = {
+ N_("Uid"),
+ N_("Summary"),
+ N_("Description List"),
+ N_("Categories List"),
+ N_("Comment List"),
+ N_("Completed"),
+ N_("Created"),
+ N_("Contact List"),
+ N_("Start"),
+ N_("End"),
+ N_("Due"),
+ N_("percent Done"),
+ N_("Priority"),
+ N_("Url"),
+ N_("Attendees List"),
+ N_("Location"),
+ N_("Modified"),
+ };
+
line = g_string_new ("");
- g_string_append_printf (line, _("Uid%sSummary%sDescription List%sCategories List%s"
- "Comment List%sCompleted%sCreated%sContact List%s"
- "Start%sEnd%sDue%sPercent Done%sPriority%sUrl%s"
- "Attendees List%sLocation%sModified%s"),
- config->delimiter, config->delimiter, config->delimiter, config->delimiter,
- config->delimiter, config->delimiter, config->delimiter, config->delimiter,
- config->delimiter, config->delimiter, config->delimiter, config->delimiter,
- config->delimiter, config->delimiter, config->delimiter, config->delimiter,
- config->newline);
+ for (i=0;i<G_N_ELEMENTS(labels);i++) {
+ if (i>0)
+ line = g_string_append(line, config->delimiter);
+ line = g_string_append(line, _(labels[i]));
+ }
+
+ line = g_string_append (line, config->newline);
gnome_vfs_write (handle, line->str, line->len, NULL);
g_string_free (line, TRUE);
diff --git a/plugins/save-calendar/rdf-format.c b/plugins/save-calendar/rdf-format.c
index 41b1ba5517..ff64ed5ec8 100644
--- a/plugins/save-calendar/rdf-format.c
+++ b/plugins/save-calendar/rdf-format.c
@@ -38,6 +38,8 @@
#include <libecal/e-cal.h>
#include <calendar/gui/e-cal-popup.h>
#include <libgnomevfs/gnome-vfs.h>
+#include <libecal/e-cal-time-util.h>
+#include <libedataserver/e-util.h>
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
@@ -62,18 +64,18 @@ add_string_to_rdf (xmlNodePtr node, const gchar *tag, const char *value);
#define CALENDAR_CONFIG_PREFIX "/apps/evolution/calendar"
#define CALENDAR_CONFIG_TIMEZONE CALENDAR_CONFIG_PREFIX "/display/timezone"
-GConfClient *config = NULL;
+static GConfClient *config = NULL;
static gchar *
calendar_config_get_timezone (void)
{
+
gchar *retval = NULL;
if (!config)
config = gconf_client_get_default ();
retval = gconf_client_get_string (config, CALENDAR_CONFIG_TIMEZONE, NULL);
-
if (!retval)
retval = g_strdup ("UTC");
@@ -144,14 +146,17 @@ add_time_to_rdf (xmlNodePtr node, const gchar *tag, icaltimetype *time)
{
if (time) {
xmlNodePtr cur_node = NULL;
+ struct tm mytm = icaltimetype_to_tm (time);
+ gchar *str = (gchar*) g_malloc (sizeof (gchar) * 200);
gchar *tmp = NULL;
- gchar *str = g_strdup_printf ("%s%d-%s%d-%s%dT%s%d:%s%d:%s%d",
- (time->year < 10)?"0":"", time->year,
- (time->month < 10)?"0":"", time->month,
- (time->day < 10)?"0":"", time->day,
- (time->hour < 10)?"0":"", time->hour,
- (time->minute < 10)?"0":"", time->minute,
- (time->second < 10)?"0":"", time->second);
+
+ /*
+ * Translator: the %FT%T is the thirth argument for a strftime function.
+ * It lets you define the formatting of the date in the rdf-file.
+ * Also check out http://www.w3.org/2002/12/cal/tzd
+ * */
+ e_utf8_strftime (str, 200, _("%FT%T"), &mytm);
+
cur_node = xmlNewChild (node, NULL, tag, str);
/* Not sure about this property */
@@ -218,7 +223,7 @@ do_save_calendar_rdf (FormatHandler *handler, EPlugin *ep, ECalPopupTargetSource
result = gnome_vfs_open_uri (&handle, uri, GNOME_VFS_OPEN_READ);
if (result == GNOME_VFS_OK)
- doit = e_error_run(gtk_widget_get_toplevel (GTK_WIDGET (target->selector)),
+ doit = e_error_run(GTK_WINDOW(gtk_widget_get_toplevel (GTK_WIDGET (target->selector))),
E_ERROR_ASK_FILE_EXISTS_OVERWRITE, dest_uri, NULL) == GTK_RESPONSE_OK;
if (doit) {