diff options
| author | Stefano Facchini <stefano.facchini@gmail.com> | 2017-10-21 12:38:11 +0000 |
|---|---|---|
| committer | Tavmjong Bah <tavmjong@free.fr> | 2018-01-16 20:46:09 +0000 |
| commit | b3e192e3afdf498e64141a679e6aa525d6509063 (patch) | |
| tree | 2b0980aab11c026bf220155becc3d9fb266d8ef5 /src | |
| parent | Remove obsolete build defines (diff) | |
| download | inkscape-b3e192e3afdf498e64141a679e6aa525d6509063.tar.gz inkscape-b3e192e3afdf498e64141a679e6aa525d6509063.zip | |
panel: remove the "apply_label" API
It was used only by the Memory dialog, which can very well add the
"Recalculate" button itself.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ui/dialog/glyphs.cpp | 2 | ||||
| -rw-r--r-- | src/ui/dialog/memory.cpp | 5 | ||||
| -rw-r--r-- | src/ui/dialog/panel-dialog.h | 39 | ||||
| -rw-r--r-- | src/ui/dialog/swatches.cpp | 2 | ||||
| -rw-r--r-- | src/ui/widget/panel.cpp | 8 | ||||
| -rw-r--r-- | src/ui/widget/panel.h | 4 |
6 files changed, 21 insertions, 39 deletions
diff --git a/src/ui/dialog/glyphs.cpp b/src/ui/dialog/glyphs.cpp index f858a4d55..a23d4ffee 100644 --- a/src/ui/dialog/glyphs.cpp +++ b/src/ui/dialog/glyphs.cpp @@ -318,7 +318,7 @@ GlyphColumns *GlyphsPanel::getColumns() * Constructor */ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : - Inkscape::UI::Widget::Panel("", prefsPath, SP_VERB_DIALOG_GLYPHS, "", false), + Inkscape::UI::Widget::Panel("", prefsPath, SP_VERB_DIALOG_GLYPHS), store(Gtk::ListStore::create(*getColumns())), iconView(0), entry(0), diff --git a/src/ui/dialog/memory.cpp b/src/ui/dialog/memory.cpp index 074a6a884..228701dab 100644 --- a/src/ui/dialog/memory.cpp +++ b/src/ui/dialog/memory.cpp @@ -20,6 +20,7 @@ #include <gtkmm/liststore.h> #include <gtkmm/treeview.h> +#include <gtkmm/dialog.h> #include "inkgc/gc-core.h" #include "debug/heap.h" @@ -207,13 +208,15 @@ void Memory::Private::stop_update_task() { } Memory::Memory() - : UI::Widget::Panel ("", "/dialogs/memory", SP_VERB_HELP_MEMORY, _("Recalculate")), + : UI::Widget::Panel ("", "/dialogs/memory", SP_VERB_HELP_MEMORY), _private(*(new Memory::Private())) { _getContents()->pack_start(_private.view); _private.update(); + addResponseButton(_("Recalculate"), Gtk::RESPONSE_APPLY); + show_all_children(); signal_show().connect(sigc::mem_fun(_private, &Private::start_update_task)); diff --git a/src/ui/dialog/panel-dialog.h b/src/ui/dialog/panel-dialog.h index 5919fcaeb..cd7d07790 100644 --- a/src/ui/dialog/panel-dialog.h +++ b/src/ui/dialog/panel-dialog.h @@ -39,8 +39,7 @@ namespace Dialog { */ class PanelDialogBase { public: - PanelDialogBase(UI::Widget::Panel &panel, char const */*prefs_path*/, int const /*verb_num*/, - Glib::ustring const &/*apply_label*/) : + PanelDialogBase(UI::Widget::Panel &panel, char const */*prefs_path*/, int const /*verb_num*/) : _panel (panel) { } virtual void present() = 0; @@ -77,8 +76,7 @@ public: * @param prefs_path characteristic path for loading/saving dialog position. * @param verb_num the dialog verb. */ - PanelDialog(UI::Widget::Panel &contents, char const *prefs_path, int const verb_num, - Glib::ustring const &apply_label); + PanelDialog(UI::Widget::Panel &contents, char const *prefs_path, int const verb_num); virtual ~PanelDialog() {} @@ -101,8 +99,7 @@ class PanelDialog<Behavior::FloatingBehavior> : public PanelDialogBase, public Inkscape::UI::Dialog::Dialog { public: - inline PanelDialog(UI::Widget::Panel &contents, char const *prefs_path, int const verb_num, - Glib::ustring const &apply_label); + inline PanelDialog(UI::Widget::Panel &contents, char const *prefs_path, int const verb_num); virtual ~PanelDialog() {} @@ -140,10 +137,9 @@ void PanelDialogBase::_propagateDesktopDeactivated(SPDesktop *desktop) template <typename B> -PanelDialog<B>::PanelDialog(Widget::Panel &panel, char const *prefs_path, int const verb_num, - Glib::ustring const &apply_label) : - PanelDialogBase(panel, prefs_path, verb_num, apply_label), - Dialog(&B::create, prefs_path, verb_num, apply_label) +PanelDialog<B>::PanelDialog(Widget::Panel &panel, char const *prefs_path, int const verb_num) : + PanelDialogBase(panel, prefs_path, verb_num), + Dialog(&B::create, prefs_path, verb_num) { Gtk::Box *vbox = get_vbox(); _panel.signalResponse().connect(sigc::mem_fun(*this, &PanelDialog::_handleResponse)); @@ -159,12 +155,8 @@ PanelDialog<B>::PanelDialog(Widget::Panel &panel, char const *prefs_path, int co desktop->connectDocumentReplaced(sigc::mem_fun(*this, &PanelDialog::_propagateDocumentReplaced)); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - if (prefs->getBool("/dialogs/showclose") || !apply_label.empty()) { + if (prefs->getBool("/dialogs/showclose")) { // TODO: make the order of buttons obey the global preference - if (!apply_label.empty()) { - panel.addResponseButton(apply_label, Gtk::RESPONSE_APPLY); - panel.setDefaultResponse(Gtk::RESPONSE_APPLY); - } panel.addResponseButton(_("_Close"), Gtk::RESPONSE_CLOSE); } @@ -175,7 +167,7 @@ template <typename B> template <typename P> PanelDialog<B> *PanelDialog<B>::create() { UI::Widget::Panel &panel = P::getInstance(); - return new PanelDialog<B>(panel, panel.getPrefsPath(), panel.getVerb(), panel.getApplyLabel()); + return new PanelDialog<B>(panel, panel.getPrefsPath(), panel.getVerb()); } template <typename B> @@ -191,9 +183,9 @@ void PanelDialog<B>::_presentDialog() } PanelDialog<Behavior::FloatingBehavior>::PanelDialog(UI::Widget::Panel &panel, char const *prefs_path, - int const verb_num, Glib::ustring const &apply_label) : - PanelDialogBase(panel, prefs_path, verb_num, apply_label), - Dialog(&Behavior::FloatingBehavior::create, prefs_path, verb_num, apply_label) + int const verb_num) : + PanelDialogBase(panel, prefs_path, verb_num), + Dialog(&Behavior::FloatingBehavior::create, prefs_path, verb_num) { Gtk::Box *vbox = get_vbox(); _panel.signalResponse().connect(sigc::mem_fun(*this, &PanelDialog::_handleResponse)); @@ -208,12 +200,8 @@ PanelDialog<Behavior::FloatingBehavior>::PanelDialog(UI::Widget::Panel &panel, c desktop->connectDocumentReplaced(sigc::mem_fun(*this, &PanelDialog::_propagateDocumentReplaced)); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - if (prefs->getBool("/dialogs/showclose") || !apply_label.empty()) { + if (prefs->getBool("/dialogs/showclose")) { // TODO: make the order of buttons obey the global preference - if (!apply_label.empty()) { - panel.addResponseButton(apply_label, Gtk::RESPONSE_APPLY); - panel.setDefaultResponse(Gtk::RESPONSE_APPLY); - } panel.addResponseButton(_("_Close"), Gtk::RESPONSE_CLOSE); } @@ -235,8 +223,7 @@ PanelDialog<Behavior::FloatingBehavior> *PanelDialog<Behavior::FloatingBehavior> { UI::Widget::Panel &panel = P::getInstance(); PanelDialog<Behavior::FloatingBehavior> *instance = - new PanelDialog<Behavior::FloatingBehavior>(panel, panel.getPrefsPath(), - panel.getVerb(), panel.getApplyLabel()); + new PanelDialog<Behavior::FloatingBehavior>(panel, panel.getPrefsPath(), panel.getVerb()); INKSCAPE.signal_activate_desktop.connect( sigc::mem_fun(*instance, &PanelDialog<Behavior::FloatingBehavior>::_propagateDesktopActivated) diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp index 4392e430d..443993a8c 100644 --- a/src/ui/dialog/swatches.cpp +++ b/src/ui/dialog/swatches.cpp @@ -547,7 +547,7 @@ SwatchesPanel& SwatchesPanel::getInstance() * Constructor */ SwatchesPanel::SwatchesPanel(gchar const* prefsPath) : - Inkscape::UI::Widget::Panel("", prefsPath, SP_VERB_DIALOG_SWATCHES, "", true), + Inkscape::UI::Widget::Panel("", prefsPath, SP_VERB_DIALOG_SWATCHES, true), _holder(0), _clear(0), _remove(0), diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index cc17262af..2d0a75d2b 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -56,13 +56,12 @@ void Panel::prep() { } Panel::Panel(Glib::ustring const &label, gchar const *prefs_path, - int verb_num, Glib::ustring const &apply_label, + int verb_num, bool menu_desired) : _prefs_path(prefs_path), _menu_desired(menu_desired), _desktop(SP_ACTIVE_DESKTOP), _label(label), - _apply_label(apply_label), _verb_num(verb_num), _temp_arrow(), _menu(0), @@ -543,11 +542,6 @@ int const &Panel::getVerb() const return _verb_num; } -Glib::ustring const &Panel::getApplyLabel() const -{ - return _apply_label; -} - void Panel::setDesktop(SPDesktop *desktop) { _desktop = desktop; diff --git a/src/ui/widget/panel.h b/src/ui/widget/panel.h index 06b65dfbc..f90420913 100644 --- a/src/ui/widget/panel.h +++ b/src/ui/widget/panel.h @@ -70,7 +70,7 @@ public: * @param verb_num the dialog verb. */ Panel(Glib::ustring const &label = "", gchar const *prefs_path = 0, - int verb_num = 0, Glib::ustring const &apply_label = "", + int verb_num = 0, bool menu_desired = false); virtual ~Panel(); @@ -83,7 +83,6 @@ public: void setLabel(Glib::ustring const &label); Glib::ustring const &getLabel() const; int const &getVerb() const; - Glib::ustring const &getApplyLabel() const; virtual void setOrientation(SPAnchorType how); @@ -150,7 +149,6 @@ private: SPDesktop *_desktop; Glib::ustring _label; - Glib::ustring _apply_label; int _verb_num; Gtk::HBox _top_bar; |
