[epiphany] Sync with upstream GeditOverlay
- From: Xan Lopez <xan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Sync with upstream GeditOverlay
- Date: Sat, 26 Feb 2011 01:16:15 +0000 (UTC)
commit ebc582d3f2e7cd7b10fd5893aff5e981d9d8f822
Author: Xan Lopez <xlopez igalia com>
Date: Sat Feb 26 02:11:03 2011 +0100
Sync with upstream GeditOverlay
lib/widgets/Makefile.am | 17 -----------
lib/widgets/gedit-enum-types.c.template | 39 --------------------------
lib/widgets/gedit-enum-types.h.template | 27 ------------------
lib/widgets/gedit-overlay-child.c | 45 ++++++++++++++----------------
4 files changed, 21 insertions(+), 107 deletions(-)
---
diff --git a/lib/widgets/Makefile.am b/lib/widgets/Makefile.am
index f1e2f0d..99557c1 100644
--- a/lib/widgets/Makefile.am
+++ b/lib/widgets/Makefile.am
@@ -32,20 +32,3 @@ libephywidgets_la_CPPFLAGS = \
libephywidgets_la_CFLAGS = \
$(DEPENDENCIES_CFLAGS) \
$(AM_CFLAGS)
-
-BUILT_SOURCES = \
- gedit-enum-types.c \
- gedit-enum-types.h
-
-ENUM_TYPES = \
- gedit-overlay-child.h
-
-gedit-enum-types.h: gedit-enum-types.h.template $(ENUM_TYPES) $(GLIB_MKENUMS)
- $(AM_V_GEN)(cd $(srcdir) && $(GLIB_MKENUMS) --template gedit-enum-types.h.template $(ENUM_TYPES)) > $@
-
-gedit-enum-types.c: gedit-enum-types.c.template $(ENUM_TYPES) $(GLIB_MKENUMS)
- $(AM_V_GEN)(cd $(srcdir) && $(GLIB_MKENUMS) --template gedit-enum-types.c.template $(ENUM_TYPES)) > $@
-
-EXTRA_DIST = \
- gedit-enum-types.c.template \
- gedit-enum-types.h.template
diff --git a/lib/widgets/gedit-overlay-child.c b/lib/widgets/gedit-overlay-child.c
index c97162f..e30d6ed 100644
--- a/lib/widgets/gedit-overlay-child.c
+++ b/lib/widgets/gedit-overlay-child.c
@@ -20,13 +20,11 @@
*/
#include "gedit-overlay-child.h"
-#include "gedit-enum-types.h"
struct _GeditOverlayChildPrivate
{
- GtkWidget *widget;
- GBinding *binding;
- GtkAllocation widget_alloc;
+ GtkWidget *widget;
+ GBinding *binding;
GeditOverlayChildPosition position;
guint offset;
};
@@ -55,7 +53,7 @@ gedit_overlay_child_get_property (GObject *object,
g_value_set_object (value, child->priv->widget);
break;
case PROP_POSITION:
- g_value_set_enum (value, child->priv->position);
+ g_value_set_uint (value, child->priv->position);
break;
case PROP_OFFSET:
g_value_set_uint (value, child->priv->offset);
@@ -81,7 +79,7 @@ gedit_overlay_child_set_property (GObject *object,
g_value_get_object (value));
break;
case PROP_POSITION:
- child->priv->position = g_value_get_enum (value);
+ child->priv->position = g_value_get_uint (value);
break;
case PROP_OFFSET:
child->priv->offset = g_value_get_uint (value);
@@ -108,6 +106,8 @@ gedit_overlay_child_realize (GtkWidget *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);
@@ -122,19 +122,16 @@ gedit_overlay_child_get_preferred_width (GtkWidget *widget,
gint *natural)
{
GeditOverlayChild *child = GEDIT_OVERLAY_CHILD (widget);
- gint width;
+ gint child_min = 0, child_nat = 0;
if (child->priv->widget != NULL)
{
- gint child_min, child_nat;
-
gtk_widget_get_preferred_width (child->priv->widget,
&child_min, &child_nat);
- child->priv->widget_alloc.width = child_min;
}
- width = child->priv->widget_alloc.width;
- *minimum = *natural = width;
+ *minimum = child_min;
+ *natural = child_nat;
}
static void
@@ -143,19 +140,16 @@ gedit_overlay_child_get_preferred_height (GtkWidget *widget,
gint *natural)
{
GeditOverlayChild *child = GEDIT_OVERLAY_CHILD (widget);
- gint height;
+ gint child_min = 0, child_nat = 0;
if (child->priv->widget != NULL)
{
- gint child_min, child_nat;
-
gtk_widget_get_preferred_height (child->priv->widget,
&child_min, &child_nat);
- child->priv->widget_alloc.height = child_min;
}
- height = child->priv->widget_alloc.height;
- *minimum = *natural = height;
+ *minimum = child_min;
+ *natural = child_nat;
}
static void
@@ -163,15 +157,18 @@ gedit_overlay_child_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GeditOverlayChild *child = GEDIT_OVERLAY_CHILD (widget);
+ 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);
- if (child->priv->widget != NULL &&
- child->priv->widget_alloc.height &&
- child->priv->widget_alloc.width)
+ if (child->priv->widget != NULL)
{
gtk_widget_size_allocate (child->priv->widget,
- &child->priv->widget_alloc);
+ &tmp);
}
}
@@ -231,10 +228,10 @@ gedit_overlay_child_class_init (GeditOverlayChildClass *klass)
G_PARAM_STATIC_STRINGS));
g_object_class_install_property (object_class, PROP_POSITION,
- g_param_spec_enum ("position",
+ g_param_spec_uint ("position",
"Position",
"The Widget Position",
- GEDIT_TYPE_OVERLAY_CHILD_POSITION,
+ 1, GEDIT_OVERLAY_CHILD_POSITION_STATIC,
GEDIT_OVERLAY_CHILD_POSITION_STATIC,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT |
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]