From 0e11a8ac5e0e90ae1b576287e13011593dcdc88c Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 17 Dec 2013 22:08:08 -0600 Subject: add other datetime header files --- include/datetime/utils.h | 67 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 include/datetime/utils.h (limited to 'include/datetime/utils.h') diff --git a/include/datetime/utils.h b/include/datetime/utils.h new file mode 100644 index 0000000..bd2e132 --- /dev/null +++ b/include/datetime/utils.h @@ -0,0 +1,67 @@ +/* -*- Mode: C; coding: utf-8; indent-tabs-mode: nil; tab-width: 2 -*- + +A dialog for setting time and date preferences. + +Copyright 2010 Canonical Ltd. + +Authors: + Michael Terry + +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published +by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program. If not, see . +*/ + +#ifndef __DATETIME_UTILS_H__ +#define __DATETIME_UTILS_H__ + +#include +#include /* GSettings */ + +G_BEGIN_DECLS + +gboolean is_locale_12h (void); + +void split_settings_location (const char * location, + char ** zone, + char ** name); + +gchar * get_current_zone_name (const char * location, + GSettings * settings); + +#if 0 +gchar* join_date_and_time_format_strings (const char * date_fmt, + const char * time_fmt); +/*** +**** +***/ + +const gchar * get_terse_time_format_string (GDateTime * time); + +const gchar * get_terse_header_time_format_string (void); + +const gchar * get_full_time_format_string (GSettings * settings); + +gchar * generate_terse_format_string_at_time (GDateTime * now, + GDateTime * time); + +gchar * generate_full_format_string (gboolean show_day, + gboolean show_date, + gboolean show_year, + GSettings * settings); +#endif + +gchar * generate_full_format_string_at_time (GDateTime * now, + GDateTime * time); + +G_END_DECLS + +#endif -- cgit v1.2.3 From ee64bb2698adfe27e55615a8856b0e2c78ad8469 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 14 Jan 2014 23:07:10 -0600 Subject: Function: add fully-tested ActionGroups, per-profile Menus, state object. Form: Add code annotations/comments. Remove dead code. Use Mir style guide. Todo: GSettings toggles, sync with new dbus-test-runner API, get GNOME Panel building again --- include/datetime/utils.h | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) (limited to 'include/datetime/utils.h') diff --git a/include/datetime/utils.h b/include/datetime/utils.h index bd2e132..fbc80d7 100644 --- a/include/datetime/utils.h +++ b/include/datetime/utils.h @@ -20,8 +20,8 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef __DATETIME_UTILS_H__ -#define __DATETIME_UTILS_H__ +#ifndef INDICATOR_DATETIME_UTILS_H +#define INDICATOR_DATETIME_UTILS_H #include #include /* GSettings */ @@ -37,31 +37,9 @@ void split_settings_location (const char * location, gchar * get_current_zone_name (const char * location, GSettings * settings); -#if 0 -gchar* join_date_and_time_format_strings (const char * date_fmt, - const char * time_fmt); -/*** -**** -***/ - -const gchar * get_terse_time_format_string (GDateTime * time); - -const gchar * get_terse_header_time_format_string (void); - -const gchar * get_full_time_format_string (GSettings * settings); - -gchar * generate_terse_format_string_at_time (GDateTime * now, - GDateTime * time); - -gchar * generate_full_format_string (gboolean show_day, - gboolean show_date, - gboolean show_year, - GSettings * settings); -#endif - gchar * generate_full_format_string_at_time (GDateTime * now, GDateTime * time); G_END_DECLS -#endif +#endif /* INDICATOR_DATETIME_UTILS_H */ -- cgit v1.2.3 From 4cc19729c540ffba163d5c9a53b9352fe61fe8af Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 16 Jan 2014 17:28:37 -0600 Subject: in utils.c, make a version of get_timezone_name() that doesn't require a GSettings argument. Update utils tests. --- include/datetime/utils.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include/datetime/utils.h') diff --git a/include/datetime/utils.h b/include/datetime/utils.h index fbc80d7..10e881f 100644 --- a/include/datetime/utils.h +++ b/include/datetime/utils.h @@ -34,9 +34,12 @@ void split_settings_location (const char * location, char ** zone, char ** name); -gchar * get_current_zone_name (const char * location, +gchar * get_timezone_name (const char * timezone, GSettings * settings); +gchar * get_beautified_timezone_name (const char * timezone, + const char * saved_location); + gchar * generate_full_format_string_at_time (GDateTime * now, GDateTime * time); -- cgit v1.2.3 From ee9f4c7ef822a101cea8d12c565d8a8a93d9caf5 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 28 Jan 2014 16:26:45 -0600 Subject: make utils.cpp's generate_full_format_string_at_time() a standalone function so that the panels can use the utils functions without a libindicatordatetime dependency --- include/datetime/utils.h | 50 +++++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 22 deletions(-) (limited to 'include/datetime/utils.h') diff --git a/include/datetime/utils.h b/include/datetime/utils.h index 10e881f..7cac9fd 100644 --- a/include/datetime/utils.h +++ b/include/datetime/utils.h @@ -1,24 +1,22 @@ -/* -*- Mode: C; coding: utf-8; indent-tabs-mode: nil; tab-width: 2 -*- - -A dialog for setting time and date preferences. - -Copyright 2010 Canonical Ltd. - -Authors: - Michael Terry - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published -by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see . -*/ +/* + * Copyright 2010, 2014 Canonical Ltd. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3, as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranties of + * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + * + * Authors: + * Michael Terry + * Charles Kerr + */ #ifndef INDICATOR_DATETIME_UTILS_H #define INDICATOR_DATETIME_UTILS_H @@ -28,6 +26,7 @@ with this program. If not, see . G_BEGIN_DECLS +/** \brief Returns true if the current locale prefers 12h display instead of 24h */ gboolean is_locale_12h (void); void split_settings_location (const char * location, @@ -41,7 +40,14 @@ gchar * get_beautified_timezone_name (const char * timezone, const char * saved_location); gchar * generate_full_format_string_at_time (GDateTime * now, - GDateTime * time); + GDateTime * then_begin, + GDateTime * then_end); + +/** \brief Translate the string based on LC_TIME instead of LC_MESSAGES. + The intent of this is to let users set LC_TIME to override + their other locale settings when generating time format string */ +const char* T_ (const char * msg); + G_END_DECLS -- cgit v1.2.3