Remove all conditional compilation w.r.t. disabling exceptions in Glib since that is no longer supported anyway.
This commit is contained in:
@@ -21,10 +21,6 @@
|
||||
#include <glib/gstdio.h>
|
||||
#include "safegtk.h"
|
||||
|
||||
#ifndef GLIBMM_EXCEPTIONS_ENABLED
|
||||
#include <memory>
|
||||
#endif
|
||||
|
||||
using namespace rtengine;
|
||||
|
||||
extern "C" IptcData *iptc_data_new_from_jpeg_file (FILE* infile);
|
||||
|
@@ -76,23 +76,18 @@ Cairo::RefPtr<Cairo::ImageSurface> safe_create_from_png(const Glib::ustring& fil
|
||||
Glib::RefPtr<Gio::FileInfo> safe_query_file_info (Glib::RefPtr<Gio::File> &file)
|
||||
{
|
||||
Glib::RefPtr<Gio::FileInfo> info;
|
||||
#ifdef GLIBMM_EXCEPTIONS_ENABLED
|
||||
|
||||
try {
|
||||
info = file->query_info();
|
||||
} catch (...) { }
|
||||
|
||||
#else
|
||||
std::auto_ptr<Glib::Error> error;
|
||||
info = file->query_info("*", Gio::FILE_QUERY_INFO_NONE, error);
|
||||
#endif
|
||||
return info;
|
||||
}
|
||||
|
||||
Glib::RefPtr<Gio::FileInfo> safe_next_file (Glib::RefPtr<Gio::FileEnumerator> &dirList)
|
||||
{
|
||||
Glib::RefPtr<Gio::FileInfo> info;
|
||||
#ifdef GLIBMM_EXCEPTIONS_ENABLED
|
||||
|
||||
bool retry;
|
||||
Glib::ustring last_error = "";
|
||||
|
||||
@@ -113,42 +108,15 @@ Glib::RefPtr<Gio::FileInfo> safe_next_file (Glib::RefPtr<Gio::FileEnumerator> &d
|
||||
}
|
||||
} while (retry);
|
||||
|
||||
#else
|
||||
bool retry;
|
||||
Glib::ustring last_error = "";
|
||||
|
||||
do {
|
||||
retry = false;
|
||||
std::auto_ptr<Glib::Error> error;
|
||||
Glib::RefPtr<Gio::Cancellable> cancellable;
|
||||
info = dirList->next_file(cancellable, error);
|
||||
|
||||
if (!info && error.get()) {
|
||||
printf ("%s\n", error.what().c_str());
|
||||
retry = (error.what() != last_error);
|
||||
last_error = error.what();
|
||||
}
|
||||
} while (retry);
|
||||
|
||||
#endif
|
||||
return info;
|
||||
}
|
||||
|
||||
#ifdef GLIBMM_EXCEPTIONS_ENABLED
|
||||
# define SAFE_ENUMERATOR_CODE_START \
|
||||
do{try { if ((dirList = dir->enumerate_children ())) \
|
||||
for (Glib::RefPtr<Gio::FileInfo> info = safe_next_file(dirList); info; info = safe_next_file(dirList)) {
|
||||
|
||||
# define SAFE_ENUMERATOR_CODE_END \
|
||||
}} catch (Glib::Exception& ex) { printf ("%s\n", ex.what().c_str()); }}while(0)
|
||||
#else
|
||||
# define SAFE_ENUMERATOR_CODE_START \
|
||||
do{std::auto_ptr<Glib::Error> error; Glib::RefPtr<Gio::Cancellable> cancellable; \
|
||||
if ((dirList = dir->enumerate_children (cancellable, "*", Gio::FILE_QUERY_INFO_NONE, error))) \
|
||||
for (Glib::RefPtr<Gio::FileInfo> info = safe_next_file(dirList); info; info = safe_next_file(dirList)) {
|
||||
|
||||
# define SAFE_ENUMERATOR_CODE_END } if (error.get()) printf ("%s\n", error->what().c_str());}while (0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* safe_build_file_list can now filter out at the source all files that doesn't have the extensions specified (if provided)
|
||||
@@ -223,8 +191,8 @@ void safe_build_subdir_list (Glib::RefPtr<Gio::File> &dir, std::vector<Glib::ust
|
||||
Glib::ustring safe_filename_to_utf8 (const std::string& src)
|
||||
{
|
||||
Glib::ustring utf8_str;
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef GLIBMM_EXCEPTIONS_ENABLED
|
||||
|
||||
try {
|
||||
utf8_str = Glib::locale_to_utf8(src);
|
||||
@@ -233,25 +201,17 @@ Glib::ustring safe_filename_to_utf8 (const std::string& src)
|
||||
}
|
||||
|
||||
#else
|
||||
{
|
||||
std::auto_ptr<Glib::Error> error;
|
||||
utf8_str = locale_to_utf8(src, error);
|
||||
|
||||
if (error.get()) {
|
||||
utf8_str = Glib::convert_with_fallback(src, "UTF-8", "ISO-8859-1", "?", error);
|
||||
}
|
||||
}
|
||||
#endif //GLIBMM_EXCEPTIONS_ENABLED
|
||||
#else
|
||||
utf8_str = Glib::filename_to_utf8(src);
|
||||
|
||||
#endif
|
||||
|
||||
return utf8_str;
|
||||
}
|
||||
|
||||
Glib::ustring safe_locale_to_utf8 (const std::string& src)
|
||||
{
|
||||
Glib::ustring utf8_str;
|
||||
#ifdef GLIBMM_EXCEPTIONS_ENABLED
|
||||
|
||||
try {
|
||||
utf8_str = Glib::locale_to_utf8(src);
|
||||
@@ -259,38 +219,17 @@ Glib::ustring safe_locale_to_utf8 (const std::string& src)
|
||||
utf8_str = Glib::convert_with_fallback(src, "UTF-8", "ISO-8859-1", "?");
|
||||
}
|
||||
|
||||
#else
|
||||
{
|
||||
std::auto_ptr<Glib::Error> error;
|
||||
utf8_str = locale_to_utf8(src, error);
|
||||
|
||||
if (error.get()) {
|
||||
utf8_str = Glib::convert_with_fallback(src, "UTF-8", "ISO-8859-1", "?", error);
|
||||
}
|
||||
}
|
||||
#endif //GLIBMM_EXCEPTIONS_ENABLED
|
||||
return utf8_str;
|
||||
}
|
||||
|
||||
std::string safe_locale_from_utf8 (const Glib::ustring& utf8_str)
|
||||
{
|
||||
std::string str;
|
||||
#ifdef GLIBMM_EXCEPTIONS_ENABLED
|
||||
|
||||
try {
|
||||
str = Glib::locale_from_utf8(utf8_str);
|
||||
} catch (const Glib::Error& e) {
|
||||
//str = Glib::convert_with_fallback(utf8_str, "ISO-8859-1", "UTF-8", "?");
|
||||
}
|
||||
} catch (Glib::Error&) {}
|
||||
|
||||
#else
|
||||
{
|
||||
std::auto_ptr<Glib::Error> error;
|
||||
str = Glib::locale_from_utf8(utf8_str, error);
|
||||
/*if (error.get())
|
||||
{str = Glib::convert_with_fallback(utf8_str, "ISO-8859-1", "UTF-8", "?", error);}*/
|
||||
}
|
||||
#endif //GLIBMM_EXCEPTIONS_ENABLED
|
||||
return str;
|
||||
}
|
||||
|
||||
@@ -298,7 +237,6 @@ bool safe_spawn_command_line_async (const Glib::ustring& cmd_utf8)
|
||||
{
|
||||
std::string cmd;
|
||||
bool success = false;
|
||||
#ifdef GLIBMM_EXCEPTIONS_ENABLED
|
||||
|
||||
try {
|
||||
cmd = Glib::filename_from_utf8(cmd_utf8);
|
||||
@@ -309,22 +247,6 @@ bool safe_spawn_command_line_async (const Glib::ustring& cmd_utf8)
|
||||
printf ("%s\n", ex.what().c_str());
|
||||
}
|
||||
|
||||
#else
|
||||
std::auto_ptr<Glib::Error> error;
|
||||
cmd = Glib::filename_from_utf8(cmd_utf8, error);
|
||||
|
||||
if (!error.get()) {
|
||||
printf ("command line: %s\n", cmd.c_str());
|
||||
Glib::spawn_command_line_async (cmd, error);
|
||||
}
|
||||
|
||||
if (error.get()) {
|
||||
printf ("%s\n", error->what().c_str());
|
||||
} else {
|
||||
success = true;
|
||||
}
|
||||
|
||||
#endif
|
||||
return success;
|
||||
}
|
||||
|
||||
|
@@ -61,20 +61,12 @@ EditWindow::EditWindow (RTWindow* p) : parent(p) , isFullscreen(false)
|
||||
Glib::ustring fName = "rt-logo.png";
|
||||
Glib::ustring fullPath = RTImage::findIconAbsolutePath(fName);
|
||||
|
||||
#ifdef GLIBMM_EXCEPTIONS_ENABLED
|
||||
|
||||
try {
|
||||
set_default_icon_from_file (fullPath);
|
||||
} catch(Glib::Exception& ex) {
|
||||
printf ("%s\n", ex.what().c_str());
|
||||
}
|
||||
|
||||
#else
|
||||
{
|
||||
std::auto_ptr<Glib::Error> error;
|
||||
set_default_icon_from_file (fullPath, error);
|
||||
}
|
||||
#endif //GLIBMM_EXCEPTIONS_ENABLED
|
||||
set_title_decorated("");
|
||||
property_allow_shrink() = true;
|
||||
set_modal(false);
|
||||
|
@@ -94,21 +94,12 @@ RTWindow::RTWindow ()
|
||||
Glib::ustring fName = "rt-logo.png";
|
||||
Glib::ustring fullPath = RTImage::findIconAbsolutePath(fName);
|
||||
|
||||
#ifdef GLIBMM_EXCEPTIONS_ENABLED
|
||||
|
||||
try {
|
||||
set_default_icon_from_file (fullPath);
|
||||
} catch(Glib::Exception& ex) {
|
||||
printf ("%s\n", ex.what().c_str());
|
||||
}
|
||||
|
||||
#else
|
||||
{
|
||||
std::auto_ptr<Glib::Error> error;
|
||||
set_default_icon_from_file (fullPath, error);
|
||||
}
|
||||
#endif //GLIBMM_EXCEPTIONS_ENABLED
|
||||
|
||||
#if defined(__APPLE__)
|
||||
{
|
||||
osxApp = (GtkosxApplication *)g_object_new (GTKOSX_TYPE_APPLICATION, NULL);
|
||||
|
Reference in New Issue
Block a user