~ubuntu-branches/ubuntu/vivid/liferea/vivid-proposed

« back to all changes in this revision

Viewing changes to src/enclosure.c

  • Committer: Package Import Robot
  • Author(s): bojo42
  • Date: 2012-03-29 14:17:21 UTC
  • mfrom: (1.3.9) (3.2.5 sid)
  • Revision ID: package-import@ubuntu.com-20120329141721-tbfopcrc5797wxt7
Tags: 1.8.3-0.1ubuntu1
* New upstream release (LP: #290666, #371754, #741543, #716688)
* Merge from Debian unstable (LP: #935147), remaining changes:
* debian/patches:
  - drop gtk-status-icon.patch & notification-append as in upstream
  - drop fix_systray_behavior as mostly upstreamed and rest seems unused
  - 01_ubuntu_feedlists: update & rename, move planets to "Open Source"  
  - add_X-Ubuntu-Gettext-Domain: rebase
  - libunity.patch: rebase, apply before indicator patch (liferea_shell.c)
  - libindicate_increase_version.patch: exclude from libindicate.patch
  - deactivate libindicate.patch, seems partly upstreamed and needs rework
* debian/control: libindicate-dev, libindicate-gtk-dev & libunity-dev
* debian/liferea.indicate & liferea.install: ship indicator desktop file
* debian/rules: enable libindicate

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
2
 * @file enclosure.c enclosures/podcast support
3
3
 *
4
 
 * Copyright (C) 2007-2008 Lars Lindner <lars.lindner@gmail.com>
 
4
 * Copyright (C) 2007-2011 Lars Lindner <lars.lindner@gmail.com>
5
5
 *
6
6
 * This program is free software; you can redistribute it and/or modify
7
7
 * it under the terms of the GNU General Public License as published by
18
18
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
19
 */
20
20
 
21
 
#ifdef HAVE_CONFIG_H
22
 
#  include <config.h>
23
 
#endif
24
 
 
25
21
#include <string.h>
26
22
#include <sys/wait.h>
27
23
 
113
109
        /* There are websites out there encoding -1 as size */
114
110
        if (size < 0)
115
111
                size = 0;
116
 
 
 
112
                
117
113
        safeUrl = common_uri_escape (url);
118
114
        result = g_strdup_printf ("enc:%s:%s:%" G_GSSIZE_FORMAT ":%s", downloaded?"1":"0", mime, size, safeUrl);
119
115
        g_free (safeUrl);
188
184
        g_free (filename);
189
185
}
190
186
 
191
 
static void
 
187
void
192
188
enclosure_mime_types_save (void)
193
189
{
194
190
        xmlDocPtr       doc;
214
210
        }
215
211
        
216
212
        xmlDocSetRootElement (doc, root);
217
 
        
 
213
 
218
214
        filename = g_build_filename (common_get_cache_path (), "mime.xml", NULL);
219
215
        if (-1 == xmlSaveFormatFileEnc (filename, doc, NULL, 1))
220
216
                g_warning ("Could not save to enclosure type config file!");
302
298
 
303
299
/* etp is optional, if it is missing we are in save mode */
304
300
static void
305
 
enclosure_download (encTypePtr type, const gchar *url, const gchar *filename)
 
301
enclosure_download (encTypePtr type, const gchar *url, gchar *filename)
306
302
{
307
303
        enclosureDownloadToolPtr        tool;
308
304
        encJobPtr                       job;
310
306
 
311
307
        /* prepare job structure */
312
308
        job = g_new0 (struct encJob, 1);
313
 
        job->filename = g_strdup (filename);
 
309
        job->filename = filename;
314
310
 
315
311
        filenameQ = g_shell_quote (filename);
316
312
        urlQ = g_shell_quote (url);
361
357
 */
362
358
void
363
359
enclosure_save_as_file (encTypePtr type, const gchar *url, const gchar *filename)
364
 
{       
 
360
{
 
361
        gchar   *enclosure_download_path;
 
362
        gchar   *download_filename;
 
363
 
365
364
        g_assert (url != NULL);
366
365
        
367
366
        if (!filename) {
372
371
                        filename = url;
373
372
                else
374
373
                        filename++;
375
 
                filename = g_build_filename (conf_get_str_value (ENCLOSURE_DOWNLOAD_PATH), filename, NULL);
 
374
                conf_get_str_value (ENCLOSURE_DOWNLOAD_PATH, &enclosure_download_path);
 
375
                download_filename = g_build_filename (enclosure_download_path, filename, NULL);
 
376
                g_strdelimit (download_filename, "?", 0);       /* strip GET parameters */
 
377
                g_free (enclosure_download_path);
 
378
        } else {
 
379
                download_filename = g_strdup (filename);
376
380
        }
377
 
        enclosure_download (type, url, filename);
 
381
        
 
382
        enclosure_download (type, url, download_filename);
378
383
}