aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorClaudio Saavedra <csaavedra@igalia.com>2011-12-05 02:27:50 +0800
committerClaudio Saavedra <csaavedra@igalia.com>2011-12-14 19:51:19 +0800
commit762a30c569efd36510f7b418a0c11aee84320a6c (patch)
treed27d3049de58652c41bb00b4fbaf7edac0ee0b0b /lib
parentb370ee25bcc3c464b57e4c090ce8adc6677f8f96 (diff)
downloadgsoc2013-epiphany-762a30c569efd36510f7b418a0c11aee84320a6c.tar
gsoc2013-epiphany-762a30c569efd36510f7b418a0c11aee84320a6c.tar.gz
gsoc2013-epiphany-762a30c569efd36510f7b418a0c11aee84320a6c.tar.bz2
gsoc2013-epiphany-762a30c569efd36510f7b418a0c11aee84320a6c.tar.lz
gsoc2013-epiphany-762a30c569efd36510f7b418a0c11aee84320a6c.tar.xz
gsoc2013-epiphany-762a30c569efd36510f7b418a0c11aee84320a6c.tar.zst
gsoc2013-epiphany-762a30c569efd36510f7b418a0c11aee84320a6c.zip
Use a GtkOverlay for the statusbar instead of shipping GeditOverlay
Instead of escaping the cursor, we align the overlay at the opposite side of the window. This is consistent with nautilus. https://bugzilla.gnome.org/show_bug.cgi?id=653996
Diffstat (limited to 'lib')
-rw-r--r--lib/widgets/Makefile.am8
-rw-r--r--lib/widgets/ephy-overlay-escaping-child.c314
-rw-r--r--lib/widgets/ephy-overlay-escaping-child.h56
-rw-r--r--lib/widgets/gedit-overlay-child.c362
-rw-r--r--lib/widgets/gedit-overlay-child.h89
-rw-r--r--lib/widgets/gedit-overlay.c542
-rw-r--r--lib/widgets/gedit-overlay.h70
7 files changed, 1 insertions, 1440 deletions
diff --git a/lib/widgets/Makefile.am b/lib/widgets/Makefile.am
index 66c9f9084..f9a114ee5 100644
--- a/lib/widgets/Makefile.am
+++ b/lib/widgets/Makefile.am
@@ -18,13 +18,7 @@ libephywidgets_la_SOURCES = \
ephy-zoom-action.h \
ephy-zoom-action.c \
ephy-zoom-control.c \
- ephy-zoom-control.h \
- gedit-overlay.c \
- gedit-overlay.h \
- gedit-overlay-child.c \
- gedit-overlay-child.h \
- ephy-overlay-escaping-child.c \
- ephy-overlay-escaping-child.h
+ ephy-zoom-control.h
libephywidgets_la_CPPFLAGS = \
-I$(top_builddir)/lib \
diff --git a/lib/widgets/ephy-overlay-escaping-child.c b/lib/widgets/ephy-overlay-escaping-child.c
deleted file mode 100644
index b1fd796a8..000000000
--- a/lib/widgets/ephy-overlay-escaping-child.c
+++ /dev/null
@@ -1,314 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/*
- * Copyright © 2011 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "ephy-overlay-escaping-child.h"
-
-#define EPHY_OVERLAY_ESCAPING_CHILD_DEFAULT_DISTANCE 20
-
-G_DEFINE_TYPE (EphyOverlayEscapingChild, ephy_overlay_escaping_child, GEDIT_TYPE_OVERLAY_CHILD);
-
-/* properties */
-enum
-{
- PROP_0,
- PROP_ESCAPING_DISTANCE
-};
-
-struct _EphyOverlayEscapingChildPrivate
-{
- guint escaping_distance;
- GtkAllocation initial_allocation;
- GdkRectangle escaping_area;
-};
-
-/* If the pointer leaves the window, restore the widget position */
-static gboolean
-parent_leave_notify_event (GtkWidget *widget,
- GdkEventMotion *event,
- GtkWidget *parent)
-{
- EphyOverlayEscapingChildPrivate *priv = EPHY_OVERLAY_ESCAPING_CHILD (widget)->priv;
- GtkAllocation alloc;
-
- gtk_widget_get_allocation (widget, &alloc);
- alloc.y = priv->initial_allocation.y;
- gtk_widget_size_allocate (widget, &alloc);
-
- return FALSE;
-}
-
-/* this should be in Gdk...really */
-static gboolean
-is_point_in_rectangle (int point_x,
- int point_y,
- GdkRectangle rectangle)
-{
- int rectangle_x_higher_bound = rectangle.x + rectangle.width;
- int rectangle_y_higher_bound = rectangle.y + rectangle.height;
-
- return point_x >= rectangle.x && point_x < rectangle_x_higher_bound
- && point_y >= rectangle.y && point_y < rectangle_y_higher_bound;
-}
-
-/* Keep the widget-pointer distance at at least
- * EphyOverlayEscapingChildPrivate::escaping_distance by sliding the widget
- * away if needed.
- */
-static gboolean
-parent_motion_notify_event (GtkWidget *widget,
- GdkEventMotion *event,
- GtkWidget *parent)
-{
- EphyOverlayEscapingChildPrivate *priv = EPHY_OVERLAY_ESCAPING_CHILD (widget)->priv;
- int distance_x, distance_y;
- GtkAllocation alloc;
-
- gtk_widget_get_allocation (widget, &alloc);
-
- if (is_point_in_rectangle (event->x, event->y, priv->escaping_area)) {
- gdk_window_get_device_position (gtk_widget_get_window (widget),
- gdk_event_get_device ((GdkEvent *) event),
- &distance_x, &distance_y, NULL);
- alloc.y += priv->escaping_distance + distance_y;
- }
- else {
- /* Put the widget at its original position if we are out of the escaping
- * zone. Do nothing if it is already there.
- */
- if (alloc.y == priv->initial_allocation.y)
- return FALSE;
- alloc.y = priv->initial_allocation.y;
- }
-
- gtk_widget_size_allocate (widget, &alloc);
-
- return FALSE;
-}
-
-/* When the parent overlay is resized, the child relative position is modified.
- * So we update our initial_allocation to this new value and redefine our
- * escaping area.
- */
-static void
-parent_size_allocate (GtkWidget *widget,
- GdkRectangle *allocation,
- GtkWidget *parent)
-{
- EphyOverlayEscapingChildPrivate *priv = EPHY_OVERLAY_ESCAPING_CHILD (widget)->priv;
- GtkAllocation initial_allocation;
-
- gtk_widget_get_allocation (widget, &initial_allocation);
- priv->escaping_area = priv->initial_allocation = initial_allocation;
-
- /* Define an escaping area around the widget.
- * Current implementation only handle horizontal lowerside widgets
- */
- priv->escaping_area.height += priv->escaping_distance;
- /* escape on both right and left */
- priv->escaping_area.width += 2 * priv->escaping_distance;
- priv->escaping_area.x -= priv->escaping_distance;
- priv->escaping_area.y -= priv->escaping_distance;
-}
-
-/* Install listeners on our overlay parents to locate the pointer
- * and our relative position.
- */
-static void
-ephy_overlay_escaping_child_parent_set (GtkWidget *widget,
- GtkWidget *previous_parent)
-{
- GtkWidget *parent;
-
- if (previous_parent != NULL) {
- g_signal_handlers_disconnect_by_func (previous_parent,
- G_CALLBACK (parent_motion_notify_event),
- widget);
- g_signal_handlers_disconnect_by_func (previous_parent,
- G_CALLBACK (parent_leave_notify_event),
- widget);
- g_signal_handlers_disconnect_by_func (previous_parent,
- G_CALLBACK (parent_size_allocate),
- widget);
- }
-
- parent = gtk_widget_get_parent (widget);
- if (parent == NULL)
- return;
-
- g_signal_connect_swapped (parent,
- "motion-notify-event",
- G_CALLBACK (parent_motion_notify_event),
- widget);
- g_signal_connect_swapped (parent,
- "leave-notify-event",
- G_CALLBACK (parent_leave_notify_event),
- widget);
- g_signal_connect_swapped (parent,
- "size-allocate",
- G_CALLBACK (parent_size_allocate),
- widget);
-
-}
-
-/* When the mouse is over us, translate the event coords and slide the widget
- * accordingly
- */
-static gboolean
-ephy_overlay_escaping_child_motion_notify_event (GtkWidget *widget,
- GdkEventMotion *event)
-{
- EphyOverlayEscapingChildPrivate *priv = EPHY_OVERLAY_ESCAPING_CHILD (widget)->priv;
-
- event->x += priv->initial_allocation.x;
- event->y += priv->initial_allocation.y;
- return parent_motion_notify_event (widget, event, gtk_widget_get_parent (widget));
-}
-
-/* Make our event window propagate mouse motion events, so we can slide the widget,
- * when hovered.
- */
-static void
-ephy_overlay_escaping_child_realize (GtkWidget *widget)
-{
- GdkWindow *window;
- GdkEventMask events;
-
- GTK_WIDGET_CLASS (ephy_overlay_escaping_child_parent_class)->realize (widget);
-
- window = gtk_widget_get_window (widget);
- events = gdk_window_get_events (window);
- events |= GDK_POINTER_MOTION_MASK;
-
- gdk_window_set_events (window, events);
-}
-
-static void
-ephy_overlay_escaping_child_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
-{
- EphyOverlayEscapingChild *self = EPHY_OVERLAY_ESCAPING_CHILD (object);
- EphyOverlayEscapingChildPrivate *priv = self->priv;
-
- switch (property_id) {
- case PROP_ESCAPING_DISTANCE:
- g_value_set_uint (value, priv->escaping_distance);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-static void
-ephy_overlay_escaping_child_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- EphyOverlayEscapingChild *self = EPHY_OVERLAY_ESCAPING_CHILD (object);
- EphyOverlayEscapingChildPrivate *priv = self->priv;
-
- switch (property_id)
- {
- case PROP_ESCAPING_DISTANCE:
- priv->escaping_distance = g_value_get_uint (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-static void
-ephy_overlay_escaping_child_class_init (EphyOverlayEscapingChildClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
- g_type_class_add_private (klass, sizeof(EphyOverlayEscapingChildPrivate));
-
- gobject_class->get_property = ephy_overlay_escaping_child_get_property;
- gobject_class->set_property = ephy_overlay_escaping_child_set_property;
-
- widget_class->parent_set = ephy_overlay_escaping_child_parent_set;
- widget_class->motion_notify_event = ephy_overlay_escaping_child_motion_notify_event;
- widget_class->realize = ephy_overlay_escaping_child_realize;
-
- g_object_class_install_property (gobject_class,
- PROP_ESCAPING_DISTANCE,
- g_param_spec_uint ("escaping-distance",
- "Escaping distance",
- "Maximum distance between the mouse pointer and the widget",
- 0,
- G_MAXUINT,
- EPHY_OVERLAY_ESCAPING_CHILD_DEFAULT_DISTANCE,
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
-}
-
-static void
-ephy_overlay_escaping_child_init (EphyOverlayEscapingChild *self)
-{
- self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
- EPHY_TYPE_OVERLAY_ESCAPING_CHILD,
- EphyOverlayEscapingChildPrivate);
-}
-
-/**
- * ephy_overlay_escaping_child_new:
- * @widget: the wrapped #GtkWidget
- * @escaping_distance: the distance from which the widget escapes the mouse
- * pointer
- *
- * Creates a new #EphyOverlayEscapingChild object wrapping the provided
- * widget. The widget will stay at a minimal distance of @escaping_distance pixel
- * from the mouse pointer.
- *
- * Returns: a new #EphyOverlayEscapingChild object
- */
-EphyOverlayEscapingChild *
-ephy_overlay_escaping_child_new_with_distance (GtkWidget *widget,
- guint escaping_distance)
-{
- return g_object_new (EPHY_TYPE_OVERLAY_ESCAPING_CHILD,
- "widget", widget,
- "escaping-distance", escaping_distance,
- NULL);
-}
-
-/**
- * ephy_overlay_escaping_child_new:
- * @widget: the wrapped #GtkWidget
- *
- * Creates a new #EphyOverlayEscapingChild object wrapping the provided
- * widget. The widget will stay at a minimal distance of 20 pixels from
- * the mouse pointer.
- *
- * Returns: a new #EphyOverlayEscapingChild object
- */
-EphyOverlayEscapingChild *
-ephy_overlay_escaping_child_new (GtkWidget *widget)
-{
- return g_object_new (EPHY_TYPE_OVERLAY_ESCAPING_CHILD,
- "widget", widget,
- NULL);
-}
diff --git a/lib/widgets/ephy-overlay-escaping-child.h b/lib/widgets/ephy-overlay-escaping-child.h
deleted file mode 100644
index cf567fd55..000000000
--- a/lib/widgets/ephy-overlay-escaping-child.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- *
- * Copyright © 2011 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __EPHY_OVERLAY_ESCAPING_CHILD_H__
-#define __EPHY_OVERLAY_ESCAPING_CHILD_H__
-
-#include "gedit-overlay-child.h"
-
-G_BEGIN_DECLS
-
-#define EPHY_TYPE_OVERLAY_ESCAPING_CHILD (ephy_overlay_escaping_child_get_type())
-#define EPHY_OVERLAY_ESCAPING_CHILD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EPHY_TYPE_OVERLAY_ESCAPING_CHILD, EphyOverlayEscapingChild))
-#define EPHY_OVERLAY_ESCAPING_CHILD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EPHY_TYPE_OVERLAY_ESCAPING_CHILD, EphyOverlayEscapingChildClass))
-#define IS_EPHY_OVERLAY_ESCAPING_CHILD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EPHY_TYPE_OVERLAY_ESCAPING_CHILD))
-#define IS_EPHY_OVERLAY_ESCAPING_CHILD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EPHY_TYPE_OVERLAY_ESCAPING_CHILD))
-#define EPHY_OVERLAY_ESCAPING_CHILD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EPHY_TYPE_OVERLAY_ESCAPING_CHILD, EphyOverlayEscapingChildClass))
-typedef struct _EphyOverlayEscapingChild EphyOverlayEscapingChild;
-
-typedef struct _EphyOverlayEscapingChildClass EphyOverlayEscapingChildClass;
-typedef struct _EphyOverlayEscapingChildPrivate EphyOverlayEscapingChildPrivate;
-
-struct _EphyOverlayEscapingChildClass
-{
- GeditOverlayChildClass parent_class;
-};
-
-struct _EphyOverlayEscapingChild
-{
- GeditOverlayChild parent;
- EphyOverlayEscapingChildPrivate *priv;
-};
-
-GType ephy_overlay_escaping_child_get_type (void) G_GNUC_CONST;
-
-EphyOverlayEscapingChild *ephy_overlay_escaping_child_new (GtkWidget *widget);
-EphyOverlayEscapingChild *ephy_overlay_escaping_child_new_with_distance (GtkWidget *widget,
- guint escaping_distance);
-G_END_DECLS
-
-#endif /* __EPHY_OVERLAY_ESCAPING_CHILD_H__ */
diff --git a/lib/widgets/gedit-overlay-child.c b/lib/widgets/gedit-overlay-child.c
deleted file mode 100644
index 7593fe18c..000000000
--- a/lib/widgets/gedit-overlay-child.c
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
- * gedit-overlay-child.c
- * This file is part of gedit
- *
- * Copyright (C) 2011 - Ignacio Casal Quinteiro
- *
- * gedit is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * gedit is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "gedit-overlay-child.h"
-
-struct _GeditOverlayChildPrivate
-{
- GBinding *binding;
- GeditOverlayChildPosition position;
- guint offset;
-};
-
-enum
-{
- PROP_0,
- PROP_WIDGET,
- PROP_POSITION,
- PROP_OFFSET
-};
-
-G_DEFINE_TYPE (GeditOverlayChild, gedit_overlay_child, GTK_TYPE_BIN)
-
-static void
-gedit_overlay_child_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- GeditOverlayChild *child = GEDIT_OVERLAY_CHILD (object);
-
- switch (prop_id)
- {
- case PROP_WIDGET:
- g_value_set_object (value, gtk_bin_get_child (GTK_BIN (child)));
- break;
- case PROP_POSITION:
- g_value_set_uint (value, child->priv->position);
- break;
- case PROP_OFFSET:
- g_value_set_uint (value, child->priv->offset);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gedit_overlay_child_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GeditOverlayChild *child = GEDIT_OVERLAY_CHILD (object);
-
- switch (prop_id)
- {
- case PROP_WIDGET:
- gtk_container_add (GTK_CONTAINER (child),
- g_value_get_object (value));
- break;
- case PROP_POSITION:
- child->priv->position = g_value_get_uint (value);
- break;
- case PROP_OFFSET:
- child->priv->offset = g_value_get_uint (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gedit_overlay_child_realize (GtkWidget *widget)
-{
- GdkWindowAttr attributes;
- GdkWindow *parent_window;
- GdkWindow *window;
- GtkStyleContext *context;
-
- gtk_widget_set_realized (widget, TRUE);
-
- parent_window = gtk_widget_get_parent_window (widget);
- context = gtk_widget_get_style_context (widget);
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.event_mask = GDK_EXPOSURE_MASK;
- attributes.width = 0;
- attributes.height = 0;
-
- window = gdk_window_new (parent_window, &attributes, 0);
- gdk_window_set_user_data (window, widget);
- gtk_widget_set_window (widget, window);
- gtk_style_context_set_state (context, GTK_STATE_FLAG_NORMAL);
- gtk_style_context_set_background (context, window);
-}
-
-static void
-gedit_overlay_child_get_size (GtkWidget *widget,
- GtkOrientation orientation,
- gint *minimum,
- gint *natural)
-{
- GeditOverlayChild *overlay_child = GEDIT_OVERLAY_CHILD (widget);
- GtkWidget *child;
- gint child_min = 0, child_nat = 0;
-
- child = gtk_bin_get_child (GTK_BIN (overlay_child));
-
- if (child != NULL)
- {
- if (orientation == GTK_ORIENTATION_HORIZONTAL)
- {
- gtk_widget_get_preferred_width (child,
- &child_min, &child_nat);
- }
- else
- {
- gtk_widget_get_preferred_height (child,
- &child_min, &child_nat);
- }
- }
-
- *minimum = child_min;
- *natural = child_nat;
-}
-
-static void
-gedit_overlay_child_get_preferred_width (GtkWidget *widget,
- gint *minimum,
- gint *natural)
-{
- gedit_overlay_child_get_size (widget, GTK_ORIENTATION_HORIZONTAL, minimum, natural);
-}
-
-static void
-gedit_overlay_child_get_preferred_height (GtkWidget *widget,
- gint *minimum,
- gint *natural)
-{
- gedit_overlay_child_get_size (widget, GTK_ORIENTATION_VERTICAL, minimum, natural);
-}
-
-static void
-gedit_overlay_child_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GeditOverlayChild *overlay_child = GEDIT_OVERLAY_CHILD (widget);
- GtkWidget *child;
- GtkAllocation tmp;
-
- tmp.width = allocation->width;
- tmp.height = allocation->height;
- tmp.x = tmp.y = 0;
-
- GTK_WIDGET_CLASS (gedit_overlay_child_parent_class)->size_allocate (widget, allocation);
-
- child = gtk_bin_get_child (GTK_BIN (overlay_child));
-
- if (child != NULL)
- {
- gtk_widget_size_allocate (child, &tmp);
- }
-}
-
-static void
-gedit_overlay_child_add (GtkContainer *container,
- GtkWidget *widget)
-{
- GeditOverlayChild *overlay_child = GEDIT_OVERLAY_CHILD (container);
-
- overlay_child->priv->binding = g_object_bind_property (G_OBJECT (widget), "visible",
- G_OBJECT (container), "visible",
- G_BINDING_BIDIRECTIONAL);
-
- GTK_CONTAINER_CLASS (gedit_overlay_child_parent_class)->add (container, widget);
-}
-
-static void
-gedit_overlay_child_remove (GtkContainer *container,
- GtkWidget *widget)
-{
- GeditOverlayChild *child = GEDIT_OVERLAY_CHILD (container);
-
- g_object_unref (child->priv->binding);
-
- GTK_CONTAINER_CLASS (gedit_overlay_child_parent_class)->remove (container, widget);
-}
-
-static void
-gedit_overlay_child_class_init (GeditOverlayChildClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
-
- object_class->get_property = gedit_overlay_child_get_property;
- object_class->set_property = gedit_overlay_child_set_property;
-
- widget_class->realize = gedit_overlay_child_realize;
- widget_class->get_preferred_width = gedit_overlay_child_get_preferred_width;
- widget_class->get_preferred_height = gedit_overlay_child_get_preferred_height;
- widget_class->size_allocate = gedit_overlay_child_size_allocate;
-
- container_class->add = gedit_overlay_child_add;
- container_class->remove = gedit_overlay_child_remove;
-
- g_object_class_install_property (object_class, PROP_WIDGET,
- g_param_spec_object ("widget",
- "Widget",
- "The Widget",
- GTK_TYPE_WIDGET,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (object_class, PROP_POSITION,
- g_param_spec_uint ("position",
- "Position",
- "The Widget Position",
- 1, GEDIT_OVERLAY_CHILD_POSITION_STATIC,
- GEDIT_OVERLAY_CHILD_POSITION_STATIC,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT |
- G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (object_class, PROP_OFFSET,
- g_param_spec_uint ("offset",
- "Offset",
- "The Widget Offset",
- 0,
- G_MAXUINT,
- 0,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT |
- G_PARAM_STATIC_STRINGS));
-
- g_type_class_add_private (object_class, sizeof (GeditOverlayChildPrivate));
-}
-
-static void
-gedit_overlay_child_init (GeditOverlayChild *child)
-{
- child->priv = G_TYPE_INSTANCE_GET_PRIVATE (child,
- GEDIT_TYPE_OVERLAY_CHILD,
- GeditOverlayChildPrivate);
-
- gtk_widget_set_has_window (GTK_WIDGET (child), TRUE);
-}
-
-/**
- * gedit_overlay_child_new:
- * @widget: a #GtkWidget
- *
- * Creates a new #GeditOverlayChild object
- *
- * Returns: a new #GeditOverlayChild object
- */
-GeditOverlayChild *
-gedit_overlay_child_new (GtkWidget *widget)
-{
- return g_object_new (GEDIT_TYPE_OVERLAY_CHILD,
- "widget", widget,
- NULL);
-}
-
-/**
- * gedit_overlay_child_get_position:
- * @child: a #GeditOverlayChild
- *
- * Gets the position of the widget
- *
- * Returns: wether the child should be placed in a #GeditOverlay
- */
-GeditOverlayChildPosition
-gedit_overlay_child_get_position (GeditOverlayChild *child)
-{
- g_return_val_if_fail (GEDIT_IS_OVERLAY_CHILD (child), GEDIT_OVERLAY_CHILD_POSITION_STATIC);
-
- return child->priv->position;
-}
-
-/**
- * gedit_overlay_child_set_position:
- * @child: a #GeditOverlayChild
- * @position: a #GeditOverlayChildPosition
- *
- * Sets the new position for @child
- */
-void
-gedit_overlay_child_set_position (GeditOverlayChild *child,
- GeditOverlayChildPosition position)
-{
- g_return_if_fail (GEDIT_IS_OVERLAY_CHILD (child));
-
- if (child->priv->position != position)
- {
- child->priv->position = position;
-
- g_object_notify (G_OBJECT (child), "position");
- }
-}
-
-/**
- * gedit_overlay_child_get_offset:
- * @child: a #GeditOverlayChild
- *
- * Gets the offset for @child. The offset is usually used by #GeditOverlay
- * to not place the widget directly in the border of the container
- *
- * Returns: the offset for @child
- */
-guint
-gedit_overlay_child_get_offset (GeditOverlayChild *child)
-{
- g_return_val_if_fail (GEDIT_IS_OVERLAY_CHILD (child), 0);
-
- return child->priv->offset;
-}
-
-/**
- * gedit_overlay_child_set_offset:
- * @child: a #GeditOverlayChild
- * @offset: the offset for @child
- *
- * Sets the new offset for @child
- */
-void
-gedit_overlay_child_set_offset (GeditOverlayChild *child,
- guint offset)
-{
- g_return_if_fail (GEDIT_IS_OVERLAY_CHILD (child));
-
- if (child->priv->offset != offset)
- {
- child->priv->offset = offset;
-
- g_object_notify (G_OBJECT (child), "offset");
- }
-}
-
-/* ex:set ts=8 noet: */
diff --git a/lib/widgets/gedit-overlay-child.h b/lib/widgets/gedit-overlay-child.h
deleted file mode 100644
index 86e051b74..000000000
--- a/lib/widgets/gedit-overlay-child.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * gedit-overlay-child.h
- * This file is part of gedit
- *
- * Copyright (C) 2011 - Ignacio Casal Quinteiro
- *
- * gedit is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * gedit is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __GEDIT_OVERLAY_CHILD_H__
-#define __GEDIT_OVERLAY_CHILD_H__
-
-#include <glib-object.h>
-#include <gtk/gtk.h>
-
-G_BEGIN_DECLS
-
-#define GEDIT_TYPE_OVERLAY_CHILD (gedit_overlay_child_get_type ())
-#define GEDIT_OVERLAY_CHILD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_OVERLAY_CHILD, GeditOverlayChild))
-#define GEDIT_OVERLAY_CHILD_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_OVERLAY_CHILD, GeditOverlayChild const))
-#define GEDIT_OVERLAY_CHILD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEDIT_TYPE_OVERLAY_CHILD, GeditOverlayChildClass))
-#define GEDIT_IS_OVERLAY_CHILD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_TYPE_OVERLAY_CHILD))
-#define GEDIT_IS_OVERLAY_CHILD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_TYPE_OVERLAY_CHILD))
-#define GEDIT_OVERLAY_CHILD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEDIT_TYPE_OVERLAY_CHILD, GeditOverlayChildClass))
-
-typedef struct _GeditOverlayChild GeditOverlayChild;
-typedef struct _GeditOverlayChildClass GeditOverlayChildClass;
-typedef struct _GeditOverlayChildPrivate GeditOverlayChildPrivate;
-
-struct _GeditOverlayChild
-{
- GtkBin parent;
-
- GeditOverlayChildPrivate *priv;
-};
-
-struct _GeditOverlayChildClass
-{
- GtkBinClass parent_class;
-};
-
-typedef enum
-{
- GEDIT_OVERLAY_CHILD_POSITION_NORTH_WEST = 1,
- GEDIT_OVERLAY_CHILD_POSITION_NORTH,
- GEDIT_OVERLAY_CHILD_POSITION_NORTH_EAST,
- GEDIT_OVERLAY_CHILD_POSITION_WEST,
- GEDIT_OVERLAY_CHILD_POSITION_CENTER,
- GEDIT_OVERLAY_CHILD_POSITION_EAST,
- GEDIT_OVERLAY_CHILD_POSITION_SOUTH_WEST,
- GEDIT_OVERLAY_CHILD_POSITION_SOUTH,
- GEDIT_OVERLAY_CHILD_POSITION_SOUTH_EAST,
- GEDIT_OVERLAY_CHILD_POSITION_STATIC
-} GeditOverlayChildPosition;
-
-GType gedit_overlay_child_get_type (void) G_GNUC_CONST;
-
-GeditOverlayChild *gedit_overlay_child_new (GtkWidget *widget);
-
-GeditOverlayChildPosition gedit_overlay_child_get_position (GeditOverlayChild *child);
-
-void gedit_overlay_child_set_position (GeditOverlayChild *child,
- GeditOverlayChildPosition position);
-
-guint gedit_overlay_child_get_offset (GeditOverlayChild *child);
-
-void gedit_overlay_child_set_offset (GeditOverlayChild *child,
- guint offset);
-
-gboolean gedit_overlay_child_get_fixed (GeditOverlayChild *child);
-
-void gedit_overlay_child_set_fixed (GeditOverlayChild *child,
- gboolean fixed);
-
-G_END_DECLS
-
-#endif /* __GEDIT_OVERLAY_CHILD_H__ */
diff --git a/lib/widgets/gedit-overlay.c b/lib/widgets/gedit-overlay.c
deleted file mode 100644
index b80c0af1c..000000000
--- a/lib/widgets/gedit-overlay.c
+++ /dev/null
@@ -1,542 +0,0 @@
-/*
- * gedit-overlay.c
- * This file is part of gedit
- *
- * Copyright (C) 2011 - Ignacio Casal Quinteiro
- *
- * Based on Mike Krüger <mkrueger@novell.com> work.
- *
- * gedit is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * gedit is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "gedit-overlay.h"
-#include "gedit-overlay-child.h"
-
-#define GEDIT_OVERLAY_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), GEDIT_TYPE_OVERLAY, GeditOverlayPrivate))
-
-typedef struct
-{
- GtkWidget *child;
- GtkWidget *original;
-} ChildContainer;
-
-struct _GeditOverlayPrivate
-{
- GtkWidget *main_widget;
- GtkWidget *relative_widget;
- GSList *children;
-};
-
-enum
-{
- PROP_0,
- PROP_MAIN_WIDGET,
- PROP_RELATIVE_WIDGET
-};
-
-G_DEFINE_TYPE (GeditOverlay, gedit_overlay, GTK_TYPE_CONTAINER)
-
-static ChildContainer *
-child_container_new (GtkWidget *child,
- GtkWidget *original)
-{
- ChildContainer *ret;
-
- ret = g_slice_new (ChildContainer);
- ret->child = child;
- ret->original = original;
-
- return ret;
-}
-
-static void
-child_container_free (ChildContainer *container)
-{
- g_slice_free (ChildContainer, container);
-}
-
-static GtkWidget *
-child_container_get_child (ChildContainer *container)
-{
- GtkWidget *child;
-
- if (container->child != NULL)
- {
- child = container->child;
- }
- else
- {
- child = container->original;
- }
-
- return child;
-}
-
-static void
-add_toplevel_widget (GeditOverlay *overlay,
- GtkWidget *child,
- GtkWidget *original)
-{
- ChildContainer *container;
-
- if (child != NULL)
- {
- gtk_widget_set_parent (child, GTK_WIDGET (overlay));
- }
- else
- {
- gtk_widget_set_parent (original, GTK_WIDGET (overlay));
- }
-
- container = child_container_new (child, original);
-
- overlay->priv->children = g_slist_append (overlay->priv->children,
- container);
-}
-
-static void
-gedit_overlay_dispose (GObject *object)
-{
- G_OBJECT_CLASS (gedit_overlay_parent_class)->dispose (object);
-}
-
-static void
-gedit_overlay_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- GeditOverlay *overlay = GEDIT_OVERLAY (object);
- GeditOverlayPrivate *priv = overlay->priv;
-
- switch (prop_id)
- {
- case PROP_MAIN_WIDGET:
- g_value_set_object (value, priv->main_widget);
- break;
-
- case PROP_RELATIVE_WIDGET:
- g_value_set_object (value, priv->relative_widget);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static GtkWidget *
-wrap_child_if_needed (GtkWidget *widget)
-{
- GtkWidget *child;
-
- if (GEDIT_IS_OVERLAY_CHILD (widget))
- {
- return widget;
- }
-
- child = GTK_WIDGET (gedit_overlay_child_new (widget));
- gtk_widget_show (child);
-
- g_signal_connect_swapped (widget,
- "destroy",
- G_CALLBACK (gtk_widget_destroy),
- child);
-
- return child;
-}
-
-static void
-gedit_overlay_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GeditOverlay *overlay = GEDIT_OVERLAY (object);
- GeditOverlayPrivate *priv = overlay->priv;
-
- switch (prop_id)
- {
- case PROP_MAIN_WIDGET:
- {
- priv->main_widget = g_value_get_object (value);
-
- add_toplevel_widget (overlay,
- NULL,
- priv->main_widget);
- break;
- }
- case PROP_RELATIVE_WIDGET:
- priv->relative_widget = g_value_get_object (value);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gedit_overlay_realize (GtkWidget *widget)
-{
- GtkAllocation allocation;
- GdkWindow *window;
- GdkWindowAttr attributes;
- gint attributes_mask;
- GtkStyleContext *context;
-
- gtk_widget_set_realized (widget, TRUE);
-
- gtk_widget_get_allocation (widget, &allocation);
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = allocation.x;
- attributes.y = allocation.y;
- attributes.width = allocation.width;
- attributes.height = allocation.height;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.event_mask = gtk_widget_get_events (widget);
- attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_LEAVE_NOTIFY_MASK;
-
- attributes_mask = GDK_WA_X | GDK_WA_Y;
-
- window = gdk_window_new (gtk_widget_get_parent_window (widget),
- &attributes, attributes_mask);
- gtk_widget_set_window (widget, window);
- gdk_window_set_user_data (window, widget);
-
- context = gtk_widget_get_style_context (widget);
- gtk_style_context_set_state (context, GTK_STATE_FLAG_NORMAL);
- gtk_style_context_set_background (context, window);
-}
-
-static void
-gedit_overlay_get_preferred_width (GtkWidget *widget,
- gint *minimum,
- gint *natural)
-{
- GeditOverlayPrivate *priv = GEDIT_OVERLAY (widget)->priv;
-
- *minimum = 0;
- *natural = 0;
-
- if (priv->main_widget)
- {
- gtk_widget_get_preferred_width (priv->main_widget, minimum, natural);
- }
-}
-
-static void
-gedit_overlay_get_preferred_height (GtkWidget *widget,
- gint *minimum,
- gint *natural)
-{
- GeditOverlayPrivate *priv = GEDIT_OVERLAY (widget)->priv;
-
- *minimum = 0;
- *natural = 0;
-
- if (priv->main_widget)
- {
- gtk_widget_get_preferred_height (priv->main_widget, minimum, natural);
- }
-}
-
-static void
-gedit_overlay_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GeditOverlay *overlay = GEDIT_OVERLAY (widget);
- GeditOverlayPrivate *priv = overlay->priv;
- GtkAllocation main_alloc;
- GSList *l;
-
- GTK_WIDGET_CLASS (gedit_overlay_parent_class)->size_allocate (widget, allocation);
-
- /* main widget allocation */
- main_alloc.x = 0;
- main_alloc.y = 0;
- main_alloc.width = allocation->width;
- main_alloc.height = allocation->height;
-
- gtk_widget_size_allocate (overlay->priv->main_widget, &main_alloc);
-
- /* if a relative widget exists place the floating widgets in relation to it */
- if (priv->relative_widget)
- {
- gtk_widget_get_allocation (priv->relative_widget, &main_alloc);
- }
-
- for (l = priv->children; l != NULL; l = g_slist_next (l))
- {
- ChildContainer *container = l->data;
- GtkWidget *child;
- GtkRequisition req;
- GtkAllocation alloc;
- guint offset;
-
- child = child_container_get_child (container);
-
- if (child == priv->main_widget)
- continue;
-
- gtk_widget_get_preferred_size (child, NULL, &req);
- offset = gedit_overlay_child_get_offset (GEDIT_OVERLAY_CHILD (child));
-
- /* FIXME: Add all the positions here */
- switch (gedit_overlay_child_get_position (GEDIT_OVERLAY_CHILD (child)))
- {
- /* The gravity is treated as position and not as a gravity */
- case GEDIT_OVERLAY_CHILD_POSITION_NORTH_EAST:
- alloc.x = MAX (main_alloc.x, main_alloc.width - req.width - (gint) offset);
- alloc.y = 0;
- break;
- case GEDIT_OVERLAY_CHILD_POSITION_NORTH_WEST:
- alloc.x = offset;
- alloc.y = 0;
- break;
- case GEDIT_OVERLAY_CHILD_POSITION_SOUTH_WEST:
- alloc.x = offset;
- alloc.y = MAX (main_alloc.y, main_alloc.height - req.height);
- break;
- case GEDIT_OVERLAY_CHILD_POSITION_SOUTH_EAST:
- alloc.x = MAX (main_alloc.x, main_alloc.width - req.width - (gint) offset);
- alloc.y = MAX (main_alloc.y, main_alloc.height - req.height);
- break;
- default:
- alloc.x = 0;
- alloc.y = 0;
- }
-
- if (main_alloc.width < req.width || main_alloc.height < req.height)
- {
- GdkWindow *child_window = gtk_widget_get_window (child);
- if (child_window)
- gdk_window_move_resize (child_window,
- alloc.x, alloc.y,
- MIN (main_alloc.width, req.width),
- MIN (main_alloc.height, req.height));
- }
-
- alloc.width = req.width;
- alloc.height = req.height;
-
- gtk_widget_size_allocate (child, &alloc);
- }
-}
-
-static GeditOverlayChild *
-get_overlay_child (GeditOverlay *overlay,
- GtkWidget *widget)
-{
- GSList *l;
-
- for (l = overlay->priv->children; l != NULL; l = g_slist_next (l))
- {
- ChildContainer *container = l->data;
-
- if (container->original == widget &&
- GEDIT_IS_OVERLAY_CHILD (container->child))
- {
- return GEDIT_OVERLAY_CHILD (container->child);
- }
- }
-
- return NULL;
-}
-
-static void
-overlay_add (GtkContainer *overlay,
- GtkWidget *widget)
-{
- GeditOverlayChild *child;
-
- /* check that the widget is not added yet */
- child = get_overlay_child (GEDIT_OVERLAY (overlay), widget);
-
- if (child == NULL)
- {
- add_toplevel_widget (GEDIT_OVERLAY (overlay),
- wrap_child_if_needed (widget),
- widget);
- }
-}
-
-static void
-gedit_overlay_remove (GtkContainer *overlay,
- GtkWidget *widget)
-{
- GeditOverlayPrivate *priv = GEDIT_OVERLAY (overlay)->priv;
- GSList *l;
-
- for (l = priv->children; l != NULL; l = g_slist_next (l))
- {
- ChildContainer *container = l->data;
- GtkWidget *original = container->original;
-
- if (original == widget)
- {
- gtk_widget_unparent (widget);
-
- if (container->child != NULL &&
- original != container->child)
- {
- g_signal_handlers_disconnect_by_func (original,
- gtk_widget_destroy,
- container->child);
-
- gtk_widget_destroy (container->child);
- }
-
- child_container_free (container);
- priv->children = g_slist_delete_link (priv->children,
- l);
-
- break;
- }
- }
-}
-
-static void
-gedit_overlay_forall (GtkContainer *overlay,
- gboolean include_internals,
- GtkCallback callback,
- gpointer callback_data)
-{
- GeditOverlayPrivate *priv = GEDIT_OVERLAY (overlay)->priv;
- GSList *children;
-
- children = priv->children;
-
- while (children)
- {
- GtkWidget *child;
- ChildContainer *container = children->data;
- children = children->next;
-
- child = child_container_get_child (container);
-
- (* callback) (child, callback_data);
- }
-}
-
-static GType
-gedit_overlay_child_type (GtkContainer *overlay)
-{
- return GTK_TYPE_WIDGET;
-}
-
-static void
-gedit_overlay_class_init (GeditOverlayClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
-
- object_class->dispose = gedit_overlay_dispose;
- object_class->get_property = gedit_overlay_get_property;
- object_class->set_property = gedit_overlay_set_property;
-
- widget_class->realize = gedit_overlay_realize;
- widget_class->get_preferred_width = gedit_overlay_get_preferred_width;
- widget_class->get_preferred_height = gedit_overlay_get_preferred_height;
- widget_class->size_allocate = gedit_overlay_size_allocate;
-
- container_class->add = overlay_add;
- container_class->remove = gedit_overlay_remove;
- container_class->forall = gedit_overlay_forall;
- container_class->child_type = gedit_overlay_child_type;
-
- g_object_class_install_property (object_class, PROP_MAIN_WIDGET,
- g_param_spec_object ("main-widget",
- "Main Widget",
- "The Main Widget",
- GTK_TYPE_WIDGET,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (object_class, PROP_RELATIVE_WIDGET,
- g_param_spec_object ("relative-widget",
- "Relative Widget",
- "Widget on which the floating widgets are placed",
- GTK_TYPE_WIDGET,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
-
- g_type_class_add_private (object_class, sizeof (GeditOverlayPrivate));
-}
-
-static void
-gedit_overlay_init (GeditOverlay *overlay)
-{
- overlay->priv = GEDIT_OVERLAY_GET_PRIVATE (overlay);
-
- gtk_widget_set_app_paintable (GTK_WIDGET (overlay), TRUE);
-}
-
-/**
- * gedit_overlay_new:
- * @main_widget: a #GtkWidget
- * @relative_widget: (allow-none): a #Gtkwidget
- *
- * Creates a new #GeditOverlay. If @relative_widget is not %NULL the floating
- * widgets will be placed in relation to it, if not @main_widget will be use
- * for this purpose.
- *
- * Returns: a new #GeditOverlay object.
- */
-GtkWidget *
-gedit_overlay_new (GtkWidget *main_widget,
- GtkWidget *relative_widget)
-{
- g_return_val_if_fail (GTK_IS_WIDGET (main_widget), NULL);
-
- return GTK_WIDGET (g_object_new (GEDIT_TYPE_OVERLAY,
- "main-widget", main_widget,
- "relative-widget", relative_widget,
- NULL));
-}
-
-/**
- * gedit_overlay_add:
- * @overlay: a #GeditOverlay
- * @widget: a #GtkWidget to be added to the container
- * @position: a #GeditOverlayChildPosition
- * @offset: offset for @widget
- *
- * Adds @widget to @overlay in a specific position.
- */
-void
-gedit_overlay_add (GeditOverlay *overlay,
- GtkWidget *widget,
- GeditOverlayChildPosition position,
- guint offset)
-{
- GeditOverlayChild *child;
-
- g_return_if_fail (GEDIT_IS_OVERLAY (overlay));
- g_return_if_fail (GTK_IS_WIDGET (widget));
-
- gtk_container_add (GTK_CONTAINER (overlay), widget);
-
- /* NOTE: can we improve this without exposing overlay child? */
- child = get_overlay_child (overlay, widget);
- g_assert (child != NULL);
-
- gedit_overlay_child_set_position (child, position);
- gedit_overlay_child_set_offset (child, offset);
-}
diff --git a/lib/widgets/gedit-overlay.h b/lib/widgets/gedit-overlay.h
deleted file mode 100644
index 224c3ee83..000000000
--- a/lib/widgets/gedit-overlay.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * gedit-overlay.h
- * This file is part of gedit
- *
- * Copyright (C) 2011 - Ignacio Casal Quinteiro
- *
- * gedit is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * gedit is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __GEDIT_OVERLAY_H__
-#define __GEDIT_OVERLAY_H__
-
-#include <glib-object.h>
-#include <gtk/gtk.h>
-#include "gedit-overlay-child.h"
-
-G_BEGIN_DECLS
-
-#define GEDIT_TYPE_OVERLAY (gedit_overlay_get_type ())
-#define GEDIT_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_OVERLAY, GeditOverlay))
-#define GEDIT_OVERLAY_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_OVERLAY, GeditOverlay const))
-#define GEDIT_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEDIT_TYPE_OVERLAY, GeditOverlayClass))
-#define GEDIT_IS_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_TYPE_OVERLAY))
-#define GEDIT_IS_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_TYPE_OVERLAY))
-#define GEDIT_OVERLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEDIT_TYPE_OVERLAY, GeditOverlayClass))
-
-typedef struct _GeditOverlay GeditOverlay;
-typedef struct _GeditOverlayClass GeditOverlayClass;
-typedef struct _GeditOverlayPrivate GeditOverlayPrivate;
-
-struct _GeditOverlay
-{
- GtkContainer parent;
-
- GeditOverlayPrivate *priv;
-};
-
-struct _GeditOverlayClass
-{
- GtkContainerClass parent_class;
-};
-
-GType gedit_overlay_get_type (void) G_GNUC_CONST;
-
-GtkWidget *gedit_overlay_new (GtkWidget *main_widget,
- GtkWidget *relative_widget);
-
-void gedit_overlay_add (GeditOverlay *overlay,
- GtkWidget *widget,
- GeditOverlayChildPosition position,
- guint offset);
-
-void gedit_overlay_set_composited (GeditOverlay *overlay,
- gboolean enabled);
-
-G_END_DECLS
-
-#endif /* __GEDIT_OVERLAY_H__ */