static void
impl_activate (PeasActivatable *plugin)
{
	RBGriloPlugin *pi = RB_GRILO_PLUGIN (plugin);
	GError *error = NULL;
	RBShell *shell;

	pi->sources = g_hash_table_new_full (g_direct_hash,
					     g_direct_equal,
					     g_object_unref,
					     g_object_unref);

	grl_init (0, NULL);
	pi->registry = grl_registry_get_default ();
	g_signal_connect (pi->registry, "source-added", G_CALLBACK (grilo_source_added_cb), pi);
	if (grl_registry_load_all_plugins (pi->registry, &error) == FALSE) {
		g_warning ("Failed to load Grilo plugins: %s", error->message);
		g_clear_error (&error);
	}

	g_object_get (plugin, "object", &shell, NULL);
	g_object_get (shell, "shell-player", &pi->shell_player, NULL);
	g_object_unref (shell);

	g_signal_connect (pi->shell_player, "playing-song-changed", G_CALLBACK (playing_song_changed_cb), pi);

	pi->art_store = rb_ext_db_new ("album-art");
}
Exemple #2
0
static void
impl_deactivate	(PeasActivatable *bplugin)
{
	RBGriloPlugin *plugin = RB_GRILO_PLUGIN (bplugin);
	GHashTableIter iter;
	gpointer key, value;

	g_signal_handler_disconnect (plugin->registry, plugin->handler_id_source_added);
	g_signal_handler_disconnect (plugin->registry, plugin->handler_id_source_removed);

	g_hash_table_iter_init (&iter, plugin->sources);
	while (g_hash_table_iter_next (&iter, &key, &value)) {
		grl_registry_unregister_source (plugin->registry, GRL_SOURCE (key), NULL);
		rb_display_page_delete_thyself (RB_DISPLAY_PAGE (value));
	}
	g_hash_table_destroy (plugin->sources);
	plugin->sources = NULL;
	plugin->registry = NULL;

	if (plugin->emit_cover_art_id != 0) {
		g_source_remove (plugin->emit_cover_art_id);
		plugin->emit_cover_art_id = 0;
	}
	g_signal_handlers_disconnect_by_func (plugin->shell_player, G_CALLBACK (playing_song_changed_cb), plugin);
	g_object_unref (plugin->shell_player);
	plugin->shell_player = NULL;

	g_object_unref (plugin->art_store);
	plugin->art_store = NULL;
}
Exemple #3
0
static void
impl_deactivate	(PeasActivatable *bplugin)
{
	RBGriloPlugin         *plugin = RB_GRILO_PLUGIN (bplugin);

	g_hash_table_foreach (plugin->sources, (GHFunc)_delete_cb, plugin);
	g_hash_table_destroy (plugin->sources);
	plugin->sources = NULL;

	plugin->registry = NULL;

	if (plugin->emit_cover_art_id != 0) {
		g_source_remove (plugin->emit_cover_art_id);
		plugin->emit_cover_art_id = 0;
	}
	g_signal_handlers_disconnect_by_func (plugin->shell_player, G_CALLBACK (playing_song_changed_cb), plugin);
	g_object_unref (plugin->shell_player);
	plugin->shell_player = NULL;

	g_object_unref (plugin->art_store);
	plugin->art_store = NULL;
}