[glibmm] Application, ApplicationCommandLine: Wrap API that uses VariantDict.



commit 1bdd6540c70aa099dc6dab3537079264746396d7
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Apr 3 11:12:03 2014 +0200

    Application, ApplicationCommandLine: Wrap API that uses VariantDict.
    
    * gio/src/application.hg: Add the handle-local-options signal.
    * gio/src/applicationcommandline: Add get_options_dict().
    * tools/m4/convert_glib.m4: Add necessary conversions.
    
    I really need to try using this API so we can be sure that it
    is correct before calling it stable, because this part of the awful
    GApplication documentation is particularly awful.

 gio/src/application.hg            |    6 ++++--
 gio/src/applicationcommandline.hg |    3 ++-
 tools/m4/convert_glib.m4          |    2 ++
 3 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/gio/src/application.hg b/gio/src/application.hg
index 1cd6b76..9ca76e9 100644
--- a/gio/src/application.hg
+++ b/gio/src/application.hg
@@ -231,9 +231,11 @@ public:
   _WRAP_SIGNAL(int command_line(const Glib::RefPtr<ApplicationCommandLine>& command_line), "command-line")
 
   //TODO: Remove no_default_handler when we can break ABI
-  //TODO: Wrap GVariantDict* for C++.
   //TODO: Avoid the use of the Variants in the VariantDict?
-  //_WRAP_SIGNAL(int handle_local_options(GVariantDict* options), "handle-local-options", no_default_handler)
+  //TODO: Should options definitely be non-const? Confirm that the handler is meant to modify it.
+#m4 _CONVERSION(`GVariantDict*',`const Glib::RefPtr<Glib::VariantDict>&',`Glib::wrap($3, true)')
+  _WRAP_SIGNAL(int handle_local_options(const Glib::RefPtr<Glib::VariantDict>& options), 
"handle-local-options", no_default_handler)
+
 protected:
   virtual void on_open(const type_vec_files& files, const Glib::ustring& hint);
 
diff --git a/gio/src/applicationcommandline.hg b/gio/src/applicationcommandline.hg
index 8230c6d..14e5d9c 100644
--- a/gio/src/applicationcommandline.hg
+++ b/gio/src/applicationcommandline.hg
@@ -66,7 +66,8 @@ public:
   _WRAP_METHOD(char** get_arguments(int& argc) const, g_application_command_line_get_arguments)
 
   //TODO: Wrap the GVariantDict*. See also Application's handle-local-options signal.
-  //_WRAP_METHOD(GVariantDict * g_application_command_line_get_options_dict(), 
g_application_command_line_get_options_dict)
+  _WRAP_METHOD(Glib::RefPtr<Glib::VariantDict> get_options_dict(), 
g_application_command_line_get_options_dict, refreturn)
+  _WRAP_METHOD(Glib::RefPtr<const Glib::VariantDict> get_options_dict() const, 
g_application_command_line_get_options_dict, refreturn, constversion)
 
   _WRAP_METHOD(Glib::RefPtr<InputStream> get_stdin(), g_application_command_line_get_stdin, refreturn)
   _WRAP_METHOD(Glib::RefPtr<const InputStream> get_stdin() const, g_application_command_line_get_stdin, 
refreturn, constversion)
diff --git a/tools/m4/convert_glib.m4 b/tools/m4/convert_glib.m4
index a380390..f7e768c 100644
--- a/tools/m4/convert_glib.m4
+++ b/tools/m4/convert_glib.m4
@@ -166,6 +166,8 @@ _CONVERSION(`const VariantContainerBase&',`GVariant*',`const_cast<GVariant*>(($3
 
 #VariantDict
 _CONVERSION(`GVariantDict*',`Glib::RefPtr<VariantDict>',`Glib::wrap($3)')
+_CONVERSION(`GVariantDict*',`Glib::RefPtr<Glib::VariantDict>',`Glib::wrap($3)')
+_CONVERSION(`GVariantDict*',`Glib::RefPtr<const Glib::VariantDict>',`Glib::wrap($3)')
 
 #VariantType
 _CONVERSION(`const GVariantType*',`Glib::VariantType',`Glib::wrap(const_cast<GVariantType*>($3), true)')


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