[glibmm] Gio::Application: Initialize glibmm and giomm.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] Gio::Application: Initialize glibmm and giomm.
- Date: Tue, 18 Jan 2011 22:37:57 +0000 (UTC)
commit 590000d08fa94a72d042ac1143fa042c90cf9705
Author: Murray Cumming <murrayc murrayc com>
Date: Tue Jan 18 22:32:08 2011 +0100
Gio::Application: Initialize glibmm and giomm.
* glib/glibmm/objectbase.cc: Constructors: Call Glib::init(), making it
unnecessary to call this explicitly before instantiating a Glib::Object.
* gio/src/application.ccg: Make sure that giomm can be used as soon as a
Gio::Application has been instantiated.
This should let use just instantiate a Gtk::Application
instead of using Gtk::Main.
ChangeLog | 11 +++++++++++
gio/src/application.ccg | 10 ++++++++++
gio/src/application.hg | 6 ++++--
glib/glibmm/objectbase.cc | 23 +++++++++++++++++++----
4 files changed, 44 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a9b0ab4..beebcdb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2011-01-18 Murray Cumming <murrayc murrayc com>
+
+ Gio::Application: Initialize glibmm and giomm.
+
+ * glib/glibmm/objectbase.cc: Constructors: Call Glib::init(), making it
+ unnecessary to call this explicitly before instantiating a Glib::Object.
+ * gio/src/application.ccg: Make sure that giomm can be used as soon as a
+ Gio::Application has been instantiated.
+ This should let use just instantiate a Gtk::Application
+ instead of using Gtk::Main.
+
2011-01-17 Murray Cumming <murrayc murrayc com>
Fix the make check build.
diff --git a/gio/src/application.ccg b/gio/src/application.ccg
index 3cecd49..bff3c81 100644
--- a/gio/src/application.ccg
+++ b/gio/src/application.ccg
@@ -20,6 +20,7 @@
#include <gio/gio.h>
#include <giomm/file.h>
#include <giomm/actiongroup.h>
+#include <giomm/init.h>
namespace
{
@@ -102,6 +103,15 @@ static const Glib::SignalProxyInfo Application_signal_open_info =
namespace Gio
{
+Application::Application(const Glib::ustring& application_id, ApplicationFlags flags)
+:
+ _CONSTRUCT("application_id", application_id.c_str(), "flags", GApplicationFlags(flags))
+{
+ //Object::Object() has already called Glib::init().
+ //Here we initialize giomm too, which is likely to be needed:
+ Gio::init();
+}
+
void Application_Class::open_callback(GApplication* self, GFile** files,
gint n_files, const gchar *hint)
{
diff --git a/gio/src/application.hg b/gio/src/application.hg
index dc942c4..749e31d 100644
--- a/gio/src/application.hg
+++ b/gio/src/application.hg
@@ -83,10 +83,12 @@ class Application : public Glib::Object
_CLASS_GOBJECT(Application, GApplication, G_APPLICATION, Glib::Object, GObject)
protected:
- _WRAP_CTOR(Application(const Glib::ustring& application_id, ApplicationFlags flags=APPLICATION_FLAGS_NONE), g_application_new)
+ //TODO: Documentation
+ explicit Application(const Glib::ustring& application_id, ApplicationFlags flags = APPLICATION_FLAGS_NONE);
+ _IGNORE(g_application_new)
public:
- _WRAP_CREATE(const Glib::ustring& application_id, ApplicationFlags flags=APPLICATION_FLAGS_NONE)
+ _WRAP_CREATE(const Glib::ustring& application_id, ApplicationFlags flags = APPLICATION_FLAGS_NONE)
_WRAP_METHOD(static bool id_is_valid(const Glib::ustring& application_id), g_application_id_is_valid)
diff --git a/glib/glibmm/objectbase.cc b/glib/glibmm/objectbase.cc
index 4798c1f..3350918 100644
--- a/glib/glibmm/objectbase.cc
+++ b/glib/glibmm/objectbase.cc
@@ -23,7 +23,7 @@
#include <glibmm/quark.h>
#include <glibmm/objectbase.h>
#include <glibmm/propertyproxy_base.h> //For PropertyProxyConnectionNode
-
+#include <glibmm/init.h>
namespace
{
@@ -47,21 +47,36 @@ ObjectBase::ObjectBase()
gobject_ (0),
custom_type_name_ (anonymous_custom_type_name),
cpp_destruction_in_progress_ (false)
-{}
+{
+ //Check that glibmm is initialized,
+ //so that no explicit initialization is needed before instantiating Gio::Application,
+ //whose constructor uses the GType system.
+ Glib::init();
+}
ObjectBase::ObjectBase(const char* custom_type_name)
:
gobject_ (0),
custom_type_name_ (custom_type_name),
cpp_destruction_in_progress_ (false)
-{}
+{
+ //Check that glibmm is initialized,
+ //so that no explicit initialization is needed before instantiating Gio::Application,
+ //whose constructor uses the GType system.
+ Glib::init();
+}
ObjectBase::ObjectBase(const std::type_info& custom_type_info)
:
gobject_ (0),
custom_type_name_ (custom_type_info.name()),
cpp_destruction_in_progress_ (false)
-{}
+{
+ //Check that glibmm is initialized,
+ //so that no explicit initialization is needed before instantiating Gio::Application,
+ //whose constructor uses the GType system.
+ Glib::init();
+}
// initialize() actually initializes the wrapper. Glib::ObjectBase is used
// as virtual base class, which means the most-derived class' ctor invokes
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]