Code

Prevented automatic center docking from happening and added the
authorgustav_b <gustav_b@users.sourceforge.net>
Thu, 6 Sep 2007 00:32:22 +0000 (00:32 +0000)
committergustav_b <gustav_b@users.sourceforge.net>
Thu, 6 Sep 2007 00:32:22 +0000 (00:32 +0000)
preference "options.dialogscancenterdock" to allow users to disable it
completely.

src/libgdl/gdl-dock-placeholder.c
src/libgdl/gdl-dock.c
src/preferences-skeleton.h
src/ui/widget/dock-item.cpp

index 11c0d3127f23dd50585408c8ffd15060429ccf38..c22ea038c5e301054e420b4965c65f7f98fc684e 100644 (file)
@@ -333,14 +333,11 @@ gdl_dock_placeholder_add (GtkContainer *container,
                           GtkWidget    *widget)
 {
     GdlDockPlaceholder *ph;
-    GdlDockPlacement    pos = GDL_DOCK_CENTER;   /* default position */
+    GdlDockPlacement    pos = GDL_DOCK_TOP;   /* default position */
     
     g_return_if_fail (GDL_IS_DOCK_PLACEHOLDER (container));
     g_return_if_fail (GDL_IS_DOCK_ITEM (widget));
 
-    if (GDL_DOCK_ITEM (widget)->behavior & GDL_DOCK_ITEM_BEH_CANT_DOCK_CENTER)
-        pos = GDL_DOCK_TOP;
-
     ph = GDL_DOCK_PLACEHOLDER (container);
     if (ph->_priv->placement_stack)
         pos = (GdlDockPlacement) ph->_priv->placement_stack->data;
index cb3e1b3725695577441626799988bfdfc41f5693..7c74791db50fa75426c28a10cf358e9835e81893 100644 (file)
@@ -1077,17 +1077,11 @@ gdl_dock_refine_placement (GdlDock *dock, GdlDockItem *dock_item,
 
     if (placement == GDL_DOCK_LEFT || placement == GDL_DOCK_RIGHT) {
         /* Check if dock_object touches center in terms of width */
-        if (GTK_WIDGET (dock)->allocation.width/2 > object_size.width &&
-            !(dock_item->behavior & GDL_DOCK_ITEM_BEH_CANT_DOCK_CENTER)) {
-            return GDL_DOCK_CENTER;
+        if (GTK_WIDGET (dock)->allocation.width/2 > object_size.width) {
+            return GDL_DOCK_TOP;
         }
-    } else if (placement == GDL_DOCK_TOP || placement == GDL_DOCK_BOTTOM) {
-        /* Check if dock_object touches center in terms of height */
-        if (GTK_WIDGET (dock)->allocation.height/2 > object_size.height  && 
-            !(dock_item->behavior & GDL_DOCK_ITEM_BEH_CANT_DOCK_CENTER)) {
-            return GDL_DOCK_CENTER;
-        }
-    }
+    } 
+
     return placement;
 }
 
index 208b822f239fe5860f01e7ce4010695fddd758be..97d399f2891179bde36f0ca930724b4d37f440b5 100644 (file)
@@ -196,6 +196,7 @@ static char const preferences_skeleton[] =
 "    <group id=\"autoscrolldistance\" value=\"-10\"/>\n"
 "    <group id=\"simplifythreshold\" value=\"0.002\"/>\n"
 "    <group id=\"dialogtype\" value=\"1\"/>\n"
+"    <group id=\"dialogscancenterdock\" value=\"1\"/>\n"
 "    <group id=\"dialogsskiptaskbar\" value=\"1\"/>\n"
 #ifdef WIN32 // FIXME: Temporary Win32 special code to enable transient dialogs
 "    <group id=\"dialogsontopwin32\" value=\"0\"/>\n"
index 97f11f56eadd30af91f26f3bfe686075db45a580..46a2667c7b125ea4b4fe5c4543b98c560915825e 100644 (file)
@@ -12,6 +12,7 @@
 #include "dock-item.h"
 #include "desktop.h"
 #include "inkscape.h"
+#include "prefs-utils.h"
 #include "ui/widget/dock.h"
 #include "widgets/icon.h"
 
@@ -47,6 +48,11 @@ DockItem::DockItem(Dock& dock, const Glib::ustring& name, const Glib::ustring& l
     }
 
 
+    GdlDockItemBehavior gdl_dock_behavior = 
+        (prefs_get_int_attribute_limited ("options.dialogscancenterdock", "value", 1, 0, 1) == 0 ?
+         GDL_DOCK_ITEM_BEH_CANT_DOCK_CENTER
+         : GDL_DOCK_ITEM_BEH_NORMAL);
+
     if (!icon_name.empty()) {
         Gtk::Widget *icon = sp_icon_get_icon(icon_name, Inkscape::ICON_SIZE_MENU);
         if (icon) {
@@ -62,12 +68,12 @@ DockItem::DockItem(Dock& dock, const Glib::ustring& name, const Glib::ustring& l
             delete icon;
 
             _gdl_dock_item = 
-                gdl_dock_item_new_with_pixbuf_icon(name.c_str(), long_name.c_str(), _icon_pixbuf->gobj(),
-                                                   GDL_DOCK_ITEM_BEH_NORMAL);
+                gdl_dock_item_new_with_pixbuf_icon(name.c_str(), long_name.c_str(), 
+                                                   _icon_pixbuf->gobj(), gdl_dock_behavior);
         }
     } else {
         _gdl_dock_item = 
-            gdl_dock_item_new(name.c_str(), long_name.c_str(), GDL_DOCK_ITEM_BEH_NORMAL);
+            gdl_dock_item_new(name.c_str(), long_name.c_str(), gdl_dock_behavior);
     }
 
     _frame.set_shadow_type(Gtk::SHADOW_IN);