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

« back to all changes in this revision

Viewing changes to src/fl_sources/default_source.c

  • Committer: Package Import Robot
  • Author(s): Moray Allan, Bojo42, Rodrigo Gallardo, Moray Allan
  • Date: 2012-03-27 21:44:42 UTC
  • mfrom: (1.5.1)
  • mto: (3.3.2 experimental)
  • mto: This revision was merged to the branch mainline in revision 122.
  • Revision ID: package-import@ubuntu.com-20120327214442-g0xfh714cdmsbnts
Tags: 1.8.3-0.1
[ Bojo42 ]
* Non-maintainer upload.
* New upstream release (Closes: #502307, #623619, #631778, #651913) 
* debian/patches:
  - drop libnotify0.7 as in upstream
  - debian-example-feeds: update, move planets from "News" to "Open Source"
  - www-browser: update due to new file location
  - libtool-dont-rearange-as-needed: rebase
* debian/control:
  - update Standards-Version
  - remove obsolete Build-Depends:
    - quilt not needed for "3.0 (quilt)" source format
    - libnm-glib-dev & libdbus-glib-1-dev: upstream switched to GDBus
    - liblua5.1-0-dev: LUA scripting support got dropped
  - new Build-Depends on libunique-dev, libjson-glib-dev & dh_autoreconf
  - update version dependencies
* debian/rules: run dh_autoreconf & update translations
* debian/liferea.install: nothing to ship from /usr/lib/liferea

[ Rodrigo Gallardo ]
* Lintian love:
  - debian/control: switch from Conflicts to Breaks
  - debian/rules: redo build targets

[ Moray Allan ]
* debian/copyright: update to include additional copyright owners.
* debian/patches/www-browser: also set default external browser.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
 
 * @file default_source.c  default static feedlist provider
 
2
 * @file default_source.c  default static feed list source
3
3
 * 
4
 
 * Copyright (C) 2005-2008 Lars Lindner <lars.lindner@gmail.com>
 
4
 * Copyright (C) 2005-2010 Lars Lindner <lars.lindner@gmail.com>
5
5
 * Copyright (C) 2005-2006 Nathan J. Conrad <t98502@users.sourceforge.net>
6
6
 *
7
7
 * This program is free software; you can redistribute it and/or modify
24
24
#include <string.h>
25
25
 
26
26
#include "common.h"
27
 
#include "conf.h"
28
27
#include "debug.h"
29
28
#include "export.h"
30
29
#include "feed.h"
34
33
#include "update.h"
35
34
#include "fl_sources/default_source.h"
36
35
#include "fl_sources/node_source.h"
37
 
#include "ui/ui_feedlist.h"
38
 
#include "ui/ui_node.h"
39
 
#include "ui/ui_subscription.h"
40
 
#include "ui/ui_tray.h"
41
36
 
42
37
/** lock to prevent feed list saving while loading */
43
38
static gboolean feedlistImport = FALSE;
53
48
{
54
49
        gchar           *filename10;
55
50
        gchar           *filename12;
56
 
        gchar           *filename13;
57
51
        gchar           *filename14;
 
52
        gchar           *filename16;
 
53
        gchar           *filename17;
58
54
        gchar           *filename, *backupFilename;
59
55
        gchar           *content;
60
56
        gssize          length;
68
64
        /* build test file names */
69
65
        filename10 = g_strdup_printf ("%s/.liferea/feedlist.opml", g_get_home_dir ());
70
66
        filename12 = g_strdup_printf ("%s/.liferea_1.2/feedlist.opml", g_get_home_dir ());
71
 
        filename13 = g_strdup_printf ("%s/.liferea_1.3/feedlist.opml", g_get_home_dir ());
72
67
        filename14 = g_strdup_printf ("%s/.liferea_1.4/feedlist.opml", g_get_home_dir ());
 
68
        filename16 = g_strdup_printf ("%s/.liferea_1.6/feedlist.opml", g_get_home_dir ());
 
69
        filename17 = g_strdup_printf ("%s/.liferea_1.7/feedlist.opml", g_get_home_dir ());
73
70
        filename = default_source_source_get_feedlist (node);
74
71
        backupFilename = g_strdup_printf("%s.backup", filename);
75
72
        
76
73
        if (!g_file_test (filename, G_FILE_TEST_EXISTS)) {
77
 
                /* if feed list is missing, try migration */
78
 
                
79
 
                if (g_file_test (filename13, G_FILE_TEST_EXISTS)) {
80
 
                        /* migration needs to be done before feed list import... */
81
 
                        migration_execute (MIGRATION_FROM_13);
 
74
                /* If feed list is missing, try migration. */
 
75
 
 
76
                /* Note: Starting with 1.3 migration needs to be done before feed list import... */
 
77
                if (g_file_test (filename17, G_FILE_TEST_EXISTS)) {
 
78
                        migration_execute (MIGRATION_FROM_17);
 
79
                } else if (g_file_test (filename16, G_FILE_TEST_EXISTS)) {
 
80
                        migration_execute (MIGRATION_FROM_16);
82
81
                } else if (g_file_test (filename14, G_FILE_TEST_EXISTS)) {
83
 
                        /* migration needs to be done before feed list import... */
84
82
                        migration_execute (MIGRATION_FROM_14);
85
83
                } else if (g_file_test (filename12, G_FILE_TEST_EXISTS)) {
86
84
                        /* migration needs to be done after feed list import
97
95
                }
98
96
        }
99
97
 
 
98
        g_free (filename17);
 
99
        g_free (filename16);
100
100
        g_free (filename14);
101
 
        g_free (filename13);
102
101
        g_free (filename12);
103
102
        g_free (filename10);
104
103
        
107
106
                /* if there is no feedlist.opml we provide a default feed list */
108
107
                g_free (filename);
109
108
                
110
 
                /* "feedlist.opml" is translatable so that translators can provide a localized default feed list */
111
 
                filename = g_build_filename (PACKAGE_DATA_DIR, PACKAGE, "opml", _("feedlist.opml"), NULL);
112
 
                
113
 
                /* sanity check to catch wrong filenames supplied in translations */
114
 
                if (!g_file_test (filename, G_FILE_TEST_EXISTS)) {
115
 
                        g_warning ("Configured localized feed list \"%s\" does not exist!", filename);
116
 
                        g_free (filename);
117
 
                        filename = g_build_filename (PACKAGE_DATA_DIR, PACKAGE, "opml", "feedlist.opml", NULL);
118
 
                }
 
109
                filename = common_get_localized_filename (PACKAGE_DATA_DIR "/" PACKAGE "/opml/feedlist_%s.opml");
 
110
 
 
111
                if (!filename)
 
112
                        g_error ("No default feedlist found.");
119
113
        }
120
114
 
121
115
        if (!import_OPML_feedlist (filename, node, FALSE, TRUE))
211
205
/* node source type definition */
212
206
 
213
207
static struct nodeSourceType nst = {
214
 
        .api_version            = NODE_SOURCE_TYPE_API_VERSION,
215
208
        .id                     = "fl_default",
216
209
        .name                   = "Static Feed List",
217
210
        .description            = "The default feed list source. Should never be added manually. If you see this then something went wrong!",