~ubuntu-branches/ubuntu/precise/rhythmbox/precise-201203091205

« back to all changes in this revision

Viewing changes to sources/rb-ipod-source.c

Tags: upstream-0.9.2cvs20060102
ImportĀ upstreamĀ versionĀ 0.9.2cvs20060102

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
#include "eel-gconf-extensions.h"
40
40
#include "rb-ipod-source.h"
41
41
#include "rb-debug.h"
42
 
#include "rb-playlist-source.h"
 
42
#include "rb-static-playlist-source.h"
43
43
#include "rb-util.h"
44
44
#include "rhythmdb.h"
45
45
 
194
194
                      "entry-type", &entry_type,
195
195
                      NULL);
196
196
 
197
 
        playlist_source = RB_SOURCE (g_object_new (RB_TYPE_PLAYLIST_SOURCE,
198
 
                                                   "name", playlist->name,
199
 
                                                   "shell", shell,
200
 
                                                   "visibility", TRUE,
201
 
                                                   "is-local", FALSE,
202
 
                                                   "entry-type", entry_type,
203
 
                                                   NULL));
 
197
        playlist_source = rb_static_playlist_source_new (shell, 
 
198
                                                         playlist->name, 
 
199
                                                         FALSE,
 
200
                                                         entry_type);
204
201
 
205
202
        for (it = playlist->members; it != NULL; it = it->next) {
206
203
                Itdb_Track *song;
209
206
                song = (Itdb_Track *)it->data;
210
207
                filename = ipod_path_to_uri (priv->ipod_mount_path, 
211
208
                                            song->ipod_path);
212
 
                rb_playlist_source_add_location (RB_PLAYLIST_SOURCE (playlist_source),
213
 
                                                 filename);
 
209
                rb_static_playlist_source_add_location (RB_STATIC_PLAYLIST_SOURCE (playlist_source),
 
210
                                                        filename, -1);
214
211
                g_free (filename);
215
212
        }
216
213
 
328
325
                                                       &value);
329
326
                        g_value_unset (&value);
330
327
                }
331
 
                
 
328
 
 
329
                /* Set playcount */
 
330
                if (song->playcount != 0) {
 
331
                        GValue value = {0, };
 
332
                        g_value_init (&value, G_TYPE_ULONG);
 
333
                        g_value_set_ulong (&value, song->playcount);
 
334
                        rhythmdb_entry_set_uninserted (RHYTHMDB (db), entry,
 
335
                                                       RHYTHMDB_PROP_PLAY_COUNT,
 
336
                                                       &value);
 
337
                        g_value_unset (&value);
 
338
                }
 
339
 
 
340
                /* Set year */
 
341
                if (song->year != 0) {
 
342
                        GDate *date = NULL;
 
343
                        GType type;
 
344
                        GValue value = {0, };
 
345
                        
 
346
                        date = g_date_new_dmy (1, G_DATE_JANUARY, song->year);
 
347
 
 
348
                        type = rhythmdb_get_property_type (RHYTHMDB(db),
 
349
                                                            RHYTHMDB_PROP_DATE);
 
350
                        
 
351
                        g_value_init (&value, type);
 
352
                        g_value_set_ulong (&value, (date ? g_date_get_julian (date) : 0));
 
353
                        
 
354
                        rhythmdb_entry_set_uninserted (RHYTHMDB (db), entry,
 
355
                                                       RHYTHMDB_PROP_DATE,
 
356
                                                       &value);
 
357
                        g_value_unset (&value);
 
358
                        if (date)
 
359
                                g_date_free (date);
 
360
                }
 
361
 
332
362
                /* Set title */         
333
363
                entry_set_string_prop (RHYTHMDB (db), entry, 
334
364
                                       RHYTHMDB_PROP_TITLE, song->title);