[glide] Slide pane no longer goes crazy on new documents
- From: Robert Carr <racarr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glide] Slide pane no longer goes crazy on new documents
- Date: Thu, 29 Apr 2010 09:34:15 +0000 (UTC)
commit 92461c5e2738ef785c789dac46eb7817dbe693ad
Author: Robert Carr <racarr Valentine localdomain>
Date: Thu Apr 29 05:34:35 2010 -0400
Slide pane no longer goes crazy on new documents
src/glide-slide-box-priv.h | 1 +
src/glide-slide-box.c | 35 +++++++++++++++++++++++++++--------
src/glide-slide-button.c | 1 -
3 files changed, 28 insertions(+), 9 deletions(-)
---
diff --git a/src/glide-slide-box-priv.h b/src/glide-slide-box-priv.h
index b2c34ce..327ce46 100644
--- a/src/glide-slide-box-priv.h
+++ b/src/glide-slide-box-priv.h
@@ -27,6 +27,7 @@ G_BEGIN_DECLS
struct _GlideSlideBoxPrivate
{
GlideStageManager *manager;
+ GlideDocument *document;
gulong slide_added_id;
gulong slide_removed_id;
diff --git a/src/glide-slide-box.c b/src/glide-slide-box.c
index 2e328ec..eee9740 100644
--- a/src/glide-slide-box.c
+++ b/src/glide-slide-box.c
@@ -31,6 +31,19 @@ enum {
};
static void
+glide_slide_box_remove_children (GlideSlideBox *box)
+{
+ GList *children = gtk_container_get_children (GTK_CONTAINER (box));
+ GList *t;
+
+ for (t = children; t; t = t->next)
+ {
+ GtkWidget *child = (GtkWidget *)t->data;
+ gtk_widget_destroy (child);
+ }
+}
+
+static void
glide_slide_box_document_slide_added (GlideDocument *document,
GlideSlide *slide,
gpointer data)
@@ -63,7 +76,8 @@ glide_slide_box_document_slide_removed (GlideDocument *document,
static void
glide_slide_box_finalize (GObject *object)
{
-
+ GlideSlideBox *box = (GlideSlideBox *)object;
+ g_object_unref (G_OBJECT (box->priv->document));
}
static void
@@ -151,15 +165,20 @@ glide_slide_box_set_stage_manager (GlideSlideBox *box,
if (box->priv->manager)
{
- g_signal_handler_disconnect (doc, box->priv->slide_added_id);
- g_signal_handler_disconnect (doc, box->priv->slide_removed_id);
+ g_signal_handler_disconnect (box->priv->document, box->priv->slide_added_id);
+ g_signal_handler_disconnect (box->priv->document, box->priv->slide_removed_id);
+ glide_slide_box_remove_children (box);
}
box->priv->manager = manager;
-
- g_signal_connect (doc, "slide-added",
- G_CALLBACK (glide_slide_box_document_slide_added),
- box);
- g_signal_connect (doc, "slide-removed",
+
+ if (box->priv->document)
+ g_object_unref (G_OBJECT (box->priv->document));
+ box->priv->document = (GlideDocument *)g_object_ref (G_OBJECT (doc));
+
+ box->priv->slide_added_id = g_signal_connect (doc, "slide-added",
+ G_CALLBACK (glide_slide_box_document_slide_added),
+ box);
+ box->priv->slide_removed_id = g_signal_connect (doc, "slide-removed",
G_CALLBACK (glide_slide_box_document_slide_removed),
box);
diff --git a/src/glide-slide-button.c b/src/glide-slide-button.c
index f859de3..603b1f2 100644
--- a/src/glide-slide-button.c
+++ b/src/glide-slide-button.c
@@ -99,7 +99,6 @@ static void
glide_slide_button_finalize (GObject *object)
{
GlideSlideButton *button = (GlideSlideButton *)object;
- gtk_widget_destroy (button->priv->drawing_area);
if (button->priv->manager)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]