Author: juha
Date: 2007-02-03 22:52:27 +0000 (Sat, 03 Feb 2007)
New Revision: 24839
Modified:
xfcalendar/trunk/src/appointment.c
xfcalendar/trunk/src/appointment.h
xfcalendar/trunk/src/functions.c
xfcalendar/trunk/src/functions.h
Log:
Annoying! I can't get nls working in functions.c.so I need to return two
functions, which include i18 code into appointment.c
Very annoying, but I do not have time to fight this more now.
Modified: xfcalendar/trunk/src/appointment.c
===================================================================
--- xfcalendar/trunk/src/appointment.c 2007-02-03 22:05:11 UTC (rev 24838)
+++ xfcalendar/trunk/src/appointment.c 2007-02-03 22:52:27 UTC (rev 24839)
@@ -62,6 +62,57 @@
static void fill_appt_window(appt_win *apptw, char *action, char *par);
+
+/* FIXME: moved form functions. because, these do not work there!
+ * I do not know why NLS does not work here. Very annoying!
+ * */
+struct tm orage_i18_date_to_tm_date(const char *i18_date)
+{
+ const char *date_format;
+ char *ret;
+ struct tm tm_date = {0,0,0,0,0,0,0,0,0};
+
+ date_format = _("%m/%d/%Y");
+ /*
+ g_print("format: %s (%s) %s\n", date_format, _("%m/%d/%Y"), "%m/%d/%Y");
+ */
+ ret = (char *)strptime(i18_date, date_format, &tm_date);
+ if (ret == NULL)
+ g_error("Orage: orage_i18_date_to_tm_date wrong format (%s)"
+ , i18_date);
+ else if (strlen(ret))
+ g_error("Orage: orage_i18_date_to_tm_date too long format (%s)"
+ , i18_date);
+ return(tm_date);
+}
+
+char *orage_tm_date_to_i18_date(struct tm tm_date)
+{
+ const char *date_format;
+ static char i18_date[32];
+ /*
+ struct tm d = {0,0,0,0,0,0,0,0,0};
+ */
+
+ date_format = _("%m/%d/%Y");
+ /*
+ g_print("format: %s\n", date_format);
+ g_print("format: %s (%s) %s\n", date_format, _("%m/%d/%Y"), "%m/%d/%Y");
+ */
+ /*
+ d.tm_mday = day;
+ d.tm_mon = month - 1;
+ d.tm_year = year - 1900;
+ */
+
+ if (strftime(i18_date, 32, date_format, &tm_date))
+ return(i18_date);
+ else {
+ g_error("Orage: orage_tm_date_to_i18_date too long string in
strftime"); return(NULL);
+ }
+}
+
+
static gboolean ical_to_year_month_day_hour_minute(char *ical
, int *year, int *month, int *day, int *hour, int *minute)
{
Modified: xfcalendar/trunk/src/appointment.h
===================================================================
--- xfcalendar/trunk/src/appointment.h 2007-02-03 22:05:11 UTC (rev 24838)
+++ xfcalendar/trunk/src/appointment.h 2007-02-03 22:52:27 UTC (rev 24839)
@@ -157,4 +157,8 @@
appt_win *create_appt_win(char *action, char *par, el_win *el);
+struct tm orage_i18_date_to_tm_date(const char *display);
+
+char *orage_tm_date_to_i18_date(struct tm tm_date);
+
#endif /* !__APPOINTMENT_H__ */
Modified: xfcalendar/trunk/src/functions.c
===================================================================
--- xfcalendar/trunk/src/functions.c 2007-02-03 22:05:11 UTC (rev 24838)
+++ xfcalendar/trunk/src/functions.c 2007-02-03 22:52:27 UTC (rev 24839)
@@ -35,10 +35,13 @@
/**************************************
- * Functions for drawing interfaces *
+ * General purpose helper functions *
**************************************/
-
+/* FIXME: moved to appointment.c, because these do not work here!
+ * I do not know why NLS does not work here. Very annoying!
+ * */
+/*
struct tm orage_i18_date_to_tm_date(const char *i18_date)
{
const char *date_format;
@@ -46,6 +49,7 @@
struct tm tm_date = {0,0,0,0,0,0,0,0,0};
date_format = _("%m/%d/%Y");
+ g_print("format: %s (%s) %s\n", date_format, _("%m/%d/%Y"), "%m/%d/%Y");
ret = (char *)strptime(i18_date, date_format, &tm_date);
if (ret == NULL)
g_error("Orage: orage_i18_date_to_tm_date wrong format (%s)"
@@ -60,16 +64,18 @@
{
const char *date_format;
static char i18_date[32];
- /*
+ / *
struct tm d = {0,0,0,0,0,0,0,0,0};
- */
+ * /
date_format = _("%m/%d/%Y");
- /*
+ g_print("format: %s\n", date_format);
+ g_print("format: %s (%s) %s\n", date_format, _("%m/%d/%Y"), "%m/%d/%Y");
+ / *
d.tm_mday = day;
d.tm_mon = month - 1;
d.tm_year = year - 1900;
- */
+ * /
if (strftime(i18_date, 32, date_format, &tm_date))
return(i18_date);
@@ -78,6 +84,7 @@
return(NULL);
}
}
+*/
GtkWidget *orage_toolbar_append_button(GtkWidget *toolbar
, const gchar *stock_id, GtkTooltips *tooltips, const char *tooltip_text
Modified: xfcalendar/trunk/src/functions.h
===================================================================
--- xfcalendar/trunk/src/functions.h 2007-02-03 22:05:11 UTC (rev 24838)
+++ xfcalendar/trunk/src/functions.h 2007-02-03 22:52:27 UTC (rev 24839)
@@ -55,7 +55,9 @@
void orage_select_today(GtkCalendar *cal);
+/*
struct tm orage_i18_date_to_tm_date(const char *display);
char *orage_tm_date_to_i18_date(struct tm tm_date);
+*/
#endif /* !__ORAGE_FUNCTIONS_H__ */
_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits