gnome-desktop r5350 - trunk/libgnome-desktop



Author: halfline
Date: Mon Jan 19 22:57:33 2009
New Revision: 5350
URL: http://svn.gnome.org/viewvc/gnome-desktop?rev=5350&view=rev

Log:
Emit "transitioned" not "changed" for new frames

Previously, "changed" would get emitted when switching
backgrounds AND when switching slides in an animated
background.  The two actions are conceptually different,
so this commit splits the signal into two signals. This
will allow us to add a cross fade effect when switching
backgrounds (and not add the cross fade effect when
switching slides that have their own transition effect)

Modified:
   trunk/libgnome-desktop/ChangeLog
   trunk/libgnome-desktop/gnome-bg.c

Modified: trunk/libgnome-desktop/gnome-bg.c
==============================================================================
--- trunk/libgnome-desktop/gnome-bg.c	(original)
+++ trunk/libgnome-desktop/gnome-bg.c	Mon Jan 19 22:57:33 2009
@@ -98,7 +98,8 @@
 	GFileMonitor *		file_monitor;
 
 	guint                   changed_id;
-	
+	guint                   transitioned_id;
+
 	/* Cached information, only access through cache accessor functions */
         SlideShow *		slideshow;
 	time_t			file_mtime;
@@ -115,6 +116,7 @@
 
 enum {
 	CHANGED,
+	TRANSITIONED,
 	N_SIGNALS
 };
 
@@ -275,6 +277,30 @@
 					     NULL);
 }
 
+static gboolean
+do_transitioned (GnomeBG *bg)
+{
+	bg->transitioned_id = 0;
+
+	g_signal_emit (G_OBJECT (bg), signals[TRANSITIONED], 0);
+
+	return FALSE;
+}
+
+static void
+queue_transitioned (GnomeBG *bg)
+{
+	if (bg->transitioned_id > 0) {
+		g_source_remove (bg->transitioned_id);
+	}
+
+	bg->transitioned_id = g_timeout_add_full (G_PRIORITY_LOW,
+					     100,
+					     (GSourceFunc)do_transitioned,
+					     bg,
+					     NULL);
+}
+
 void
 gnome_bg_load_from_preferences (GnomeBG     *bg,
 				GConfClient *client)
@@ -419,6 +445,14 @@
 					 NULL, NULL,
 					 g_cclosure_marshal_VOID__VOID,
 					 G_TYPE_NONE, 0);
+
+	signals[TRANSITIONED] = g_signal_new ("transitioned",
+					 G_OBJECT_CLASS_TYPE (object_class),
+					 G_SIGNAL_RUN_LAST,
+					 0,
+					 NULL, NULL,
+					 g_cclosure_marshal_VOID__VOID,
+					 G_TYPE_NONE, 0);
 }
 
 GnomeBG *
@@ -1349,7 +1383,7 @@
 
 	bg->timeout_id = 0;
 	
-	queue_changed (bg);
+	queue_transitioned (bg);
 
 	return FALSE;
 }



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