From f006ebdee5b2f29127a152978ac72e41f61ced33 Mon Sep 17 00:00:00 2001 From: Bruno Dilly Date: Mon, 6 Aug 2007 18:32:13 +0000 Subject: adds export to ocal feature without dialog window (bzr r3398) --- src/ui/widget/preferences-widget.cpp | 22 +++++++++++++++++++++- src/ui/widget/preferences-widget.h | 14 +++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) (limited to 'src/ui/widget') diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index 00d8b5a26..a6302aa9d 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -3,8 +3,9 @@ * * Authors: * Marco Scholten + * Bruno Dilly * - * Copyright (C) 2004, 2006 Authors + * Copyright (C) 2004, 2006, 2007 Authors * * Released under GNU GPL. Read the file 'COPYING' for more information. */ @@ -266,6 +267,25 @@ void PrefCombo::on_changed() } } +void PrefEntry::init(const std::string& prefs_path, const std::string& attr, + bool visibility) +{ + _prefs_path = prefs_path; + _attr = attr; + this->set_invisible_char('*'); + this->set_visibility(visibility); + this->set_text(prefs_get_string_attribute(_prefs_path.c_str(), _attr.c_str())); +} + +void PrefEntry::on_activate() +{ + if (this->is_visible()) //only take action if user changed value + { + prefs_set_string_attribute(_prefs_path.c_str(), _attr.c_str(), this->get_text().c_str()); + } + return; +} + } // namespace Widget } // namespace UI } // namespace Inkscape diff --git a/src/ui/widget/preferences-widget.h b/src/ui/widget/preferences-widget.h index 361d737a8..5b6402883 100644 --- a/src/ui/widget/preferences-widget.h +++ b/src/ui/widget/preferences-widget.h @@ -3,8 +3,9 @@ * * Authors: * Marco Scholten + * Bruno Dilly * - * Copyright (C) 2004, 2006 Authors + * Copyright (C) 2004, 2006, 2007 Authors * * Released under GNU GPL. Read the file 'COPYING' for more information. */ @@ -88,6 +89,17 @@ protected: void on_changed(); }; +class PrefEntry : public Gtk::Entry +{ +public: + void init(const std::string& prefs_path, const std::string& attr, + bool mask); +protected: + std::string _prefs_path; + std::string _attr; + void on_activate(); +}; + class DialogPage : public Gtk::Table { public: -- cgit v1.2.3