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

« back to all changes in this revision

Viewing changes to src/export.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:
2
2
 * @file export.c  OPML feed list import & export
3
3
 *
4
4
 * Copyright (C) 2004-2006 Nathan J. Conrad <t98502@users.sourceforge.net>
5
 
 * Copyright (C) 2004-2009 Lars Lindner <lars.lindner@gmail.com>
 
5
 * Copyright (C) 2004-2011 Lars Lindner <lars.lindner@gmail.com>
6
6
 *
7
7
 * This program is free software; you can redistribute it and/or modify
8
8
 * it under the terms of the GNU General Public License as published by
78
78
                        case NODE_VIEW_SORT_BY_PARENT:
79
79
                                xmlNewProp (childNode, BAD_CAST"sortColumn", BAD_CAST"parent");
80
80
                                break;
 
81
                        case NODE_VIEW_SORT_BY_STATE:
 
82
                                xmlNewProp (childNode, BAD_CAST"sortColumn", BAD_CAST"state");
 
83
                                break;
81
84
                }
82
85
 
83
86
                if (FALSE == node->sortReversed)
84
87
                        xmlNewProp (childNode, BAD_CAST"sortReversed", BAD_CAST"false");
85
88
                        
 
89
                if (node->loadItemLink)
 
90
                        xmlNewProp (childNode, BAD_CAST"loadItemLink", BAD_CAST"true");
 
91
                        
86
92
                tmp = g_strdup_printf ("%u", node_get_view_mode(node));
87
93
                xmlNewProp (childNode, BAD_CAST"viewMode", BAD_CAST tmp);
88
94
                g_free (tmp);
150
156
                
151
157
                if (!trusted)
152
158
                        old_umask = umask (022);        /* give read permissions for other, per-default we wouldn't give it... */
153
 
                        
154
 
                if (-1 == xml_save_to_file (doc, backupFilename)) {
155
 
                        g_warning ("Could not export to OPML file! Feed list changes will be lost!");
 
159
 
 
160
                xmlSetDocCompressMode (doc, 0);
 
161
 
 
162
                if (-1 == xmlSaveFile (backupFilename, doc)) {
 
163
                        g_warning ("Could not export to OPML file!");
156
164
                        error = TRUE;
157
165
                }
158
166
                
228
236
        if (trusted) {
229
237
                gchar *id = NULL;
230
238
                id = xmlGetProp (cur, BAD_CAST"id");
 
239
 
 
240
                /* If, for some reason, the OPML has been corrupted
 
241
                   and there are two copies asking for a certain ID
 
242
                   then give the second one a new ID. */
 
243
                if (node_is_used_id (id)) {
 
244
                        xmlFree (id);
 
245
                        id = NULL;
 
246
                }
 
247
 
231
248
                if (id) {
232
249
                        node_set_id (node, id);
233
250
                        xmlFree (id);
258
275
                        node->sortColumn = NODE_VIEW_SORT_BY_TITLE;
259
276
                else if (!xmlStrcmp (sortStr, "parent"))
260
277
                        node->sortColumn = NODE_VIEW_SORT_BY_PARENT;
 
278
                else if (!xmlStrcmp (sortStr, "state"))
 
279
                        node->sortColumn = NODE_VIEW_SORT_BY_STATE;
261
280
                else
262
281
                        node->sortColumn = NODE_VIEW_SORT_BY_TIME;
263
282
                xmlFree (sortStr);
269
288
                xmlFree (sortStr);
270
289
        }
271
290
        
 
291
        /* auto item link loading flag */
 
292
        tmp = xmlGetProp (cur, BAD_CAST"loadItemLink");
 
293
        if (tmp) {
 
294
                if (!xmlStrcmp (tmp, BAD_CAST"true"))
 
295
                node->loadItemLink = TRUE;
 
296
                xmlFree (tmp);
 
297
        }
 
298
 
272
299
        /* viewing mode */
273
 
        tmp = xmlGetProp (cur, BAD_CAST"twoPane");      /* migration for old setting... */
274
 
        if (tmp) {
275
 
                if(!xmlStrcmp (tmp, BAD_CAST"true"))
276
 
                        node_set_view_mode (node, 2);
277
 
                xmlFree (tmp);
278
 
        }
279
 
                
280
300
        tmp = xmlGetProp (cur, BAD_CAST"viewMode");
281
301
        if (tmp) {
282
302
                node_set_view_mode (node, atoi (tmp));
315
335
                debug1 (DEBUG_CACHE, "seems to be an import, setting new id: %s and doing first download...", node_get_id(node));
316
336
                subscription_update (node->subscription, 0);
317
337
        }
318
 
        
319
 
        /* 8. save node info to DB */
320
 
        db_node_update (node);
321
338
 
322
339
        debug_exit ("import_parse_outline");
323
340
}
380
397
                                /* set title only when importing as folder and not as OPML source */
381
398
                                xmlNodePtr title = xpath_find (cur, "/opml/head/title"); 
382
399
                                if (title) {
383
 
                                        xmlChar *titleStr = common_utf8_fix (xmlNodeListGetString (title->doc, title->xmlChildrenNode, 1));
 
400
                                        xmlChar *titleStr = xmlNodeListGetString (title->doc, title->xmlChildrenNode, 1);
384
401
                                        if (titleStr) {
385
402
                                                node_set_title (parentNode, titleStr);
386
403
                                                xmlFree (titleStr);
427
444
void
428
445
import_OPML_file (void)
429
446
{
430
 
 
431
 
        ui_choose_file(_("Import Feed List"), _("Import"), FALSE, on_import_activate_cb, NULL, NULL, NULL);
 
447
        ui_choose_file(_("Import Feed List"), _("Import"), FALSE, on_import_activate_cb, NULL, NULL, "*.opml", _("OPML Files"), NULL);
432
448
}
433
449
 
434
450
static void
445
461
void
446
462
export_OPML_file (void)
447
463
{
448
 
        ui_choose_file (_("Export Feed List"), _("Export"), TRUE, on_export_activate_cb,  NULL, "feedlist.opml", NULL);
 
464
        ui_choose_file (_("Export Feed List"), _("Export"), TRUE, on_export_activate_cb,  NULL, "feedlist.opml", "*.opml", _("OPML Files"), NULL);
449
465
}