summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac4
-rw-r--r--src/lib/elm_datetime.c32
2 files changed, 33 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index c820e29d8..f735415e1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -124,7 +124,7 @@ ELM_WINCE_DEF="#undef"
124have_windows="no" 124have_windows="no"
125have_dlopen="no" 125have_dlopen="no"
126case "$host_os" in 126case "$host_os" in
127 mingw32ce* | cegcc*) 127 mingw32ce*)
128 PKG_CHECK_MODULES([EVIL], [evil]) 128 PKG_CHECK_MODULES([EVIL], [evil])
129 AC_DEFINE(HAVE_EVIL, 1, [Set to 1 if evil package is installed.]) 129 AC_DEFINE(HAVE_EVIL, 1, [Set to 1 if evil package is installed.])
130 lt_enable_auto_import="-Wl,--enable-auto-import" 130 lt_enable_auto_import="-Wl,--enable-auto-import"
@@ -652,6 +652,8 @@ if test "x${have_mman}" = "xyes"; then
652 AC_DEFINE(HAVE_MMAN_H, 1, [Have sys/mman.h header file]) 652 AC_DEFINE(HAVE_MMAN_H, 1, [Have sys/mman.h header file])
653fi 653fi
654 654
655AC_CHECK_HEADERS([locale.h langinfo.h])
656
655my_libs="-lm" 657my_libs="-lm"
656AC_SUBST(my_libs) 658AC_SUBST(my_libs)
657AC_SUBST(requirement_elm) 659AC_SUBST(requirement_elm)
diff --git a/src/lib/elm_datetime.c b/src/lib/elm_datetime.c
index d4b92c8e3..4896ee1d7 100644
--- a/src/lib/elm_datetime.c
+++ b/src/lib/elm_datetime.c
@@ -1,8 +1,14 @@
1#include <locale.h>
2#include <langinfo.h>
3#include <Elementary.h> 1#include <Elementary.h>
4#include "elm_priv.h" 2#include "elm_priv.h"
5 3
4#ifdef HAVE_LOCALE_H
5# include <locale.h>
6#endif
7
8#ifdef HAVE_LANGINFO_H
9# include <langinfo.h>
10#endif
11
6typedef struct _Widget_Data Widget_Data; 12typedef struct _Widget_Data Widget_Data;
7typedef struct _Datetime_Field Datetime_Field; 13typedef struct _Datetime_Field Datetime_Field;
8typedef struct _Datetime_Mod_Api Datetime_Mod_Api; 14typedef struct _Datetime_Mod_Api Datetime_Mod_Api;
@@ -545,6 +551,7 @@ _field_list_arrange(Evas_Object *obj)
545 _field_list_display(obj); 551 _field_list_display(obj);
546} 552}
547 553
554// FIXME: provide nl_langinfo on Windows if possible
548// returns expanded format string for corresponding multi-field format character 555// returns expanded format string for corresponding multi-field format character
549static char * 556static char *
550_expanded_fmt_str_get(char ch) 557_expanded_fmt_str_get(char ch)
@@ -553,16 +560,32 @@ _expanded_fmt_str_get(char ch)
553 switch (ch) 560 switch (ch)
554 { 561 {
555 case 'c': 562 case 'c':
563#ifdef HAVE_LANGINFO_H
556 exp_fmt = nl_langinfo(D_T_FMT); 564 exp_fmt = nl_langinfo(D_T_FMT);
565#else
566 exp_fmt = "";
567#endif
557 break; 568 break;
558 case 'x': 569 case 'x':
570#ifdef HAVE_LANGINFO_H
559 exp_fmt = nl_langinfo(D_FMT); 571 exp_fmt = nl_langinfo(D_FMT);
572#else
573 exp_fmt = "";
574#endif
560 break; 575 break;
561 case 'X': 576 case 'X':
577#ifdef HAVE_LANGINFO_H
562 exp_fmt = nl_langinfo(T_FMT); 578 exp_fmt = nl_langinfo(T_FMT);
579#else
580 exp_fmt = "";
581#endif
563 break; 582 break;
564 case 'r': 583 case 'r':
584#ifdef HAVE_LANGINFO_H
565 exp_fmt = nl_langinfo(T_FMT_AMPM); 585 exp_fmt = nl_langinfo(T_FMT_AMPM);
586#else
587 exp_fmt = "";
588#endif
566 break; 589 break;
567 case 'R': 590 case 'R':
568 exp_fmt = "%H:%M"; 591 exp_fmt = "%H:%M";
@@ -680,9 +703,14 @@ _reload_format(Evas_Object *obj)
680 wd = elm_widget_data_get(obj); 703 wd = elm_widget_data_get(obj);
681 if (!wd) return; 704 if (!wd) return;
682 705
706 // FIXME: provide nl_langinfo on Windows if possible
683 // fetch the default format from Libc. 707 // fetch the default format from Libc.
684 if (!wd->user_format) 708 if (!wd->user_format)
709#ifdef HAVE_LANGINFO_H
685 strncpy(wd->format, nl_langinfo(D_T_FMT), MAX_FORMAT_LEN); 710 strncpy(wd->format, nl_langinfo(D_T_FMT), MAX_FORMAT_LEN);
711#else
712 strncpy(wd->format, "", MAX_FORMAT_LEN);
713#endif
686 714
687 dt_fmt = (char *)malloc(MAX_FORMAT_LEN); 715 dt_fmt = (char *)malloc(MAX_FORMAT_LEN);
688 strncpy(dt_fmt, wd->format, MAX_FORMAT_LEN); 716 strncpy(dt_fmt, wd->format, MAX_FORMAT_LEN);