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

« back to all changes in this revision

Viewing changes to src/vfolder.h

  • 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 vfolder.h  search folder node type
3
3
 *
4
 
 * Copyright (C) 2003-2009 Lars Lindner <lars.lindner@gmail.com>
 
4
 * Copyright (C) 2003-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
22
22
#define _VFOLDER_H
23
23
 
24
24
#include <glib.h>
25
 
#include "rule.h"
 
25
 
 
26
#include "itemset.h"
26
27
#include "node_type.h"
27
28
 
28
29
/* The search folder implementation of Liferea is similar to the
29
30
   one in Evolution. Search folders are effectivly permanent searches.
 
31
   
 
32
   As Liferea realizes filtered lists of items using rule based itemsets,
 
33
   search folders are effectively persistent rule based itemsets.
30
34
 
31
 
   Each search folder instance is a set of rules applied to all items
32
 
   of all other feeds (excluding other search folders). Each search
33
 
   folder instance can be represented by a single node in the feed list. 
34
 
   The search feature is realized using a temporary search folder.
 
35
   GUI wise a search folder is a type of node in the subscription list.
35
36
*/
36
37
 
37
 
/** search vfolder data structure */
 
38
/** search folder data structure */
38
39
typedef struct vfolder {
39
 
        GSList          *rules;         /**< list of rules of this search folder */
40
 
        struct node     *node;          /**< the feed list node of this search folder (or NULL) */
41
 
        gboolean        anyMatch;       /**< TRUE means only one of the rules must match for item inclusion */
 
40
        struct node     *node;          /**< the feed list node of this search folder */
 
41
        
 
42
        itemSetPtr      itemset;        /**< the itemset with the rules and matching items */
 
43
 
 
44
        gboolean        reloading;      /**< if the search folder is in async reloading */
 
45
        gulong          maxLoadedId;    /**< when in reloading maximum scanned id so far */
42
46
} *vfolderPtr;
43
47
 
44
48
/**
51
55
vfolderPtr vfolder_new (struct node *node);
52
56
 
53
57
/**
54
 
 * Method that adds an existing rule to a search folder.
55
 
 * To be used when editing search folders.
56
 
 *
57
 
 * @param vfdoler       search folder
58
 
 * @param rule          rule to add
59
 
 */
60
 
void vfolder_add_existing_rule (vfolderPtr vfolder, rulePtr rule);
61
 
 
62
 
/**
63
 
 * Method that creates and adds a rule to a search folder. To be used
64
 
 * on loading time, when creating searches or when editing
65
 
 * search folder properties.
66
 
 *  
67
 
 * vfolder_refresh() needs to called to update the item matches
68
 
 *
69
 
 * @param vfolder       search folder the rule belongs to
70
 
 * @param ruleId        id string for this rule type
71
 
 * @param value         argument string for this rule
72
 
 * @param additive      indicates positive or negative logic
73
 
 */
74
 
void vfolder_add_rule (vfolderPtr vfolder, const gchar *ruleId, const gchar *value, gboolean additive);
75
 
 
76
 
/** 
77
 
 * Method that removes a rule from the rule list of a given
78
 
 * search folder. To be used when deleting search folders 
79
 
 * or editing its rules.
80
 
 *
81
 
 * vfolder_refresh() needs to called to update the item matches
82
 
 *
83
 
 * @param vfolder       search folder
84
 
 * @param rule          rule to remove
85
 
 */
86
 
void vfolder_remove_rule (vfolderPtr vfolder, rulePtr rule);
87
 
 
88
 
/**
89
 
 * Method to unconditionally invoke a callback for all search folders.
 
58
 * Method to unconditionally invoke an node callback for all search folders.
90
59
 *
91
60
 * @param func          callback
92
61
 */
93
62
void vfolder_foreach (nodeActionFunc func);
94
63
 
 
64
typedef void    (*vfolderActionDataFunc)        (vfolderPtr vfolder, itemPtr item);
 
65
 
95
66
/**
96
 
 * Method to invoke a callback for all search folders that do use
97
 
 * the given rule.
 
67
 * Method to unconditionally invoke an item callback for all search folders.
98
68
 *
99
 
 * @param ruleName      the rule type
100
69
 * @param func          callback
101
 
 */
102
 
void vfolder_foreach_with_rule (const gchar *ruleName, nodeActionFunc func);
103
 
 
104
 
/**
105
 
 * Method to invoke callbacks for all search folders that are
106
 
 * affected by a modification of the given item. For each
107
 
 * search folder it is checked if the item matches the search folder 
108
 
 * rules. If yes then the given callback is invoked.
109
 
 *
110
 
 * @param itemId        the item id
111
 
 * @param func          function to call if the search folder contains the item
112
 
 */
113
 
void vfolder_foreach_with_item (gulong itemId, nodeActionFunc func);
114
 
 
115
 
/**
116
 
 * Method that updates the unread and item count for the given
117
 
 * search folder node.
118
 
 *
119
 
 * @param node          the search folder node
120
 
 */
121
 
void vfolder_update_counters (nodePtr node);
122
 
 
123
 
/**
124
 
 * Method that "refreshes" the DB view according
125
 
 * to the search folder rules. To be called after
126
 
 * vfolder_(add|remove)_rule().
 
70
 * @param data          the item to process
 
71
 */
 
72
void vfolder_foreach_data (vfolderActionDataFunc func, itemPtr item);
 
73
 
 
74
/**
 
75
 * Method to remove an item from a search folder.
 
76
 *
 
77
 * @param vfolder       search folder
 
78
 * @param item          the item
 
79
 */
 
80
void vfolder_remove_item (vfolderPtr vfolder, itemPtr item);
 
81
 
 
82
/**
 
83
 * Method to add an item to a search folder.
 
84
 *
 
85
 * @param vfolder       search folder
 
86
 * @param item          the item
 
87
 */
 
88
void vfolder_add_item (vfolderPtr vfolder, itemPtr item);
 
89
 
 
90
/**
 
91
 * Method to merge an item to a search folder if
 
92
 * it matches the search folder rules.
 
93
 *
 
94
 * @param vfolder       search folder
 
95
 * @param item          the item
 
96
 */
 
97
void vfolder_merge_item (vfolderPtr vfolder, itemPtr item);
 
98
 
 
99
/**
 
100
 * Returns a list of all search folders currently matching
 
101
 * the given item id.
 
102
 *
 
103
 * @param id            the item id
 
104
 *
 
105
 * @returns a list of vfolderPtr (to be free'd using g_slist_free())
 
106
 */
 
107
GSList * vfolder_get_all_with_item_id (gulong id);
 
108
 
 
109
/**
 
110
 * Resets vfolder state. Drops all items from it.
 
111
 * To be called after vfolder_(add|remove)_rule().
 
112
 *
 
113
 * @param vfolder       search folder to reset
 
114
 */
 
115
void vfolder_reset (vfolderPtr vfolder);
 
116
 
 
117
/**
 
118
 * Rebuilds a search folder by scanning all existing items.
127
119
 *
128
120
 * @param vfolder       search folder to rebuild
129
121
 */
130
 
void vfolder_refresh (vfolderPtr vfolder);
 
122
void vfolder_rebuild (nodePtr node);
131
123
 
132
124
/* implementation of the node type interface */
133
125