[glide] Box now tracks slide add removes



commit 4119cf0f1718ac656a222cfa5e6877e7ce2a9615
Author: Robert Carr <racarr Valentine localdomain>
Date:   Thu Apr 29 02:44:59 2010 -0400

    Box now tracks slide add removes

 src/glide-slide-box-priv.h |    3 +++
 src/glide-slide-box.c      |   35 +++++++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+), 0 deletions(-)
---
diff --git a/src/glide-slide-box-priv.h b/src/glide-slide-box-priv.h
index 8c6e04b..b2c34ce 100644
--- a/src/glide-slide-box-priv.h
+++ b/src/glide-slide-box-priv.h
@@ -27,6 +27,9 @@ G_BEGIN_DECLS
 struct _GlideSlideBoxPrivate
 {
   GlideStageManager *manager;
+  
+  gulong slide_added_id;
+  gulong slide_removed_id;
 };
 
 G_END_DECLS
diff --git a/src/glide-slide-box.c b/src/glide-slide-box.c
index 87edb37..2a67e91 100644
--- a/src/glide-slide-box.c
+++ b/src/glide-slide-box.c
@@ -29,6 +29,26 @@ enum {
 };
 
 static void
+glide_slide_box_document_slide_added (GlideDocument *document,
+				      GlideSlide *slide,
+				      gpointer data)
+{
+  GlideSlideBox *box = (GlideSlideBox *)data;
+  
+  g_message ("Box %p slide added", box);
+}
+
+static void
+glide_slide_box_document_slide_removed (GlideDocument *document,
+					GlideSlide *slide,
+					gpointer data)
+{
+  GlideSlideBox *box = (GlideSlideBox *)data;
+  
+  g_message ("Box %p slide removed", box);
+}
+
+static void
 glide_slide_box_finalize (GObject *object)
 {
   
@@ -115,7 +135,22 @@ void
 glide_slide_box_set_stage_manager (GlideSlideBox *box,
 				   GlideStageManager *manager)
 {
+  GlideDocument *doc = glide_stage_manager_get_document (manager);
+
+  if (box->priv->manager)
+    {
+      g_signal_handler_disconnect (doc, box->priv->slide_added_id);
+      g_signal_handler_disconnect (doc, box->priv->slide_removed_id);
+    }
   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",
+		    G_CALLBACK (glide_slide_box_document_slide_removed),
+		    box);
+
   g_object_notify (G_OBJECT (box), "stage-manager");
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]