From d6c5424f69aeb91cf1cfeba262b5466a42dd95a5 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Thu, 19 Oct 2017 23:41:25 +0200 Subject: FontFactory: Add function to add additional font directories --- src/libnrtype/FontFactory.cpp | 32 ++++++++++++++++++++++++++++++++ src/libnrtype/FontFactory.h | 3 +++ 2 files changed, 35 insertions(+) (limited to 'src') diff --git a/src/libnrtype/FontFactory.cpp b/src/libnrtype/FontFactory.cpp index bf4cbc56f..677b8abe7 100644 --- a/src/libnrtype/FontFactory.cpp +++ b/src/libnrtype/FontFactory.cpp @@ -17,8 +17,11 @@ #endif #include +#include +#include #include #include +#include "io/sys.h" #include "libnrtype/FontFactory.h" #include "libnrtype/font-instance.h" #include "util/unordered-containers.h" @@ -914,6 +917,35 @@ void font_factory::AddInCache(font_instance *who) nbEnt++; } +void font_factory::AddFontsDir(char const *utf8dir) +{ +#ifdef USE_PANGO_WIN32 + g_info("Adding additional font directories only supported for fontconfig backend."); +#else + if (!Inkscape::IO::file_test(utf8dir, G_FILE_TEST_IS_DIR)) { + g_warning("Fonts dir '%s' does not exist and will be ignored.", utf8dir); + return; + } + + gchar *dir; +# ifdef WIN32 + dir = g_win32_locale_filename_from_utf8(utf8dir); +# else + dir = g_filename_from_utf8(utf8dir, -1, NULL, NULL, NULL); +# endif + + FcConfig *conf = pango_fc_font_map_get_config(PANGO_FC_FONT_MAP(fontServer)); + FcBool res = FcConfigAppFontAddDir(conf, (FcChar8 const *)dir); + if (res = FcTrue) { + g_info("Fonts dir '%s' added successfully.", utf8dir); + } else { + g_warning("Could not add fonts dir '%s'.", utf8dir); + } + + g_free(dir); +#endif +} + /* Local Variables: mode:c++ diff --git a/src/libnrtype/FontFactory.h b/src/libnrtype/FontFactory.h index 41c4cb6eb..c273be2f4 100644 --- a/src/libnrtype/FontFactory.h +++ b/src/libnrtype/FontFactory.h @@ -136,6 +136,9 @@ public: // internal void AddInCache(font_instance *who); + /// Add a directory from which to include additional fonts + void AddFontsDir(char const *utf8dir); + private: void* loadedPtr; -- cgit v1.2.3 From 0ec8457e3dfde14a9f1be1e65ddd0aa35f9dcd7c Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Fri, 20 Oct 2017 22:54:21 +0200 Subject: Define INKSCAPE_FONTSDIR and add USER/SYSTEM resource paths for fonts (Note we always had an empty /share/fonts directory that didn't seem to have any purpose yet) --- src/io/resource.cpp | 2 ++ src/io/resource.h | 1 + src/path-prefix.h | 4 ++++ src/preferences.cpp | 2 +- 4 files changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/io/resource.cpp b/src/io/resource.cpp index c3cd9e403..3f970dfa1 100644 --- a/src/io/resource.cpp +++ b/src/io/resource.cpp @@ -52,6 +52,7 @@ gchar *_get_path(Domain domain, Type type, char const *filename) case APPICONS: temp = INKSCAPE_APPICONDIR; break; case EXTENSIONS: temp = INKSCAPE_EXTENSIONDIR; break; case FILTERS: temp = INKSCAPE_FILTERDIR; break; + case FONTS: temp = INKSCAPE_FONTSDIR; break; case GRADIENTS: temp = INKSCAPE_GRADIENTSDIR; break; case ICONS: temp = INKSCAPE_PIXMAPDIR; break; case KEYS: temp = INKSCAPE_KEYSDIR; break; @@ -87,6 +88,7 @@ gchar *_get_path(Domain domain, Type type, char const *filename) switch (type) { case EXTENSIONS: name = "extensions"; break; case FILTERS: name = "filters"; break; + case FONTS: name = "fonts"; break; case GRADIENTS: name = "gradients"; break; case ICONS: name = "icons"; break; case KEYS: name = "keys"; break; diff --git a/src/io/resource.h b/src/io/resource.h index d7dd506ad..6ec08a28c 100644 --- a/src/io/resource.h +++ b/src/io/resource.h @@ -33,6 +33,7 @@ namespace Resource { enum Type { APPICONS, EXTENSIONS, + FONTS, GRADIENTS, ICONS, KEYS, diff --git a/src/path-prefix.h b/src/path-prefix.h index 1c17ce2d8..d6514d832 100644 --- a/src/path-prefix.h +++ b/src/path-prefix.h @@ -34,6 +34,7 @@ # define INKSCAPE_EXAMPLESDIR BR_DATADIR( INKSCAPE_LIBPREFIX "/share/inkscape/examples" ) # define INKSCAPE_EXTENSIONDIR BR_DATADIR( INKSCAPE_LIBPREFIX "/share/inkscape/extensions" ) # define INKSCAPE_FILTERDIR BR_DATADIR( INKSCAPE_LIBPREFIX "/share/inkscape/filters" ) +# define INKSCAPE_FONTSDIR BR_DATADIR( INKSCAPE_LIBPREFIX "/share/inkscape/fonts" ) # define INKSCAPE_GRADIENTSDIR BR_DATADIR( INKSCAPE_LIBPREFIX "/share/inkscape/gradients" ) # define INKSCAPE_KEYSDIR BR_DATADIR( INKSCAPE_LIBPREFIX "/share/inkscape/keys" ) # define INKSCAPE_PIXMAPDIR BR_DATADIR( INKSCAPE_LIBPREFIX "/share/inkscape/icons" ) @@ -58,6 +59,7 @@ # define INKSCAPE_EXAMPLESDIR WIN32_DATADIR("examples") # define INKSCAPE_EXTENSIONDIR WIN32_DATADIR("extensions") # define INKSCAPE_FILTERDIR WIN32_DATADIR("filters") +# define INKSCAPE_FONTSDIR WIN32_DATADIR("fonts") # define INKSCAPE_GRADIENTSDIR WIN32_DATADIR("gradients") # define INKSCAPE_KEYSDIR WIN32_DATADIR("keys") # define INKSCAPE_PIXMAPDIR WIN32_DATADIR("icons") @@ -81,6 +83,7 @@ # define INKSCAPE_EXAMPLESDIR "Contents/Resources/share/inkscape/examples" # define INKSCAPE_EXTENSIONDIR "Contents/Resources/share/inkscape/extensions" # define INKSCAPE_FILTERDIR "Contents/Resources/share/inkscape/filters" +# define INKSCAPE_FONTSDIR "Contents/Resources/share/inkscape/fonts" # define INKSCAPE_GRADIENTSDIR "Contents/Resources/share/inkscape/gradients" # define INKSCAPE_KEYSDIR "Contents/Resources/share/inkscape/keys" # define INKSCAPE_PIXMAPDIR "Contents/Resources/share/inkscape/icons" @@ -104,6 +107,7 @@ # define INKSCAPE_EXAMPLESDIR INKSCAPE_DATADIR "/inkscape/examples" # define INKSCAPE_EXTENSIONDIR INKSCAPE_DATADIR "/inkscape/extensions" # define INKSCAPE_FILTERDIR INKSCAPE_DATADIR "/inkscape/filters" +# define INKSCAPE_FONTSDIR INKSCAPE_DATADIR "/inkscape/fonts" # define INKSCAPE_GRADIENTSDIR INKSCAPE_DATADIR "/inkscape/gradients" # define INKSCAPE_KEYSDIR INKSCAPE_DATADIR "/inkscape/keys" # define INKSCAPE_PIXMAPDIR INKSCAPE_DATADIR "/inkscape/icons" diff --git a/src/preferences.cpp b/src/preferences.cpp index 9d5fb0639..7ebf55a79 100644 --- a/src/preferences.cpp +++ b/src/preferences.cpp @@ -147,7 +147,7 @@ void Preferences::_load() return; } // create some subdirectories for user stuff - char const *user_dirs[] = {"keys", "templates", "icons", "extensions", "palettes", NULL}; + char const *user_dirs[] = {"extensions", "fonts", "icons", "keys", "palettes", "templates", NULL}; for (int i=0; user_dirs[i]; ++i) { // XXX Why are we doing this here? shouldn't this be an IO load item? char *dir = Inkscape::IO::Resource::profile_path(user_dirs[i]); -- cgit v1.2.3 From 75444920325ba8a134eb16c4844f7fa15f34dd55 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Fri, 20 Oct 2017 22:59:35 +0200 Subject: Add preference to load additional fonts from 'fonts' directories - 'use_fontsdir_system' for /share/inkscape/fonts - 'use_fontsdir_user' for /inkscape/fonts in user config (both activated by default) --- src/inkscape.cpp | 13 +++++++++++++ src/ui/dialog/inkscape-preferences.cpp | 8 +++++++- src/ui/dialog/inkscape-preferences.h | 2 ++ 3 files changed, 22 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/inkscape.cpp b/src/inkscape.cpp index c6c43272c..0c3763c2b 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -47,6 +47,7 @@ #include "inkscape.h" #include "io/sys.h" #include "io/resource.h" +#include "libnrtype/FontFactory.h" #include "message-stack.h" #include "path-prefix.h" #include "resource-manager.h" @@ -429,6 +430,7 @@ Application::Application(const char* argv, bool use_gui) : _trackalt(FALSE), _use_gui(use_gui) { + using namespace Inkscape::IO::Resource; /* fixme: load application defaults */ segv_handler = signal (SIGSEGV, Application::crash_handler); @@ -499,6 +501,17 @@ Application::Application(const char* argv, bool use_gui) : Inkscape::Extension::init(); autosave_init(); + + /* Initialize font factory */ + font_factory *factory = font_factory::Default(); + if (prefs->getBool("/options/font/use_fontsdir_system", true)) { + char const *fontsdir = get_path(SYSTEM, FONTS); + factory->AddFontsDir(fontsdir); + } + if (prefs->getBool("/options/font/use_fontsdir_user", true)) { + char const *fontsdir = get_path(USER, FONTS); + factory->AddFontsDir(fontsdir); + } } Application::~Application() diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index d87a3d94a..5ceacd7b8 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -460,11 +460,17 @@ void InkscapePreferences::initPageTools() _page_text.add_group_header( _("Text units")); _font_unit_type.init( "/options/font/unitType", sizeLabels, sizeValues, G_N_ELEMENTS(sizeLabels), SP_CSS_UNIT_PT ); - _page_text.add_line( false, _("Text size unit type:"), _font_unit_type, "", + _page_text.add_line( true, _("Text size unit type:"), _font_unit_type, "", _("Set the type of unit used in the text toolbar and text dialogs"), false); _font_output_px.init ( _("Always output text size in pixels (px)"), "/options/font/textOutputPx", true); // _page_text.add_line( false, "", _font_output_px, "", _("Always convert the text size units above into pixels (px) before saving to file")); + _page_text.add_group_header( _("Font directories")); + _font_fontsdir_system.init( _("Use Inkscape's fonts directory"), "/options/font/use_fontsdir_system", true); + _page_text.add_line( true, "", _font_fontsdir_system, "", _("Load additional fonts from \"fonts\" directory located in Inkscape's global \"share\" directory")); + _font_fontsdir_user.init( _("Use user's fonts directory"), "/options/font/use_fontsdir_user", true); + _page_text.add_line( true, "", _font_fontsdir_user, "", _("Load additional fonts from \"fonts\" directory located in Inkscape's user configuration directory")); + this->AddNewObjectsStyle(_page_text, "/tools/text"); //Spray diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index e6ba4e4b2..38b622095 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -328,6 +328,8 @@ protected: UI::Widget::PrefCheckButton _font_dialog; UI::Widget::PrefCombo _font_unit_type; UI::Widget::PrefCheckButton _font_output_px; + UI::Widget::PrefCheckButton _font_fontsdir_system; + UI::Widget::PrefCheckButton _font_fontsdir_user; UI::Widget::PrefCheckButton _misc_comment; UI::Widget::PrefCheckButton _misc_default_metadata; -- cgit v1.2.3 From fd55cff81015288863feceaa9cb579e2cdb2986e Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sat, 21 Oct 2017 17:50:19 +0200 Subject: Add preferences widget 'PrefMultiEntry' This is a multiline text input, similar to 'PrefEntry' Newlines characters in the multiline input will be converted to '|' in the saved preference. This is because the XML parser will convert real newline characters to spaces when reading the preferences file the next time. --- src/ui/widget/preferences-widget.cpp | 31 +++++++++++++++++++++++++++++++ src/ui/widget/preferences-widget.h | 12 ++++++++++++ 2 files changed, 43 insertions(+) (limited to 'src') diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index 2981316c0..e93b83db4 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -34,6 +34,7 @@ #include #include +#include #ifdef WIN32 #include @@ -859,6 +860,36 @@ void PrefEntry::on_changed() } } +void PrefMultiEntry::init(Glib::ustring const &prefs_path, int height) +{ + // TODO: Figure out if there's a way to specify height in lines instead of px + // and how to obtain a reasonable default width if 'expand_widget' is not used + set_size_request(100, height); + set_hexpand(true); + set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + set_shadow_type(Gtk::SHADOW_IN); + + add(_text); + + _prefs_path = prefs_path; + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + Glib::ustring value = prefs->getString(_prefs_path); + value = Glib::Regex::create("\\|")->replace_literal(value, 0, "\n", (Glib::RegexMatchFlags)0); + _text.get_buffer()->set_text(value); + _text.get_buffer()->signal_changed().connect(sigc::mem_fun(*this, &PrefMultiEntry::on_changed)); +} + +void PrefMultiEntry::on_changed() +{ + if (get_visible()) //only take action if user changed value + { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + Glib::ustring value = _text.get_buffer()->get_text(); + value = Glib::Regex::create("\\n")->replace_literal(value, 0, "|", (Glib::RegexMatchFlags)0); + prefs->setString(_prefs_path, value); + } +} + void PrefColorPicker::init(Glib::ustring const &label, Glib::ustring const &prefs_path, guint32 default_rgba) { diff --git a/src/ui/widget/preferences-widget.h b/src/ui/widget/preferences-widget.h index 142793509..2578be533 100644 --- a/src/ui/widget/preferences-widget.h +++ b/src/ui/widget/preferences-widget.h @@ -28,6 +28,8 @@ #include #include #include +#include +#include #include #include #include @@ -195,6 +197,16 @@ protected: void on_changed(); }; +class PrefMultiEntry : public Gtk::ScrolledWindow +{ +public: + void init(Glib::ustring const &prefs_path, int height); +protected: + Glib::ustring _prefs_path; + Gtk::TextView _text; + void on_changed(); +}; + class PrefEntryButtonHBox : public Gtk::HBox { public: -- cgit v1.2.3 From 2dc0f89864fded681d8ece1d077d6ff5c77bbe97 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sat, 21 Oct 2017 18:25:18 +0200 Subject: Add preference to load additional fonts from custom directories 'custom_fontdirs' is a list of paths to search for fonts --- src/inkscape.cpp | 6 ++++++ src/ui/dialog/inkscape-preferences.cpp | 3 +++ src/ui/dialog/inkscape-preferences.h | 1 + 3 files changed, 10 insertions(+) (limited to 'src') diff --git a/src/inkscape.cpp b/src/inkscape.cpp index 0c3763c2b..e7e93929b 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -512,6 +513,11 @@ Application::Application(const char* argv, bool use_gui) : char const *fontsdir = get_path(USER, FONTS); factory->AddFontsDir(fontsdir); } + Glib::ustring fontdirs_pref = prefs->getString("/options/font/custom_fontdirs"); + std::vector fontdirs = Glib::Regex::split_simple("\\|", fontdirs_pref); + for (auto &fontdir : fontdirs) { + factory->AddFontsDir(fontdir.c_str()); + } } Application::~Application() diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 5ceacd7b8..ae013a27b 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -470,6 +470,9 @@ void InkscapePreferences::initPageTools() _page_text.add_line( true, "", _font_fontsdir_system, "", _("Load additional fonts from \"fonts\" directory located in Inkscape's global \"share\" directory")); _font_fontsdir_user.init( _("Use user's fonts directory"), "/options/font/use_fontsdir_user", true); _page_text.add_line( true, "", _font_fontsdir_user, "", _("Load additional fonts from \"fonts\" directory located in Inkscape's user configuration directory")); + _font_fontdirs_custom.init("/options/font/custom_fontdirs", 50); + _page_text.add_line(true, _("Additional font directories"), _font_fontdirs_custom, "", _("Load additional fonts from custom locations (one path per line)"), true); + this->AddNewObjectsStyle(_page_text, "/tools/text"); diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index 38b622095..531533cee 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -330,6 +330,7 @@ protected: UI::Widget::PrefCheckButton _font_output_px; UI::Widget::PrefCheckButton _font_fontsdir_system; UI::Widget::PrefCheckButton _font_fontsdir_user; + UI::Widget::PrefMultiEntry _font_fontdirs_custom; UI::Widget::PrefCheckButton _misc_comment; UI::Widget::PrefCheckButton _misc_default_metadata; -- cgit v1.2.3 From bd536de52298231e37a37ad0509c27dbd6615728 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sun, 22 Oct 2017 16:57:27 +0200 Subject: Preferences: fix inputs not properly expanding horizontally (gtk3 issue) --- src/ui/widget/preferences-widget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index e93b83db4..8b8e663a5 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -79,6 +79,7 @@ void DialogPage::add_line(bool indent, auto hb = Gtk::manage(new Gtk::Box()); hb->set_spacing(12); + hb->set_hexpand(true); hb->pack_start(widget, expand_widget, expand_widget); // Pack an additional widget into a box with the widget if desired @@ -865,7 +866,6 @@ void PrefMultiEntry::init(Glib::ustring const &prefs_path, int height) // TODO: Figure out if there's a way to specify height in lines instead of px // and how to obtain a reasonable default width if 'expand_widget' is not used set_size_request(100, height); - set_hexpand(true); set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); set_shadow_type(Gtk::SHADOW_IN); -- cgit v1.2.3 From e6919ea013dc0c926e049a1e7b1188829060baac Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sun, 22 Oct 2017 17:21:09 +0200 Subject: Preferences: Simplify code from 9f2c9d85b73ff773e6181d700678f28757714992 --- src/ui/dialog/inkscape-preferences.cpp | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index ae013a27b..bd4f5c75e 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -1930,12 +1930,7 @@ void InkscapePreferences::initPageSpellcheck() static void appendList( Glib::ustring& tmp, const gchar* const*listing ) { - bool first = true; for (const gchar* const* ptr = listing; *ptr; ptr++) { - if (!first) { - tmp += " "; - } - first = false; tmp += *ptr; tmp += "\n"; } @@ -2000,22 +1995,12 @@ void InkscapePreferences::initPageSystem() _sys_systemdata_scroll.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); _page_system.add_line(true, _("System data: "), _sys_systemdata_scroll, "", _("Locations of system data"), true); - { - tmp = ""; - gchar** paths = 0; - gint count = 0; - gtk_icon_theme_get_search_path(gtk_icon_theme_get_default(), &paths, &count); - if (count > 0) { - tmp += paths[0]; - tmp += "\n"; - for (int i = 1; i < count; i++) { - tmp += " "; - tmp += paths[i]; - tmp += "\n"; - } - } - } - + tmp = ""; + gchar** paths = 0; + gint count = 0; + gtk_icon_theme_get_search_path(gtk_icon_theme_get_default(), &paths, &count); + appendList( tmp, paths ); + g_strfreev(paths); _sys_icon.get_buffer()->insert(_sys_icon.get_buffer()->end(), tmp); } _sys_icon.set_editable(false); -- cgit v1.2.3 From 8059f2c4d9751a531a1b672699508ccd2cc3c53b Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sun, 22 Oct 2017 17:21:38 +0200 Subject: Preferences: Minor consistency fixes for UI --- src/ui/dialog/inkscape-preferences.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index bd4f5c75e..351eb0845 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -1991,9 +1991,10 @@ void InkscapePreferences::initPageSystem() _sys_systemdata.get_buffer()->insert(_sys_systemdata.get_buffer()->end(), tmp); _sys_systemdata.set_editable(false); _sys_systemdata_scroll.add(_sys_systemdata); - _sys_systemdata_scroll.set_size_request(0, 80); + _sys_systemdata_scroll.set_size_request(100, 80); _sys_systemdata_scroll.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); - _page_system.add_line(true, _("System data: "), _sys_systemdata_scroll, "", _("Locations of system data"), true); + _sys_systemdata_scroll.set_shadow_type(Gtk::SHADOW_IN); + _page_system.add_line(true, _("System data: "), _sys_systemdata_scroll, "", _("Locations of system data"), true); tmp = ""; gchar** paths = 0; @@ -2005,8 +2006,9 @@ void InkscapePreferences::initPageSystem() } _sys_icon.set_editable(false); _sys_icon_scroll.add(_sys_icon); - _sys_icon_scroll.set_size_request(0, 80); + _sys_icon_scroll.set_size_request(100, 80); _sys_icon_scroll.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + _sys_icon_scroll.set_shadow_type(Gtk::SHADOW_IN); _page_system.add_line(true, _("Icon theme: "), _sys_icon_scroll, "", _("Locations of icon themes"), true); this->AddPage(_page_system, _("System"), PREFS_PAGE_SYSTEM); -- cgit v1.2.3 From f63768018051ac3213df44bb086aea1024df070a Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sun, 22 Oct 2017 17:25:13 +0200 Subject: Preferences: cleanup --- src/ui/dialog/inkscape-preferences.cpp | 97 ++++++++++++++++------------------ 1 file changed, 46 insertions(+), 51 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 351eb0845..09ba06720 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -1946,64 +1946,59 @@ void InkscapePreferences::initPageSystem() _page_system.add_line( false, "", _misc_namedicon_delay, "", _("When on, named icons will be rendered before displaying the ui. This is for working around bugs in GTK+ named icon notification"), true); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - { - // TRANSLATORS: following strings are paths in Inkscape preferences - Misc - System info - - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - - _page_system.add_group_header( _("System info")); + _page_system.add_group_header( _("System info")); - _sys_user_config.set_text((char const *)Inkscape::IO::Resource::profile_path("")); - _sys_user_config.set_editable(false); - _page_system.add_line(true, _("User config: "), _sys_user_config, "", _("Location of users configuration"), true); + _sys_user_config.set_text((char const *)Inkscape::IO::Resource::profile_path("")); + _sys_user_config.set_editable(false); + _page_system.add_line(true, _("User config: "), _sys_user_config, "", _("Location of users configuration"), true); - _sys_user_prefs.set_text(prefs->getPrefsFilename()); - _sys_user_prefs.set_editable(false); - _page_system.add_line(true, _("User preferences: "), _sys_user_prefs, "", _("Location of the users preferences file"), true); + _sys_user_prefs.set_text(prefs->getPrefsFilename()); + _sys_user_prefs.set_editable(false); + _page_system.add_line(true, _("User preferences: "), _sys_user_prefs, "", _("Location of the users preferences file"), true); - _sys_user_extension_dir.set_text((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::EXTENSIONS, "")); - _sys_user_extension_dir.set_editable(false); - _page_system.add_line(true, _("User extensions: "), _sys_user_extension_dir, "", _("Location of the users extensions"), true); + _sys_user_extension_dir.set_text((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::EXTENSIONS, "")); + _sys_user_extension_dir.set_editable(false); + _page_system.add_line(true, _("User extensions: "), _sys_user_extension_dir, "", _("Location of the users extensions"), true); - _sys_user_cache.set_text(g_get_user_cache_dir()); - _sys_user_cache.set_editable(false); - _page_system.add_line(true, _("User cache: "), _sys_user_cache, "", _("Location of users cache"), true); + _sys_user_cache.set_text(g_get_user_cache_dir()); + _sys_user_cache.set_editable(false); + _page_system.add_line(true, _("User cache: "), _sys_user_cache, "", _("Location of users cache"), true); - Glib::ustring tmp_dir = prefs->getString("/options/autosave/path"); - if (tmp_dir.empty()) { - tmp_dir = Glib::get_tmp_dir(); - } - _sys_tmp_files.set_text(tmp_dir); - _sys_tmp_files.set_editable(false); - _page_system.add_line(true, _("Temporary files: "), _sys_tmp_files, "", _("Location of the temporary files used for autosave"), true); - - _sys_data.set_text( INKSCAPE_DATADIR ); - _sys_data.set_editable(false); - _page_system.add_line(true, _("Inkscape data: "), _sys_data, "", _("Location of Inkscape data"), true); - - _sys_extension_dir.set_text(INKSCAPE_EXTENSIONDIR); - _sys_extension_dir.set_editable(false); - _page_system.add_line(true, _("Inkscape extensions: "), _sys_extension_dir, "", _("Location of the Inkscape extensions"), true); - - Glib::ustring tmp; - appendList( tmp, g_get_system_data_dirs() ); - _sys_systemdata.get_buffer()->insert(_sys_systemdata.get_buffer()->end(), tmp); - _sys_systemdata.set_editable(false); - _sys_systemdata_scroll.add(_sys_systemdata); - _sys_systemdata_scroll.set_size_request(100, 80); - _sys_systemdata_scroll.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); - _sys_systemdata_scroll.set_shadow_type(Gtk::SHADOW_IN); - _page_system.add_line(true, _("System data: "), _sys_systemdata_scroll, "", _("Locations of system data"), true); - - tmp = ""; - gchar** paths = 0; - gint count = 0; - gtk_icon_theme_get_search_path(gtk_icon_theme_get_default(), &paths, &count); - appendList( tmp, paths ); - g_strfreev(paths); - _sys_icon.get_buffer()->insert(_sys_icon.get_buffer()->end(), tmp); + Glib::ustring tmp_dir = prefs->getString("/options/autosave/path"); + if (tmp_dir.empty()) { + tmp_dir = Glib::get_tmp_dir(); } + _sys_tmp_files.set_text(tmp_dir); + _sys_tmp_files.set_editable(false); + _page_system.add_line(true, _("Temporary files: "), _sys_tmp_files, "", _("Location of the temporary files used for autosave"), true); + + _sys_data.set_text( INKSCAPE_DATADIR ); + _sys_data.set_editable(false); + _page_system.add_line(true, _("Inkscape data: "), _sys_data, "", _("Location of Inkscape data"), true); + + _sys_extension_dir.set_text(INKSCAPE_EXTENSIONDIR); + _sys_extension_dir.set_editable(false); + _page_system.add_line(true, _("Inkscape extensions: "), _sys_extension_dir, "", _("Location of the Inkscape extensions"), true); + + Glib::ustring tmp; + appendList( tmp, g_get_system_data_dirs() ); + _sys_systemdata.get_buffer()->insert(_sys_systemdata.get_buffer()->end(), tmp); + _sys_systemdata.set_editable(false); + _sys_systemdata_scroll.add(_sys_systemdata); + _sys_systemdata_scroll.set_size_request(100, 80); + _sys_systemdata_scroll.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + _sys_systemdata_scroll.set_shadow_type(Gtk::SHADOW_IN); + _page_system.add_line(true, _("System data: "), _sys_systemdata_scroll, "", _("Locations of system data"), true); + + tmp = ""; + gchar** paths = 0; + gint count = 0; + gtk_icon_theme_get_search_path(gtk_icon_theme_get_default(), &paths, &count); + appendList( tmp, paths ); + g_strfreev(paths); + _sys_icon.get_buffer()->insert(_sys_icon.get_buffer()->end(), tmp); _sys_icon.set_editable(false); _sys_icon_scroll.add(_sys_icon); _sys_icon_scroll.set_size_request(100, 80); -- cgit v1.2.3