udapted vi.po
[rhythmbox.git] / rhythmdb / rhythmdb-private.h
blob10311e351b208ee57d9d19f17e6855f4ee2b9300
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 #if (GLIB_MAJOR_VERSION >= 2 && GLIB_MINOR_VERSION >= 10)
72 volatile gint refcount;
73 #else
74 gint refcount;
75 #endif
76 void *data;
77 RhythmDBEntryType type;
78 guint id;
80 /* metadata */
81 RBRefString *title;
82 RBRefString *artist;
83 RBRefString *album;
84 RBRefString *genre;
85 RBRefString *musicbrainz_trackid;
86 gulong tracknum;
87 gulong discnum;
88 gulong duration;
89 gulong bitrate;
90 double track_gain;
91 double track_peak;
92 double album_gain;
93 double album_peak;
94 GDate date;
96 /* filesystem */
97 RBRefString *location;
98 RBRefString *mountpoint;
99 guint64 file_size;
100 RBRefString *mimetype;
101 gulong mtime;
102 gulong first_seen;
103 gulong last_seen;
105 /* user data */
106 gdouble rating;
107 glong play_count;
108 gulong last_played;
110 /* cached data */
111 gpointer last_played_str;
112 gpointer first_seen_str;
113 gpointer last_seen_str;
115 /* playback error string */
116 RBRefString *playback_error;
119 struct RhythmDBPrivate
121 char *name;
123 gint read_counter;
125 RBMetaData *metadata;
127 xmlChar **column_xml_names;
129 RBRefString *empty_string;
130 RBRefString *octet_stream_str;
132 gboolean action_thread_running;
133 gint outstanding_threads;
134 GAsyncQueue *action_queue;
135 GAsyncQueue *event_queue;
136 GAsyncQueue *restored_queue;
137 GThreadPool *query_thread_pool;
138 GThreadPool *add_thread_pool;
140 GList *stat_list;
141 GHashTable *stat_events;
142 GnomeVFSAsyncHandle *stat_handle;
143 GList *outstanding_stats;
144 GMutex *stat_mutex;
146 GHashTable *monitored_directories;
147 GHashTable *changed_files;
148 guint library_location_notify_id;
149 guint changed_files_id;
150 GSList *library_locations;
152 gboolean dry_run;
153 gboolean no_update;
155 GMutex *change_mutex;
156 GHashTable *added_entries;
157 GHashTable *changed_entries;
158 GHashTable *deleted_entries;
160 GHashTable *propname_map;
162 GMutex *exit_mutex;
163 gboolean exiting;
165 GCond *saving_condition;
166 GMutex *saving_mutex;
168 guint event_poll_id;
169 guint commit_timeout_id;
170 guint save_timeout_id;
172 guint emit_entry_signals_id;
173 GList *added_entries_to_emit;
174 GList *deleted_entries_to_emit;
176 gboolean can_save;
177 gboolean saving;
178 gboolean dirty;
180 GHashTable *entry_type_map;
181 GMutex *entry_type_map_mutex;
182 GMutex *entry_type_mutex;
184 gint next_entry_id;
187 typedef struct
189 enum {
190 RHYTHMDB_EVENT_STAT,
191 RHYTHMDB_EVENT_METADATA_LOAD,
192 RHYTHMDB_EVENT_DB_LOAD,
193 RHYTHMDB_EVENT_THREAD_EXITED,
194 RHYTHMDB_EVENT_DB_SAVED,
195 RHYTHMDB_EVENT_QUERY_COMPLETE,
196 RHYTHMDB_EVENT_FILE_CREATED_OR_MODIFIED,
197 RHYTHMDB_EVENT_FILE_DELETED,
198 RHYTHMDB_EVENT_ENTRY_SET
199 } type;
200 RBRefString *uri;
201 RBRefString *real_uri; /* Target of a symlink, if any */
202 RhythmDBEntryType entry_type;
204 GError *error;
205 RhythmDB *db;
207 /* STAT */
208 GnomeVFSFileInfo *vfsinfo;
209 GnomeVFSAsyncHandle *handle;
210 /* LOAD */
211 RBMetaData *metadata;
212 /* QUERY_COMPLETE */
213 RhythmDBQueryResults *results;
214 /* ENTRY_SET */
215 RhythmDBEntry *entry;
216 /* ENTRY_SET */
217 gboolean signal_change;
218 RhythmDBEntryChange change;
219 } RhythmDBEvent;
221 /* from rhythmdb.c */
222 void queue_stat_uri (const char *uri, RhythmDB *db, RhythmDBEntryType type);
223 void rhythmdb_entry_set_visibility (RhythmDB *db, RhythmDBEntry *entry,
224 gboolean visibility);
225 void rhythmdb_entry_set_internal (RhythmDB *db, RhythmDBEntry *entry,
226 gboolean notify_if_inserted, guint propid,
227 const GValue *value);
228 void rhythmdb_entry_type_foreach (RhythmDB *db, GHFunc func, gpointer data);
229 RhythmDBEntry * rhythmdb_entry_lookup_by_location_refstring (RhythmDB *db, RBRefString *uri);
231 /* from rhythmdb-monitor.c */
232 void rhythmdb_init_monitoring (RhythmDB *db);
233 void rhythmdb_finalize_monitoring (RhythmDB *db);
234 void rhythmdb_stop_monitoring (RhythmDB *db);
235 void rhythmdb_start_monitoring (RhythmDB *db);
236 void rhythmdb_monitor_uri_path (RhythmDB *db, const char *uri, GError **error);
238 /* from rhythmdb-query.c */
239 GPtrArray *rhythmdb_query_parse_valist (RhythmDB *db, va_list args);
240 void rhythmdb_read_encoded_property (RhythmDB *db, const char *data, RhythmDBPropType propid, GValue *val);
242 G_END_DECLS
244 #endif /* __RHYTHMDB_PRIVATE_H */