コード例 #1
0
ファイル: playlist.c プロジェクト: dsheeler/xmms2
static void
xmms_playlist_destroy (xmms_object_t *object)
{
	xmms_config_property_t *val;
	xmms_playlist_t *playlist = (xmms_playlist_t *) object;

	XMMS_DBG ("Deactivating playlist object");

	g_return_if_fail (playlist);

	val = xmms_config_lookup ("playlist.repeat_one");
	xmms_config_property_callback_remove (val, on_playlist_r_one_changed, playlist);

	val = xmms_config_lookup ("playlist.repeat_all");
	xmms_config_property_callback_remove (val, on_playlist_r_all_changed, playlist);

	xmms_object_disconnect (XMMS_OBJECT (playlist->medialib),
	                        XMMS_IPC_SIGNAL_MEDIALIB_ENTRY_REMOVED,
	                        on_medialib_entry_removed, playlist);

	xmms_object_disconnect (XMMS_OBJECT (playlist->colldag),
	                        XMMS_IPC_SIGNAL_COLLECTION_CHANGED,
	                        on_collection_changed, playlist);

	xmms_object_unref (playlist->colldag);
	xmms_object_unref (playlist->medialib);

	g_mutex_free (playlist->mutex);

	xmms_playlist_unregister_ipc_commands ();
}
コード例 #2
0
ファイル: medialib.c プロジェクト: Malvineous/xmms2-devel
static s4_t *
xmms_medialib_database_convert (const gchar *database_name,
                                const gchar *indices[])
{
	const gchar *coll_conf, *conv_conf;
	gchar *cmdline, *new_name, *obsolete_name;
	xmms_config_property_t *cfg;
	gint exit_status;
	s4_t *s4;

	cfg = xmms_config_lookup ("collection.directory");
	coll_conf = xmms_config_property_get_string (cfg);

	cfg = xmms_config_lookup ("sqlite2s4.path");
	conv_conf = xmms_config_property_get_string (cfg);

	new_name = xmms_medialib_database_converted_name (database_name);

	cmdline = g_strjoin (" ", conv_conf, database_name,
	                     new_name, coll_conf, NULL);

	xmms_log_info ("Attempting to migrate database to new format.");

	if (!g_spawn_command_line_sync (cmdline, NULL, NULL, &exit_status, NULL) || exit_status) {
		xmms_log_fatal ("Could not run \"%s\", try to run it manually", cmdline);
	}

	g_free (cmdline);

	s4 = s4_open (new_name, indices, 0);
	/* Now we give up */
	if (s4 == NULL) {
		xmms_log_fatal ("Could not open the S4 database");
	}

	xmms_log_info ("Migration successful.");

	/* Move the sqlite database */
	obsolete_name = g_strconcat (database_name, ".obsolete", NULL);
	g_rename (database_name, obsolete_name);
	g_free (obsolete_name);

	/* Update the config path */
	cfg = xmms_config_lookup ("medialib.path");
	xmms_config_property_set_data (cfg, new_name);

	g_free (new_name);

	return s4;
}
コード例 #3
0
ファイル: main.c プロジェクト: dreamerc/xmms2
/**
 * @internal Destroy the main object
 * @param[in] object The object to destroy
 */
static void
xmms_main_destroy (xmms_object_t *object)
{
	xmms_main_t *mainobj = (xmms_main_t *) object;
	xmms_object_cmd_arg_t arg;
	xmms_config_property_t *cv;

	cv = xmms_config_lookup ("core.shutdownpath");
	do_scriptdir (xmms_config_property_get_string (cv), "stop");

	/* stop output */
	xmms_object_cmd_arg_init (&arg);

	xmms_object_cmd_call (XMMS_OBJECT (mainobj->output),
	                      XMMS_IPC_CMD_STOP, &arg);

	g_usleep (G_USEC_PER_SEC); /* wait for the output thread to end */

	xmms_object_unref (mainobj->vis);
	xmms_object_unref (mainobj->output);

	xmms_object_unref (xform_obj);

	xmms_config_save ();

	xmms_config_shutdown ();

	xmms_plugin_shutdown ();

	xmms_ipc_object_unregister (XMMS_IPC_OBJECT_MAIN);
	xmms_ipc_shutdown ();

	xmms_log_shutdown ();
}
コード例 #4
0
ファイル: xform.c プロジェクト: mantaraya36/xmms2-mantaraya36
static void
update_effect_properties (xmms_object_t *object, xmmsv_t *data,
                          gpointer userdata)
{
	gint effect_no = GPOINTER_TO_INT (userdata);
	const gchar *name;

	xmms_config_property_t *cfg;
	xmms_xform_plugin_t *xform_plugin;
	xmms_plugin_t *plugin;
	gchar key[64];

	name = xmms_config_property_get_string ((xmms_config_property_t *) object);

	if (name[0]) {
		plugin = xmms_plugin_find (XMMS_PLUGIN_TYPE_XFORM, name);
		if (!plugin) {
			xmms_log_error ("Couldn't find any effect named '%s'", name);
		} else {
			xform_plugin = (xmms_xform_plugin_t *) plugin;
			xmms_xform_plugin_config_property_register (xform_plugin, "enabled",
			                                            "1", NULL, NULL);
			xmms_object_unref (plugin);
		}

		/* setup new effect.order.n */
		g_snprintf (key, sizeof (key), "effect.order.%i", effect_no + 1);

		cfg = xmms_config_lookup (key);
		if (!cfg) {
			xmms_config_property_register (key, "", update_effect_properties,
			                               GINT_TO_POINTER (effect_no + 1));
		}
	}
}
コード例 #5
0
ファイル: xform.c プロジェクト: mantaraya36/xmms2-mantaraya36
static xmms_xform_t *
add_effects (xmms_xform_t *last, xmms_medialib_entry_t entry,
             GList *goal_formats)
{
	gint effect_no;

	for (effect_no = 0; TRUE; effect_no++) {
		xmms_config_property_t *cfg;
		gchar key[64];
		const gchar *name;

		g_snprintf (key, sizeof (key), "effect.order.%i", effect_no);

		cfg = xmms_config_lookup (key);
		if (!cfg) {
			break;
		}

		name = xmms_config_property_get_string (cfg);

		if (!name[0]) {
			continue;
		}

		last = xmms_xform_new_effect (last, entry, goal_formats, name);
	}

	return last;
}
コード例 #6
0
ファイル: xform_object.c プロジェクト: eggpi/xmms2-guilherme
static void
xmms_xform_effect_properties_update (xmms_object_t *object, xmmsv_t *data, gpointer udata)
{
	xmms_config_property_t *cfg = (xmms_config_property_t *) object;
	xmms_xform_plugin_t *plugin;
	const gchar *name;
	gchar key[64];
	gint effect_no = GPOINTER_TO_INT (udata);

	name = xmms_config_property_get_string (cfg);
	if (!name[0]) {
		return;
	}

	plugin = xmms_xform_find_plugin (name);
	if (!plugin) {
		xmms_log_error ("Couldn't find any effect named '%s'", name);
	} else {
		xmms_xform_plugin_config_property_register (plugin, "enabled",
		                                            "1", NULL, NULL);
		xmms_object_unref (plugin);
	}

	/* setup new effect.order.n */
	g_snprintf (key, sizeof (key), "effect.order.%i", effect_no + 1);
	if (!xmms_config_lookup (key)) {
		xmms_config_property_register (key, "", xmms_xform_effect_properties_update,
		                               GINT_TO_POINTER (effect_no + 1));
	}
}
コード例 #7
0
ファイル: main.c プロジェクト: chrippa/xmms2
/**
 * @internal Destroy the main object
 * @param[in] object The object to destroy
 */
