[gnote] Add 64 bit version D-Bus functions GetNoteCreateDateUnix and GeNoteChangeDateUnix



commit 1ab591e8bf942cb9169528003cba87a9bc582757
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sun Jan 26 18:52:51 2020 +0200

    Add 64 bit version D-Bus functions GetNoteCreateDateUnix and GeNoteChangeDateUnix

 src/dbus/gnote-introspect.xml   |  8 ++++++++
 src/dbus/remotecontrol-glue.cpp | 29 ++++++++++++++++++++++++++++-
 src/dbus/remotecontrol-glue.hpp |  8 +++++++-
 src/dbus/remotecontrol.cpp      | 12 ++++++++++++
 src/dbus/remotecontrol.hpp      |  4 +++-
 5 files changed, 58 insertions(+), 3 deletions(-)
---
diff --git a/src/dbus/gnote-introspect.xml b/src/dbus/gnote-introspect.xml
index 092e848b..04195f47 100644
--- a/src/dbus/gnote-introspect.xml
+++ b/src/dbus/gnote-introspect.xml
@@ -46,6 +46,10 @@
       <arg type="s" name="uri" direction="in"/>
       <arg type="i" name="ret" direction="out"/>
     </method>
+    <method name="GetNoteChangeDateUnix">
+      <arg type="s" name="uri" direction="in"/>
+      <arg type="x" name="ret" direction="out"/>
+    </method>
     <method name="GetNoteCompleteXml">
       <arg type="s" name="uri" direction="in"/>
       <arg type="s" name="ret" direction="out"/>
@@ -62,6 +66,10 @@
       <arg type="s" name="uri" direction="in"/>
       <arg type="i" name="ret" direction="out"/>
     </method>
+    <method name="GetNoteCreateDateUnix">
+      <arg type="s" name="uri" direction="in"/>
+      <arg type="x" name="ret" direction="out"/>
+    </method>
     <method name="GetNoteTitle">
       <arg type="s" name="uri" direction="in"/>
       <arg type="s" name="ret" direction="out"/>
