[glom] Remove useless old GLIBMM_EXCEPTIONS_ENABLED ifdefs.



commit cc8970ed10d5fcbc73af777d260d4d66d9b40ee7
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Nov 3 20:07:16 2015 +0100

    Remove useless old GLIBMM_EXCEPTIONS_ENABLED ifdefs.

 glom/appwindow.cc                                  |   89 +++-----------------
 glom/libglom/connectionpool_backends/mysql.cc      |   15 ----
 glom/libglom/connectionpool_backends/postgres.cc   |   15 ----
 .../eggspreadtablemm/eggspreadtabledndmm.cc        |   12 ---
 4 files changed, 13 insertions(+), 118 deletions(-)
---
diff --git a/glom/appwindow.cc b/glom/appwindow.cc
index 10b305d..f0d2c40 100644
--- a/glom/appwindow.cc
+++ b/glom/appwindow.cc
@@ -1510,47 +1510,22 @@ bool AppWindow::recreate_database_from_example(bool& user_cancelled)
     return false;
 
   connection_pool->set_database(db_name);
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
   try
-#else
-  std::shared_ptr<std::exception> error;
-#endif // GLIBMM_EXCEPTIONS_ENABLED
   {
     connection_pool->set_ready_to_connect(); //This has succeeded already.
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
     std::shared_ptr<SharedConnection> sharedconnection = connection_pool->connect();
-#else
-    std::shared_ptr<SharedConnection> sharedconnection = connection_pool->connect(error);
-    if(!error.get())
-    {
-#endif // GLIBMM_EXCEPTIONS_ENABLED
-      std::cerr << G_STRFUNC << ": Failed because database exists already." << std::endl;
+    std::cerr << G_STRFUNC << ": Failed because database exists already." << std::endl;
 
-      return false; //Connection to the database succeeded, because no exception was thrown. so the database 
exists already.
-#ifndef GLIBMM_EXCEPTIONS_ENABLED
-    }
-#endif // !GLIBMM_EXCEPTIONS_ENABLED
+    return false; //Connection to the database succeeded, because no exception was thrown. so the database 
exists already.
   }
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
   catch(const ExceptionConnection& ex)
   {
-#else
-  if(error.get())
-  {
-    const auto exptr = dynamic_cast<ExceptionConnection*>(error.get());
-    if(exptr)
+    if(ex.get_failure_type() == ExceptionConnection::failure_type::NO_SERVER)
     {
-      const ExceptionConnection& ex = *exptr;
-#endif // GLIBMM_EXCEPTIONS_ENABLED
-      if(ex.get_failure_type() == ExceptionConnection::failure_type::NO_SERVER)
-      {
-        user_cancelled = true; //Eventually, the user will cancel after retrying.
-        std::cerr << G_STRFUNC << ": Failed because connection to server failed, without specifying a 
database." << std::endl;
-        return false;
-      }
-#ifndef GLIBMM_EXCEPTIONS_ENABLED
+      user_cancelled = true; //Eventually, the user will cancel after retrying.
+      std::cerr << G_STRFUNC << ": Failed because connection to server failed, without specifying a 
database." << std::endl;
+      return false;
     }
-#endif // !GLIBMM_EXCEPTIONS_ENABLED
 
     //Otherwise continue, because we _expected_ connect() to fail if the db does not exist yet.
   }
@@ -1577,26 +1552,13 @@ bool AppWindow::recreate_database_from_example(bool& user_cancelled)
   BusyCursor busy_cursor(this);
 
   std::shared_ptr<SharedConnection> sharedconnection;
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
   try
-#endif // GLIBMM_EXCEPTIONS_ENABLED
   {
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
     sharedconnection = connection_pool->connect();
-#else
-    sharedconnection = connection_pool->connect(error);
-    if(!error.get())
-#endif // GLIBMM_EXCEPTIONS_ENABLED
-      connection_pool->set_database(db_name); //The database was successfully created, so specify it when 
connecting from now on.
+    connection_pool->set_database(db_name); //The database was successfully created, so specify it when 
connecting from now on.
   }
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
   catch(const ExceptionConnection& ex)
   {
-#else
-  if(error.get())
-  {
-    const auto ex = *error.get();
-#endif // GLIBMM_EXCEPTIONS_ENABLED
     std::cerr << G_STRFUNC << ": Failed to connect to the newly-created database." << std::endl;
     return false;
   }
@@ -1692,47 +1654,22 @@ bool AppWindow::recreate_database_from_backup(const std::string& backup_data_fil
     return false;
 
   connection_pool->set_database(db_name);
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
   try
-#else
-  std::shared_ptr<std::exception> error;
-#endif // GLIBMM_EXCEPTIONS_ENABLED
   {
     connection_pool->set_ready_to_connect(); //This has succeeded already.
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
     std::shared_ptr<SharedConnection> sharedconnection = connection_pool->connect();
-#else
-    std::shared_ptr<SharedConnection> sharedconnection = connection_pool->connect(error);
-    if(!error.get())
-    {
-#endif // GLIBMM_EXCEPTIONS_ENABLED
-      std::cerr << G_STRFUNC << ": Failed because database exists already." << std::endl;
+    std::cerr << G_STRFUNC << ": Failed because database exists already." << std::endl;
 
-      return false; //Connection to the database succeeded, because no exception was thrown. so the database 
exists already.
-#ifndef GLIBMM_EXCEPTIONS_ENABLED
-    }
-#endif // !GLIBMM_EXCEPTIONS_ENABLED
+    return false; //Connection to the database succeeded, because no exception was thrown. so the database 
exists already.
   }
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
   catch(const ExceptionConnection& ex)
   {
-#else
-  if(error.get())
-  {
-    const auto exptr = dynamic_cast<ExceptionConnection*>(error.get());
-    if(exptr)
+    if(ex.get_failure_type() == ExceptionConnection::failure_type::NO_SERVER)
     {
-      const ExceptionConnection& ex = *exptr;
-#endif // GLIBMM_EXCEPTIONS_ENABLED
-      if(ex.get_failure_type() == ExceptionConnection::failure_type::NO_SERVER)
-      {
-        user_cancelled = true; //Eventually, the user will cancel after retrying.
-        std::cerr << G_STRFUNC << ": Failed because connection to server failed, without specifying a 
database." << std::endl;
-        return false;
-      }
-#ifndef GLIBMM_EXCEPTIONS_ENABLED
+      user_cancelled = true; //Eventually, the user will cancel after retrying.
+      std::cerr << G_STRFUNC << ": Failed because connection to server failed, without specifying a 
database." << std::endl;
+      return false;
     }
-#endif // !GLIBMM_EXCEPTIONS_ENABLED
 
     //Otherwise continue, because we _expected_ connect() to fail if the db does not exist yet.
   }
diff --git a/glom/libglom/connectionpool_backends/mysql.cc b/glom/libglom/connectionpool_backends/mysql.cc
index d384ca5..fbf3f88 100644
--- a/glom/libglom/connectionpool_backends/mysql.cc
+++ b/glom/libglom/connectionpool_backends/mysql.cc
@@ -771,7 +771,6 @@ bool MySQL::create_text_file(const std::string& file_uri, const std::string& con
   Glib::RefPtr<Gio::FileOutputStream> stream;
 
   //Create the file if it does not already exist:
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
   try
   {
     if(file->query_exists())
@@ -801,13 +800,6 @@ bool MySQL::create_text_file(const std::string& file_uri, const std::string& con
   }
   catch(const Gio::Error& ex)
   {
-#else
-  std::shared_ptr<Gio::Error> error;
-  stream.create(error);
-  if(error.get())
-  {
-    const auto ex = *error.get();
-#endif
     // If the operation was not successful, print the error and abort
     std::cerr << G_STRFUNC << ": ConnectionPool::create_text_file(): exception while creating file." << 
std::endl
       << "  file uri:" << file_uri << std::endl
@@ -822,7 +814,6 @@ bool MySQL::create_text_file(const std::string& file_uri, const std::string& con
 
   gssize bytes_written = 0;
   const auto contents_size = contents.size();
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
   try
   {
     //Write the data to the output uri
@@ -830,12 +821,6 @@ bool MySQL::create_text_file(const std::string& file_uri, const std::string& con
   }
   catch(const Gio::Error& ex)
   {
-#else
-  bytes_written = stream->write(contents.data(), contents_size, error);
-  if(error.get())
-  {
-    auto ex = *error.get();
-#endif
     // If the operation was not successful, print the error and abort
     std::cerr << G_STRFUNC << ": ConnectionPool::create_text_file(): exception while writing to file." << 
std::endl
       << "  file uri:" << file_uri << std::endl
diff --git a/glom/libglom/connectionpool_backends/postgres.cc 
b/glom/libglom/connectionpool_backends/postgres.cc
index 8fb7f18..bf0b1b7 100644
--- a/glom/libglom/connectionpool_backends/postgres.cc
+++ b/glom/libglom/connectionpool_backends/postgres.cc
@@ -873,7 +873,6 @@ bool Postgres::create_text_file(const std::string& file_uri, const std::string&
   Glib::RefPtr<Gio::FileOutputStream> stream;
 
   //Create the file if it does not already exist:
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
   try
   {
     if(file->query_exists())
@@ -903,13 +902,6 @@ bool Postgres::create_text_file(const std::string& file_uri, const std::string&
   }
   catch(const Gio::Error& ex)
   {
-#else
-  std::shared_ptr<Gio::Error> error;
-  stream.create(error);
-  if(error.get())
-  {
-    const auto ex = *error.get();
-#endif
     // If the operation was not successful, print the error and abort
     std::cerr << G_STRFUNC << ": ConnectionPool::create_text_file(): exception while creating file." << 
std::endl
       << "  file uri:" << file_uri << std::endl
@@ -924,7 +916,6 @@ bool Postgres::create_text_file(const std::string& file_uri, const std::string&
 
   gssize bytes_written = 0;
   const auto contents_size = contents.size();
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
   try
   {
     //Write the data to the output uri
@@ -932,12 +923,6 @@ bool Postgres::create_text_file(const std::string& file_uri, const std::string&
   }
   catch(const Gio::Error& ex)
   {
-#else
-  bytes_written = stream->write(contents.data(), contents_size, error);
-  if(error.get())
-  {
-    auto ex = *error.get();
-#endif
     // If the operation was not successful, print the error and abort
     std::cerr << G_STRFUNC << ": ConnectionPool::create_text_file(): exception while writing to file." << 
std::endl
       << "  file uri:" << file_uri << std::endl
diff --git a/glom/utility_widgets/eggspreadtablemm/eggspreadtabledndmm.cc 
b/glom/utility_widgets/eggspreadtablemm/eggspreadtabledndmm.cc
index 5c396d5..8106ef0 100644
--- a/glom/utility_widgets/eggspreadtablemm/eggspreadtabledndmm.cc
+++ b/glom/utility_widgets/eggspreadtablemm/eggspreadtabledndmm.cc
@@ -46,10 +46,8 @@ static gboolean EggSpreadTableDnd_signal_widget_drop_possible_callback(EggSpread
   // Do not try to call a signal on a disassociated wrapper.
   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
   {
-    #ifdef GLIBMM_EXCEPTIONS_ENABLED
     try
     {
-    #endif //GLIBMM_EXCEPTIONS_ENABLED
       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
       {
         bool cpp_drop_possible = false;
@@ -57,13 +55,11 @@ static gboolean EggSpreadTableDnd_signal_widget_drop_possible_callback(EggSpread
         *drop_possible = cpp_drop_possible;
         return result;
       }
-    #ifdef GLIBMM_EXCEPTIONS_ENABLED
     }
     catch(...)
     {
       Glib::exception_handlers_invoke();
     }
-    #endif //GLIBMM_EXCEPTIONS_ENABLED
   }
 
   typedef gboolean RType;
@@ -78,10 +74,8 @@ static gboolean EggSpreadTableDnd_signal_widget_drop_possible_notify_callback(Eg
   // Do not try to call a signal on a disassociated wrapper.
   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
   {
-    #ifdef GLIBMM_EXCEPTIONS_ENABLED
     try
     {
-    #endif //GLIBMM_EXCEPTIONS_ENABLED
       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
       {
         bool cpp_drop_possible = false;
@@ -89,13 +83,11 @@ static gboolean EggSpreadTableDnd_signal_widget_drop_possible_notify_callback(Eg
         *drop_possible = cpp_drop_possible;
         return result;
       }
-    #ifdef GLIBMM_EXCEPTIONS_ENABLED
     }
     catch(...)
     {
       Glib::exception_handlers_invoke();
     }
-    #endif //GLIBMM_EXCEPTIONS_ENABLED
   }
 
   typedef gboolean RType;
@@ -160,10 +152,8 @@ gboolean SpreadTableDnd_Class::widget_drop_possible_callback(EggSpreadTableDnd*
     CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
     if(obj) // This can be NULL during destruction.
     {
-      #ifdef GLIBMM_EXCEPTIONS_ENABLED
       try // Trap C++ exceptions which would normally be lost because this is a C callback.
       {
-      #endif //GLIBMM_EXCEPTIONS_ENABLED
         // Call the virtual member method, which derived classes might override.
         bool cpp_drop_possible = false;
         const bool result = 
@@ -171,13 +161,11 @@ gboolean SpreadTableDnd_Class::widget_drop_possible_callback(EggSpreadTableDnd*
             cpp_drop_possible));
         *drop_possible = cpp_drop_possible;
         return result;
-      #ifdef GLIBMM_EXCEPTIONS_ENABLED
       }
       catch(...)
       {
         Glib::exception_handlers_invoke();
       }
-      #endif //GLIBMM_EXCEPTIONS_ENABLED
     }
   }
 


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