[glom] Remove remaining uses of deprecated Gtk::Main API.



commit 2af2e45816ad5b870e0e5bceb38849d431f42726
Author: Murray Cumming <murrayc murrayc com>
Date:   Sat Mar 3 15:06:33 2012 +0100

    Remove remaining uses of deprecated Gtk::Main API.

 ChangeLog                                          |    4 ++++
 glom/application.cc                                |    1 -
 glom/appwindow.cc                                  |   12 ++++++------
 .../eggspreadtablemm/test_spreadtablednd.cc        |    9 ++++-----
 glom/utility_widgets/test_flowtable.cc             |    9 ++++-----
 tests/glade_toplevels_instantiation.cc             |    5 +++--
 tests/test_glade_derived_instantiation.cc          |    5 +++--
 7 files changed, 24 insertions(+), 21 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 8c5ea43..1eca4ef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-03-03  Murray Cumming  <murrayc murrayc com>
+
+	Remove remaining uses of deprecated Gtk::Main API.
+
 2012-03-01  Murray Cumming  <murrayc murrayc com>
 
 	Add a unistd.h include to fix the mingw MS Windows build.
diff --git a/glom/application.cc b/glom/application.cc
index dae306d..6ac5d52 100644
--- a/glom/application.cc
+++ b/glom/application.cc
@@ -22,7 +22,6 @@
 #include <glom/appwindow.h>
 #include <glom/main_local_options.h>
 #include <glom/glade_utils.h>
-#include <gtkmm/main.h>
 #include <glibmm/optioncontext.h>
 #include <iostream>
 
diff --git a/glom/appwindow.cc b/glom/appwindow.cc
index 214fd14..5b62703 100644
--- a/glom/appwindow.cc
+++ b/glom/appwindow.cc
@@ -1610,8 +1610,8 @@ void AppWindow::on_recreate_database_progress()
   pulse_progress_message();
 
   //Ensure that the infobar is shown, instead of waiting for the application to be idle.
-  while(Gtk::Main::instance()->events_pending())
-    Gtk::Main::instance()->iteration();
+  while(Gtk::Main::events_pending())
+    Gtk::Main::iteration();
 }
 
 bool AppWindow::recreate_database_from_example(bool& user_cancelled)
@@ -1682,8 +1682,8 @@ bool AppWindow::recreate_database_from_example(bool& user_cancelled)
   pulse_progress_message();
 
   //Ensure that the infobar is shown, instead of waiting for the application to be idle.
-  while(Gtk::Main::instance()->events_pending())
-    Gtk::Main::instance()->iteration();
+  while(Gtk::Main::events_pending())
+    Gtk::Main::iteration();
 
   //Create the database: (This will show a connection dialog)
   connection_pool->set_database( Glib::ustring() );
