summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorJabier Arraiza <jabier.arraiza@marker.es>2019-10-01 13:24:52 +0000
committerJabier Arraiza <jabier.arraiza@marker.es>2019-10-01 13:24:52 +0000
commit2375422a16eba1307d51847220acc6a15035524f (patch)
tree466ad24fc96cda4cc9a34540ffe6b9c618420cf4 /src/ui
parentFix tests after adding xml:lang. (diff)
downloadinkscape-2375422a16eba1307d51847220acc6a15035524f.tar.gz
inkscape-2375422a16eba1307d51847220acc6a15035524f.zip
Make funtion that add classes to top level windows in diallogs callable from non dialogs windows
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/dialog/dialog.cpp28
-rw-r--r--src/ui/dialog/dialog.h4
-rw-r--r--src/ui/dialog/livepatheffect-add.cpp6
3 files changed, 24 insertions, 14 deletions
diff --git a/src/ui/dialog/dialog.cpp b/src/ui/dialog/dialog.cpp
index 8f703c319..6fef22545 100644
--- a/src/ui/dialog/dialog.cpp
+++ b/src/ui/dialog/dialog.cpp
@@ -70,17 +70,18 @@ Dialog::Dialog(Behavior::BehaviorFactory behavior_factory, const char *prefs_pat
_behavior = behavior_factory(*this);
_desktop = SP_ACTIVE_DESKTOP;
+ Gtk::Widget *widg = dynamic_cast<Gtk::Widget *>(Glib::wrap(_behavior->gobj()));
INKSCAPE.signal_activate_desktop.connect(sigc::mem_fun(*this, &Dialog::onDesktopActivated));
INKSCAPE.signal_dialogs_hide.connect(sigc::mem_fun(*this, &Dialog::onHideF12));
INKSCAPE.signal_dialogs_unhide.connect(sigc::mem_fun(*this, &Dialog::onShowF12));
INKSCAPE.signal_shut_down.connect(sigc::mem_fun(*this, &Dialog::onShutdown));
- INKSCAPE.signal_change_theme.connect(sigc::mem_fun(*this, &Dialog::addTopWindowClasses));
+ INKSCAPE.signal_change_theme.connect(sigc::bind(sigc::ptr_fun(&sp_add_top_window_classes), widg));
Glib::wrap(gobj())->signal_event().connect(sigc::mem_fun(*this, &Dialog::_onEvent));
Glib::wrap(gobj())->signal_key_press_event().connect(sigc::mem_fun(*this, &Dialog::_onKeyPress));
read_geometry();
- addTopWindowClasses();
+ sp_add_top_window_classes(widg);
}
Dialog::~Dialog()
@@ -310,27 +311,30 @@ Dialog::_getSelection()
return SP_ACTIVE_DESKTOP->getSelection();
}
-void Dialog::addTopWindowClasses()
+void sp_add_top_window_classes(Gtk::Widget *widg)
{
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
if (desktop) {
Gtk::Widget *canvas = Glib::wrap(GTK_WIDGET(desktop->canvas));
Gtk::Window *toplevel_window = dynamic_cast<Gtk::Window *>(canvas->get_toplevel());
if (toplevel_window) {
- Gtk::Widget *dialog_window = Glib::wrap(gobj());
+ Gtk::Window *current_window = dynamic_cast<Gtk::Window *>(widg);
+ if (!current_window) {
+ current_window = dynamic_cast<Gtk::Window *>(widg->get_toplevel());
+ }
if (toplevel_window->get_style_context()->has_class("dark")) {
- dialog_window->get_style_context()->add_class("dark");
- dialog_window->get_style_context()->remove_class("bright");
+ current_window->get_style_context()->add_class("dark");
+ current_window->get_style_context()->remove_class("bright");
} else {
- dialog_window->get_style_context()->add_class("bright");
- dialog_window->get_style_context()->remove_class("dark");
+ current_window->get_style_context()->add_class("bright");
+ current_window->get_style_context()->remove_class("dark");
}
if (toplevel_window->get_style_context()->has_class("symbolic")) {
- dialog_window->get_style_context()->add_class("symbolic");
- dialog_window->get_style_context()->remove_class("regular");
+ current_window->get_style_context()->add_class("symbolic");
+ current_window->get_style_context()->remove_class("regular");
} else {
- dialog_window->get_style_context()->remove_class("symbolic");
- dialog_window->get_style_context()->add_class("regular");
+ current_window->get_style_context()->remove_class("symbolic");
+ current_window->get_style_context()->add_class("regular");
}
}
}
diff --git a/src/ui/dialog/dialog.h b/src/ui/dialog/dialog.h
index 7b668a4ba..012bbc638 100644
--- a/src/ui/dialog/dialog.h
+++ b/src/ui/dialog/dialog.h
@@ -148,7 +148,6 @@ protected:
private:
Behavior::Behavior* _behavior;
- void addTopWindowClasses();
Dialog() = delete; // no constructor without params
@@ -159,10 +158,13 @@ protected:
friend class Behavior::DockBehavior;
};
+void sp_add_top_window_classes(Gtk::Widget *widg);
} // namespace Dialog
} // namespace UI
} // namespace Inkscape
+
+
#endif //INKSCAPE_DIALOG_H
/*
diff --git a/src/ui/dialog/livepatheffect-add.cpp b/src/ui/dialog/livepatheffect-add.cpp
index fa1571be6..4c86189db 100644
--- a/src/ui/dialog/livepatheffect-add.cpp
+++ b/src/ui/dialog/livepatheffect-add.cpp
@@ -9,10 +9,11 @@
* Released under GNU GPL v2+, read the file 'COPYING' for more information.
*/
+#include "livepatheffect-add.h"
#include "desktop.h"
+#include "dialog.h"
#include "io/resource.h"
#include "live_effects/effect.h"
-#include "livepatheffect-add.h"
#include "object/sp-item-group.h"
#include "object/sp-path.h"
#include "object/sp-shape.h"
@@ -246,6 +247,9 @@ LivePathEffectAdd::LivePathEffectAdd()
_LPESelectorEffectRadioList->set_active();
viewChanged(2);
}
+ Gtk::Widget *widg = dynamic_cast<Gtk::Widget *>(_LPEDialogSelector);
+ INKSCAPE.signal_change_theme.connect(sigc::bind(sigc::ptr_fun(sp_add_top_window_classes), widg));
+ sp_add_top_window_classes(widg);
}
const LivePathEffect::EnumEffectData<LivePathEffect::EffectType> *LivePathEffectAdd::getActiveData()
{