Fixes issues following merge with 'dev'

- External Editor: App icon not correctly managed in RTImage
- Favorite preferences: Fixes widget sizes
- Other fix: With some versions of Glib/Glibmm library on MacOS, Glib::KeyFile "load_from_file" function does not raise a Glib::Error but another exception. This causes crash opening preferences panel due to missing dynamic profiles configuration
This commit is contained in:
Pandagrapher
2023-04-29 11:06:58 +02:00
parent 2338b8f366
commit 23be310029
4 changed files with 9 additions and 5 deletions

View File

@@ -23,6 +23,7 @@
#include <glibmm/regex.h> #include <glibmm/regex.h>
#include <glibmm/miscutils.h> #include <glibmm/miscutils.h>
#include <glibmm/keyfile.h> #include <glibmm/keyfile.h>
#include <glibmm/fileutils.h>
#include "rtengine.h" #include "rtengine.h"
#include "../rtgui/options.h" #include "../rtgui/options.h"
@@ -173,9 +174,12 @@ bool DynamicProfileRules::loadRules()
{ {
dynamicRules.clear(); dynamicRules.clear();
Glib::KeyFile kf; Glib::KeyFile kf;
const Glib::ustring fileName = Glib::build_filename (Options::rtdir, "dynamicprofile.cfg");
try { try {
if (!kf.load_from_file (Glib::build_filename (Options::rtdir, "dynamicprofile.cfg"))) { if (Glib::file_test(fileName, Glib::FILE_TEST_EXISTS)) {
kf.load_from_file (fileName);
} else {
return false; return false;
} }
} catch (Glib::Error &e) { } catch (Glib::Error &e) {

View File

@@ -92,8 +92,8 @@ ExternalEditorPreferences::getEditors() const
auto children = list_model->children(); auto children = list_model->children();
for (auto rowIter = children.begin(); rowIter != children.end(); rowIter++) { for (auto rowIter = children.begin(); rowIter != children.end(); rowIter++) {
const Gio::Icon *const icon = rowIter->get_value(model_columns.icon).get(); const auto icon = rowIter->get_value(model_columns.icon);
const auto &icon_serialized = icon == nullptr ? "" : icon->serialize().print(); const auto &icon_serialized = !icon ? "" : icon->serialize().print();
editors.push_back(ExternalEditorPreferences::EditorInfo( editors.push_back(ExternalEditorPreferences::EditorInfo(
rowIter->get_value(model_columns.name), rowIter->get_value(model_columns.name),
rowIter->get_value(model_columns.command), rowIter->get_value(model_columns.command),

View File

@@ -74,7 +74,7 @@ RTImage::RTImage (const Glib::RefPtr<const Gio::Icon>& gIcon, const Gtk::IconSiz
Gtk::Image(), Gtk::Image(),
size(iconSize), size(iconSize),
icon_name(""), icon_name(""),
g_icon(Glib::RefPtr<const Gio::Icon>()) g_icon(gIcon)
{ {
// Configure RTImage based on g_icon // Configure RTImage based on g_icon
set(this->g_icon, this->size); set(this->g_icon, this->size);

View File

@@ -734,7 +734,7 @@ ToolLocationPreference::ToolLocationPreference(Options &options) :
Gtk::Box *favorites_box = Gtk::manage(new Gtk::Box()); Gtk::Box *favorites_box = Gtk::manage(new Gtk::Box());
Gtk::ScrolledWindow *favorites_list_scrolled_window = Gtk::ScrolledWindow *favorites_list_scrolled_window =
Gtk::manage(new Gtk::ScrolledWindow()); Gtk::manage(new Gtk::ScrolledWindow());
favorites_list_scrolled_window->set_min_content_width(RTScalable::scalePixelSize(300)); favorites_list_scrolled_window->set_min_content_width(RTScalable::scalePixelSize(400));
layout_grid->attach_next_to(*favorites_frame, Gtk::PositionType::POS_RIGHT, 1, 1); layout_grid->attach_next_to(*favorites_frame, Gtk::PositionType::POS_RIGHT, 1, 1);
favorites_box->pack_start(impl->favoritesListEditButtons, false, false); favorites_box->pack_start(impl->favoritesListEditButtons, false, false);
favorites_box->pack_start(*favorites_list_scrolled_window, false, false); favorites_box->pack_start(*favorites_list_scrolled_window, false, false);