[gedit] Let the GtkBin manage the child.
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Let the GtkBin manage the child.
- Date: Thu, 9 Sep 2010 11:45:42 +0000 (UTC)
commit d10e48268c8c5c48cf2971f960567c07d0e7ada5
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Thu Sep 9 13:45:16 2010 +0200
Let the GtkBin manage the child.
gedit/gedit-overlay.c | 2 +-
gedit/theatrics/gedit-theatrics-animated-widget.c | 54 +++++++--------------
gedit/theatrics/gedit-theatrics-animated-widget.h | 2 -
3 files changed, 18 insertions(+), 40 deletions(-)
---
diff --git a/gedit/gedit-overlay.c b/gedit/gedit-overlay.c
index 74d0c9a..dc09b51 100644
--- a/gedit/gedit-overlay.c
+++ b/gedit/gedit-overlay.c
@@ -595,7 +595,7 @@ gedit_overlay_move_widget (GeditOverlay *overlay,
if (child->is_animated)
{
- w = gedit_theatrics_animated_widget_get_widget (GEDIT_THEATRICS_ANIMATED_WIDGET (child->child));
+ w = gtk_bin_get_child (GTK_BIN (child->child));
}
else
{
diff --git a/gedit/theatrics/gedit-theatrics-animated-widget.c b/gedit/theatrics/gedit-theatrics-animated-widget.c
index 826aec1..4ee6ff4 100644
--- a/gedit/theatrics/gedit-theatrics-animated-widget.c
+++ b/gedit/theatrics/gedit-theatrics-animated-widget.c
@@ -117,21 +117,6 @@ on_widget_destroyed (GtkWidget *widget,
}
static void
-set_widget (GeditTheatricsAnimatedWidget *aw,
- GtkWidget *widget)
-{
- if (widget == NULL)
- return;
-
- aw->priv->widget = widget;
- gtk_widget_set_parent (widget, GTK_WIDGET (aw));
-
- g_signal_connect (widget, "destroy",
- G_CALLBACK (on_widget_destroyed),
- aw);
-}
-
-static void
gedit_theatrics_animated_widget_finalize (GObject *object)
{
G_OBJECT_CLASS (gedit_theatrics_animated_widget_parent_class)->finalize (object);
@@ -186,7 +171,8 @@ gedit_theatrics_animated_widget_set_property (GObject *object,
{
case PROP_WIDGET:
{
- set_widget (aw, g_value_get_object (value));
+ gtk_container_add (GTK_CONTAINER (aw),
+ g_value_get_object (value));
break;
}
case PROP_EASING:
@@ -355,27 +341,29 @@ gedit_theatrics_animated_widget_expose_event (GtkWidget *widget,
}
static void
-gedit_theatrics_animated_widget_remove (GtkContainer *container,
- GtkWidget *widget)
+gedit_theatrics_animated_widget_add (GtkContainer *container,
+ GtkWidget *widget)
{
GeditTheatricsAnimatedWidget *aw = GEDIT_THEATRICS_ANIMATED_WIDGET (container);
- gtk_widget_unparent (widget);
- aw->priv->widget = NULL;
+ aw->priv->widget = widget;
+
+ g_signal_connect (widget, "destroy",
+ G_CALLBACK (on_widget_destroyed),
+ aw);
+
+ GTK_CONTAINER_CLASS (gedit_theatrics_animated_widget_parent_class)->add (container, widget);
}
static void
-gedit_theatrics_animated_widget_forall (GtkContainer *container,
- gboolean include_internals,
- GtkCallback callback,
- gpointer callback_data)
+gedit_theatrics_animated_widget_remove (GtkContainer *container,
+ GtkWidget *widget)
{
GeditTheatricsAnimatedWidget *aw = GEDIT_THEATRICS_ANIMATED_WIDGET (container);
- if (aw->priv->widget != NULL)
- {
- callback (aw->priv->widget, callback_data);
- }
+ aw->priv->widget = NULL;
+
+ GTK_CONTAINER_CLASS (gedit_theatrics_animated_widget_parent_class)->remove (container, widget);
}
static void
@@ -394,8 +382,8 @@ gedit_theatrics_animated_widget_class_init (GeditTheatricsAnimatedWidgetClass *k
widget_class->size_allocate = gedit_theatrics_animated_widget_size_allocate;
widget_class->expose_event = gedit_theatrics_animated_widget_expose_event;
+ container_class->add = gedit_theatrics_animated_widget_add;
container_class->remove = gedit_theatrics_animated_widget_remove;
- container_class->forall = gedit_theatrics_animated_widget_forall;
g_object_class_install_property (object_class, PROP_WIDGET,
g_param_spec_object ("widget",
@@ -502,14 +490,6 @@ gedit_theatrics_animated_widget_new (GtkWidget *widget,
NULL);
}
-GtkWidget *
-gedit_theatrics_animated_widget_get_widget (GeditTheatricsAnimatedWidget *aw)
-{
- g_return_val_if_fail (GEDIT_IS_THEATRICS_ANIMATED_WIDGET (aw), NULL);
-
- return aw->priv->widget;
-}
-
GeditTheatricsChoreographerEasing
gedit_theatrics_animated_widget_get_easing (GeditTheatricsAnimatedWidget *aw)
{
diff --git a/gedit/theatrics/gedit-theatrics-animated-widget.h b/gedit/theatrics/gedit-theatrics-animated-widget.h
index ef9c013..c26a5bd 100644
--- a/gedit/theatrics/gedit-theatrics-animated-widget.h
+++ b/gedit/theatrics/gedit-theatrics-animated-widget.h
@@ -65,8 +65,6 @@ GeditTheatricsAnimatedWidget *gedit_theatrics_animated_widget_new (GtkWidget
GeditTheatricsChoreographerBlocking blocking,
GtkOrientation orientation);
-GtkWidget *gedit_theatrics_animated_widget_get_widget (GeditTheatricsAnimatedWidget *aw);
-
GeditTheatricsChoreographerEasing
gedit_theatrics_animated_widget_get_easing (GeditTheatricsAnimatedWidget *aw);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]