diff --git a/src/dbus/remotecontrol-glue.cpp b/src/dbus/remotecontrol-glue.cpp
index f30248c0..e7e3928f 100644
--- a/src/dbus/remotecontrol-glue.cpp
+++ b/src/dbus/remotecontrol-glue.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2011,2017 Aurimas Cernius
+ * Copyright (C) 2011,2017,2020 Aurimas Cernius
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -48,10 +48,12 @@ RemoteControl_adaptor::RemoteControl_adaptor(const Glib::RefPtr<Gio::DBus::Conne
   m_stubs["FindStartHereNote"] = &RemoteControl_adaptor::FindStartHereNote_stub;
   m_stubs["GetAllNotesWithTag"] = &RemoteControl_adaptor::GetAllNotesWithTag_stub;
   m_stubs["GetNoteChangeDate"] = &RemoteControl_adaptor::GetNoteChangeDate_stub;
+  m_stubs["GetNoteChangeDateUnix"] = &RemoteControl_adaptor::GetNoteChangeDateUnix_stub;
   m_stubs["GetNoteCompleteXml"] = &RemoteControl_adaptor::GetNoteCompleteXml_stub;
   m_stubs["GetNoteContents"] = &RemoteControl_adaptor::GetNoteContents_stub;
   m_stubs["GetNoteContentsXml"] = &RemoteControl_adaptor::GetNoteContentsXml_stub;
   m_stubs["GetNoteCreateDate"] = &RemoteControl_adaptor::GetNoteCreateDate_stub;
+  m_stubs["GetNoteCreateDateUnix"] = &RemoteControl_adaptor::GetNoteCreateDateUnix_stub;
   m_stubs["GetNoteTitle"] = &RemoteControl_adaptor::GetNoteTitle_stub;
   m_stubs["GetTagsForNote"] = &RemoteControl_adaptor::GetTagsForNote_stub;
   m_stubs["HideNote"] = &RemoteControl_adaptor::HideNote_stub;
@@ -198,6 +200,12 @@ Glib::VariantContainerBase RemoteControl_adaptor::GetNoteChangeDate_stub(const G
 }
 
 
+Glib::VariantContainerBase RemoteControl_adaptor::GetNoteChangeDateUnix_stub(const 
Glib::VariantContainerBase & parameters)
+{
+  return stub_int64_string(parameters, &RemoteControl_adaptor::GetNoteChangeDateUnix);
+}
+
+
 Glib::VariantContainerBase RemoteControl_adaptor::GetNoteCompleteXml_stub(const Glib::VariantContainerBase & 
parameters)
 {
   return stub_string_string(parameters, &RemoteControl_adaptor::GetNoteCompleteXml);
@@ -222,6 +230,12 @@ Glib::VariantContainerBase RemoteControl_adaptor::GetNoteCreateDate_stub(const G
 }
 
 
+Glib::VariantContainerBase RemoteControl_adaptor::GetNoteCreateDateUnix_stub(const 
Glib::VariantContainerBase & parameters)
+{
+  return stub_int64_string(parameters, &RemoteControl_adaptor::GetNoteCreateDateUnix);
+}
+
+
 Glib::VariantContainerBase RemoteControl_adaptor::GetNoteTitle_stub(const Glib::VariantContainerBase & 
parameters)
 {
   return stub_string_string(parameters, &RemoteControl_adaptor::GetNoteTitle);
@@ -344,6 +358,19 @@ Glib::VariantContainerBase RemoteControl_adaptor::stub_int_string(const Glib::Va
 }
 
 
+Glib::VariantContainerBase RemoteControl_adaptor::stub_int64_string(const Glib::VariantContainerBase & 
parameters, int64_string_func func)
+{
+  gint64 result = 0;
+  if(parameters.get_n_children() == 1) {
+    Glib::Variant<Glib::ustring> param;
+    parameters.get_child(param);
+    result = (this->*func)(param.get());
+  }
+
+  return Glib::VariantContainerBase::create_tuple(Glib::Variant<gint64>::create(result));
+}
+
+
 Glib::VariantContainerBase RemoteControl_adaptor::stub_string_string(const Glib::VariantContainerBase & 
parameters,
                                                                      string_string_func func)
 {
diff --git a/src/dbus/remotecontrol-glue.hpp b/src/dbus/remotecontrol-glue.hpp
index 251144b6..5e168135 100644
--- a/src/dbus/remotecontrol-glue.hpp
+++ b/src/dbus/remotecontrol-glue.hpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2011,2017 Aurimas Cernius
+ * Copyright (C) 2011,2017,2020 Aurimas Cernius
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -45,10 +45,12 @@ public:
   virtual Glib::ustring FindStartHereNote() = 0;
   virtual std::vector<Glib::ustring> GetAllNotesWithTag(const Glib::ustring& tag_name) = 0;
   virtual int32_t GetNoteChangeDate(const Glib::ustring& uri) = 0;
+  virtual int64_t GetNoteChangeDateUnix(const Glib::ustring& uri) = 0;
   virtual Glib::ustring GetNoteCompleteXml(const Glib::ustring& uri) = 0;
   virtual Glib::ustring GetNoteContents(const Glib::ustring& uri) = 0;
   virtual Glib::ustring GetNoteContentsXml(const Glib::ustring& uri) = 0;
   virtual int32_t GetNoteCreateDate(const Glib::ustring& uri) = 0;
+  virtual int64_t GetNoteCreateDateUnix(const Glib::ustring& uri) = 0;
   virtual Glib::ustring GetNoteTitle(const Glib::ustring& uri) = 0;
   virtual std::vector<Glib::ustring> GetTagsForNote(const Glib::ustring& uri) = 0;
   virtual bool HideNote(const Glib::ustring& uri) = 0;
@@ -85,10 +87,12 @@ private:
   Glib::VariantContainerBase FindStartHereNote_stub(const Glib::VariantContainerBase &);
   Glib::VariantContainerBase GetAllNotesWithTag_stub(const Glib::VariantContainerBase &);
   Glib::VariantContainerBase GetNoteChangeDate_stub(const Glib::VariantContainerBase &);
+  Glib::VariantContainerBase GetNoteChangeDateUnix_stub(const Glib::VariantContainerBase &);
   Glib::VariantContainerBase GetNoteCompleteXml_stub(const Glib::VariantContainerBase &);
   Glib::VariantContainerBase GetNoteContents_stub(const Glib::VariantContainerBase &);
   Glib::VariantContainerBase GetNoteContentsXml_stub(const Glib::VariantContainerBase &);
   Glib::VariantContainerBase GetNoteCreateDate_stub(const Glib::VariantContainerBase &);
+  Glib::VariantContainerBase GetNoteCreateDateUnix_stub(const Glib::VariantContainerBase &);
   Glib::VariantContainerBase GetNoteTitle_stub(const Glib::VariantContainerBase &);
   Glib::VariantContainerBase GetTagsForNote_stub(const Glib::VariantContainerBase &);
   Glib::VariantContainerBase HideNote_stub(const Glib::VariantContainerBase &);
@@ -109,6 +113,8 @@ private:
   Glib::VariantContainerBase stub_bool_string_string(const Glib::VariantContainerBase &, 
bool_string_string_func);
   typedef int32_t (RemoteControl_adaptor::*int_string_func)(const Glib::ustring &);
   Glib::VariantContainerBase stub_int_string(const Glib::VariantContainerBase &, int_string_func);
+  typedef int64_t (RemoteControl_adaptor::*int64_string_func)(const Glib::ustring &);
+  Glib::VariantContainerBase stub_int64_string(const Glib::VariantContainerBase &, int64_string_func);
   typedef Glib::ustring (RemoteControl_adaptor::*string_string_func)(const Glib::ustring &);
   Glib::VariantContainerBase stub_string_string(const Glib::VariantContainerBase &, string_string_func);
   typedef std::vector<Glib::ustring> (RemoteControl_adaptor::*vectorstring_void_func)();
diff --git a/src/dbus/remotecontrol.cpp b/src/dbus/remotecontrol.cpp
index 3b256ddb..195f3be8 100644
--- a/src/dbus/remotecontrol.cpp
+++ b/src/dbus/remotecontrol.cpp
@@ -181,6 +181,12 @@ namespace gnote {
 
 
   int32_t RemoteControl::GetNoteChangeDate(const Glib::ustring& uri)
+  {
+    return GetNoteChangeDateUnix(uri);
+  }
+
+
+  int64_t RemoteControl::GetNoteChangeDateUnix(const Glib::ustring& uri)
   {
     NoteBase::Ptr note = m_manager.find_by_uri(uri);
     if (!note)
@@ -218,6 +224,12 @@ namespace gnote {
 
 
   int32_t RemoteControl::GetNoteCreateDate(const Glib::ustring& uri)
+  {
+    return GetNoteCreateDateUnix(uri);
+  }
+
+
+  int64_t RemoteControl::GetNoteCreateDateUnix(const Glib::ustring& uri)
   {
     NoteBase::Ptr note = m_manager.find_by_uri(uri);
     if (!note)
diff --git a/src/dbus/remotecontrol.hpp b/src/dbus/remotecontrol.hpp
index a186d8af..ce4814ab 100644
--- a/src/dbus/remotecontrol.hpp
+++ b/src/dbus/remotecontrol.hpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2011-2014,2017,2019 Aurimas Cernius
+ * Copyright (C) 2011-2014,2017,2019-2020 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
@@ -55,10 +55,12 @@ public:
   virtual Glib::ustring FindStartHereNote() override;
   virtual std::vector<Glib::ustring> GetAllNotesWithTag(const Glib::ustring& tag_name) override;
   virtual int32_t GetNoteChangeDate(const Glib::ustring& uri) override;
+  virtual int64_t GetNoteChangeDateUnix(const Glib::ustring& uri) override;
   virtual Glib::ustring GetNoteCompleteXml(const Glib::ustring& uri) override;
   virtual Glib::ustring GetNoteContents(const Glib::ustring& uri) override;
   virtual Glib::ustring GetNoteContentsXml(const Glib::ustring& uri) override;
   virtual int32_t GetNoteCreateDate(const Glib::ustring& uri) override;
+  virtual int64_t GetNoteCreateDateUnix(const Glib::ustring& uri) override;
   virtual Glib::ustring GetNoteTitle(const Glib::ustring& uri) override;
   virtual std::vector<Glib::ustring> GetTagsForNote(const Glib::ustring& uri) override;
   virtual bool HideNote(const Glib::ustring& uri) override;


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