[gtkmm] Application: Initialize gtkmm early enough for successful construction.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm] Application: Initialize gtkmm early enough for successful construction.
- Date: Wed, 15 Feb 2012 09:42:25 +0000 (UTC)
commit 65fc1e9d7e8c64741be9b335e05e438cf611f771
Author: Josà Alburquerque <jaalburqu svn gnome org>
Date: Tue Feb 14 18:33:27 2012 -0500
Application: Initialize gtkmm early enough for successful construction.
* gtk/src/application.{ccg,hg} (init_gtkmm_internals): Place function
in an anonymous namespace.
(Application::custom_class_init): Initialize gtkmm in this method so
that construction is successful after.
(Application::Application): Add a gtk_init() call in the command-line
argument constructor so that gtk+ command-line parsing is correctly
done.
(Application::create): Remove the call to the init_gtkmm() methods
because initialization has already taken place in the construction
process.
(Application::init_gtkmm): Remove these methods for efficiency.
Bug #637445.
ChangeLog | 19 +++++++++++++++++++
gtk/src/application.ccg | 30 ++++++++----------------------
gtk/src/application.hg | 12 ------------
3 files changed, 27 insertions(+), 34 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 8dde7a5..f87f949 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2012-02-14 Josà Alburquerque <jaalburquerque gmail com>
+
+ Application: Initialize gtkmm early enough for successful construction.
+
+ * gtk/src/application.{ccg,hg} (init_gtkmm_internals): Place function
+ in an anonymous namespace.
+ (Application::custom_class_init): Initialize gtkmm in this method so
+ that construction is successful after.
+ (Application::Application): Add a gtk_init() call in the command-line
+ argument constructor so that gtk+ command-line parsing is correctly
+ done.
+ (Application::create): Remove the call to the init_gtkmm() methods
+ because initialization has already taken place in the construction
+ process.
+ (Application::init_gtkmm): Remove these methods for efficiency.
+
+ Bug #637445.
+
+
2012-02-13 Murray Cumming <murrayc murrayc com>
Gtk::Border: Add reference documentation.
diff --git a/gtk/src/application.ccg b/gtk/src/application.ccg
index 58124fc..8f67247 100644
--- a/gtk/src/application.ccg
+++ b/gtk/src/application.ccg
@@ -31,10 +31,9 @@
#include <gdkmm/wrap_init.h>
#include <gtkmm/wrap_init.h>
-namespace Gtk
+namespace
{
-
static void init_gtkmm_internals()
{
static bool init_done = false;
@@ -56,9 +55,14 @@ static void init_gtkmm_internals()
}
}
+} // anonymous namespace
+
+namespace Gtk
+{
+
const Glib::Class& Application::custom_class_init()
{
- Glib::init();
+ init_gtkmm_internals();
return application_class_.init();
}
@@ -82,37 +86,19 @@ Application::Application(int argc, char** argv, const Glib::ustring& application
m_argc(argc),
m_argv(argv)
{
+ gtk_init(&argc, &argv);
}
Glib::RefPtr<Application> Application::create(const Glib::ustring& application_id, Gio::ApplicationFlags flags)
{
- //Let the constructor succeed:
- init_gtkmm();
-
return Glib::RefPtr<Application>( new Application(application_id, flags) );
}
Glib::RefPtr<Application> Application::create(int argc, char** argv, const Glib::ustring& application_id, Gio::ApplicationFlags flags)
{
- //Let the constructor succeed:
- init_gtkmm(argc, argv);
-
return Glib::RefPtr<Application>( new Application(argc, argv, application_id, flags) );
}
-void Application::init_gtkmm()
-{
- gtk_init(0, 0);
- init_gtkmm_internals();
-}
-
-void Application::init_gtkmm(int& argc, char**& argv)
-{
- gtk_init(&argc, &argv);
- init_gtkmm_internals();
-}
-
-
void Application::on_activate_showwindow()
{
if(m_main_window)
diff --git a/gtk/src/application.hg b/gtk/src/application.hg
index b4e10e8..fa44632 100644
--- a/gtk/src/application.hg
+++ b/gtk/src/application.hg
@@ -155,18 +155,6 @@ public:
*/
int run();
-protected:
-
- /** Initialize GTK+ and gtkmm.
- * This should be used by derived classes in their create() methods.
- */
- static void init_gtkmm();
-
- /** Initialize GTK+ and gtkmm.
- * This should be used by derived classes in their create() methods.
- */
- static void init_gtkmm(int& argc, char**& argv);
-
private:
/** This is just a way to call Glib::init() (which calls g_type_init()) before
* calling application_class_.init(), so that
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]