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/widget/preferences-widget.cpp | |
| 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/widget/preferences-widget.cpp')
| -rw-r--r-- | src/ui/widget/preferences-widget.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
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; |
