[gtkmm: 1/2] Use DateTime instead of time_t in RecentInfo




commit 816a2c75f12f7eaab4feabeaed746444607a22d6
Author: Andreas Persson <andreasp56 outlook com>
Date:   Sat Aug 1 12:37:03 2020 +0200

    Use DateTime instead of time_t in RecentInfo
    
    Adapt to change in Gtk.

 gtk/src/gtk_docs.xml     | 24 ++++++++++++------------
 gtk/src/gtk_methods.defs |  8 ++++----
 gtk/src/recentinfo.ccg   |  6 ++++--
 gtk/src/recentinfo.hg    | 10 +++++-----
 4 files changed, 25 insertions(+), 23 deletions(-)
---
diff --git a/gtk/src/gtk_docs.xml b/gtk/src/gtk_docs.xml
index c6dc4810..bdb1dccb 100644
--- a/gtk/src/gtk_docs.xml
+++ b/gtk/src/gtk_docs.xml
@@ -61117,7 +61117,7 @@ to local files.
 
 <function name="gtk_recent_info_get_added">
 <description>
-Gets the timestamp (seconds from system’s Epoch) when the resource
+Gets the the time when the resource
 was added to the recently used resources list.
 
 
@@ -61128,8 +61128,8 @@ was added to the recently used resources list.
 </parameter_description>
 </parameter>
 </parameters>
-<return> the number of seconds elapsed from system’s Epoch when
-the resource was added to the list, or -1 on failure.
+<return> a #GDateTime for the time
+when the resource was added
 </return>
 </function>
 
@@ -61179,9 +61179,9 @@ the command line
 <parameter_description> return location for the number of times this item was registered
 </parameter_description>
 </parameter>
-<parameter name="time_">
-<parameter_description> return location for the timestamp this item was last registered
-for this application
+<parameter name="stamp">
+<parameter_description> return location for the time this item was last
+registered for this application
 </parameter_description>
 </parameter>
 </parameters>
@@ -61309,7 +61309,7 @@ is owned by the recent manager, and should not be freed.
 
 <function name="gtk_recent_info_get_modified">
 <description>
-Gets the timestamp (seconds from system’s Epoch) when the meta-data
+Gets the time when the meta-data
 for the resource was last modified.
 
 
@@ -61320,8 +61320,8 @@ for the resource was last modified.
 </parameter_description>
 </parameter>
 </parameters>
-<return> the number of seconds elapsed from system’s Epoch when
-the resource was last modified, or -1 on failure.
+<return> a #GDateTime for the time
+when the resource was last modified
 </return>
 </function>
 
@@ -61401,7 +61401,7 @@ resource’s URI or %NULL. Use g_free() when done using it.
 
 <function name="gtk_recent_info_get_visited">
 <description>
-Gets the timestamp (seconds from system’s Epoch) when the meta-data
+Gets the time when the meta-data
 for the resource was last visited.
 
 
@@ -61412,8 +61412,8 @@ for the resource was last visited.
 </parameter_description>
 </parameter>
 </parameters>
-<return> the number of seconds elapsed from system’s Epoch when
-the resource was last visited, or -1 on failure.
+<return> a #GDateTime for the time
+when the resource was last visited
 </return>
 </function>
 
diff --git a/gtk/src/gtk_methods.defs b/gtk/src/gtk_methods.defs
index aceac53b..85112fa6 100644
--- a/gtk/src/gtk_methods.defs
+++ b/gtk/src/gtk_methods.defs
@@ -20672,19 +20672,19 @@
 (define-method get_added
   (of-object "GtkRecentInfo")
   (c-name "gtk_recent_info_get_added")
-  (return-type "time_t")
+  (return-type "GDateTime*")
 )
 
 (define-method get_modified
   (of-object "GtkRecentInfo")
   (c-name "gtk_recent_info_get_modified")
-  (return-type "time_t")
+  (return-type "GDateTime*")
 )
 
 (define-method get_visited
   (of-object "GtkRecentInfo")
   (c-name "gtk_recent_info_get_visited")
-  (return-type "time_t")
+  (return-type "GDateTime*")
 )
 
 (define-method get_private_hint
@@ -20701,7 +20701,7 @@
     '("const-char*" "app_name")
     '("const-char**" "app_exec")
     '("guint*" "count")
-    '("time_t*" "time_")
+    '("GDateTime**" "stamp")
   )
 )
 
diff --git a/gtk/src/recentinfo.ccg b/gtk/src/recentinfo.ccg
index 78e7e87f..12c744dd 100644
--- a/gtk/src/recentinfo.ccg
+++ b/gtk/src/recentinfo.ccg
@@ -32,11 +32,13 @@ std::vector<Glib::ustring> RecentInfo::get_applications() const
 }
 
 bool RecentInfo::get_application_info(const Glib::ustring& app_name, std::string& app_exec,
-                                      guint& count, std::time_t& time_) const
+                                      guint& count, Glib::DateTime& stamp) const
 {
   const char* app_exec_cstr = nullptr;
+  GDateTime* date_time = nullptr;
   const int found = gtk_recent_info_get_application_info(
-      const_cast<GtkRecentInfo*>(gobj()), app_name.c_str(), &app_exec_cstr, &count, &time_);
+      const_cast<GtkRecentInfo*>(gobj()), app_name.c_str(), &app_exec_cstr, &count, &date_time);
+  stamp = Glib::wrap(date_time);
 
   if (app_exec_cstr)
     app_exec = app_exec_cstr;
diff --git a/gtk/src/recentinfo.hg b/gtk/src/recentinfo.hg
index 57354997..988e1453 100644
--- a/gtk/src/recentinfo.hg
+++ b/gtk/src/recentinfo.hg
@@ -21,7 +21,7 @@ _CONFIGINCLUDE(gtkmmconfig.h)
 
 #include <giomm/icon.h>
 #include <giomm/appinfo.h>
-#include <ctime>
+#include <glibmm/datetime.h>
 
 _DEFS(gtkmm,gtk)
 
@@ -54,9 +54,9 @@ public:
   _WRAP_METHOD(Glib::ustring get_description() const, gtk_recent_info_get_description)
   _WRAP_METHOD(Glib::ustring get_mime_type() const, gtk_recent_info_get_mime_type)
 
-  _WRAP_METHOD(std::time_t get_added() const, gtk_recent_info_get_added)
-  _WRAP_METHOD(std::time_t get_modified() const, gtk_recent_info_get_modified)
-  _WRAP_METHOD(std::time_t get_visited() const, gtk_recent_info_get_visited)
+  _WRAP_METHOD(Glib::DateTime get_added() const, gtk_recent_info_get_added)
+  _WRAP_METHOD(Glib::DateTime get_modified() const, gtk_recent_info_get_modified)
+  _WRAP_METHOD(Glib::DateTime get_visited() const, gtk_recent_info_get_visited)
 
   _WRAP_METHOD(bool get_private_hint() const, gtk_recent_info_get_private_hint)
 
@@ -65,7 +65,7 @@ public:
 
   _WRAP_METHOD_DOCS_ONLY(gtk_recent_info_get_application_info)
   bool get_application_info(const Glib::ustring& app_name, std::string& app_exec,
-                            guint& count, std::time_t& time) const;
+                            guint& count, Glib::DateTime& stamp) const;
 
   _WRAP_METHOD_DOCS_ONLY(gtk_recent_info_get_applications)
   std::vector<Glib::ustring> get_applications() const;


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