示例#1
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;
}
示例#2
0
static void
server_lost_cb (GrlDleynaServersManager *serversmgr,
                GrlDleynaServer         *server,
                gpointer                *user_data)
{
  GrlDleynaMediaDevice *device;
  GrlSource *source;
  GrlRegistry *registry;
  const gchar* udn;
  gchar *source_id;

  GRL_DEBUG (G_STRFUNC);
  device = grl_dleyna_server_get_media_device (server);
  udn = grl_dleyna_media_device_get_udn (device);
  GRL_DEBUG ("%s udn: %s ", G_STRFUNC, udn);

  registry = grl_registry_get_default ();
  source_id = grl_dleyna_source_build_id (udn);

  GRL_DEBUG ("%s id: %s ", G_STRFUNC, source_id);

  source = grl_registry_lookup_source (registry, source_id);
  if (source != NULL) {
    GError *error = NULL;
    GRL_DEBUG ("%s unregistered %s", G_STRFUNC, source_id);
    grl_registry_unregister_source (registry, source, &error);
    if (error != NULL) {
      GRL_WARNING ("Failed to unregister source %s: %s", udn, error->message);
      g_error_free (error);
    }
  }

  g_free (source_id);
}
示例#3
0
static void
grilo_source_added_cb (GrlRegistry *registry, GrlSource *grilo_source, RBGriloPlugin *plugin)
{
	GrlPlugin *grilo_plugin;
	GrlSupportedOps ops;
	const GList *keys;
	RBSource *source;
	RBShell *shell;
	int i;

	if (!(grl_source_get_supported_media (grilo_source) & GRL_MEDIA_TYPE_AUDIO)) {
		rb_debug ("grilo source %s doesn't support audio",
			  grl_source_get_name (grilo_source));
		goto ignore;
	}

	grilo_plugin = grl_source_get_plugin (grilo_source);
	for (i = 0; i < G_N_ELEMENTS (ignored_plugins); i++) {
		if (g_str_equal (ignored_plugins[i], grl_plugin_get_id (grilo_plugin))) {
			rb_debug ("grilo source %s is blacklisted",
				  grl_source_get_name (grilo_source));
			goto ignore;
		}
	}

	ops = grl_source_supported_operations (grilo_source);
	if (((ops & GRL_OP_BROWSE) == 0) && ((ops & GRL_OP_SEARCH) == 0)) {
		rb_debug ("grilo source %s is not interesting",
			  grl_source_get_name (grilo_source));
		goto ignore;
	}

	keys = grl_source_supported_keys (grilo_source);
	if (g_list_find ((GList *)keys, GINT_TO_POINTER (GRL_METADATA_KEY_URL)) == NULL) {
		rb_debug ("grilo source %s doesn't do urls", grl_source_get_name (grilo_source));
		goto ignore;
	}

	rb_debug ("new grilo source: %s", grl_source_get_name (grilo_source));

	source = rb_grilo_source_new (G_OBJECT (plugin), grilo_source);
	g_hash_table_insert (plugin->sources, g_object_ref (grilo_source), g_object_ref_sink (source));

	/* probably put some sources under 'shared', some under 'stores'? */
	g_object_get (plugin, "object", &shell, NULL);
	rb_shell_append_display_page (shell, RB_DISPLAY_PAGE (source), RB_DISPLAY_PAGE_GROUP_SHARED);
	g_object_unref (shell);

	return;

ignore:
	grl_registry_unregister_source (registry, grilo_source, NULL);
}
示例#4
0
static void
grl_dpap_service_removed_cb (DMAPMdnsBrowser *browser,
                             const gchar *service_name,
                             GrlPlugin *plugin)
{
  GrlRegistry   *registry = grl_registry_get_default ();
  GrlDpapSource *source   = g_hash_table_lookup (sources, service_name);

  GRL_DEBUG (__FUNCTION__);

  if (source) {
    grl_registry_unregister_source (registry, GRL_SOURCE (source), NULL);
    g_hash_table_remove (sources, service_name);
  }
}