[glibmm] Added Gio::Application, wrapping GApplication.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] Added Gio::Application, wrapping GApplication.
- Date: Fri, 30 Jul 2010 13:05:22 +0000 (UTC)
commit 98becffff9b72c64095deeb51185226c1776c847
Author: Murray Cumming <murrayc murrayc com>
Date: Fri Jul 30 15:05:13 2010 +0200
Added Gio::Application, wrapping GApplication.
* gio/src/filelist.am:
* gio/src/application.[hg|ccg]: New files. We maybe want to move some of
Glib::Main to this and deprecated Glib::Main, though it would then be
annoying to use Glib::RefPtr there.
ChangeLog | 9 ++++++
gio/src/application.ccg | 48 ++++++++++++++++++++++++++++++
gio/src/application.hg | 74 +++++++++++++++++++++++++++++++++++++++++++++++
gio/src/filelist.am | 1 +
tools/m4/convert_gio.m4 | 2 +
5 files changed, 134 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 42367e8..ba15199 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-07-30 Murray Cumming <murrayc murrayc com>
+
+ Added Gio::Application, wrapping GApplication.
+
+ * gio/src/filelist.am:
+ * gio/src/application.[hg|ccg]: New files. We maybe want to move some of
+ Glib::Main to this and deprecated Glib::Main, though it would then be
+ annoying to use Glib::RefPtr there.
+
2010-07-30 José Alburquerque <jaalburqu svn gnome org>
Add Gio::DBus::[own|unown]_name().
diff --git a/gio/src/application.ccg b/gio/src/application.ccg
new file mode 100644
index 0000000..7848b3a
--- /dev/null
+++ b/gio/src/application.ccg
@@ -0,0 +1,48 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* Copyright (C) 2007 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <gio/gio.h>
+#include <giomm/file.h>
+
+namespace Gio
+{
+
+/*
+Glib::RefPtr<AppInfo>
+Application::create_from_commandline(const std::string& commandline,
+ const std::string& application_name,
+ AppInfoCreateFlags flags)
+{
+ GAppInfo* capp_info = 0;
+ GError* gerror = 0;
+
+ capp_info = g_app_info_create_from_commandline(commandline.c_str(),
+ application_name.c_str(),
+ static_cast<GAppInfoCreateFlags>(flags),
+ &gerror);
+
+ if (gerror)
+ ::Glib::Error::throw_exception(gerror);
+
+ return Glib::wrap(capp_info);
+}
+*/
+
+
+} // namespace Gio
diff --git a/gio/src/application.hg b/gio/src/application.hg
new file mode 100644
index 0000000..11d0a37
--- /dev/null
+++ b/gio/src/application.hg
@@ -0,0 +1,74 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* Copyright (C) 2007 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <glibmm/object.h>
+#include <glibmm/variant.h>
+
+_DEFS(giomm,gio)
+_PINCLUDE(glibmm/private/object_p.h)
+
+namespace Gio
+{
+
+/** TODO
+ *
+ * @newin{2,26}
+ */
+class Application : public Glib::Object
+{
+ _CLASS_GOBJECT(Application, GApplication, G_APPLICATION, Glib::Object, GObject)
+
+protected:
+ _CTOR_DEFAULT()
+
+public:
+ //_WRAP_CREATE()
+
+ _WRAP_METHOD(static Glib::RefPtr<Application> create(const Glib::ustring& appid, int argc, char** argv), g_application_new)
+
+ _WRAP_METHOD(static Glib::RefPtr<Application> create_try(const Glib::ustring& appid, int argc, char** argv), g_application_try_new, errthrow)
+
+ _WRAP_METHOD(static Glib::RefPtr<Application> create_unregistered_try(const Glib::ustring& appid, int argc, char** argv), g_application_unregistered_try_new, errthrow)
+
+ //Renamed from register() because that is a C++ keyword.
+ _WRAP_METHOD(bool register_application(), g_application_register)
+
+ _WRAP_METHOD(static Glib::RefPtr<Application> get_instance(), g_application_get_instance, refreturn)
+ _WRAP_METHOD(Glib::ustring get_id() const, g_application_get_id)
+
+ _WRAP_METHOD(void add_action(const Glib::ustring& name, const Glib::ustring& description), g_application_add_action)
+ _WRAP_METHOD(void remove_action(const Glib::ustring& name), g_application_remove_action)
+
+ #m4 _CONVERSION(`gchar**',`Glib::StringArrayHandle',`Glib::StringArrayHandle($3, Glib::OWNERSHIP_DEEP)')
+ _WRAP_METHOD(Glib::StringArrayHandle list_actions() const, g_application_list_actions)
+
+ _WRAP_METHOD(void set_action_enabled(const Glib::ustring& name, bool enabled = true), g_application_set_action_enabled)
+ _WRAP_METHOD(bool get_action_enabled(const Glib::ustring& name) const, g_application_get_action_enabled)
+ _WRAP_METHOD(Glib::ustring get_action_description(const Glib::ustring& name), g_application_get_action_description)
+ _WRAP_METHOD(void invoke_action(const Glib::ustring& name, const Glib::VariantBase& platform_data), g_application_invoke_action)
+
+ _WRAP_METHOD(void run(), g_application_run)
+ _WRAP_METHOD(bool quit_with_data(const Glib::VariantBase& platform_data), g_application_quit_with_data)
+
+ _WRAP_METHOD(bool is_remote() const, g_application_is_remote)
+};
+
+
+} // namespace Gio
+
diff --git a/gio/src/filelist.am b/gio/src/filelist.am
index 11cca05..d3b3e6a 100644
--- a/gio/src/filelist.am
+++ b/gio/src/filelist.am
@@ -13,6 +13,7 @@ giomm_files_defs = \
giomm_files_any_hg = \
appinfo.hg \
+ application.hg \
asyncresult.hg \
bufferedinputstream.hg \
bufferedoutputstream.hg \
diff --git a/tools/m4/convert_gio.m4 b/tools/m4/convert_gio.m4
index f0c1b97..2b8d0bb 100644
--- a/tools/m4/convert_gio.m4
+++ b/tools/m4/convert_gio.m4
@@ -41,6 +41,8 @@ _CONVERSION(`Glib::RefPtr<AppInfo>',`GAppInfo*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`GAppInfo*',`const Glib::RefPtr<AppInfo>&',`Glib::wrap($3)')
_CONVERSION(`const Glib::ListHandle< Glib::RefPtr<Gio::File> >&',`GList*',`$3.data()')
+_CONVERSION(`GApplication*',`Glib::RefPtr<Application>',`Glib::wrap($3)')
+
# AsyncResult
_CONVERSION(`Glib::RefPtr<Glib::Object>',`GObject*',__CONVERT_REFPTR_TO_P)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]