summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMurray Cumming <murrayc@murrayc.com>2014-04-03 11:12:03 +0200
committerMurray Cumming <murrayc@murrayc.com>2014-04-03 11:12:03 +0200
commit1bdd6540c70aa099dc6dab3537079264746396d7 (patch)
tree971343846edda2447847c041fc85436525cdd28d
parent415335bfd0a2393dd2650b483dbae4bb605c56e2 (diff)
downloadglibmm-1bdd6540c70aa099dc6dab3537079264746396d7.tar.gz
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.
-rw-r--r--gio/src/application.hg6
-rw-r--r--gio/src/applicationcommandline.hg3
-rw-r--r--tools/m4/convert_glib.m42
3 files changed, 8 insertions, 3 deletions
diff --git a/gio/src/application.hg b/gio/src/application.hg
index 1cd6b76f..9ca76e97 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 8230c6d0..14e5d9c7 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 a3803905..f7e768cf 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)')