[glibmm] Application: Add add_main_option_entry() and add_option_group().
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] Application: Add add_main_option_entry() and add_option_group().
- Date: Wed, 5 Mar 2014 14:21:04 +0000 (UTC)
commit 0d896ba1cabc4d372a588a131ec1de8f51959d6f
Author: Murray Cumming <murrayc murrayc com>
Date: Wed Mar 5 15:19:48 2014 +0100
Application: Add add_main_option_entry() and add_option_group().
* gio/src/application.hg: Wrap g_application_add_main_option_entries()
and g_application_add_option_group().
gio/src/application.ccg | 11 +++++++++++
gio/src/application.hg | 11 +++++++++++
tools/m4/convert_glib.m4 | 2 +-
3 files changed, 23 insertions(+), 1 deletions(-)
---
diff --git a/gio/src/application.ccg b/gio/src/application.ccg
index 3dee00d..8175d9e 100644
--- a/gio/src/application.ccg
+++ b/gio/src/application.ccg
@@ -21,6 +21,7 @@
#include <giomm/file.h>
#include <giomm/actiongroup.h>
#include <giomm/init.h>
+#include <cstring> // std::memset()
namespace
{
@@ -207,4 +208,14 @@ void Application::open(const Glib::RefPtr<Gio::File>& file, const Glib::ustring&
open(files, hint);
}
+void Application::add_main_option_entry(Glib::OptionEntry& entry)
+{
+ //Create a temporary array, just so we can give the correct thing to
g_application_add_main_option_entries():
+ GOptionEntry array[2];
+ array[0] = *(entry.gobj()); //Copy contents.
+ std::memset(&array[1], 0, sizeof(GOptionEntry));
+
+ g_application_add_main_option_entries(gobj(), array);
+}
+
} // namespace Gio
diff --git a/gio/src/application.hg b/gio/src/application.hg
index d8d02ef..327736a 100644
--- a/gio/src/application.hg
+++ b/gio/src/application.hg
@@ -27,6 +27,7 @@
#include <giomm/applicationcommandline.h>
#include <giomm/file.h>
#include <glibmm/object.h>
+#include <glibmm/optiongroup.h>
#include <glibmm/variant.h>
#include <giomm/dbusconnection.h>
#include <giomm/notification.h>
@@ -129,6 +130,16 @@ public:
_WRAP_METHOD(void set_action_group(const Glib::RefPtr<ActionGroup>& action_group),
g_application_set_action_group)
+
+ //TODO: Custom write the documentation for this method?
+ _WRAP_METHOD_DOCS_ONLY(g_application_add_main_option_entries)
+ void add_main_option_entry(Glib::OptionEntry& entry);
+ _IGNORE(g_application_add_main_option_entries)
+
+ _WRAP_METHOD(void add_option_group(Glib::OptionGroup& group), g_application_add_option_group)
+
+
+
_WRAP_METHOD(bool is_registered() const, g_application_get_is_registered)
_WRAP_METHOD(bool is_remote() const, g_application_get_is_remote)
diff --git a/tools/m4/convert_glib.m4 b/tools/m4/convert_glib.m4
index 5df0a27..3dd4e8d 100644
--- a/tools/m4/convert_glib.m4
+++ b/tools/m4/convert_glib.m4
@@ -122,7 +122,7 @@ _CONVERSION(`GObject*',`Glib::RefPtr<const Glib::ObjectBase>',`Glib::wrap($3)')
dnl OptionGroup
_CONVERSION(`OptionGroup&',`GOptionGroup*',`($3).gobj()')
-#_CONVERSION(`GOptionGroup*',`OptionGroup',`Glib::wrap(($3), true /* take_copy */)')
+_CONVERSION(`Glib::OptionGroup&',`GOptionGroup*',`($3).gobj()')
dnl Bytes
_CONVERSION(`GBytes*',`Glib::RefPtr<Glib::Bytes>',`Glib::wrap($3)')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]