[gtkmm] Application: Pass 0 (NULL) rather than to GApplication.



commit 07dfbb35a8c6a5ad609c1778c90997781a0b3db0
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon May 28 15:00:55 2012 +0200

    Application: Pass 0 (NULL) rather than  to GApplication.
    
    * gtk/src/application.ccg: It is annoying that GApplication (and other
    C code) distinguishes, of course.

 ChangeLog               |    7 +++++++
 gtk/src/application.ccg |    6 ++++--
 2 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7878fb6..7b25248 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2012-05-28  Murray Cumming  <murrayc murrayc com>
 
+	Application: Pass 0 (NULL) rather than "" to GApplication.
+
+	* gtk/src/application.ccg: It is annoying that GApplication (and other 
+	C code) distinguishes, of course.
+
+2012-05-28  Murray Cumming  <murrayc murrayc com>
+
 	Application: Document that ID may now be empty.
 
 	* gtk/src/application.hg: Constructors/create(): Document that the 
diff --git a/gtk/src/application.ccg b/gtk/src/application.ccg
index 4769eb0..6a3ce78 100644
--- a/gtk/src/application.ccg
+++ b/gtk/src/application.ccg
@@ -69,8 +69,9 @@ const Glib::Class& Application::custom_class_init()
 Application::Application(const Glib::ustring& application_id, Gio::ApplicationFlags flags)
 :
   // Mark this class as non-derived to allow C++ vfuncs to be skipped.
+  //Note that GApplication complains about "" but allows NULL (0), so we avoid passing "".
   Glib::ObjectBase(0),
-  Gio::Application(Glib::ConstructParams(custom_class_init(), "application_id", application_id.c_str(), "flags", GApplicationFlags(flags), static_cast<char*>(0))),
+  Gio::Application(Glib::ConstructParams(custom_class_init(), "application_id", (application_id.empty() ? 0 : application_id.c_str()), "flags", GApplicationFlags(flags), static_cast<char*>(0))),
   m_argc(0),
   m_argv(0)
 {
@@ -79,8 +80,9 @@ Application::Application(const Glib::ustring& application_id, Gio::ApplicationFl
 Application::Application(int& argc, char**& argv, const Glib::ustring& application_id, Gio::ApplicationFlags flags)
 :
   // Mark this class as non-derived to allow C++ vfuncs to be skipped.
+  //Note that GApplication complains about "" but allows NULL (0), so we avoid passing "".
   Glib::ObjectBase(0),
-  Gio::Application(Glib::ConstructParams(custom_class_init(), "application_id", application_id.c_str(), "flags", GApplicationFlags(flags), static_cast<char*>(0))),
+  Gio::Application(Glib::ConstructParams(custom_class_init(), "application_id", (application_id.empty() ? 0 : application_id.c_str()), "flags", GApplicationFlags(flags), static_cast<char*>(0))),
   m_argc(argc),
   m_argv(argv)
 {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]