aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXan Lopez <xlopez@igalia.com>2011-02-26 09:11:03 +0800
committerXan Lopez <xlopez@igalia.com>2011-02-26 09:11:03 +0800
commitebc582d3f2e7cd7b10fd5893aff5e981d9d8f822 (patch)
treec41c367c0bfd6b64a3ef8268a6860685c90663d6
parent0c799b8e9de67440b1c3bc976fa63685367f295e (diff)
downloadgsoc2013-epiphany-ebc582d3f2e7cd7b10fd5893aff5e981d9d8f822.tar
gsoc2013-epiphany-ebc582d3f2e7cd7b10fd5893aff5e981d9d8f822.tar.gz
gsoc2013-epiphany-ebc582d3f2e7cd7b10fd5893aff5e981d9d8f822.tar.bz2
gsoc2013-epiphany-ebc582d3f2e7cd7b10fd5893aff5e981d9d8f822.tar.lz
gsoc2013-epiphany-ebc582d3f2e7cd7b10fd5893aff5e981d9d8f822.tar.xz
gsoc2013-epiphany-ebc582d3f2e7cd7b10fd5893aff5e981d9d8f822.tar.zst
gsoc2013-epiphany-ebc582d3f2e7cd7b10fd5893aff5e981d9d8f822.zip
Sync with upstream GeditOverlay
-rw-r--r--lib/widgets/Makefile.am17
-rw-r--r--lib/widgets/gedit-enum-types.c.template39
-rw-r--r--lib/widgets/gedit-enum-types.h.template27
-rw-r--r--lib/widgets/gedit-overlay-child.c45
4 files changed, 21 insertions, 107 deletions
diff --git a/lib/widgets/Makefile.am b/lib/widgets/Makefile.am
index f1e2f0dbd..99557c157 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-enum-types.c.template b/lib/widgets/gedit-enum-types.c.template
deleted file mode 100644
index 7a67ac798..000000000
--- a/lib/widgets/gedit-enum-types.c.template
+++ /dev/null
@@ -1,39 +0,0 @@
-/*** BEGIN file-header ***/
-#include "gedit-enum-types.h"
-
-/*** END file-header ***/
-
-/*** BEGIN file-production ***/
-/* enumerations from "@filename@" */
-#include "@filename@"
-
-/*** END file-production ***/
-
-/*** BEGIN value-header ***/
-GType
-@enum_name@_get_type (void)
-{
- static GType the_type = 0;
-
- if (the_type == 0)
- {
- static const G@Type@Value values[] = {
-/*** END value-header ***/
-
-/*** BEGIN value-production ***/
- { @VALUENAME@,
- "@VALUENAME@",
- "@valuenick@" },
-/*** END value-production ***/
-
-/*** BEGIN value-tail ***/
- { 0, NULL, NULL }
- };
- the_type = g_@type@_register_static (
- g_intern_static_string ("@EnumName@"),
- values);
- }
- return the_type;
-}
-
-/*** END value-tail ***/
diff --git a/lib/widgets/gedit-enum-types.h.template b/lib/widgets/gedit-enum-types.h.template
deleted file mode 100644
index 78f39ce81..000000000
--- a/lib/widgets/gedit-enum-types.h.template
+++ /dev/null
@@ -1,27 +0,0 @@
-/*** BEGIN file-header ***/
-#ifndef __GEDIT_ENUM_TYPES_H__
-#define __GEDIT_ENUM_TYPES_H__
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-/*** END file-header ***/
-
-/*** BEGIN file-production ***/
-/* Enumerations from "@filename@" */
-
-/*** END file-production ***/
-
-/*** BEGIN enumeration-production ***/
-#define GEDIT_TYPE_@ENUMSHORT@ (@enum_name@_get_type())
-GType @enum_name@_get_type (void) G_GNUC_CONST;
-
-/*** END enumeration-production ***/
-
-/*** BEGIN file-tail ***/
-G_END_DECLS
-
-#endif /* __GEDIT_ENUM_TYPES_H__ */
-/*** END file-tail ***/
-
diff --git a/lib/widgets/gedit-overlay-child.c b/lib/widgets/gedit-overlay-child.c
index c97162fe6..e30d6edfb 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 |