~ubuntu-branches/ubuntu/saucy/totem-pl-parser/saucy-proposed

« back to all changes in this revision

Viewing changes to plparse/totem-pl-parser-lines.c

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-01-26 20:52:06 UTC
  • mfrom: (1.4.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20100126205206-mj1kg7e81c9f0zgv
Tags: 2.29.1-0ubuntu1
* New upstream release:
  - Add introspection support
  - Remove GTK+ dependency
  - Remove deprecated symbols
  - Add more metadata to XSPF playlist saving
  - Fix compilation on *BSDs
* debian/watch: update to take unstable version
* debian/control.in:
  - add Vcs-Bzr tag
  - add gobject-introspection, libgirepository1.0-dev and gir1.0-glib-2.0
    build-dep
  - remove libgtk2.0-dev build-dep
  - bump package revision as soname bumped
  - add gir1.0-totemplparser-1.0 package
* debian/rules:
  - bump makeshlibs args to new revision
  - call dh_girepository
* debian/libtotem-plparser17.install:
  - renamed from debian/libtotem-plparser12.install
* add debian/gir1.0-totemplparser-1.0.install package
* debian/libtotem-plparser-dev.install:
  - add gir file
* add debian/patches/01_fix_gir_file.patch:
  - fix gir and typelib file to have good release version
* add debian/patches/90autoreconf.patch to include previous patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 
28
28
#ifndef TOTEM_PL_PARSER_MINI
29
29
#include <glib/gi18n-lib.h>
30
 
#include <gtk/gtk.h>
 
30
 
31
31
#include <gio/gio.h>
32
32
 
33
33
#include "totem-pl-parser.h"
78
78
}
79
79
 
80
80
gboolean
81
 
totem_pl_parser_write_m3u (TotemPlParser *parser, GtkTreeModel *model,
82
 
                           TotemPlParserIterFunc func, GFile *output,
83
 
                           gboolean dos_compatible, gpointer user_data, GError **error)
 
81
totem_pl_parser_save_m3u (TotemPlParser    *parser,
 
82
                          TotemPlPlaylist  *playlist,
 
83
                          GFile            *output,
 
84
                          gboolean          dos_compatible,
 
85
                          GError          **error)
84
86
{
 
87
        TotemPlPlaylistIter iter;
85
88
        GFileOutputStream *stream;
86
 
        int num_entries_total, i;
87
 
        gboolean success;
 
89
        gboolean valid, success;
88
90
        char *buf;
89
91
        char *cr;
90
92
 
93
95
                return FALSE;
94
96
 
95
97
        cr = dos_compatible ? "\r\n" : "\n";
96
 
        num_entries_total = gtk_tree_model_iter_n_children (model, NULL);
97
 
        if (num_entries_total == 0)
98
 
                return TRUE;
99
98
 
100
99
        buf = g_strdup_printf ("#EXTM3U%s", cr);
101
100
        success = totem_pl_parser_write_string (G_OUTPUT_STREAM (stream), buf, error);
103
102
        if (success == FALSE)
104
103
                return FALSE;
105
104
 
106
 
        for (i = 1; i <= num_entries_total; i++) {
107
 
                GtkTreeIter iter;
 
105
        valid = totem_pl_playlist_iter_first (playlist, &iter);
 
106
 
 
107
        while (valid) {
108
108
                char *uri, *title, *path2;
109
 
                gboolean custom_title;
110
109
                GFile *file;
111
110
 
112
 
                if (gtk_tree_model_iter_nth_child (model, &iter, NULL, i - 1) == FALSE)
113
 
                        continue;
114
 
 
115
 
                func (model, &iter, &uri, &title, &custom_title, user_data);
116
 
 
117
 
                file = g_file_new_for_uri (uri);
 
111
                totem_pl_playlist_get (playlist, &iter,
 
112
                                       TOTEM_PL_PARSER_FIELD_URI, &uri,
 
113
                                       TOTEM_PL_PARSER_FIELD_TITLE, &title,
 
114
                                       NULL);
 
115
 
 
116
                valid = totem_pl_playlist_iter_next (playlist, &iter);
 
117
 
 
118
                if (!uri) {
 
119
                        g_free (title);
 
120
                        continue;
 
121
                }
 
122
 
 
123
                file = g_file_new_for_uri (uri);
 
124
 
118
125
                if (totem_pl_parser_scheme_is_ignored (parser, file) != FALSE) {
119
126
                        g_object_unref (file);
120
127
                        g_free (uri);
123
130
                }
124
131
                g_object_unref (file);
125
132
 
126
 
                if (custom_title != FALSE) {
 
133
                if (title) {
127
134
                        buf = g_strdup_printf (EXTINF",%s%s", title, cr);
128
135
                        success = totem_pl_parser_write_string (G_OUTPUT_STREAM (stream), buf, error);
129
136
                        g_free (buf);