gimp r27218 - in trunk: . app/widgets
- From: martinn svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r27218 - in trunk: . app/widgets
- Date: Fri, 10 Oct 2008 23:10:22 +0000 (UTC)
Author: martinn
Date: Fri Oct 10 23:10:21 2008
New Revision: 27218
URL: http://svn.gnome.org/viewvc/gimp?rev=27218&view=rev
Log:
* app/widgets/gimpdockseparator.c (gimp_dock_separator_new): Add a
GtkAnchorType member to GimpDockSeparator that specifies where a
dropped dockable shall be inserted.
(gimp_dock_separator_drag_drop): Get rid of the ugly hack where
the role of a given separator was based on its position as a child
in its container. Simply decide what role the separator has by
loooking at its anchor-member.
* app/widgets/gimpdock.c (gimp_dock_init)
(gimp_dock_add_book): Give the GimpDockSeparators their
appropriate roles directly at their construction.
Modified:
trunk/ChangeLog
trunk/app/widgets/gimpdock.c
trunk/app/widgets/gimpdockseparator.c
trunk/app/widgets/gimpdockseparator.h
Modified: trunk/app/widgets/gimpdock.c
==============================================================================
--- trunk/app/widgets/gimpdock.c (original)
+++ trunk/app/widgets/gimpdock.c Fri Oct 10 23:10:21 2008
@@ -193,7 +193,7 @@
gtk_container_add (GTK_CONTAINER (dock->main_vbox), dock->vbox);
gtk_widget_show (dock->vbox);
- separator = gimp_dock_separator_new (dock);
+ separator = gimp_dock_separator_new (dock, GTK_ANCHOR_NORTH);
gtk_box_pack_start (GTK_BOX (dock->vbox), separator, FALSE, FALSE, 0);
gtk_widget_show (separator);
}
@@ -472,7 +472,7 @@
gtk_box_pack_start (GTK_BOX (dock->vbox), GTK_WIDGET (dockbook),
TRUE, TRUE, 0);
- separator = gimp_dock_separator_new (dock);
+ separator = gimp_dock_separator_new (dock, GTK_ANCHOR_SOUTH);
gtk_box_pack_end (GTK_BOX (dock->vbox), separator, FALSE, FALSE, 0);
gtk_widget_show (separator);
}
Modified: trunk/app/widgets/gimpdockseparator.c
==============================================================================
--- trunk/app/widgets/gimpdockseparator.c (original)
+++ trunk/app/widgets/gimpdockseparator.c Fri Oct 10 23:10:21 2008
@@ -196,22 +196,14 @@
if (dockable)
{
GtkWidget *dockbook;
- GtkWidget *parent;
- GList *children;
gint index;
g_object_set_data (G_OBJECT (dockable),
"gimp-dock-drag-widget", NULL);
- parent = gtk_widget_get_parent (widget);
-
- children = gtk_container_get_children (GTK_CONTAINER (parent));
- index = g_list_index (children, widget);
- g_list_free (children);
-
- if (index == 0)
+ if (separator->anchor == GTK_ANCHOR_NORTH)
index = 0;
- else if (index == 2)
+ else if (separator->anchor == GTK_ANCHOR_SOUTH)
index = -1;
/* if dropping to the same dock, take care that we don't try
@@ -219,8 +211,9 @@
*/
if (dockable->dockbook->dock == dock)
{
- gint n_books;
- gint n_dockables;
+ GList *children;
+ gint n_books;
+ gint n_dockables;
n_books = g_list_length (dock->dockbooks);
@@ -255,7 +248,8 @@
/* public functions */
GtkWidget *
-gimp_dock_separator_new (GimpDock *dock)
+gimp_dock_separator_new (GimpDock *dock,
+ GtkAnchorType anchor)
{
GimpDockSeparator *separator;
@@ -263,7 +257,8 @@
separator = g_object_new (GIMP_TYPE_DOCK_SEPARATOR, NULL);
- separator->dock = dock;
+ separator->dock = dock;
+ separator->anchor = anchor;
return GTK_WIDGET (separator);
}
Modified: trunk/app/widgets/gimpdockseparator.h
==============================================================================
--- trunk/app/widgets/gimpdockseparator.h (original)
+++ trunk/app/widgets/gimpdockseparator.h Fri Oct 10 23:10:21 2008
@@ -35,12 +35,14 @@
struct _GimpDockSeparator
{
- GtkEventBox parent_instance;
+ GtkEventBox parent_instance;
- GimpDock *dock;
+ GimpDock *dock;
- GtkWidget *frame;
- GtkWidget *label;
+ GtkWidget *frame;
+ GtkWidget *label;
+
+ GtkAnchorType anchor;
};
struct _GimpDockSeparatorClass
@@ -51,7 +53,8 @@
GType gimp_dock_separator_get_type (void) G_GNUC_CONST;
-GtkWidget * gimp_dock_separator_new (GimpDock *dock);
+GtkWidget * gimp_dock_separator_new (GimpDock *dock,
+ GtkAnchorType anchor);
void gimp_dock_separator_set_show_label (GimpDockSeparator *separator,
gboolean show);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]