2
* @file default_source.c default static feedlist provider
2
* @file default_source.c default static feed list source
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>
7
7
* This program is free software; you can redistribute it and/or modify
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"
42
37
/** lock to prevent feed list saving while loading */
43
38
static gboolean feedlistImport = FALSE;
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);
76
73
if (!g_file_test (filename, G_FILE_TEST_EXISTS)) {
77
/* if feed list is missing, try migration */
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. */
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
107
106
/* if there is no feedlist.opml we provide a default feed list */
108
107
g_free (filename);
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);
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);
117
filename = g_build_filename (PACKAGE_DATA_DIR, PACKAGE, "opml", "feedlist.opml", NULL);
109
filename = common_get_localized_filename (PACKAGE_DATA_DIR "/" PACKAGE "/opml/feedlist_%s.opml");
112
g_error ("No default feedlist found.");
121
115
if (!import_OPML_feedlist (filename, node, FALSE, TRUE))
211
205
/* node source type definition */
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!",