[rhythmbox] shell: add database-load-complete signal emitted when database is loaded



commit 059b62386795cb315b6983681e81006935a7d0c5
Author: Jonathan Matthew <jonathan d14n org>
Date:   Tue Aug 10 17:26:08 2010 +1000

    shell: add database-load-complete signal emitted when database is loaded

 shell/rb-shell.c |   20 ++++++++++++++++++++
 shell/rb-shell.h |    1 +
 2 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/shell/rb-shell.c b/shell/rb-shell.c
index 851ed4c..bdeb7df 100644
--- a/shell/rb-shell.c
+++ b/shell/rb-shell.c
@@ -283,6 +283,7 @@ enum
 	REMOVABLE_MEDIA_SCAN_FINISHED,
 	NOTIFY_PLAYING_ENTRY,
 	NOTIFY_CUSTOM,
+	DATABASE_LOAD_COMPLETE,
 	LAST_SIGNAL
 };
 
@@ -853,6 +854,23 @@ rb_shell_class_init (RBShellClass *klass)
 			      G_TYPE_NONE,
 			      5,
 			      G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_BOOLEAN);
+	/**
+	 * RBShell::database-load-complete:
+	 * @shell: the #RBShell
+	 *
+	 * Emitted when the database has been loaded.  This is intended to allow
+	 * DBus clients that start a new instance of the application to wait until
+	 * a reasonable amount of state has been loaded before making further requests.
+	 */
+	rb_shell_signals[DATABASE_LOAD_COMPLETE] =
+		g_signal_new ("database-load-complete",
+			      G_OBJECT_CLASS_TYPE (object_class),
+			      G_SIGNAL_RUN_LAST,
+			      G_STRUCT_OFFSET (RBShellClass, database_load_complete),
+			      NULL, NULL,
+			      g_cclosure_marshal_VOID__VOID,
+			      G_TYPE_NONE,
+			      0);
 
 	g_type_class_add_private (klass, sizeof (RBShellPrivate));
 }
@@ -2613,6 +2631,8 @@ idle_handle_load_complete (RBShell *shell)
 	shell->priv->load_complete = TRUE;
 	shell->priv->save_playlist_id = g_timeout_add_seconds (10, (GSourceFunc) idle_save_playlist_manager, shell);
 
+	g_signal_emit (shell, rb_shell_signals[DATABASE_LOAD_COMPLETE], 0);
+
 	rhythmdb_start_action_thread (shell->priv->db);
 
 	GDK_THREADS_LEAVE ();
diff --git a/shell/rb-shell.h b/shell/rb-shell.h
index b1c7065..386cab2 100644
--- a/shell/rb-shell.h
+++ b/shell/rb-shell.h
@@ -87,6 +87,7 @@ struct _RBShellClass
 	void	 (*visibility_changed)	(RBShell *shell, gboolean visible);
 	void	 (*create_song_info)	(RBShell *shell, RBSongInfo *song_info, gboolean multi);
 	void	 (*removable_media_scan_finished) (RBShell *shell);
+	void     (*database_load_complete) (RBShell *shell);
 };
 
 GType		rb_shell_get_type	(void);



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