From: gustav_b Date: Tue, 25 Sep 2007 23:23:44 +0000 (+0000) Subject: Define DockItems' floating state properly. Fixes some issues with X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=073fa4ce4f7402aa0ce7e02dea7c3da7a1cacc27;p=inkscape.git Define DockItems' floating state properly. Fixes some issues with floating docks. --- 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 signal_layout_changed();