[glide] Slides now keep track of their indices
- From: Robert Carr <racarr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glide] Slides now keep track of their indices
- Date: Thu, 29 Apr 2010 08:41:46 +0000 (UTC)
commit de598c81bef716fb4ba0a2f4d89268d2cc42ffeb
Author: Robert Carr <racarr Valentine localdomain>
Date: Thu Apr 29 03:19:51 2010 -0400
Slides now keep track of their indices
src/glide-document.c | 23 +++++++++++++++++++++++
src/glide-stage-manager.c | 5 ++++-
2 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/src/glide-document.c b/src/glide-document.c
index 6d292cb..93c82b9 100644
--- a/src/glide-document.c
+++ b/src/glide-document.c
@@ -297,10 +297,27 @@ glide_document_get_nth_slide (GlideDocument *document,
return GLIDE_SLIDE (g_list_nth_data (document->priv->slides, n));
}
+static void
+glide_document_update_slide_indices (GlideDocument *document)
+{
+ GList *l;
+ guint i = 0;
+
+ for (l = document->priv->slides; l; l = l->next)
+ {
+ GlideSlide *s = (GlideSlide *)l->data;
+
+ glide_slide_set_index (s, i);
+ i++;
+ }
+}
+
GlideSlide *
glide_document_append_slide (GlideDocument *document)
{
GlideSlide *s = glide_slide_new (document);
+
+ glide_slide_set_index (s, g_list_length (document->priv->slides));
document->priv->slides = g_list_append (document->priv->slides, s);
g_signal_emit (document, document_signals[SLIDE_ADDED], 0, s);
@@ -312,8 +329,12 @@ GlideSlide *
glide_document_insert_slide (GlideDocument *document, gint after)
{
GlideSlide *s = glide_slide_new (document);
+
document->priv->slides = g_list_insert (document->priv->slides, s, after+1);
+ glide_slide_set_index (s, after+1);
+ glide_document_update_slide_indices (document);
+
g_signal_emit (document, document_signals[SLIDE_ADDED], 0, s);
return s;
@@ -324,6 +345,8 @@ glide_document_remove_slide (GlideDocument *document, gint slide)
{
GlideSlide *s = g_list_nth_data (document->priv->slides, slide);
document->priv->slides = g_list_remove (document->priv->slides, s);
+
+ glide_document_update_slide_indices (document);
g_signal_emit (document, document_signals[SLIDE_REMOVED], 0, s);
}
diff --git a/src/glide-stage-manager.c b/src/glide-stage-manager.c
index f277b5c..bdc7407 100644
--- a/src/glide-stage-manager.c
+++ b/src/glide-stage-manager.c
@@ -164,13 +164,16 @@ glide_stage_manager_add_manipulator (GlideStageManager *manager)
void
glide_stage_manager_set_slide (GlideStageManager *manager, guint slide)
{
+ GlideSlide *s = glide_document_get_nth_slide (manager->priv->document, slide);
if (manager->priv->current_slide >= 0 && !(manager->priv->current_slide >= glide_document_get_n_slides(manager->priv->document)))
clutter_actor_hide (CLUTTER_ACTOR (glide_document_get_nth_slide (manager->priv->document, manager->priv->current_slide)));
manager->priv->current_slide = slide;
- clutter_actor_show_all (CLUTTER_ACTOR (glide_document_get_nth_slide (manager->priv->document, slide)));
+ clutter_actor_show_all (CLUTTER_ACTOR (s));
glide_stage_manager_add_manipulator (manager);
+ GLIDE_NOTE(STAGE_MANAGER, "Switching to slide index: %u", glide_slide_get_index (s));
+
g_object_notify (G_OBJECT (manager), "current-slide");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]