summaryrefslogtreecommitdiffstats
path: root/src/ui/widget
diff options
context:
space:
mode:
authorgustav_b <gustav_b@users.sourceforge.net>2007-09-25 23:23:44 +0000
committergustav_b <gustav_b@users.sourceforge.net>2007-09-25 23:23:44 +0000
commit8966f982ceca52727cdfeb1fa161eb67bc2994c4 (patch)
treece09494e740429b0a1df71c1d3a66557710e2eb4 /src/ui/widget
parentremoved flop IM extension from POTFLES.in (diff)
downloadinkscape-8966f982ceca52727cdfeb1fa161eb67bc2994c4.tar.gz
inkscape-8966f982ceca52727cdfeb1fa161eb67bc2994c4.zip
Define DockItems' floating state properly. Fixes some issues with
floating docks. (bzr r3799)
Diffstat (limited to 'src/ui/widget')
-rw-r--r--src/ui/widget/dock-item.cpp12
-rw-r--r--src/ui/widget/dock-item.h5
-rw-r--r--src/ui/widget/dock.cpp5
-rw-r--r--src/ui/widget/dock.h5
4 files changed, 15 insertions, 12 deletions
diff --git a/src/ui/widget/dock-item.cpp b/src/ui/widget/dock-item.cpp
index 2187c33e9..74cc44be9 100644
--- a/src/ui/widget/dock-item.cpp
+++ b/src/ui/widget/dock-item.cpp
@@ -196,14 +196,8 @@ DockItem::isAttached() const
bool
DockItem::isFloating() const
{
- gboolean floating = FALSE;
- if (GDL_IS_DOCK (gdl_dock_object_get_parent_object (GDL_DOCK_OBJECT (_gdl_dock_item)))) {
- GdlDock* dock = GDL_DOCK (gdl_dock_object_get_parent_object (GDL_DOCK_OBJECT (_gdl_dock_item)));
- g_object_get (dock,
- "floating", &floating,
- NULL);
- }
- return floating;
+ return (GTK_WIDGET(gdl_dock_object_get_toplevel(GDL_DOCK_OBJECT (_gdl_dock_item))) !=
+ _dock.getGdlWidget());
}
bool
@@ -431,7 +425,7 @@ DockItem::_onStateChanged(State prev_state, State new_state)
{
_window = getWindow();
- if (new_state == FLOATING_STATE) {
+ if (new_state == FLOATING_STATE && _window) {
_window->signal_hide().connect(sigc::mem_fun(*this, &Inkscape::UI::Widget::DockItem::_onHideWindow));
_signal_key_press_event_connection =
_window->signal_key_press_event().connect(sigc::mem_fun(*this, &Inkscape::UI::Widget::DockItem::_onKeyPress));
diff --git a/src/ui/widget/dock-item.h b/src/ui/widget/dock-item.h
index d2881c005..af2f3ac70 100644
--- a/src/ui/widget/dock-item.h
+++ b/src/ui/widget/dock-item.h
@@ -31,7 +31,10 @@ class DockItem {
public:
- enum State { UNATTACHED, FLOATING_STATE, DOCKED_STATE };
+ enum State { UNATTACHED, // item not bound to the dock (a temporary state)
+ FLOATING_STATE, // item not in its dock (but can be docked in other,
+ // e.g. floating, docks)
+ DOCKED_STATE }; // item in its assigned dock
enum Placement {
NONE = GDL_DOCK_NONE,
diff --git a/src/ui/widget/dock.cpp b/src/ui/widget/dock.cpp
index f282449dd..ae19ed8d6 100644
--- a/src/ui/widget/dock.cpp
+++ b/src/ui/widget/dock.cpp
@@ -133,6 +133,11 @@ Dock::getPaned()
return _paned;
}
+GtkWidget *
+Dock::getGdlWidget()
+{
+ return GTK_WIDGET(_gdl_dock);
+}
bool
Dock::isEmpty() const
diff --git a/src/ui/widget/dock.h b/src/ui/widget/dock.h
index 3cd29c01f..b5ecc02ca 100644
--- a/src/ui/widget/dock.h
+++ b/src/ui/widget/dock.h
@@ -37,10 +37,11 @@ public:
Gtk::Widget& getWidget(); //< return the top widget
Gtk::Paned *getParentPaned();
-
Gtk::Paned *getPaned();
- bool isEmpty() const; //< true iff none of the dock's items are in state != UNATTACHED
+ GtkWidget* getGdlWidget(); //< return the top gdl widget
+
+ bool isEmpty() const; //< true iff none of the dock's items are in a docked state
bool hasIconifiedItems() const;
Glib::SignalProxy0<void> signal_layout_changed();