~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): 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
 
 * @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!",