summaryrefslogtreecommitdiffstats
path: root/src/desktop.cpp
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2019-01-20 18:35:46 +0000
committerTavmjong Bah <tavmjong@free.fr>2019-01-20 18:35:46 +0000
commitda5621d2df20473ec743a788b87f5eea8006ba15 (patch)
treed51539257203569a7e680195642679d5c30e60bd /src/desktop.cpp
parentUse document rather than namedview in creating desktop widget. (diff)
downloadinkscape-da5621d2df20473ec743a788b87f5eea8006ba15.tar.gz
inkscape-da5621d2df20473ec743a788b87f5eea8006ba15.zip
No longer use widget data to store pointer to desktop widget.
Diffstat (limited to 'src/desktop.cpp')
-rw-r--r--src/desktop.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/desktop.cpp b/src/desktop.cpp
index 5ae70094b..4e3a28243 100644
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
@@ -35,6 +35,7 @@
#include "device-manager.h"
#include "document-undo.h"
#include "event-log.h"
+#include "inkscape-window.h"
#include "layer-fns.h"
#include "layer-manager.h"
#include "message-context.h"
@@ -681,12 +682,14 @@ SPDesktop::change_document (SPDocument *theDocument)
/* update the rulers, connect the desktop widget's signal to the new namedview etc.
(this can probably be done in a better way) */
- Gtk::Window *parent = this->getToplevel();
+ InkscapeWindow *parent = this->getInkscapeWindow();
g_assert(parent != nullptr);
- SPDesktopWidget *dtw = (SPDesktopWidget *) parent->get_data("desktopwidget");
+ SPDesktopWidget *dtw = parent->get_desktop_widget();
if (dtw) {
dtw->desktop = this;
dtw->updateNamedview();
+ } else {
+ std::cerr << "SPDesktop::change_document: failed to get desktop widget!" << std::endl;
}
_namedview_modified (namedview, SP_OBJECT_MODIFIED_FLAG, this);
@@ -1377,6 +1380,16 @@ SPDesktop::getToplevel( )
return _widget->getWindow();
}
+InkscapeWindow*
+SPDesktop::getInkscapeWindow( )
+{
+ InkscapeWindow* window = dynamic_cast<InkscapeWindow*>(_widget->getWindow());
+ if (!window) {
+ std::cerr << "SPDesktop::getInkscapeWindow: Failed to get window." << std::endl;
+ }
+ return window;
+}
+
void
SPDesktop::presentWindow()
{