~ubuntu-branches/ubuntu/intrepid/totem-pl-parser/intrepid-updates

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2008-06-06 12:44:07 UTC
  • mfrom: (1.2.1 lenny) (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20080606124407-gdw18zkqwqhc39lw
Tags: 2.23.1-0ubuntu1
* New upstream version:
  - Port to GIO/GVFS, and remove gnome-vfs dependency
  - Fix handling of XML-ish files with linefeeds after the document head
  - Add support for parsing remote DVDs 
  - Check mime-type by hand when we get application/octect-stream 
    as a mime-type
  - Remove trailing linefeeds from titles
* change for the new soname
* don't install the html documentation in the library
* Sync on Debian
* debian/control.in:
  - updated for the soname change 
  - updated libglib requirement, don't use gnomevfs
  - updated maintainer information

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 
15
15
   You should have received a copy of the GNU Library General Public
16
16
   License along with the Gnome Library; see the file COPYING.LIB.  If not,
17
 
   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18
 
   Boston, MA 02111-1307, USA.
 
17
   write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
18
   Boston, MA 02110-1301  USA.
19
19
 
20
20
   Author: Bastien Nocera <hadess@hadess.net>
21
21
 */
24
24
 
25
25
#include <string.h>
26
26
#include <glib.h>
27
 
#include <libgnomevfs/gnome-vfs-mime-utils.h>
28
27
 
29
28
#ifndef TOTEM_PL_PARSER_MINI
30
29
#include <gtk/gtk.h>
31
 
#include <libgnomevfs/gnome-vfs.h>
32
 
#include <libgnomevfs/gnome-vfs-mime.h>
33
 
#include <libgnomevfs/gnome-vfs-utils.h>
34
30
#include "totem-pl-parser.h"
35
31
#include "totemplparser-marshal.h"
36
32
#include "totem-disc.h"
42
38
 
43
39
#ifndef TOTEM_PL_PARSER_MINI
44
40
TotemPlParserResult
45
 
totem_pl_parser_add_gvp (TotemPlParser *parser, const char *url,
46
 
                         const char *base, gpointer data)
 
41
totem_pl_parser_add_gvp (TotemPlParser *parser,
 
42
                         GFile *file,
 
43
                         GFile *base_file,
 
44
                         gpointer data)
47
45
{
48
46
        TotemPlParserResult retval = TOTEM_PL_PARSER_RESULT_UNHANDLED;
49
47
        char *contents, **lines, *title, *link, *version;
50
 
        int size;
 
48
        gsize size;
51
49
 
52
 
        if (gnome_vfs_read_entire_file (url, &size, &contents) != GNOME_VFS_OK)
 
50
        if (g_file_load_contents (file, NULL, &contents, &size, NULL, NULL) == FALSE)
53
51
                return TOTEM_PL_PARSER_RESULT_ERROR;
54
52
 
55
53
        if (g_str_has_prefix (contents, "#.download.the.free.Google.Video.Player") == FALSE && g_str_has_prefix (contents, "# download the free Google Video Player") == FALSE) {
89
87
}
90
88
 
91
89
TotemPlParserResult
92
 
totem_pl_parser_add_desktop (TotemPlParser *parser, const char *url,
93
 
                             const char *base, gpointer data)
 
90
totem_pl_parser_add_desktop (TotemPlParser *parser,
 
91
                             GFile *file,
 
92
                             GFile *base_file,
 
93
                             gpointer data)
94
94
{
95
95
        char *contents, **lines;
96
96
        const char *path, *display_name, *type;
97
 
        int size;
 
97
        GFile *target;
 
98
        gsize size;
98
99
        TotemPlParserResult res = TOTEM_PL_PARSER_RESULT_ERROR;
99
100
 
100
 
        if (gnome_vfs_read_entire_file (url, &size, &contents) != GNOME_VFS_OK)
 
101
        if (g_file_load_contents (file, NULL, &contents, &size, NULL, NULL) == FALSE)
101
102
                return res;
102
103
 
103
104
        lines = g_strsplit (contents, "\n", 0);
115
116
        path = totem_pl_parser_read_ini_line_string (lines, "URL", FALSE);
116
117
        if (path == NULL)
117
118
                goto bail;
 
119
        target = g_file_new_for_uri (path);
118
120
 
119
121
        display_name = totem_pl_parser_read_ini_line_string (lines, "Name", FALSE);
120
122
 
121
123
        if (totem_pl_parser_ignore (parser, path) == FALSE
122
124
            && g_ascii_strcasecmp (type, "FSDevice") != 0) {
123
 
                totem_pl_parser_add_one_url (parser, path, display_name);
 
125
                totem_pl_parser_add_one_file (parser, target, display_name);
124
126
        } else {
125
 
                if (totem_pl_parser_parse_internal (parser, path, NULL) != TOTEM_PL_PARSER_RESULT_SUCCESS)
126
 
                        totem_pl_parser_add_one_url (parser, path, display_name);
 
127
                if (totem_pl_parser_parse_internal (parser, target, NULL) != TOTEM_PL_PARSER_RESULT_SUCCESS)
 
128
                        totem_pl_parser_add_one_file (parser, target, display_name);
127
129
        }
128
130
 
129
131
        res = TOTEM_PL_PARSER_RESULT_SUCCESS;