[glibmm] Glib: Add some API (DateTime::get_timezone() etc.)



commit 7d9d86fc38185de27386c111a358b822ad99702d
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Fri Mar 15 15:31:37 2019 +0100

    Glib: Add some API (DateTime::get_timezone() etc.)
    
    * glib/src/datetime.[ccg|hg]: Add get_timezone().
    * glib/src/keyfile.hg: Add get_locale_for_key().
    * glib/src/timezone.hg: Add get_identifier().

 glib/src/datetime.ccg | 6 ------
 glib/src/datetime.hg  | 6 ++++--
 glib/src/keyfile.hg   | 4 ++++
 glib/src/timezone.hg  | 1 +
 4 files changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/glib/src/datetime.ccg b/glib/src/datetime.ccg
index fbad36e9..3295b3e4 100644
--- a/glib/src/datetime.ccg
+++ b/glib/src/datetime.ccg
@@ -16,10 +16,4 @@
 
 #include <glibmm/utility.h>
 #include <glibmm/timeval.h>
-#include <glibmm/timezone.h>
 #include <glibmm/wrap.h>
-
-namespace Glib
-{
-
-} // namespace Glib
diff --git a/glib/src/datetime.hg b/glib/src/datetime.hg
index 6665950d..ac6e81da 100644
--- a/glib/src/datetime.hg
+++ b/glib/src/datetime.hg
@@ -18,6 +18,7 @@ _DEFS(glibmm,glib)
 
 #include <glibmmconfig.h>
 #include <glibmm/refptr.h>
+#include <glibmm/timezone.h>
 #include <glibmm/ustring.h>
 #include <glib.h>
 
@@ -29,7 +30,6 @@ namespace Glib
 {
 
 struct TimeVal;
-class TimeZone;
 
 /** A value representing an interval of time, in microseconds.  As GTimeSpan,
  * its underlying type is gint64.
@@ -66,7 +66,7 @@ class DateTime
   _IGNORE(g_date_time_ref, g_date_time_unref)
 
 public:
- _WRAP_METHOD(static DateTime create_now(const TimeZone& tz), g_date_time_new_now)
+  _WRAP_METHOD(static DateTime create_now(const TimeZone& tz), g_date_time_new_now)
   _WRAP_METHOD(static DateTime create_now_local(), g_date_time_new_now_local)
   _WRAP_METHOD(static DateTime create_now_utc(), g_date_time_new_now_utc)
 
@@ -143,6 +143,8 @@ public:
   _WRAP_METHOD(gint64 to_unix() const, g_date_time_to_unix)
   _WRAP_METHOD(bool to_timeval(TimeVal& tv) const, g_date_time_to_timeval)
   _WRAP_METHOD(TimeSpan get_utc_offset() const, g_date_time_get_utc_offset)
+#m4 _CONVERSION(`GTimeZone*',`TimeZone',`Glib::wrap($3, true)')
+  _WRAP_METHOD(TimeZone get_timezone() const, g_date_time_get_timezone, newin "2,60")
   _WRAP_METHOD(Glib::ustring get_timezone_abbreviation() const, g_date_time_get_timezone_abbreviation)
   _WRAP_METHOD(bool is_daylight_savings() const, g_date_time_is_daylight_savings)
   _WRAP_METHOD(DateTime to_timezone(const TimeZone& tz) const, g_date_time_to_timezone)
diff --git a/glib/src/keyfile.hg b/glib/src/keyfile.hg
index a57878e5..a2641bb9 100644
--- a/glib/src/keyfile.hg
+++ b/glib/src/keyfile.hg
@@ -165,6 +165,10 @@ public:
   _WRAP_METHOD(Glib::ustring get_value(const Glib::ustring& group_name, const Glib::ustring& key) const, 
g_key_file_get_value, errthrow)
   _WRAP_METHOD(Glib::ustring get_string(const Glib::ustring& group_name, const Glib::ustring& key) const, 
g_key_file_get_string, errthrow)
 
+  _WRAP_METHOD(Glib::ustring get_locale_for_key(const Glib::ustring& group_name,
+    const Glib::ustring& key, const Glib::ustring& locale{NULL} = {}) const,
+    g_key_file_get_locale_for_key, newin "2,60")
+
   /** Gets the value associated with @a key under @a group_name translated
    * into the current locale.
    * @return the value as a Glib::ustring
diff --git a/glib/src/timezone.hg b/glib/src/timezone.hg
index 1a033765..afa2f7fd 100644
--- a/glib/src/timezone.hg
+++ b/glib/src/timezone.hg
@@ -66,6 +66,7 @@ public:
   _WRAP_METHOD(Glib::ustring get_abbreviation(int interval) const, g_time_zone_get_abbreviation)
   _WRAP_METHOD(gint32 get_offset(int interval) const, g_time_zone_get_offset)
   _WRAP_METHOD(bool is_dst(int interval) const, g_time_zone_is_dst)
+  _WRAP_METHOD(Glib::ustring get_identifier() const, g_time_zone_get_identifier, newin "2,60")
 };
 
 } // namespace Glib


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]