コード例 #1
0
static void
podcast_post_create (RhythmDBEntryType *entry_type, RhythmDBEntry *entry)
{
	RhythmDBPodcastFields *podcast = RHYTHMDB_ENTRY_GET_TYPE_DATA (entry, RhythmDBPodcastFields);
	RBRefString *empty = rb_refstring_new ("");
	podcast->description = rb_refstring_ref (empty);
	podcast->subtitle = rb_refstring_ref (empty);
	podcast->summary = rb_refstring_ref (empty);
	podcast->lang = rb_refstring_ref (empty);
	podcast->copyright = rb_refstring_ref (empty);
	podcast->image = rb_refstring_ref (empty);
	rb_refstring_unref (empty);
}
コード例 #2
0
static void
rhythmdb_property_model_init (RhythmDBPropertyModel *model)
{
	model->priv = RHYTHMDB_PROPERTY_MODEL_GET_PRIVATE (model);

	model->priv->stamp = g_random_int ();

	model->priv->properties = g_sequence_new (NULL);
	model->priv->reverse_map = g_hash_table_new (g_str_hash, g_str_equal);
	model->priv->entries = g_hash_table_new (g_direct_hash, g_direct_equal);

	model->priv->all = g_new0 (RhythmDBPropertyModelEntry, 1);
	model->priv->all->string = rb_refstring_new (_("All"));

	model->priv->sort_propids = g_array_new (FALSE, FALSE, sizeof (RhythmDBPropType));
}
コード例 #3
0
static void
add_changed_file (RhythmDB *db, const char *uri)
{
	GTimeVal time;

	g_get_current_time (&time);
	g_hash_table_replace (db->priv->changed_files,
			      rb_refstring_new (uri),
			      GINT_TO_POINTER (time.tv_sec));
	if (db->priv->changed_files_id == 0) {
		db->priv->changed_files_id =
			g_timeout_add_seconds (RHYTHMDB_FILE_MODIFY_PROCESS_TIME,
					       (GSourceFunc) rhythmdb_process_changed_files,
					       db);
	}
}
コード例 #4
0
/**
 * rb_playlist_source_add_to_map:
 * @source: a #RBPlaylistSource
 * @location: a URI to add
 *
 * Adds a URI to the playlist's entry map.  This is useful when the
 * URI is being added to the database, but no entry exists for it yet.
 * When the entry is created, it will be added to the query model.
 *
 * Return value: TRUE if the URI was added to the entry map,
 *  FALSE if it was already there.
 */
gboolean
rb_playlist_source_add_to_map (RBPlaylistSource *source,
			       const char *location)
{
	RBRefString *refstr;

	g_return_val_if_fail (RB_IS_PLAYLIST_SOURCE (source), FALSE);

	refstr = rb_refstring_new (location);
	if (g_hash_table_lookup (source->priv->entries, refstr)) {
		rb_refstring_unref (refstr);
		return FALSE;
	}

	g_hash_table_insert (source->priv->entries,
			     refstr, GINT_TO_POINTER (1));

	return TRUE;
}