diff options
| author | Jabier Arraiza <jabier.arraiza@marker.es> | 2018-07-24 21:38:26 +0000 |
|---|---|---|
| committer | Jabier Arraiza <jabier.arraiza@marker.es> | 2018-07-24 21:38:26 +0000 |
| commit | 742d422c6f7c1abb7e788a16f9866d3063487c43 (patch) | |
| tree | 898baf9e4a2b53e6f78f998b965a4bc386b6d318 /src/ui | |
| parent | Fix a wrongy commit (diff) | |
| download | inkscape-742d422c6f7c1abb7e788a16f9866d3063487c43.tar.gz inkscape-742d422c6f7c1abb7e788a16f9866d3063487c43.zip | |
Add buttons to open folders as sugestion of Maren
Diffstat (limited to 'src/ui')
| -rw-r--r-- | src/ui/dialog/inkscape-preferences.cpp | 31 | ||||
| -rw-r--r-- | src/ui/dialog/inkscape-preferences.h | 11 | ||||
| -rw-r--r-- | src/ui/widget/preferences-widget.cpp | 22 | ||||
| -rw-r--r-- | src/ui/widget/preferences-widget.h | 10 |
4 files changed, 66 insertions, 8 deletions
diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 8107b3c30..ea5393d37 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -2184,18 +2184,37 @@ void InkscapePreferences::initPageSystem() _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_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); + _sys_user_config.init((char const *)Inkscape::IO::Resource::profile_path(""), _("Open location")); + _page_system.add_line(true, _("User config: "), _sys_user_config, "", _("Location of users configuration"), true); + + _sys_user_extension_dir.init((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::EXTENSIONS, ""),_("Open location")); _page_system.add_line(true, _("User extensions: "), _sys_user_extension_dir, "", _("Location of the users extensions"), true); + _sys_user_themes_dir.init((char const *)Inkscape::IO::Resource::profile_path("/themes"),_("Open themes")); + _page_system.add_line(true, _("User themes: "), _sys_user_themes_dir, "", _("Location of the users themes"), true); + + _sys_user_icons_dir.init((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::ICONS, ""),_("Open iconos")); + _page_system.add_line(true, _("User icons: "), _sys_user_icons_dir, "", _("Location of the users icons"), true); + + _sys_user_templates_dir.init((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::TEMPLATES, ""),_("Open templates")); + _page_system.add_line(true, _("User templates: "), _sys_user_templates_dir, "", _("Location of the users templates"), true); + + _sys_user_symbols_dir.init((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::SYMBOLS, ""),_("Open symbols")); + _page_system.add_line(true, _("User symbols: "), _sys_user_symbols_dir, "", _("Location of the users symbols"), true); + + _sys_user_palettes_dir.init((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::PALETTES, ""),_("Open palletes")); + _page_system.add_line(true, _("User palettes: "), _sys_user_palettes_dir, "", _("Location of the users palettes"), true); + + _sys_user_keys_dir.init((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::KEYS, ""),_("Open keyboard shorcuts")); + _page_system.add_line(true, _("User keys: "), _sys_user_keys_dir, "", _("Location of the users keys"), true); + + _sys_user_ui_dir.init((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::UIS, ""),_("Open UI")); + _page_system.add_line(true, _("User UI: "), _sys_user_ui_dir, "", _("Location of the users UI"), 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); diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index becd1f5b5..f734543f3 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -359,8 +359,15 @@ protected: Gtk::Entry _sys_user_prefs; Gtk::Entry _sys_tmp_files; Gtk::Entry _sys_extension_dir; - Gtk::Entry _sys_user_extension_dir; - Gtk::Entry _sys_user_config; + UI::Widget::PrefOpenFolder _sys_user_config; + UI::Widget::PrefOpenFolder _sys_user_extension_dir; + UI::Widget::PrefOpenFolder _sys_user_themes_dir; + UI::Widget::PrefOpenFolder _sys_user_ui_dir; + UI::Widget::PrefOpenFolder _sys_user_icons_dir; + UI::Widget::PrefOpenFolder _sys_user_keys_dir; + UI::Widget::PrefOpenFolder _sys_user_palettes_dir; + UI::Widget::PrefOpenFolder _sys_user_templates_dir; + UI::Widget::PrefOpenFolder _sys_user_symbols_dir; Gtk::Entry _sys_user_cache; Gtk::Entry _sys_data; Gtk::TextView _sys_icon; diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index 7e9335a8a..2b5378416 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -880,6 +880,28 @@ bool PrefEntryFileButtonHBox::on_mnemonic_activate ( bool group_cycling ) return relatedEntry->mnemonic_activate ( group_cycling ); } +void PrefOpenFolder::init(Glib::ustring const &entry_string, Glib::ustring const &button_text) +{ + relatedEntry = new Gtk::Entry(); + relatedButton = new Gtk::Button(button_text); + relatedEntry->set_text(entry_string); + relatedEntry->set_sensitive(false); + this->pack_start(*relatedEntry); + this->pack_start(*relatedButton); + relatedButton->signal_clicked().connect( + sigc::mem_fun(*this, &PrefOpenFolder::onRelatedButtonClickedCallback)); + +} + +void PrefOpenFolder::onRelatedButtonClickedCallback() +{ + g_mkdir_with_parents (relatedEntry->get_text().c_str(), 0700); + GError *error = NULL; + if (!g_app_info_launch_default_for_uri (("file://" + relatedEntry->get_text()).c_str(), NULL, &error)) { + g_warning ("Failed to open uri: %s", error->message); + } +} + void PrefFileButton::init(Glib::ustring const &prefs_path) { _prefs_path = prefs_path; diff --git a/src/ui/widget/preferences-widget.h b/src/ui/widget/preferences-widget.h index 5036a1c50..2a2b2c5f8 100644 --- a/src/ui/widget/preferences-widget.h +++ b/src/ui/widget/preferences-widget.h @@ -247,6 +247,16 @@ protected: bool on_mnemonic_activate( bool group_cycling ) override; }; +class PrefOpenFolder : public Gtk::HBox +{ +public: + void init(Glib::ustring const &entry_string, Glib::ustring const &button_text); +protected: + Gtk::Button *relatedButton; + Gtk::Entry *relatedEntry; + void onRelatedButtonClickedCallback(); +}; + class PrefFileButton : public Gtk::FileChooserButton { public: |
