Updated Finnish translation
[rhythmbox.git] / rhythmdb / rhythmdb-private.h
blobfc8f449cfe72ca27bcd807e04670ca3cfda19ca4
1 /*
2 * arch-tag: Header for RhythmDB private bits
4 * Copyright (C) 2004 Colin Walters <walters@rhythmbox.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
22 #ifndef RHYTHMDB_PRIVATE_H
23 #define RHYTHMDB_PRIVATE_H
25 #include "config.h"
27 #include "rhythmdb.h"
28 #include "rb-refstring.h"
29 #include "rb-metadata.h"
31 #include <libgnomevfs/gnome-vfs-utils.h>
32 #include <libgnomevfs/gnome-vfs-file-info.h>
33 #include <libgnomevfs/gnome-vfs-ops.h>
34 #include <libgnomevfs/gnome-vfs-async-ops.h>
36 G_BEGIN_DECLS
38 RhythmDBEntry * rhythmdb_entry_allocate (RhythmDB *db, RhythmDBEntryType type);
39 void rhythmdb_entry_insert (RhythmDB *db, RhythmDBEntry *entry);
41 typedef struct {
42 /* podcast */
43 RBRefString *description;
44 RBRefString *subtitle;
45 RBRefString *summary;
46 RBRefString *lang;
47 RBRefString *copyright;
48 RBRefString *image;
49 gulong status; /* 0-99: downloading
50 100: Complete
51 101: Error
52 102: wait
53 103: pause */
54 gulong post_time;
55 } RhythmDBPodcastFields;
57 enum {
58 RHYTHMDB_ENTRY_HIDDEN = 1,
59 RHYTHMDB_ENTRY_INSERTED = 2,
60 RHYTHMDB_ENTRY_LAST_PLAYED_DIRTY = 4,
61 RHYTHMDB_ENTRY_FIRST_SEEN_DIRTY = 8,
62 RHYTHMDB_ENTRY_LAST_SEEN_DIRTY = 16,
64 /* the backend can use the top 16 bits for private flags */
65 RHYTHMDB_ENTRY_PRIVATE_FLAG_BASE = 65536,
68 struct RhythmDBEntry_ {
69 /* internal bits */
70 guint flags;
71 volatile gint refcount;
72 void *data;
73 RhythmDBEntryType type;
74 guint id;
76 /* metadata */
77 RBRefString *title;
78 RBRefString *artist;
79 RBRefString *album;
80 RBRefString *genre;
81 RBRefString *musicbrainz_trackid;
82 gulong tracknum;
83 gulong discnum;
84 gulong duration;
85 gulong bitrate;
86 double track_gain;
87 double track_peak;
88 double album_gain;
89 double album_peak;
90 GDate date;
92 /* filesystem */
93 RBRefString *location;
94 RBRefString *mountpoint;
95 guint64 file_size;
96 RBRefString *mimetype;
97 gulong mtime;
98 gulong first_seen;
99 gulong last_seen;
101 /* user data */
102 gdouble rating;
103 glong play_count;
104 gulong last_played;
106 /* cached data */
107 gpointer last_played_str;
108 gpointer first_seen_str;
109 gpointer last_seen_str;
111 /* playback error string */
112 RBRefString *playback_error;
115 struct RhythmDBPrivate
117 char *name;
119 gint read_counter;
121 RBMetaData *metadata;
123 xmlChar **column_xml_names;
125 RBRefString *empty_string;
126 RBRefString *octet_stream_str;
128 gboolean action_thread_running;
129 gint outstanding_threads;
130 GAsyncQueue *action_queue;
131 GAsyncQueue *event_queue;
132 GAsyncQueue *restored_queue;
133 GThreadPool *query_thread_pool;
134 GThreadPool *add_thread_pool;
136 GList *stat_list;
137 GHashTable *stat_events;
138 GnomeVFSAsyncHandle *stat_handle;
139 GList *outstanding_stats;
140 GMutex *stat_mutex;
142 GHashTable *monitored_directories;
143 GHashTable *changed_files;
144 guint library_location_notify_id;
145 guint changed_files_id;
146 GSList *library_locations;
148 gboolean dry_run;
149 gboolean no_update;
151 GMutex *change_mutex;
152 GHashTable *added_entries;
153 GHashTable *changed_entries;
154 GHashTable *deleted_entries;
156 GHashTable *propname_map;
158 GMutex *exit_mutex;
159 gboolean exiting;
161 GCond *saving_condition;
162 GMutex *saving_mutex;
164 guint event_poll_id;
165 guint commit_timeout_id;
166 guint save_timeout_id;
168 guint emit_entry_signals_id;
169 GList *added_entries_to_emit;
170 GList *deleted_entries_to_emit;
172 gboolean can_save;
173 gboolean saving;
174 gboolean dirty;
176 GHashTable *entry_type_map;
177 GMutex *entry_type_map_mutex;
178 GMutex *entry_type_mutex;
180 gint next_entry_id;
183 typedef struct
185 enum {
186 RHYTHMDB_EVENT_STAT,
187 RHYTHMDB_EVENT_METADATA_LOAD,
188 RHYTHMDB_EVENT_DB_LOAD,
189 RHYTHMDB_EVENT_THREAD_EXITED,
190 RHYTHMDB_EVENT_DB_SAVED,
191 RHYTHMDB_EVENT_QUERY_COMPLETE,
192 RHYTHMDB_EVENT_FILE_CREATED_OR_MODIFIED,
193 RHYTHMDB_EVENT_FILE_DELETED,
194 RHYTHMDB_EVENT_ENTRY_SET
195 } type;
196 RBRefString *uri;
197 RBRefString *real_uri; /* Target of a symlink, if any */
198 RhythmDBEntryType entry_type;
200 GError *error;
201 RhythmDB *db;
203 /* STAT */
204 GnomeVFSFileInfo *vfsinfo;
205 GnomeVFSAsyncHandle *handle;
206 /* LOAD */
207 RBMetaData *metadata;
208 /* QUERY_COMPLETE */
209 RhythmDBQueryResults *results;
210 /* ENTRY_SET */
211 RhythmDBEntry *entry;
212 /* ENTRY_SET */
213 gboolean signal_change;
214 RhythmDBEntryChange change;
215 } RhythmDBEvent;
217 /* from rhythmdb.c */
218 void queue_stat_uri (const char *uri, RhythmDB *db, RhythmDBEntryType type);
219 void rhythmdb_entry_set_visibility (RhythmDB *db, RhythmDBEntry *entry,
220 gboolean visibility);
221 void rhythmdb_entry_set_internal (RhythmDB *db, RhythmDBEntry *entry,
222 gboolean notify_if_inserted, guint propid,
223 const GValue *value);
224 void rhythmdb_entry_type_foreach (RhythmDB *db, GHFunc func, gpointer data);
225 RhythmDBEntry * rhythmdb_entry_lookup_by_location_refstring (RhythmDB *db, RBRefString *uri);
227 /* from rhythmdb-monitor.c */
228 void rhythmdb_init_monitoring (RhythmDB *db);
229 void rhythmdb_finalize_monitoring (RhythmDB *db);
230 void rhythmdb_stop_monitoring (RhythmDB *db);
231 void rhythmdb_start_monitoring (RhythmDB *db);
232 void rhythmdb_monitor_uri_path (RhythmDB *db, const char *uri, GError **error);
234 /* from rhythmdb-query.c */
235 GPtrArray *rhythmdb_query_parse_valist (RhythmDB *db, va_list args);
236 void rhythmdb_read_encoded_property (RhythmDB *db, const char *data, RhythmDBPropType propid, GValue *val);
238 G_END_DECLS
240 #endif /* __RHYTHMDB_PRIVATE_H */