@@ -1861,8 +1861,8 @@ bool AppWindow::recreate_database_from_backup(const Glib::ustring& backup_uri, b
   pulse_progress_message();
 
   //Ensure that the infobar is shown, instead of waiting for the application to be idle.
-  while(Gtk::Main::instance()->events_pending())
-    Gtk::Main::instance()->iteration();
+  while(Gtk::Main::events_pending())
+    Gtk::Main::iteration();
 
   pulse_progress_message();
 
diff --git a/glom/utility_widgets/eggspreadtablemm/test_spreadtablednd.cc b/glom/utility_widgets/eggspreadtablemm/test_spreadtablednd.cc
index 10872c8..b136c36 100644
--- a/glom/utility_widgets/eggspreadtablemm/test_spreadtablednd.cc
+++ b/glom/utility_widgets/eggspreadtablemm/test_spreadtablednd.cc
@@ -32,7 +32,7 @@
 #include <gtkmm/frame.h>
 #include <gtkmm/comboboxtext.h>
 #include <gtkmm/scrolledwindow.h>
-#include <gtkmm/main.h>
+#include <gtkmm/application.h>
 
 static const guint INITIAL_HSPACING = 2;
 static const guint INITIAL_VSPACING = 2;
@@ -358,10 +358,9 @@ create_window()
 int
 main(int argc, char *argv[])
 {
-  Gtk::Main kit(argc, argv);
+  Glib::RefPtr<Gtk::Application> app = 
+    Gtk::Application::create(argc, argv, "org.glom.test_spreadtablednd");
 
   Gtk::Window* window = create_window();
-  Gtk::Main::run(*window);
-
-  return 0;
+  return app->run(*window);
 }
diff --git a/glom/utility_widgets/test_flowtable.cc b/glom/utility_widgets/test_flowtable.cc
index fdcab42..e4a5c9b 100644
--- a/glom/utility_widgets/test_flowtable.cc
+++ b/glom/utility_widgets/test_flowtable.cc
@@ -22,7 +22,7 @@
 #include <gtkmm/entry.h>
 #include <gtkmm/label.h>
 #include <gtkmm/button.h>
-#include <gtkmm/main.h>
+#include <gtkmm/application.h>
 #include "flowtable.h"
 #include <iostream>
 
@@ -100,7 +100,8 @@ static void clear_flowtable(Glom::FlowTable& flowtable)
 int
 main(int argc, char* argv[])
 {
-  Gtk::Main mainInstance(argc, argv);
+  Glib::RefPtr<Gtk::Application> app = 
+    Gtk::Application::create(argc, argv, "org.glom.test_flowtable");
 
   Gtk::Window window;
   //Gtk::Box flowtable;
@@ -120,7 +121,5 @@ main(int argc, char* argv[])
 //  Glom::DragWindow drag_window;
 //  drag_window.show();
 
-  Gtk::Main::run(window);
-
-  return 0;
+  return app->run(window);
 }
diff --git a/tests/glade_toplevels_instantiation.cc b/tests/glade_toplevels_instantiation.cc
index c73e095..9dc1f24 100644
--- a/tests/glade_toplevels_instantiation.cc
+++ b/tests/glade_toplevels_instantiation.cc
@@ -19,7 +19,7 @@
 
 #include <gtkmm/builder.h>
 #include <gtkmm/dialog.h>
-#include <gtkmm/main.h>
+#include <gtkmm/application.h>
 #include <gtksourceviewmm/init.h>
 #include <libxml++/libxml++.h>
 
@@ -90,7 +90,8 @@ static bool attempt_instantiation(const std::string& filepath, const xmlpp::Elem
 
 int main(int argc, char* argv[])
 {
-  Gtk::Main kit(argc, argv);
+  Glib::RefPtr<Gtk::Application> app = 
+    Gtk::Application::create(argc, argv, "org.glom.test_glade_toplevels_instantiation");
   Gsv::init(); //Our .glade files contain gtksourceview widgets too.
 
   std::string filepath;
diff --git a/tests/test_glade_derived_instantiation.cc b/tests/test_glade_derived_instantiation.cc
index ec27d77..971af29 100644
--- a/tests/test_glade_derived_instantiation.cc
+++ b/tests/test_glade_derived_instantiation.cc
@@ -73,7 +73,7 @@
 #include <glom/mode_design/print_layouts/dialog_text_formatting.h>
 #include <glom/dialog_invalid_data.h>
 #include <gtkmm/builder.h>
-#include <gtkmm/main.h>
+#include <gtkmm/application.h>
 #include <gtksourceviewmm/init.h>
 
 const int GLOM_MAX_WINDOW_WIDTH = 800;
@@ -115,7 +115,8 @@ bool instantiate_widget()
 
 int main(int argc, char *argv[])
 {
-  Gtk::Main kit(argc, argv);
+  Glib::RefPtr<Gtk::Application> app = 
+    Gtk::Application::create(argc, argv, "org.glom.test_glade_derived_instantiation");
   Gsv::init(); //Our .glade files contain gtksourceview widgets too.
 
   using namespace Glom;



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