static RBSource *
create_source_cb (RBRemovableMediaManager *rmm, GMount *mount, MPIDDevice *device_info, RBGenericPlayerPlugin *plugin)
{
	RBSource *source = NULL;
	RBShell *shell;

	g_object_get (plugin, "object", &shell, NULL);

	if (rb_psp_is_mount_player (mount, device_info))
		source = rb_psp_source_new (G_OBJECT (plugin), shell, mount, device_info);
	if (source == NULL && rb_nokia770_is_mount_player (mount, device_info))
		source = rb_nokia770_source_new (G_OBJECT (plugin), shell, mount, device_info);
	if (source == NULL && rb_generic_player_is_mount_player (mount, device_info))
		source = rb_generic_player_source_new (G_OBJECT (plugin), shell, mount, device_info);

	if (source) {
		plugin->player_sources = g_list_prepend (plugin->player_sources, source);
		g_signal_connect_object (G_OBJECT (source),
					 "deleted", G_CALLBACK (rb_generic_player_plugin_source_deleted),
					 plugin, 0);
	}

	g_object_unref (shell);
	return source;
}
Esempio n. 2
0
static RBSource *
create_source_cb (RBRemovableMediaManager *rmm, GMount *mount, MPIDDevice *device_info, RBGenericPlayerPlugin *plugin)
{
	RBSource *source = NULL;

	if (rb_psp_is_mount_player (mount, device_info))
		source = RB_SOURCE (rb_psp_source_new (RB_PLUGIN (plugin), plugin->shell, mount, device_info));
	if (source == NULL && rb_nokia770_is_mount_player (mount, device_info))
		source = RB_SOURCE (rb_nokia770_source_new (RB_PLUGIN (plugin), plugin->shell, mount, device_info));
	if (source == NULL && rb_generic_player_is_mount_player (mount, device_info))
		source = RB_SOURCE (rb_generic_player_source_new (RB_PLUGIN (plugin), plugin->shell, mount, device_info));

	if (plugin->actions == NULL) {
		plugin->actions = gtk_action_group_new ("GenericPlayerActions");
		gtk_action_group_set_translation_domain (plugin->actions, GETTEXT_PACKAGE);

		_rb_action_group_add_source_actions (plugin->actions,
						     G_OBJECT (plugin->shell),
						     rb_generic_player_plugin_actions,
						     G_N_ELEMENTS (rb_generic_player_plugin_actions));
	}

	if (source) {
		if (plugin->ui_merge_id == 0) {
			GtkUIManager *uimanager = NULL;
			char *file = NULL;

			g_object_get (G_OBJECT (plugin->shell), "ui-manager", &uimanager, NULL);

			gtk_ui_manager_insert_action_group (uimanager, plugin->actions, 0);

			file = rb_plugin_find_file (RB_PLUGIN (plugin), "generic-player-ui.xml");
			plugin->ui_merge_id = gtk_ui_manager_add_ui_from_file (uimanager,
									       file,
									       NULL);
			g_free (file);
			g_object_unref (G_OBJECT (uimanager));
		}

		plugin->player_sources = g_list_prepend (plugin->player_sources, source);
		g_signal_connect_object (G_OBJECT (source),
					 "deleted", G_CALLBACK (rb_generic_player_plugin_source_deleted),
					 plugin, 0);
	}

	return source;
}