static void
xmms_main_destroy (xmms_object_t *object)
{
	xmms_main_t *mainobj = (xmms_main_t *) object;
	xmms_config_property_t *cv;

	cv = xmms_config_lookup ("core.shutdownpath");
	do_scriptdir (xmms_config_property_get_string (cv), "stop");

	xmms_object_unref (mainobj->xform_object);
	xmms_object_unref (mainobj->visualization_object);
	xmms_object_unref (mainobj->output_object);
	xmms_object_unref (mainobj->bindata_object);
	xmms_object_unref (mainobj->playlist_object);
	xmms_object_unref (mainobj->colldag_object);
	xmms_object_unref (mainobj->medialib_object);
	xmms_object_unref (mainobj->mediainfo_object);
	xmms_object_unref (mainobj->plsupdater_object);
	xmms_object_unref (mainobj->collsync_object);

	xmms_config_save ();

	xmms_config_shutdown ();

	xmms_plugin_shutdown ();

	xmms_main_unregister_ipc_commands ();

	xmms_ipc_shutdown ();

	xmms_log_shutdown ();
}
コード例 #8
0
ファイル: plugin.c プロジェクト: kfihihc/xmms2-devel
/**
 * @internal 
 * Lookup the value of a plugin's config property, given the property key.
 * @param[in] plugin The plugin
 * @param[in] key The property key (config path)
 * @return A config value
 * @todo config value <-> property fixup
 */
xmms_config_property_t *
xmms_plugin_config_lookup (xmms_plugin_t *plugin,
                           const gchar *key)
{
	gchar path[XMMS_PLUGIN_SHORTNAME_MAX_LEN + 256];
	xmms_config_property_t *prop;

	g_return_val_if_fail (plugin, NULL);
	g_return_val_if_fail (key, NULL);

	g_snprintf (path, sizeof (path), "%s.%s",
	            xmms_plugin_shortname_get (plugin), key);
	prop = xmms_config_lookup (path);

	return prop;
}
コード例 #9
0
ファイル: xform.c プロジェクト: mantaraya36/xmms2-mantaraya36
static void
effect_callbacks_init (void)
{
	gint effect_no;

	xmms_config_property_t *cfg;
	xmms_xform_plugin_t *xform_plugin;
	xmms_plugin_t *plugin;
	gchar key[64];
	const gchar *name;

	for (effect_no = 0; ; effect_no++) {
		g_snprintf (key, sizeof (key), "effect.order.%i", effect_no);

		cfg = xmms_config_lookup (key);
		if (!cfg) {
			break;
		}
		xmms_config_property_callback_set (cfg, update_effect_properties,
		                                   GINT_TO_POINTER (effect_no));

		name = xmms_config_property_get_string (cfg);
		if (!name[0]) {
			continue;
		}

		plugin = xmms_plugin_find (XMMS_PLUGIN_TYPE_XFORM, name);
		if (!plugin) {
			xmms_log_error ("Couldn't find any effect named '%s'", name);
			continue;
		}

		xform_plugin = (xmms_xform_plugin_t *) plugin;
		xmms_xform_plugin_config_property_register (xform_plugin, "enabled",
		                                            "1", NULL, NULL);

		xmms_object_unref (plugin);
	}

	/* the name stored in the last present property was not "" or there was no
	   last present property */
	if ((!effect_no) || name[0]) {
			xmms_config_property_register (key, "", update_effect_properties,
			                               GINT_TO_POINTER (effect_no));
	}
}