summaryrefslogtreecommitdiffstats
path: root/src/ui/widget
diff options
context:
space:
mode:
authorBruno Dilly <bruno.dilly@gmail.com>2007-08-20 01:24:18 +0000
committerbdilly <bdilly@users.sourceforge.net>2007-08-20 01:24:18 +0000
commit912110b5a3c60d757bf0a32fcaaa07cf18b2d6c3 (patch)
treea97eb8f158798d77f28d4535366d9b637e39f4af /src/ui/widget
parentspeed up node and handle dragging by gobbling unprocessed motion events (diff)
downloadinkscape-912110b5a3c60d757bf0a32fcaaa07cf18b2d6c3.tar.gz
inkscape-912110b5a3c60d757bf0a32fcaaa07cf18b2d6c3.zip
search and reset buttons added to ocal related features. fixed signals in import from ocal dialog.
(bzr r3544)
Diffstat (limited to 'src/ui/widget')
-rw-r--r--src/ui/widget/preferences-widget.cpp40
-rw-r--r--src/ui/widget/preferences-widget.h16
2 files changed, 56 insertions, 0 deletions
diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp
index e1671e5b1..4de42f36f 100644
--- a/src/ui/widget/preferences-widget.cpp
+++ b/src/ui/widget/preferences-widget.cpp
@@ -267,6 +267,46 @@ void PrefCombo::on_changed()
}
}
+void PrefEntryButtonHBox::init(const std::string& prefs_path, const std::string& attr,
+ bool visibility, gchar* default_string)
+{
+ _prefs_path = prefs_path;
+ _attr = attr;
+ _default_string = default_string;
+ relatedEntry = new Gtk::Entry();
+ relatedButton = new Gtk::Button("Reset");
+ relatedEntry->set_invisible_char('*');
+ relatedEntry->set_visibility(visibility);
+ relatedEntry->set_text(prefs_get_string_attribute(_prefs_path.c_str(), _attr.c_str()));
+ this->pack_start(*relatedEntry);
+ this->pack_start(*relatedButton);
+ relatedButton->signal_clicked().connect(
+ sigc::mem_fun(*this, &PrefEntryButtonHBox::onRelatedButtonClickedCallback));
+ relatedEntry->signal_changed().connect(
+ sigc::mem_fun(*this, &PrefEntryButtonHBox::onRelatedEntryChangedCallback));
+}
+
+void PrefEntryButtonHBox::onRelatedEntryChangedCallback()
+{
+ if (this->is_visible()) //only take action if user changed value
+ {
+ prefs_set_string_attribute(_prefs_path.c_str(), _attr.c_str(),
+ relatedEntry->get_text().c_str());
+ }
+}
+
+void PrefEntryButtonHBox::onRelatedButtonClickedCallback()
+{
+ if (this->is_visible()) //only take action if user changed value
+ {
+ prefs_set_string_attribute(_prefs_path.c_str(), _attr.c_str(),
+ _default_string);
+ relatedEntry->set_text(_default_string);
+ }
+}
+
+
+
void PrefEntry::init(const std::string& prefs_path, const std::string& attr,
bool visibility)
{
diff --git a/src/ui/widget/preferences-widget.h b/src/ui/widget/preferences-widget.h
index 4ed0a35aa..b48672d39 100644
--- a/src/ui/widget/preferences-widget.h
+++ b/src/ui/widget/preferences-widget.h
@@ -21,6 +21,7 @@
#include <gtkmm/tooltips.h>
#include <gtkmm/treeview.h>
#include <gtkmm/radiobutton.h>
+#include <gtkmm/box.h>
#include <gtkmm/frame.h>
#include <sigc++/sigc++.h>
//#include <glibmm/i18n.h>
@@ -100,6 +101,21 @@ protected:
void on_changed();
};
+class PrefEntryButtonHBox : public Gtk::HBox
+{
+public:
+ void init(const std::string& prefs_path, const std::string& attr,
+ bool mask, gchar* default_string);
+protected:
+ std::string _prefs_path;
+ std::string _attr;
+ gchar* _default_string;
+ Gtk::Button *relatedButton;
+ Gtk::Entry *relatedEntry;
+ void onRelatedEntryChangedCallback();
+ void onRelatedButtonClickedCallback();
+};
+
class DialogPage : public Gtk::Table
{
public: