[glide] When adding slides to slidebox, insert at propert position



commit c0be159d87fc36a57c5127de6feda5432fcc112a
Author: Robert Carr <racarr Valentine localdomain>
Date:   Thu Apr 29 05:50:59 2010 -0400

    When adding slides to slidebox, insert at propert position

 src/glide-slide-box.c |   29 ++++++++++++++++++++++++++++-
 1 files changed, 28 insertions(+), 1 deletions(-)
---
diff --git a/src/glide-slide-box.c b/src/glide-slide-box.c
index 0599272..a0fed10 100644
--- a/src/glide-slide-box.c
+++ b/src/glide-slide-box.c
@@ -43,6 +43,25 @@ glide_slide_box_remove_children (GlideSlideBox *box)
     }
 }
 
+static GtkWidget*
+glide_slide_box_find_slide_button (GlideSlideBox *box,
+				   GlideSlide *slide)
+{
+  GList *children = gtk_container_get_children (GTK_CONTAINER (box));
+  GList *t;
+  
+  for (t = children; t; t = t->next)
+    {
+      GtkBin *alignment = (GtkBin *)t->data;
+      GlideSlideButton *button = GLIDE_SLIDE_BUTTON (gtk_bin_get_child (alignment));
+      
+      if (glide_slide_button_get_slide (button) == slide)
+	return (GtkWidget *)button;
+    }
+  return NULL;
+}
+				   
+
 static void
 glide_slide_box_document_slide_added (GlideDocument *document,
 				      GlideSlide *slide,
@@ -70,8 +89,16 @@ glide_slide_box_document_slide_removed (GlideDocument *document,
 					gpointer data)
 {
   GlideSlideBox *box = (GlideSlideBox *)data;
+  GtkWidget *button = glide_slide_box_find_slide_button (box, slide);
   
-  g_message ("Box %p slide removed", box);
+  if (!button)
+    {
+      g_warning ("glide_slide_box_document_slided_removed: No button for slide with index %d",
+		 glide_slide_get_index (slide));
+      return;
+    }
+  gtk_widget_destroy (button);
+
 }
 
 static void



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