[glibmm] Application: Constructor: Initialize glibmm and giomm.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] Application: Constructor: Initialize glibmm and giomm.
- Date: Wed, 19 Jan 2011 09:43:12 +0000 (UTC)
commit 44eac9079928f0ce5d119df4cbee13a2c6ee49d6
Author: Murray Cumming <murrayc murrayc com>
Date: Wed Jan 19 10:43:05 2011 +0100
Application: Constructor: Initialize glibmm and giomm.
* gio/src/application.[hg|ccg]: Use a custom klass init function to
make sure that glibmm and giomm are initialized when Gio::Application is
instantiated, so it is then unnecssary to call them explicitly.
ChangeLog | 8 ++++++++
gio/src/application.ccg | 18 ++++++++++++++++++
gio/src/application.hg | 11 ++++++++++-
3 files changed, 36 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a9b0ab4..e07e8d3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-01-19 Murray Cumming <murrayc murrayc com>
+
+ Application: Constructor: Initialize glibmm and giomm.
+
+ * gio/src/application.[hg|ccg]: Use a custom klass init function to
+ make sure that glibmm and giomm are initialized when Gio::Application is
+ instantiated, so it is then unnecssary to call them explicitly.
+
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..8899078 100644
--- a/gio/src/application.ccg
+++ b/gio/src/application.ccg
@@ -102,6 +102,24 @@ static const Glib::SignalProxyInfo Application_signal_open_info =
namespace Gio
{
+
+const Glib::Class& Application::custom_class_init()
+{
+ Glib::init();
+ Gio::init();
+ return application_class_.init();
+}
+
+
+Application::Application(const Glib::ustring& application_id, ApplicationFlags flags)
+:
+ // Mark this class as non-derived to allow C++ vfuncs to be skipped.
+ Glib::ObjectBase(0),
+ Glib::Object(Glib::ConstructParams(custom_class_init(), "application_id", application_id.c_str(), "flags", ((GApplicationFlags)(flags)), static_cast<char*>(0)))
+{
+
+}
+
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..abd4b76 100644
--- a/gio/src/application.hg
+++ b/gio/src/application.hg
@@ -83,7 +83,8 @@ 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)
+ 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)
@@ -168,6 +169,14 @@ protected:
static void open_callback(GApplication* self, GFile** files, gint n_files, const gchar* hint);
_POP()
#m4end
+
+private:
+ /** This is just a way to call Glib::init() (which calls g_type_init()) before
+ * calling application_class_.init(), so that
+ * g_application_get_type() will always succeed.
+ * See https://bugzilla.gnome.org/show_bug.cgi?id=639925
+ */
+ const Glib::Class& custom_class_init();
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]