#include <stdbool.h>
#include <time.h>
-extern bool settings_clock_is_24h_set(bool *h24);
-extern bool settings_clock_set_24h(bool h24);
-extern bool settings_clock_is_time_automatic(bool *automatic);
-extern bool settings_clock_set_time_automatic(bool automatic);
-extern bool settings_clock_get_current_time(struct tm *current_time);
-extern bool settings_clock_set_current_time(struct tm *current_time);
+bool settings_clock_is_24h_set(bool *h24);
+bool settings_clock_set_24h(bool h24);
+bool settings_clock_is_time_automatic(bool *automatic);
+bool settings_clock_set_time_automatic(bool automatic);
+bool settings_clock_get_current_time(struct tm *current_time);
+bool settings_clock_set_current_time(struct tm *current_time);
+char *settings_clock_get_clock_status_str();
#endif /* SETTINGS_CLOCK_H_ */
#define STR_SELECT_COUNTRY "Select your country."
+#define STR_OFF "Off"
+#define STR_ON "On"
+#define STR_UNKNOWN "Unknown"
+
+
/* Size */
#define SIZE_STR 1024
-#include "data/system/settings_clock.h"
#include <vconf.h>
#include <alarm.h>
+#include <string.h>
+#include "define.h"
+#include "app_debug.h"
+#include "data/system/settings_clock.h"
+
+#define MAX_DATETIME_LENGTH 35
bool settings_clock_is_24h_set(bool *h24)
{
} else {
return (0 == vconf_set_int(VCONFKEY_REGIONFORMAT_TIME1224, VCONFKEY_TIME_FORMAT_12));
}
-
- return true;
}
bool settings_clock_is_time_automatic(bool *automatic)
return true;
}
+
+char *settings_clock_get_clock_status_str()
+{
+ bool automatic = false;
+ bool is24h = false;
+ time_t timer;
+ char str_buffer[MAX_DATETIME_LENGTH];
+ struct tm* tm_info;
+
+ if (!settings_clock_is_time_automatic(&automatic))
+ return NULL;
+
+ if (automatic) {
+ return strdup(STR_AUTO);
+ } else {
+ time(&timer);
+ tm_info = localtime(&timer);
+
+ if (!settings_clock_is_24h_set(&is24h)) {
+ _ERR("Cannot get 24h setting");
+ }
+
+ if (is24h) {
+ strftime(str_buffer, MAX_DATETIME_LENGTH, "%x %H:%M", tm_info);
+ } else {
+ strftime(str_buffer, MAX_DATETIME_LENGTH, "%x %I:%M %p", tm_info);
+ }
+
+ return strdup(str_buffer);
+ }
+}
#include <system_settings.h>
#include <utils_i18n.h>
#include "app_debug.h"
+#include "define.h"
#include "data/system/settings_language.h"
#define LANG_LOCALE_STR_L 6
#define LANG_DISPLAY_STR_L 64
-#define LOCALE_UNKNOWN "Unknown"
-
static char *lang_str[LANG_TYPE_MAX] = { "en_US", "ko_KR" };
void settings_language_set_language(settings_language_type lang_type)
lang = settings_language_get_language_locale_str();
if (!lang) {
_ERR("Failed to get language.");
- return strdup(LOCALE_UNKNOWN);
+ return strdup(STR_UNKNOWN);
}
r = i18n_ulocale_get_display_language(lang, lang, res, sizeof(res));
if (r < 0) {
_ERR("Failed to get display language: %s.", get_last_result());
free(lang);
- return strdup(LOCALE_UNKNOWN);
+ return strdup(STR_UNKNOWN);
}
i18n_ustring_copy_au_n(name, res, LANG_DISPLAY_STR_L-1);
*/
#include "app_debug.h"
+#include "define.h"
#include "data/system/settings_clock.h"
#include "data/system/settings_wakeup_timer.h"
if(settings_wakeup_timer_get_setup() != SETUP_TYPE_OFF)
return strdup("10:45 AM <br> TV | 53 BBC");
- return strdup("Off");
+ return strdup(STR_OFF);
}
bool settings_wakeup_timer_get_time(struct tm *def_time)
#define PADDING_X 26
#define PADDING_Y 26
-#define VERSION_UNKNOWN "Unknown"
-
struct _priv {
Evas_Object *base;
Evas_Object *ly;
else if (version && !platform)
snprintf(str, sizeof(str), "Ver %s", version);
else
- snprintf(str, sizeof(str), "%s", VERSION_UNKNOWN);
+ snprintf(str, sizeof(str), "%s", STR_UNKNOWN);
free(version);
free(platform);
#define PADDING_X 26
#define PADDING_Y 26
-#define CLOCK_AUTO "Auto"
-#define CLOCK_MANUAL "Manual"
-#define TIMER_OFF "Off"
-#define TIMER_ON "On"
-#define LOCALE_UNKNOWN "Unknown"
-
struct _priv {
Evas_Object *base;
Evas_Object *ly;
static char *_get_clock_mode(void *data, int id)
{
- bool automatic = false;
-
- if (!settings_clock_is_time_automatic(&automatic))
- return NULL;
-
- if (automatic)
- return strdup(CLOCK_AUTO);
- else
- return strdup(CLOCK_MANUAL);
+ return settings_clock_get_clock_status_str();
}
static char *_get_sleep_timer(void *data, int id)
{
//@TODO: get sleep timer value
- return strdup(TIMER_OFF);
+ return strdup(STR_OFF);
}
static char *_get_wakeup_timer(void *data, int id)
SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &lang);
if (r != SYSTEM_SETTINGS_ERROR_NONE) {
_ERR("failed to get language");
- return strdup(LOCALE_UNKNOWN);
+ return strdup(STR_UNKNOWN);
}
r = system_settings_get_value_string(
if (r != SYSTEM_SETTINGS_ERROR_NONE) {
_ERR("failed to get country");
free(lang);
- return strdup(LOCALE_UNKNOWN);
+ return strdup(STR_UNKNOWN);
}
r = i18n_ulocale_get_display_country(country, lang, res, sizeof(res));
_ERR("failed to get display country: %s", get_last_result());
free(lang);
free(country);
- return strdup(LOCALE_UNKNOWN);
+ return strdup(STR_UNKNOWN);
}
i18n_ustring_copy_au(name, res);