aboutsummaryrefslogtreecommitdiffstats
path: root/filter
diff options
context:
space:
mode:
Diffstat (limited to 'filter')
-rw-r--r--filter/.cvsignore9
-rw-r--r--filter/ChangeLog1877
-rw-r--r--filter/Makefile.am85
-rw-r--r--filter/filter-code.c122
-rw-r--r--filter/filter-code.h51
-rw-r--r--filter/filter-colour.c224
-rw-r--r--filter/filter-colour.h54
-rw-r--r--filter/filter-context.c152
-rw-r--r--filter/filter-context.h58
-rw-r--r--filter/filter-datespec.c750
-rw-r--r--filter/filter-datespec.h64
-rw-r--r--filter/filter-driver.c778
-rw-r--r--filter/filter-editor.c187
-rw-r--r--filter/filter-editor.h54
-rw-r--r--filter/filter-element.c312
-rw-r--r--filter/filter-element.h86
-rw-r--r--filter/filter-filter.c499
-rw-r--r--filter/filter-filter.h59
-rw-r--r--filter/filter-folder.c319
-rw-r--r--filter/filter-folder.h55
-rw-r--r--filter/filter-input.c338
-rw-r--r--filter/filter-input.h58
-rw-r--r--filter/filter-int.c229
-rw-r--r--filter/filter-int.h58
-rw-r--r--filter/filter-message-search.c806
-rw-r--r--filter/filter-option.c351
-rw-r--r--filter/filter-option.h62
-rw-r--r--filter/filter-part.c501
-rw-r--r--filter/filter-part.h77
-rw-r--r--filter/filter-rule.c779
-rw-r--r--filter/filter-rule.h104
-rw-r--r--filter/filter-score.c236
-rw-r--r--filter/filter-score.h56
-rw-r--r--filter/filter-source.c366
-rw-r--r--filter/filter-source.h56
-rw-r--r--filter/filter.glade721
-rw-r--r--filter/filtertypes.xml628
-rw-r--r--filter/libfilter-i18n.h53
-rw-r--r--filter/rule-context.c473
-rw-r--r--filter/rule-context.h113
-rw-r--r--filter/rule-editor.c491
-rw-r--r--filter/rule-editor.h74
-rw-r--r--filter/score-context.c104
-rw-r--r--filter/score-context.h51
-rw-r--r--filter/score-editor.c149
-rw-r--r--filter/score-editor.h53
-rw-r--r--filter/score-rule.c221
-rw-r--r--filter/score-rule.h54
-rw-r--r--filter/vfolder-context.c119
-rw-r--r--filter/vfolder-context.h53
-rw-r--r--filter/vfolder-editor.c149
-rw-r--r--filter/vfolder-editor.h54
-rw-r--r--filter/vfolder-rule.c446
-rw-r--r--filter/vfolder-rule.h60
-rw-r--r--filter/vfoldertypes.xml360
55 files changed, 0 insertions, 14298 deletions
diff --git a/filter/.cvsignore b/filter/.cvsignore
deleted file mode 100644
index 7c13af9a14..0000000000
--- a/filter/.cvsignore
+++ /dev/null
@@ -1,9 +0,0 @@
-*.la
-*.lo
-.libs
-.deps
-.pure
-Makefile
-Makefile.in
-filter-driver
-filter-editor
diff --git a/filter/ChangeLog b/filter/ChangeLog
deleted file mode 100644
index 58d7486ba1..0000000000
--- a/filter/ChangeLog
+++ /dev/null
@@ -1,1877 +0,0 @@
-2001-08-03 Jeffrey Stedfast <fejj@ximian.com>
-
- * filter-rule.c (get_widget): Do an evil kludgy hack so that the
- Rule Name entry widget gets focused when the filter editor is
- shown.
-
-2001-08-02 Jeffrey Stedfast <fejj@ximian.com>
-
- * filter-rule.c: Wrap some debug printf's with d().
-
- * rule-context.h: Removed prototype for rule_context_delete_rule()
- since the function doesn't exist.
-
-2001-07-23 Jon Trowbridge <trow@ximian.com>
-
- * vfolder-rule.c (validate): Added a validate function
- that checks to make sure that vfolders that have "specific
- folders" as their source actually have a non-empty list of
- source folders selected. (Bug #4937)
- (get_widget): If fr->source is NULL for some reason, bring
- it into sync with the default in the option menu.
-
-2001-07-23 Peter Williams <peterw@ximian.com>
-
- * filter-datespec.c (make_span_editor): Change the butt-ugly
- UI to a saner (and just as flexible) one. Instead of all those
- spinbuttons, just have one and let the user select the time unit.
- (omenu_item_activated): New function. When the user changes the
- time unit, convert it from the old number. Pretty.
- (adj_value_changed): This function is now simpler.
- (set_adjustments): Also modified for new UI model.
- (button_clicked): Set the selected_type before calling the callback.
- (FilterDatespecPrivate): Members change a bit.
- (filter_datespec_init): No longer need to allocation spinbuttons
- (filter_datespec_finalise): No longer need to free spinbuttons.
-
-2001-07-20 Jeffrey Stedfast <fejj@ximian.com>
-
- * filtertypes.xml: Removed the "Forward To" filter action.
-
-2001-07-18 Jeffrey Stedfast <fejj@ximian.com>
-
- * rule-context.c (rule_context_get_rank_rule): Return -1 if we
- don't find it? This is what most of the code expected but not what
- we were returning on fail.
-
-2001-07-12 Zbigniew Chyla <cyba@gnome.pl>
-
- * filter-datespec.c (stringify_agoness): Marked string for translation.
-
-2001-07-12 Jeffrey Stedfast <fejj@ximian.com>
-
- * filtertypes.xml: Users should not be able to filter on "Status
- is Deleted" since we don't allow that in the filter driver code.
-
-2001-07-11 Jason Leach <jleach@ximian.com>
-
- * vfoldertypes.xml: Copied the "Attachments" rule part over from
- filtertypes.xml, would be a powerful feature for vfolders (see all
- the patches across all folders, or all the attachments you've sent,
- without having to duplicate potentially big files, blah blah, bug
- #1155).
-
-2001-07-10 Peter Williams <peterw@ximian.com>
-
- * vfoldertypes.xml: Put a match-all around the not-body-contains
- to make it work per-message.
-
- * filtertypes.xml: Same.
-
-2001-07-05 Jeffrey Stedfast <fejj@ximian.com>
-
- * filter-rule.c (get_widget): Set the focus on the title of the
- filter rule.
-
-2001-07-09 Anna Marie Dirks <anna@ximian.com>
-
- * rule-context.c (rule_context_add_rule_gui): Increased the size
- of the "Add Filter Rule" dialog to 600 x 400, so that no resizing
- is necessary to use the dialog.
-
-2001-07-09 Jon Trowbridge <trow@ximian.com>
-
- * filter-source.c (filter_source_get_sources): Bonobo-conf-ified.
- Removed /home/trow hard-wiring. :)
- (xml_encode): Encode things properly.
- (xml_decode): Decode things properly.
- (get_widget): Ignore accounts w/o source URLs.
- (clone): Set the ->name in our copy.
-
-2001-07-05 Jeffrey Stedfast <fejj@ximian.com>
-
- * rule-editor.c (rule_delete): Select the most appropriate filter
- rule.
-
- * filtertypes.xml: Fix bug #4043: s/colour/color
-
-2001-07-03 Peter Williams <peterw@ximian.com>
-
- * filter-source.c (get_widget): Prevent crashing while we work
- this out.
-
- * filter-rule.c (get_widget): Don't try to gtk_widget_grab_default
- with a widget that can't be the default. Altough it should be able
- to....
-
-2001-07-02 Sam Creasey <sammy@oh.verio.com>
-
- * filter-int.c: Added an integer type for filtering values. used
- for size.
-
- * Makefile.am (SOURCES): added filter-int.c, filter-int.h
-
- * filtertypes.xml: added a part entry for size based filters
-
-2001-07-02 Anna Marie Dirks <anna@ximian.com>
-
- * filter-rule.c (get_widget): Changed "Add criterion" button to
- have normal button relief in response to complaints of it not
- appearing clickable.
-
- * filter-filter.c: Changed "Add action" button to have normal
- button relief in response to complaints of it not appearing
- clickable.
-
-2001-06-29 Jeffrey Stedfast <fejj@ximian.com>
-
- * rule-editor.c (rule_editor_construct): Set the filter-rule
- dialog to be user-resizable.
-
-2001-06-27 Jeffrey Stedfast <fejj@ximian.com>
-
- * filtertypes.xml: Make "Move" the default action.
-
-2001-05-08 Not Zed <NotZed@Ximian.com>
-
- * filter-rule.c: Deleted Gediminas patch.
-
-2001-05-08 Gediminas Paulauskas <menesis@delfi.lt>
-
- * filter-rule.c (xml_decode): allow "_title" in user
- rules. translate them and encode to utf8.
- (get_rule_part_widget): do not call gettext on part->title. It is
- always translated already.
-
-2001-04-26 Jeffrey Stedfast <fejj@ximian.com>
-
- * rule-editor.c (rule_edit): Set the default size of the dialog to
- 600x400, which seems to be a nice size that fits all the widgets
- into it.
- (rule_add): Same.
-
-2001-04-26 Dan Winship <danw@ximian.com>
-
- * Makefile.am (INCLUDES): Remove UNICODE_CFLAGS
-
-2001-04-26 Not Zed <NotZed@Ximian.com>
-
- * filter-part.c (filter_part_xml_create): Blah blah fix for xml1
- broken utf8 encoding, and use "g" memory for all allocations.
- (filter_part_finalise): Free our data properly.
-
-2001-04-20 Kjartan Maraas <kmaraas@gnome.org>
-
- * filter-rule.c: Pull up fix for translation of filter
- direction drop down menu from the branch.
-
-2001-04-18 Dan Winship <danw@ximian.com>
-
- * filter-colour.c, filter-datespec.c, filter-folder.c,
- filter-input.c, filter-option.c, filter-rule.c, filter-score.c,
- filter-source.c, score-rule.c (xml_decode): Plug memory leaks.
-
- * rule-context.c (rule_context_finalise): Implement. Free stuff.
-
- * filter-element.h: #include <gnome-xml/xmlmemory.h> here for xmlFree
-
- * filter-filter.c, filter-part.c: Remove xmlmemory.h #include
-
-2001-04-15 Jeffrey Stedfast <fejj@ximian.com>
-
- * filtertypes.xml: s/Is/is/ and s/Is Not/is not/ to be more
- consistant with the rest.
-
-2001-04-13 Jon Trowbridge <trow@gnu.org>
-
- * filtertypes.xml: Add XML specs for source account filtering.
-
- * filter-element.c (filter_element_new_type_name): Recognize
- type "source", construct a FilterSource.
-
- * filter-source.c: Added. A FilterElement for the account e-mail
- comes from.
-
-2001-04-04 Kjartan Maraas <kmaraas@gnome.org>
-
- * filter-editor.c: Fix headers.
- * filter-filter.c: Same here.
- * filter-option.c: Same here.
- * filter-part.c: Same here.
- * filter-rule.c: Same here.
- * rule-editor.c: Same here.
- * score-editor.c: Same here.
- * vfolder-editor.c: Same here.
- * vfolder-rule.c: Same here.
-
-2001-04-02 Jeffrey Stedfast <fejj@ximian.com>
-
- * filter-filter.c (option_activate): Set the newpart on the
- container object.
- (less_parts): Remove the rule tht the user wants to remove.
- (attach_rule): Attach a new rule and it's remove button to the end
- of the table.
- (more_parts): Fix to resize the table and such.
- (get_widget): Don't have a remove action button, we are putting
- this next to the rule part now.
-
-2001-03-30 Kjartan Maraas <kmaraas@gnome.org>
-
- * *.*: Fix headers. Remove unneccesary ones and replace
- with more finegrained ones where needed.
-
-2001-03-22 Jeffrey Stedfast <fejj@ximian.com>
-
- * filter-datespec.c (validate): Oops, an unspecified date is '0',
- not -1.
-
-2001-03-21 Jeffrey Stedfast <fejj@ximian.com>
-
- * rule-context.c (new_rule_clicked): Validate the rule before
- closing.
-
-2001-03-20 Jeffrey Stedfast <fejj@ximian.com>
-
- * rule-editor.c (rule_edit): Set the editor dialog modal rather
- than setting the filter dialog insensitive. Also ref re->edit
- since we unref it when the editor closes. This should fix bug
- #1905.
- (edit_editor_clicked): No need to set the filter dialog sensitive
- again.
- (rule_add): Set the add-rule dialog modal and don't set the filter
- dialog insensitive.
- (add_editor_clicked): No need to set the filter dialog sensitive
- again.
-
-2001-03-17 Jeffrey Stedfast <fejj@ximian.com>
-
- * filter-option.c (build_code): Since we are now using
- filter-option widgets in place of system-flag, we do not need a
- "code" part so if there isn't a code part, don't build it.
- (clone): Updated to allow NULL code parts.
-
-2001-03-17 Jeffrey Stedfast <fejj@ximian.com>
-
- * filter-element.c (filter_element_new_type_name): If the filter
- type is a "system-flag", use the optionlist type as type
- system-flag has been removed. This should allow backward
- compatability.
-
- * filter-editor.c (filter_editor_construct): Remove the menu that
- is in the glade file because we want to replace it with our menu,
- not append items to that menu.
-
- * filtertypes.xml: Oops, missed the system-flag action-set.
-
- * vfoldertypes.xml: Update "status" ruleset.
-
-2001-03-16 Jeffrey Stedfast <fejj@ximian.com>
-
- * Makefile.am: Removed filter-url.[c,h] and
- filter-system-flag.[c,h]
-
- * filter-element.c (filter_element_new_type_name): Removed
- references to the url-type and system-flag types.
-
- * filtertypes.xml: Removed "source" type and fixed "status" to use
- the optionmenu.
-
- * filter-url.[c,h]: Removed.
-
- * filter-system-flag.[c,h]: Removed (just use optionmenu).
-
-2001-03-15 Not Zed <NotZed@Ximian.com>
-
- * filter.glade: Changed the edit_filter to be a standalone window
- rather than a widget, so we can get the rule editor part out
- separately. Same for vfolder editor, and new score, and basic rule
- editors.
-
- * score-editor.c (score_editor_new): Turned back on object
- stuff, subclass rule-editor, and removed most of the code.
-
- * filter-editor.c (filter_editor_new): Turned into an object,
- subclass rule-editor, removed most of the code. Now we accept the
- source list during create, and plug that into the glade.
-
- * vfolder-editor.c (vfolder_editor_new): Turned back on object
- stuff, subclass rule-editor, and removed most of the code.
-
- * Makefile.am (libfilter_la_SOURCES): Added rule-editor.[ch].
-
- * filter-filter.c (validate): inherit the validate function and
- also validate the actions part of a filterfilter.
-
- * filter-rule.c (filter_rule_validate): New method so that filter
- rules can validate themselves.
- (validate): Default implementation, validates base rules.
-
- * rule-editor.h: New generic rule editor, to be used for filter
- editor/vfolder editor/score editor/saved searches editor.
-
-2001-03-15 Gediminas Paulauskas <menesis@delfi.lt>
-
- * filter-system-flag.c: translate status flag title.
-
-2001-03-12 Jeffrey Stedfast <fejj@ximian.com>
-
- * filtertypes.xml: Added an "Attachments" filter option where you
- can filter messages that have (or do not have) attachments. This
- does not allow you to filter based on the types of the
- attachments.
-
-2001-03-08 Jeffrey Stedfast <fejj@ximian.com>
-
- * vfolder-editor.c (double_click): Make sure we have something
- selected first ;-)
-
- * filter-editor.c (double_click): And here too.
-
-2001-03-03 Not Zed <NotZed@Ximian.com>
-
- * filter.glade: Added option menu to vfolder editor.
-
-2001-03-02 Not Zed <NotZed@Ximian.com>
-
- * vfolder-rule.c (get_widget): Setup the data on the base source
- opiton menu, and make hte option menu reflect the source.
- (select_source_with): Set the source type for this
- rule. e.g. these folders, "with ..."
-
- * filter-editor.c: Removed the N_() stuff from the source_names
- array, they must not be internationalised!!!
-
-2001-02-28 Not Zed <NotZed@Ximian.com>
-
- * filter-rule.c (filter_rule_clone): New function to clone rules.
-
-2001-02-23 Not Zed <NotZed@Ximian.com>
-
- * filtertypes.xml: Added mailing list matching rules.
- renamed mailing list options to be more meaningful.
-
- * vfoldertypes.xml: Added mailing list rules.
- renamed mailing list options to be more meaningful.
-
-2001-02-11 Gediminas Paulauskas <menesis@delfi.lt>
-
- * filter.glade.h: removed.
- * filter.glade: do not donnt output to above one.
- * Makefile.am: do not include filter.glade.h in EXTRA_DIST.
-
-2001-02-06 Dan Winship <danw@ximian.com>
-
- * filter-option.c (get_widget): Translate the option title.
- (Noticed by Kjartan).
-
-2001-02-05 Kjartan Maraas <kmaraas@gnome.org>
-
- * filter-code.c, filter-colour.c, filter-context.c,
- filter-element.c, filter-input.c, filter-score.c,
- filter-system-flag.c, filter-url.c: Add #include <config.h>
- and mark some strings for translation.
-
-2001-01-22 Not Zed <NotZed@Ximian.com>
-
- * filter-message-search.[ch]: Removed, now lives in
- camel-filter-search.*
-
- * Makefile.am (libfilter_la_SOURCES): Removed filter-driver.[ch]
- and filter-message-search.[ch].
-
- * filter-driver.[ch]: Removed. now lives in camel-filter-driver.*
-
-2001-01-19 Jeffrey Stedfast <fejj@ximian.com>
-
- * filter-driver.c (filter_driver_filter_message): Set the delete
- bit *before* copying to the default folder.
-
-2001-01-18 Jeffrey Stedfast <fejj@ximian.com>
-
- * filter-filter.c (less_parts): Er, don't set the button
- insensitive if there is *1* action, set it insensitive if there
- are less than or equal to *1* actions. Doh!
- (more_parts): Only set the remove button sensitive if there is
- more than 1 action.
- (get_widget): Here too.
-
-2001-01-16 Jason Leach <jasonleach@usa.net>
-
- * e-search-bar.[ch]: Moved ESearchBar to $(toplevel)/widgets/misc,
- a more appropriate home. Bug #1060.
-
-2001-01-13 Jeffrey Stedfast <fejj@ximian.com>
-
- * filter-driver.c (do_copy): Moved p->copied to the inner part of
- the loop so that in the case of a folder not existing, it doesn't
- think that the message was already copied to some place and thus
- not save it to the Inbox.
- (do_move): Same.
-
-2001-01-10 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filtertypes.xml: Changed Priority to Score.
-
- * filter-option.c (get_widget): Attach to the "activate" signal -
- this should now make it so that a filter-option will "remember"
- what a user changed.
-
- * filter-system-flag.c (get_widget): Don't reset fsf->value to the
- first system flag, this should already be defaulted to the
- appropriate flag. This should fix the problem of always defaulting
- to the first menu option and thus "forgetting" the user's settings.
-
-2001-01-04 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-system-flag.c: comment out some of the system flags as we
- don't want to use them.
- (xml_encode): Update the printf
- (get_widget): Use strcmp instead of g_strcasecmp.
-
-2001-01-02 Lauris Kaplinski <lauris@helixcode.com>
-
- * filter-input.c (xml_encode): Encode utf8
- (xml_decode): Decode utf8
-
- * filter-option.c (xml_create): Decode utf8
-
- * filter-part.c (filter_part_xml_create): Decode utf8
-
- * filter_rule.c (xml_encode): Encode utf8
- (xml_decode): Decode utf8
-
-2001-01-02 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-driver.c (do_flag): Set the 'dirty' flag - this should
- fix the problem of flags not being set (or, more precisely,
- synced).
- (filter_driver_filter_message): Here too.
-
-2000-12-21 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-message-search.c (header_contains): Use
- e_utf8_strstrcase() instead of just strstr().
- (header_starts_with): Make sure that the header contents are
- longer than the starts-with string.
-
- * vfoldertypes.xml: Don't send \"Subject\" to body-contains.
- Also added matches, starts-with, and ends-with xml stuff.
-
-2000-12-28 Dan Winship <danw@helixcode.com>
-
- * filter-message-search.c (handle_multipart, body_contains,
- body_regex): Use CamelContentType rather than GMimeContentField.
-
-2000-12-24 Not Zed <NotZed@HelixCode.com>
-
- * Merge from camel-mt-branch.
-
-2000-12-21 Not Zed <NotZed@HelixCode.com>
-
- * filter-message-search.c (filter_message_search): And here too.
-
- * filter-driver.c (filter_driver_finalise): Kind of revert an
- accidentally commited patch for e_sexp_unref.
-
-2000-12-20 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-driver.c (filter_driver_filter_message): Oops, slight
- logic error. We want to copy the message to the default folder if
- the message hasn't been Moved (which is the same as Copied &&
- Deleted). This fixes bug #1007.
-
- * filter-rule.c (more_parts): Make sure we have more than 1 part
- before we sensitize the "remove" button.
-
-2000-12-20 Not Zed <NotZed@HelixCode.com>
-
- * filter-message-search.c (filter_message_search): Oops, missed a
- gtk unref of the now-no-longer gtk e_sexp.
-
- * filter-driver.c: Remove mail_tool_lock stuff.
- (filter_driver_finalise): unref e_sexp properly.
-
-2000-12-12 Christopher James Lahey <clahey@helixcode.com>
-
- * e-search-bar.c (esb_pack_menubar): Fixed some warnings.
-
-2000-12-11 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-folder.c (button_clicked): Added a kludge, 'is_active'
- which is a static variable that holds whether or not there is an
- active shell folder dialog up or not.
-
- * vfolder-editor.c (rule_delete): Autoselect the rule that ends up
- in the same position (or the one above it if the list is shorter
- than the position).
-
-2000-12-08 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-rule.c (get_widget): Don't highlight the title if it's
- "Untitled" because switching widget focus doesn't cause this
- selection to go away.
-
-2000-12-06 Kjartan Maraas <kmaraas@gnome.org>
-
- * filter-editor.c: Mark some strings for translation.
-
-2000-12-01 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-element.c (filter_element_new_type_name): Added support
- for the system-flag type.
-
- * Makefile.am: Added filter-system-flag.[c,h].
-
- * filter-system-flag.[c,h]: New type for system flags.
-
- * filtertypes.xml: Oops, looks like we were still using integers
- as arguments to set-flag. Change over to using strings which are
- safer and also change the name to set-system-flag.
-
- * filter-driver.c (do_flag): Use strings instead of integers.
- Instead of set-flag, the callback is now set-system-flag for less
- confusion. Sorry Ettore, but you'll have to change your filters.
-
- * filtertypes.xml: Added system-flags stuff.
-
- * vfoldertypes.xml: And here too.
-
- * filter-message-search.c (system_flag): New ESExp callback for
- filtering on system flags.
-
-2000-11-30 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-driver.c (filter_driver_filter_message): Use
- camel_message_info_free() instead of freeing everything by hand -
- is this a new function? I don't ever recall seeing this
- before. Also use my new function,
- camel_message_info_new_from_header - ahhh... this code is now so
- beatiful. Okay, I'm done.
-
-2000-11-30 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-driver.c (filter_driver_filter_message): Update to use
- EStrv in appropriate places (wrapped with #ifdef DOESTRV for the
- moment).
-
-2000-11-27 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filtertypes.xml: Moved the regex filter rule around - we've
- changed the format a bit.
-
- * filter-option.c (option_activate): Removed.
- (get_widget): Don't connect the activate signal.
-
- * filter-folder.c (validate): Updated.
-
- * filter-datespec.c (validate): Updated.
-
- * filter-part.c (filter_part_validate): Updated.
-
- * filter-input.c (validate): Check the filter-input type - if it's
- of type "regex", then check for regex validity.
-
- * filter-element.c (filter_element_validate): No longer takes a
- gpointer argument.
- (filter_element_new_type_name): Allow type "regex" and create a
- new filter-input with type "regex".
-
-2000-11-24 Michael Meeks <michael@helixcode.com>
-
- * filter-message-search.c (get_full_header): impl.
- (header_full_regex): use it.
-
-2000-11-23 Michael Meeks <michael@helixcode.com>
-
- * filter-message-search.c (header_full_regex): impl.
-
-2000-11-21 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-message-search.c: took out some no longer needed
- printfs.
-
-2000-11-15 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-driver.c (filter_driver_filter_folder): Sync here
- instead.
- (filter_driver_filter_mbox): And here too.
- (filter_driver_finalise): Don't sync here afterall - it's more
- preferable to sync right after processing.
-
-2000-11-15 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-driver.c (filter_driver_finalise): Sync the
- defaultfolder.
- (filter_driver_filter_folder): Sync here instead.
- (filter_driver_filter_mbox): And here too.
-
-2000-11-13 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-message-search.c (header_matches): Neglect any leading
- whitespace in the header contents.
- (header_starts_with): Same.
- (header_ends_with): Same.
- (header_soundex): Same.
-
-2000-11-12 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-driver.c (filter_driver_filter_message): If there is a
- default folder and the message hasn't been deleted then... should
- be: If there is a default folder and the message hasn't been
- copied to another folder and the message hasn't been deleted...
- (filter_driver_filter_message): Make it so that the FILTER_LOG_END
- is only called if filtered were applied to the message so we don't
- get huge gaps of whitespace in the log file.
- (filter_driver_filter_message):
-
-2000-11-10 Christopher James Lahey <clahey@helixcode.com>
-
- * e-search-bar.c: Made the underline show up properly in the main
- menu bar.
-
-2000-11-10 Christopher James Lahey <clahey@helixcode.com>
-
- * e-search-bar.c: Switched from using gtk_menu_item_new_with_label
- for the menu header to using gnome_stock_menu_item.
-
-2000-11-08 Anna Marie Dirks <anna@helixcode.com>
- * e-search-bar.c: Fixed two spacing problems: first, changed
- the spacing around the end of the text-entry widget so that
- the text entry is always aligned with the beginning of the scrollbar;
- second, trimmed down the space between the widgets in the search bar.
-
-
-2000-11-06 Not Zed <NotZed@HelixCode.com>
-
- * filter-driver.c (do_flag): you shouldn't use an integer to
- set the flag. You should use a string, and look it up, because
- the flag bits might change.
- (filter_driver_filter_message): Can som e one PLEASE STOP
- INDENTING THE CODE. Even if i have to come over the and
- beat it into you. YOU DONT INDENT CODE ONCE ITS BEEN CHECKED IN
- TO CVS, otherwise you SCREW UP THE DIFF's. Can't you please
- please learn this?
- (filter_driver_log): Fixes for api changes to mime_message.
-
-2000-11-05 Not Zed <NotZed@HelixCode.com>
-
- * filter-message-search.c (get_sent_date): Fix for date change
- api. No longer need to encode/decode the date, after its been
- encoded/ecoded already.
- (get_received_date): Likewise.
-
-2000-11-06 Christopher James Lahey <clahey@helixcode.com>
-
- * e-search-bar.h: Fixed the argument comment. Removed an old enum
- that's not used here.
-
-2000-11-06 Christopher James Lahey <clahey@helixcode.com>
-
- * Makefile.am: Added e-search-bar.c and e-search-bar.h.
-
- * e-search-bar.c, e-search-bar.h: Moved this from
- e-addressbook-search.
-
-2000-11-02 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-driver.c (filter_driver_log): Fix for when 'desc' is
- NULL.
- (filter_driver_filter_message): Use a more user-friendly filter
- name in the log file.
-
-2000-11-01 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-driver.c (filter_driver_filter_message): Use
- filter_driver_log() where appropriate.
- (do_copy): Use the service url for the path rather than the
- folder->full_name because that'll only get you a "/mbox" which is
- entirely useless. Replace occurences of report_status with
- filter_driver_log.
- (do_move): Same.
- (report_status): Don't use this for logging anymore, use only for
- reporting the status back to the caller.
- (filter_driver_log): Renamed from filter_driver_status_log. Now
- ONLY handles file logging and is for INTERNAL USE ONLY.
- (do_flag): Replace occurences of report_status with
- filter_driver_log.
- (do_score): Same.
- (do_colour): Same.
- (do_stop): Same.
-
-2000-11-01 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-datespec.c (validate): Check to make sure the user has
- entered a valid date.
-
-2000-10-31 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filtertypes.xml: Updated to allow the user to select "sounds
- like" or "does not sound like" (uses header-soundex).
-
- * filter-message-search.c (header_matches): Oops. Should be using
- !g_strncasecmp. This should fix it so this filter match works
- right.
- (header_starts_with): Same.
- (header_ends_with): Same.
- (header_soundex): New filter callback for soundex matching (yes,
- it's probably a bloated feature but hey, it was fun to code)
-
-2000-10-31 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-folder.c (validate): Override the default validate
- function to only return TRUE if a folder has been selected.
-
- * filter-editor.c (rule_add): Validate that all the rule parts and
- action parts are correctly filled in.
- (rule_edit): Same.
-
-2000-10-31 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filtertypes.xml: Updated to add an action to set message flags.
-
- * filter-driver.c (do_flag): New callback to set message info
- flags.
-
- * filter-element.c (filter_element_set_data): New convenience
- function to set the data on a FilterElement.
-
- * filter-url.c (get_widget): Set the sources list to point to the
- FilterElement data.
-
-2000-10-31 Federico Mena Quintero <federico@helixcode.com>
-
- * filter-rule.c (get_widget): Do not pad around the Name hbox;
- its parent already has spacing.
- Do not pad around the inframe's children; the inframe already has
- spacing.
-
-2000-10-30 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-option.c (option_activate): If a regex option is
- selected, change the FilterElement data to TRUE else set to FALSE.
-
- * filter-rule.c (more_parts): Validate the previously entered
- FilterPart before allowing the user to add a new FilterPart.
-
- * filter-part.c (filter_part_validate): New convenience function
- to validate an entire FilterPart expression.
-
- * filter-input.c (validate): Validate the entry text if it
- contains a regular expression.
-
- * filter-element.[c,h]: New virtual function to validate the
- contents of the FilterElement (useful for regex and sexp).
- (filter_element_validate): You get the idea...
-
-2000-10-30 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-input.c:
- * filter-option.c:
- * filter-part.c: Pure formatting changes, no actual code
- changes. Since I know I'm going to get flamed for this, I'm sorry
- but I'll probably have to modify code in these files and it's
- easier if the code is quickly readable by me.
-
- * filter-rule.c (get_widget): Set the "remove" button insensitive
- for <= 1 instead of == 1.
-
-2000-10-28 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-driver.c (filter_driver_filter_message): Copy the message
- to the default folder if it wasn't marked as deleted.
-
-2000-10-27 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filtertypes.xml: Added header-starts-with, header-ends-with, and
- header-exists menu items.
-
- * filter-message-search.c (header_starts_with): New callback to
- match the beginnings of headers.
- (header_ends_with): New callback to match the ends of headers.
- (header_exists): New callback to determine if a header exists
- which is useful when filtering out all those pesky bug-buddy
- emails!
-
-2000-10-27 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filtertypes.xml: Add header-matches expressions ("is" / "is not").
-
- * filter-message-search.c (header_matches): New callback to match
- headers exactly (aka strcmp rather than strstr).
-
-2000-10-27 Jacob "Ulysses" Berkman <jacob@helixcode.com>
-
- * filter-driver.c (filter_driver_filter_mbox): divide before
- multiple so that we don't overflow.
-
-2000-10-27 Christopher James Lahey <clahey@helixcode.com>
-
- * Makefile.am: Fixed this to include EXTRA_GNOME_CFLAGS.
-
-2000-10-27 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-driver.c (do_move): Don't mark as deleted here, otherwise
- the message will have the DELETED flag set in the folder it's
- being moved to.
- (do_delete): Don't set the DELETED flag here either...we'll only
- set it at the very end of the filtering process.
- (filter_driver_filter_message): Set the DELETED flag after all
- processing is completed.
-
-2000-10-26 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filtertypes.xml: Readded Source url stuff.
-
- * filter-element.c (filter_element_new_type_name): Added url stuff
- back in.
-
- * filter-url.[c,h]: Back from the dead...
-
- * Makefile.am: Re-added filter-url.[c,h].
-
-2000-10-25 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filtertypes.xml: Added option menu items to allow searching
- based on regular expressions.
-
- * filter-message-search.c (body_regex): New callback to match text
- in the body using regex.
- (body_contains): Modified to only match using strstr.
- (header_regex): New callback to match headers using regex.
- (header_contains): Modified to only match using strstr.
-
-2000-10-24 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filtertypes.xml: Take out the reference to "Source".
-
- * filter-element.c (filter_element_new_type_name): Remove
- filter-url code.
-
- * filter-url.[c,h]: What was I smoking? There's no good reason to
- filter on source urls as there are other ways to get the same
- effect. Thanks to both Zucchi and Miguel for helping me see this
- :-)
-
-2000-10-24 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-driver.c: Fixed NULL in fprintf.
-
-2000-10-24 Dan Winship <danw@helixcode.com>
-
- * Makefile.am (libfilter-i18n.h): Build a fake header file with
- the titles from the xml files, for translation purposes.
-
- * filter-rule.c (get_rule_part_widget): Call _() on the rule's
- title.
-
- * filter-option.c (get_widget): Call _() on the option's title.
-
- * filter.glade: Turn on translatable strings.
-
- * libfilter-i18n.h, filter.glade.h: Translatable string files.
-
- * add #include <config.h> to a bunch of C files so that _()
- actually does anything. Undo some UTF8 frobs since we're now
- dealing in localized strings.
-
-2000-10-23 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-filter.c (less_parts): Set the remove button insensitive
- if there is only 1 action left.
- (more_parts): Set the remove button sensitive (since we now have 2
- or more actions).
- (get_widget): If there is only 1 action, disable the remove
- button.
-
- * filter-rule.c (xml_encode): If there is a defined source, don't
- set it to "incoming", set it to whatever the source is!
- (less_parts): Set the remove button insensitive if there is only 1
- criterion left.
- (more_parts): Set the remove button sensitive (since we now have 2
- or more criterion).
- (get_widget): If there is no name for the filter then set it to
- "Untitled", highlight it, and grab the focus. If there is only 1
- criterion, disable the remove button.
-
- * filter-editor.c, vfolder-editor.c: GUI fixes here and there as
- well as some consistancy fixes between them.
-
- * filter-driver.c (filter_driver_filter_mbox): Updated to send the
- source url to filter_driver_filter_message()
- (filter_driver_filter_folder): Updated to send the source url of
- the folder to filter_driver_filter_message()
- (filter_driver_filter_message): Now takes a source_url argument
- that represents the url of the folder the message is coming from
- (so that we may filter based upon that information).
-
-2000-10-23 Christopher James Lahey <clahey@helixcode.com>
-
- * filter.glade: Fixed these widgets to resize properly.
-
-2000-10-23 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-editor.c: Remove the "demand" source from the list.
-
- * filter.glade: Remove the "On Demand" option and replace it with
- an "Outgoing" option.
-
-2000-10-23 Christopher James Lahey <clahey@helixcode.com>
-
- * filter-editor.c, filter-filter.c, filter-folder.c,
- filter-part.c, filter-rule.c, rule-context.c, score-editor.c,
- vfolder-editor.c: Fixed these widgets to resize properly.
-
-2000-10-20 Jeffrey Stedfast <fejj@helixcode.com>
-
- * Makefile.am: Added filter-url.[c,h].
-
- * filter-message-search.c (get_source): New callback to get the
- source url of the message being filtered.
- (filter_message_search): Now takes a source argument.
-
- * filter-element.c (filter_element_new_type_name): Added code to
- handle URL types.
-
- * filter-url.[c,h]: New filter object to handle URLs (ie in the
- case of filtering on source url). FIXME: find a way to populate
- the source combo box (including mail-config.h breaks the build in
- the addressbook - how does including mail-tools.h not break the
- build???)
-
- * filtertypes.xml: Added the source filter type and added the
- move-to action.
-
- * filter-driver.c (do_move): New callback, a "Copy" action should
- just copy the message to another location while a Move should both
- copy the message to a new location and delete it from the source
- location.
- (do_delete): Set the deleted flag on the message info.
- (filter_driver_filter_message): Now returns void as we don't care
- if it was copied or not in the caller functions. Also check the
- CamelMessageInfo being passed in - if the message has been marked
- as deleted prior to being filtered, then return immediately as we
- don't want to apply filter actions to deleted messages.
-
-2000-10-19 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-driver.c (filter_driver_filter_folder): Start fetching at
- 1, not 0.
-
-2000-10-11 Not Zed <NotZed@HelixCode.com>
-
- * filter-driver.c (filter_driver_filter_mbox): Report the
- percentage of file complete for the filter.
-
-2000-10-10 Not Zed <NotZed@HelixCode.com>
-
- * filter-driver.c (filter_driver_run): Why on earth does this code
- ref all these objects for? This is not right at all.
- (filter_driver_run): Changed source type to a string.
- (filter_driver_run): REmove the very weird exception copying
- stuff - just ref it instead.
- (do_score):
- (do_colour):
- (do_stop):
- (do_copy):
- (mark_forward):
- (do_delete): Removed bogus 'terminated' testing. This is NOT
- NEEDED HERE. It is tested after every rule/action, and
- termination only makes sense at that point.
- (filter_driver_filter_message): new funciton (renamed), filter
- only a message.
- (filter_driver_filter_mbox): Filter a whole mbox.
- (filter_driver_run): If we aren't given an info, create a simple
- one based on the message headers.
- (filter_driver_filter_message): Renamed from filter_driver_run().
- (filter_driver_set_status_func): Set the status callback function.
- (filter_driver_set_default_folder): Set the default folder for
- filtering.
- (report_status): Internal function to report the status of a given
- event.
- (do_copy): Removed a pointless cache lookup - duh, we do it in
- open_folder anyway (infact, we do it in camel too!!).
- (filter_driver_filter_message): Removed pointless re-refing of
- arguments. Why would anyone think this could be any use at all?
- (filter_driver_filter_folder): New function to filter a whole
- folder.
-
- * filter-editor.c (rule_add): api fixes.
- (rule_edit):
- (rule_up):
- (rule_down):
- (set_sensitive): This didn't take into account the source, now it
- does.
- (select_source): Fix for api changes. Changed the rather generic
- 'number' argument to be 'source', and a string.
- (filter_editor_construct): Changed the 'number' to 'source', and
- set the string appropriately. Added a warning for one case where
- the glade file is out of sync.
-
- * score-editor.c (score_editor_construct):
- (rule_edit):
- (rule_delete):
- (rule_up):
- (rule_down):
- (set_sensitive): api fixes.
-
- * vfolder-editor.c (set_sensitive): Api fixes.
- (vfolder_editor_construct):
- (rule_edit):
- (vfolder_editor_construct):
-
- * rule-context.h (RCNextRuleFunc): Added a source argument.
-
- * rule-context.c (rule_context_next_rule): Added source argument.
- (rule_context_find_rule): Added source argument.
- (rule_context_get_rank_rule): Added source argument.
- (rule_context_get_rank_rule_with_source): Removed.
- (save): Fixed for changes to RCNextRuleFunc prototype.
-
- * filter-rule.h: Changed the source to be a string, removed the
- filter_source_t type.
-
- * filter-rule.c (filter_rule_set_source): New function to set the
- source of a rule. What idiot ran this code through indent?
- (filter_rule_find_list): Added a source argument.
- (filter_rule_next_list): Added a source argument.
- (get_widget): Fixed the wording. You dont remove search parts,
- you can only remove the last one. Why you even need to mention
- they are search 'criteria' is beyond me. Whoever added the
- scrolled window needs to be shot, its the single most awful GUI
- feature ever invented (ranks with the close button next to
- maximise).
- (xml_encode): Save source as a string (if present).
- (xml_decode): Likewise for loading & fixed a small memleak.
- (filter_rule_finalise): Free source.
-
-2000-10-06 Not Zed <NotZed@HelixCode.com>
-
- * rule-context.c (load): Remove the stupid on-demand cb shit.
- (rule_context_load): And here too.
-
-2000-09-27 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-driver.c (filter_driver_run): Now takes an argument to
- specify the log file (or NULL if logging is not to be performed).
-
-2000-09-19 Dan Winship <danw@helixcode.com>
-
- * Makefile.am (gladedir, filterdir): Use $(datadir), not
- $(prefix)/share.
-
-2000-09-18 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filtertypes.xml: Modified to use more intuitive naming
-
- * score-rule.c (xml_decode): Make sure the score is within our
- range
- (get_widget): Changed range to -3 to +3
-
- * filter-score.c (get_widget): Changed range to -3 to +3
- (xml_decode): Make sure the score is within our range
-
- * filter-rule.c (get_widget): Rearranged widgets.
-
- * filter-filter.c (get_widget): Rearranged widgets.
-
- * filter-editor.c (filter_editor_construct): Updated to allow for
- double-clicking on a rule to edit it.
-
-2000-09-18 Christopher James Lahey <clahey@helixcode.com>
-
- * filter-editor.c, filter-filter.c, filter-folder.c,
- filter-input.c, filter-message-search.c, filter-option.c,
- filter-rule.c, score-editor.c, vfolder-editor.c, vfolder-rule.c:
- Fixed the #include lines to deal properly with gal.
-
-2000-09-13 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-message-search.c (body_contains): Modified to only match
- text MIME parts in the message rather than the entire MIME message
- (header_contains): Added regex matching
-
-2000-09-12 Dan Winship <danw@helixcode.com>
-
- * rule-context.c (d):
- * filter-datespec.c (d): Turn off debugging output.
-
-2000-09-11 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-driver.c: We now use a "copied" variable to record
- whether a message was marked as copied or not instead of trying to
- "guess" by looking at the folders hash table as that won't work at
- all anymore.
- (do_copy): Renamed as this is more appropriate now that it
- actually copies the message rather than marking it for copying
- later. Also fixed a logic error which prevented a message from
- being dumped into a folder if the fodler had been previously
- opened.
-
-2000-09-11 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-driver.c (filter_driver_run): No longer takes a
- self_destruct argument.
-
-2000-09-11 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-driver.c (filter_driver_run): Don't freeze/thaw the
- default inbox here, let the caller freeze/thaw it. Don't destroy
- the folders hash table here, it's faster if we wait till the
- filter-driver is destroyed.
- (filter_driver_finalise): Destroy the folders hash table here
- (filter_driver_init): Initialize the folders hash table here
-
-2000-09-11 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filtertypes.xml: Changed "Header" to be "Message header" so it's
- not quite as confusing (??)
-
-2000-09-11 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filtertypes.xml: Updated to allow the user to specify arbitrary
- headers.
-
-2000-09-09 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-driver.c (filter_driver_run): Fixed a logic error. Only
- mark filtered as TRUE if it was successfully copied to another
- folder, this means don't mark true if the default inbox is NULL.
-
-2000-09-09 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-driver.c (filter_driver_run): Erm, okay I misunderstood
- what camel_folder_[un]hook_event() did - we don't even need this
- crap in the filter driver so lets take it completely out and let
- the caller handle this junk.
-
-2000-09-09 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-driver.c (filter_driver_run): Updated to not emit the
- folder_changed signal when a message is appended to the default
- mailbox - lets leave that up to the caller so we don't queue up a
- bunch of these emits if the caller is downloading messages for
- example.
-
-2000-09-08 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filtertypes.xml: Added scoring xml stuffs
-
- * Makefile.am: added filter-score.[c,h]
-
- * filter-score.[c,h]: New functions to handle the "score" filter
- type.
-
- * filter-element.c (filter_element_new_type_name): Added support
- for "score" type.
-
- * filter-driver.c (do_score): New ESExp callback for filter
- actions to set the score on a message.
-
- * filter-message-search.c (get_score): New ESExp callback for
- getting the score tag as an integer value.
-
-2000-09-07 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-driver.c (filter_driver_run): Now takes a
- CamelMessageInfo argument in preparation for handling scoring
-
-2000-09-07 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-driver.c (filter_driver_run): Modified to return a
- boolean value specifying whether or not the message was filtered
- into a folder other than the default. The default mailbox can now
- also be specified as NULL if the message shouldn't be appended to
- it in the case that it's not filtered into some other folder.
-
-2000-09-07 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-driver.c (filter_driver_run): Rewrote - this shouldn't
- need to be an async function
-
- * filter-message-search.c (match_all): Modified to look at the
- boolean value being fed to it and just to return that instead of
- always returning TRUE
-
-2000-09-07 Lauris Kaplinski <lauris@helixcode.com>
-
- * filter-editor.c, filter-filter.c, filter-folder.c, filter-option.c:
- * filter-rule.c, score-editor.c, vfolder-editor.c, vfolder-rule.c:
- More UTF-8 wrapping
-
-2000-09-06 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-driver.c (filter_driver_run): Totally rewritten to filter
- a single message at a time instead of filtering a folder.
-
- * filter-message-search.c (filter_message_search): New convenience
- function for searching a message.
-
-2000-08-24 Lauris Kaplinski <lauris@helixcode.com>
-
- * filter-folder.c: Use e_utf8 wrappers
-
- * filter-input.c: Use e_utf8 wrappers
-
- * filter-rule.c: Use e_utf8 wrappers
-
-2000-08-23 Dan Winship <danw@helixcode.com>
-
- * filter-datespec.c (cal_day_selected): Set seltime.tm_isdst to
- -1, not daylight, because the current dst value is not relevant to
- the selected date.
-
-2000-08-18 Peter Williams <peterw@helixcode.com>
-
- * filter-driver.c (do_filter_mail): Unlink a new parameter, path_to_unlink,
- if it is empty once the mail is filtered. Fixes a race in
- mail_tool_filter_contents_into.
-
- * filter-driver.h: Update the prototype.
-
-2000-08-14 Ettore Perazzoli <ettore@helixcode.com>
-
- * vfolder-editor.c (rule_add): Add translation marks and use stock
- buttons.
- (rule_edit): Likewise.
-
- * score-editor.c (rule_add): Add translation marks and use stock
- buttons.
- (rule_edit): Likewise.
-
- * rule-context.c (rule_context_add_rule_gui): Add translation
- marks and use stock buttons.
-
- * filter-part.c (main): Add translation marks and use
- stock buttons.
-
- * filter-folder.c (button_clicked): Add translation marks and use
- stock buttons.
-
- * filter-editor.c (rule_add): Add translation marks and use stock
- buttons.
- (rule_edit): Likewise.
-
- * filter-rule.c (get_widget): Add translation marks.
-
- * filter-filter.c (get_widget): Add translation marks. Add
- padding to make it look like the buttons in `filter-rule.c'.
-
-2000-08-17 Peter Williams <peterw@helixcode.com>
-
- Implement filtering on demand.
-
- * rule-context.h: Add a new callback to rule_context_load
- that allows the caller to hook on-demand rules into its UI.
-
- * rule-context.c (rule_context_load): Changed to pass the
- extra parameters to load().
- (load): If the rule is successfully loaded, call the provided
- callback so that the UI can be updated.
-
- * filter-editor.c (rule_add): Set the source of the new filter.
- (rule_edit): Use the new rule_context_get_rank_rule_with_source()
- so that we don't get a bad index into the GtkList.
- (rule_delete): Same as above.
- (rule_up): Same as above.
- (rule_down): Same as above.
- (select_source): New function. When the user changes the
- dropdown list to select a new source type, repopulate the
- list with rules of the appropriate type.
- (filter_editor_construct): Code moved from here into
- select_source(). Hook up all the elements of the source optionmenu
- to callbacks to select_source().
-
- * filter-rule.c (xml_encode): Save the rule's source type.
- (xml_decode): Load it. Default to 'incoming' if unspecified.
-
- * filter-rule.h: New enumeration, _filter_source_t, the
- specifies the rule's source. Add it to struct _FilterRule.
-
- * filter-driver.c (filter_driver_run): Add a new input,
- sourcetype, that specifies which rules to run (only ones
- with the same source will be run). struct filter_mail_input_t
- changed to accomodate.
- (do_filter_mail): Skip rules if they're not the specified source.
- If source and dest are the same, don't delete the messages or
- copy unnecessarily.
-
- * filter.glade: Make the optionmenu sensitive. Change "Outgoing"
- to "On Demand" (outgoing should be added later).
-
-2000-08-15 Peter Williams <peterw@curious-george.helixcode.com>
-
- * vfoldertype.xml, filtertypes.xml: Add entries defining the
- date-based message filtering and vfoldering.
-
- * filter-datespec.{c,h}: New files implementing the UI for
- date-based filtering and vfoldering -- specifically, choosing
- what to compare the message to.
-
- * filter-element,c: Hook up to create a datespec filter if
- that's what's called for.
-
- * Makefile.am: Build the new -datespec files.
-
-2000-08-13 Dan Winship <danw@helixcode.com>
-
- * Makefile.am (EXTRA_DIST): remove blank.xpm and check.xpm which
- no longer exist. Add filter.glade.
-
-2000-08-12 Dan Winship <danw@helixcode.com>
-
- * filter-driver.c (describe_filter_mail): Use
- mail_tool_get_folder_name here too. (Hm... this directory really
- shouldn't depend on stuff in mail/, but it already did. We'll have
- to sort this out later.)
-
-2000-08-11 Dan Winship <danw@helixcode.com>
-
- * filter-driver.c (do_filter_mail): Remove an '#if 0' that must
- have been left in accidentally, so that messages which are copied
- to other folders will not also be copied into the Inbox. Also,
- #ifdef out the line that printfs the rule, because the rules are
- often very large.
-
-2000-08-11 Not Zed <NotZed@HelixCode.com>
-
- * filter-driver.c (do_colour): Use proper accessor function
- instead of poking the structure.
-
-2000-08-10 Christopher James Lahey <clahey@helixcode.com>
-
- * filter-driver.c, filter-folder.c, rule-context.c,
- vfolder-editor.c: Fixed some warnings.
-
-2000-08-10 Peter Williams <peterw@helixcode.com>
-
- * filter-driver.c (do_filter_mail): Fix the infinite fetchmail.
-
-2000-08-10 Not Zed <NotZed@HelixCode.com>
-
- * filter-driver.c (filter_driver_run): Save the results of
- searches till we're done. So we dont have to go strduping strings
- agian and again and again and again ... Remove all the unecessary
- strdups.
- (do_colour): Implement.
- (filter_driver_run): Change for append api change.
- (free_key): Removed.
-
-2000-08-09 Not Zed <NotZed@HelixCode.com>
-
- * rule-context.c (rule_context_add_rule_gui): Helper function to
- add a rule, but present a gui first, asking for confirmation/allow
- editing.
- (rule_context_add_rule_gui): Keep track of context so it isn't freed under us.
-
- * filter-context.c (filter_context_create_action): Implement,
- helper to aid filter generation.
-
-2000-08-08 Peter Williams <peterw@helixcode.com>
-
- * filter-driver.c (close_folder): Fix an accidental GTK unref
- of a CamelObject.
-
-2000-08-03 Ettore Perazzoli <ettore@helixcode.com>
-
- * filter-folder.c (button_clicked): Use the base name of the
- Evoluton URI for the button's label.
- (get_widget): Likewise.
-
-2000-08-03 Peter Williams <peterw@helixcode.com>
-
- * filter-driver.c (op_filter_mail): Conform to the new mail-threads
- interface.
-
-2000-08-01 Not Zed <NotZed@HelixCode.com>
-
- * vfolder-editor.c (rule_add): Oops, create a vfolder_rule when we
- add a new one.
-
- * rule-context.c (load): If there are no user rules, dont bomb
- out.
-
-2000-07-31 Not Zed <NotZed@HelixCode.com>
-
- * filter-input.c (filter_input_set_value): Set value of a simple
- type to a new string.
-
- * filter-option.c (filter_option_set_current): New function to set
- the current value of an option.
-
- * filter-rule.c (filter_rule_find_list): New function to find a
- rule in a list, by name.
- (filter_rule_set_name): Let you set the name of a rule.
-
- * rule-context.c (rule_context_find_rule): Find a rule by name.
- (rule_context_create_part): Helper to find and clone a part by
- name.
-
- * filter-folder.c (button_clicked): Fix warning.
-
- * filter.glade: Add new widgets for vfolder rule editor.
-
- * vfolder-context.c (vfolder_context_init): Changed to use vfolder
- rule as the rule type.
-
- * vfolder-rule.c: New class to encode extra information required
- for vfolder rules.
-
-2000-07-30 Not Zed <NotZed@HelixCode.com>
-
- ** Almost a total rewrite of every file, except for filter-driver
- which just had minor updates.
-
- The rule format has changed.
-
-2000-07-24 Dan Winship <danw@helixcode.com>
-
- * filter-driver.c (do_delete, filter_driver_run): Update for
- CamelFolder API changes. (delete_message and get_uids don't take
- exceptions any more.)
-
-2000-07-21 Peter Williams <peterw@helixcode.com>
-
- * filter-driver.c (cleanup_filter_mail): Use the exception
- provided to us by the async manager instead of allocating
- our own; use mail_tool_camel_lock_{up,down} around camel
- operations.
- (filter_driver_run): Make it return void.
-
-2000-07-20 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-driver.c: Update to make "async".
-
-2000-07-11 Dan Winship <danw@helixcode.com>
-
- * filter-driver.c: Update for CamelFolder API changes
-
-2000-07-11 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-driver.c (filter_driver_run): Updated to reflect changes to
- camel_folder_append_message ()
-
-2000-07-09 Dan Winship <danw@helixcode.com>
-
- * filter-xml.[ch]: add a "string" type
-
- * filtertype.xml, vfoldertypes.xml: Use type="string" rather than
- "folder" for subject/body matching.
-
- * filter-arg-types.c: Update some strings for "text" input. Fix
- some warnings (including one that pointed out a real bug).
-
- * filter-arg.c, filter-druid.c, filter-format.c: fix warnings
-
-2000-07-07 Dan Winship <danw@helixcode.com>
-
- * filter-driver.c: Update for camel_folder_search_by_expression
- change (GList -> GPtrArray).
-
- * vfoldertypes.xml: sync this to filtertypes.xml (to/cc thing)
-
-2000-07-05 Dan Winship <danw@helixcode.com>
-
- * remove some non-error case debugging messages.
-
- * filtertypes.xml: Fix typos and update the "to-address" rule to
- match To or Cc.
- * vfoldertypes.xml: Fix typos.
-
- * filter-driver.c (do_delete, do_copy, do_stop,
- filter_driver_run): Add uids to the "processed" list only after
- succesfully doing something with them. Fixes the problem where
- copying a message to a folder that didn't exist would result in it
- disapearing.
-
-2000-07-02 Ettore Perazzoli <ettore@helixcode.com>
-
- * filter-driver.c (filter_driver_new): Don't free the ruleset nor
- the xmlDoc. This will make us leak [I think], but at least
- filters work.
-
-2000-07-02 Dan Winship <danw@helixcode.com>
-
- * filter-driver.c (open_folder): freeze the folder to avoid
- multiple folder_changed's
- (close_folder): and thaw it.
-
-2000-07-02 Dan Winship <danw@helixcode.com>
-
- * filter-driver.c (filter_driver_new): kill
- filter_driver_set_session and filter_driver_set_rules and instead
- make filter_driver_new take the rules and a callback function it
- can use to turn URIs into folders.
- (open_folder): Use the callback function rather than calling camel
- directly: some URIs need special handling to turn them into stores
- and folders correctly, so let the mailer do that.
-
-2000-07-01 Ettore Perazzoli <ettore@helixcode.com>
-
- * filter-arg-types.c (arg_folder_edit_value): Only allow type
- "mail" when selecting a folder for the filter.
-
-2000-07-01 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-driver.c: Updated to reflect changes made to
- camel-folder.
-
-2000-06-30 Peter Williams <peterw@curious-george.helixcode.com>
-
- * filter-xml.c (filter_load_optionset_file): Check for failure
- when loading the filter doc.
-
- * filter-driver.c (filter_driver_set_rules): Ditto.
-
- * filter-editor.c (filter_editor_set_rule_files): Ditto.
-
-2000-06-29 Ettore Perazzoli <ettore@helixcode.com>
-
- * filter-arg-types.c: Replaced `global_shell_interface' with
- `global_shell_client'.
- (arg_folder_edit_value): Use
- `evolution_shell_client_user_select_folder()'.
- (create_listener): Removed.
- (impl_FolderSelectionListener_selected): Removed, together with
- all the ::Listener stuff.
-
-2000-06-29 Arik Devens <arik@helixcode.com>
-
- * vfoldertypes.xml (ruleset type="match"): Changed Cc to CC to be
- the same as the other CC rule. None of this works however, cause
- the CC code is not hooked up to camel... oh well ;-(
-
-2000-06-29 Arik Devens <arik@helixcode.com>
-
- * vfoldertypes.xml (ruleset type="match"): Added a Cc rule to
- vfolders. Works like To except on the Cc of a message ;-)
-
-2000-06-28 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-arg-types.c (arg_string_edit_value): Changed "Filter name"
- to "Option value" as "Filter name" made no sense in the dialog
- (arg_address_edit_value): Same
- (arg_folder_edit_value): What do we want to return??
-
-2000-06-27 Ettore Perazzoli <ettore@helixcode.com>
-
- * filter-xml.c (load_desc): Strdup content before assigning the
- value. Also, no need to check for NULL when g_strdup()ing as
- g_strdup() returns NULL for a NULL arg.
-
-2000-06-27 Ettore Perazzoli <ettore@helixcode.com>
-
- * Makefile.am (INCLUDES): `-I$(top_builddir)/shell' so that it
- works with builddir != srcdir. [We need to #include
- "Evolution.h".]
-
-2000-06-27 Michael Zucchi <zucchi@zedzone.mmc.com.au>
-
- * Makefile.am (INCLUDES): Add the shell dir for includes (for
- corba interfaces).
-
- * filter-arg-types.c (impl_FolderSelectionListener_selected):
- Listener for folder query. Sigh.
- (create_listener): Create the listener object for the folder
- dialogue query. Uses a global for linkage to the shell object,
- via the mail component.
- (arg_folder_edit_value): Call the folder selection dialogue to
- edit the value, rather than a simple text widget.
-
-2000-06-26 Jeffrey Stedfast <fejj@helixcode.com>
-
- * filter-editor.c: Added a #include <gnome-xml/parser.h> as this
- was needed (since we used the xml parser...)
- (druid_dialogue_clicked): Do we want to use struct filter_option
- or do we instead want to use struct filter_optionrule as we had before?
- Since the function we pass the data to expects filter_option, I suspect
- that that is what we want.
-
- * filter-format.h (filter_description_html_write): Renamed from
- description_html_write in order to match function name in
- filter-format.c
-
- * filter-druid.c (option_name_changed): Fixed a memory leak (Free'd
- a filter description list).
-
- * filter-arg-types.c (arg_folder_edit_values): Free'd GList data in
- argin->values.
-
- * filter-driver.c (filter_driver_set_rules): Added code to free an
- xmlDoc and some other data.
-
- * filter-arg.h: Add prototypes for filter_arg_write_html() and
- filter_arg_write_text();
-
- * filter-arg-types.c: Lets see if we can't get rid of some of these
- warnings... (use some casts to make warnings go away)
- (arg_address_edit_value): Lets make sure that ad exists before looking
- at member data.
-
-2000-06-16 Dan Winship <danw@helixcode.com>
-
- * filter-driver.c (do_delete, filter_driver_run): Update for Camel
- flag handling changes.
-
-2000-06-15 Dan Winship <danw@helixcode.com>
-
- * filter-driver.c (open_folder, close_folder): Update for
- CamelFolder changes.
-
-2000-06-09 Jacob Berkman <jacob@helixcode.com>
-
- * filter-editor.c (add_or_edit): use stock pixmap buttons
-
- * filter-druid.c (build_druid): remove the border on the notebook,
- put the html widget in a scroll frame, and add some padding
-
-2000-06-06 Dan Winship <danw@helixcode.com>
-
- * filter-driver.c (open_folder): Update for folder
- existence/creation changes.
-
-2000-06-02 Christopher James Lahey <clahey@helixcode.com>
-
- * filter-driver.c: Free the exception and the priv struct.
-
-2000-06-01 Christopher James Lahey <clahey@helixcode.com>
-
- * filter-arg-types.c (arg_address_edit_value): Search for ad in
- arg->values instead of text since it's a list of
- filter_arg_adresses. Also, free the old value in the list.
-
-2000-05-30 Not Zed <NotZed@HelixCode.com>
-
- * filtertypes.xml: And here too.
-
- * vfoldertypes.xml: Add body-contains and not-body-contains
- types.
-
-2000-05-27 Not Zed <NotZed@HelixCode.com>
-
- * vfoldertypes.xml: New file - lists rules appropriate for
- vfolders (no actions, etc).
-
- * Makefile.am (EXTRA_DIST): Add vfoldertypes.xml
-
- * filter-driver.c (filter_driver_expand_option): Made public from
- expand_filter_option.
- (filter_driver_rule_count): find out how many user rules are
- defined.
- (filter_driver_rule_get): Get a user rule by index.
-
-2000-05-21 Ettore Perazzoli <ettore@helixcode.com>
-
- * filter-druid.c: Don't pass an empty URL to `gtk_html_begin()'
- anymore.
-
- * filter-arg-types.c: Updated for the new GtkHTML API which uses
- `GtkHTMLStream *' instead of `GtkHTMLStreamHandle'.
- * filter-arg.c: Likewise.
- * filter-arg.h: Likewise.
- * filter-druid.c: Likewise.
-
- * filter-format.c: Likewise.
- * filter-format.h: Likewise.
-
-2000-05-18 Dan Winship <danw@helixcode.com>
-
- * filter-driver.c (filter_driver_run): update for
- camel_folder_get_uids change
-
-2000-05-17 NotZed <NotZed@HelixCode.com>
-
- * filter-druid.c: Fix some html formatting.
-
-2000-05-16 NotZed <NotZed@HelixCode.com>
-
- * filter-driver.c (filter_driver_run): Delete all processed
- messages. This is probably going to slow it down a bit.
- (filter_driver_run): Close folders before destroying them *sigh*.
- (open_folder): Actually open the folder. Doh.
-
- * filtertypes.xml: Initial filter rules.
-
- * filter-xml.c (filter_write_optionset): Save the description
- also.
- (write_description): Routine to save description - only saves 1
- node of description.
-
- * filter-arg.c (filter_arg_edit_clicked): Dont free edata here,
- let the destroy do it(?)
-
- * filter-editor.c (main): Simple driver program for testing, so i
- can fix all this really broken code *sigh*
-
-2000-05-15 NotZed <NotZed@HelixCode.com>
-
- * filter-editor.c (filter_editor_set_rule_files): filename based
- interface.
- (filter_editor_save_rules): Interface to save the options to a
- filename.
-
- * filter-xml.[ch]: Bunch of cleanup.
-
- * filter-xml.c (filter_*_file): New interfaces to read/write files
- directly, rather than messing with xmldoc crap.
-
- * Makefile.am: Removed filter-driver test program, now just part
- of libfilter.
-
- * filter-driver.c: Made an object, with an api and everything, can
- apply a filter to a given mailbox.
-
-2000-05-10 Christopher James Lahey <clahey@helixcode.com>
-
- * filter-arg.h: Changed tree.h to gnome-xml/tree.h.
-
- * Makefile.am: Added filter-arg-types.h, filter-arg.h,
- filter-xml.h, filter-format.h, filter-druid.h, filter-editor.h.
-
-2000-05-02 Matt Loper <matt@helixcode.com>
-
- * Makefile.am: set G_LOG_DOMAIN.
-
-2000-05-01 NotZed <NotZed@HelixCode.com>
-
- * filter-driver.c (main): Fix for api.
-
-2000-04-30 Dan Winship <danw@helixcode.com>
-
- * filter-driver.c (start): Remove no-longer-necessary call to
- camel_provider_register_as_module.
-
-2000-04-25 Ettore Perazzoli <ettore@helixcode.com>
-
- * Makefile.am (INCLUDES): Use `$(GTKHTML_CFLAGS)'.
-
-2000-04-20 NotZed <NotZed@HelixCode.com>
-
- * filter-driver.c: Removed a bunch of crappy unrequired headers.
-
- * Makefile.am (filter_driver_LDADD): Added libibex back again.
-
-2000-04-18 Dan Winship <danw@helixcode.com>
-
- * filter-driver.c: remove unused camel-log.h include
-
-2000-04-12 Matt Loper <matt@helixcode.com>
-
- * filter-arg.c (filter_arg_edit_value): Return a value.
-
-2000-03-27 NotZed <NotZed@HelixCode.com>
-
- * filter-xml.c (tokenise_xmlfreeprop): Free a prop after
- tokenising it.
- (find_node_attr): Free the prop after using it.
- (load_desc): Ditto. I use free() because xmlFree() is nowhere to
- be found.
- (filter_load_optionset): Ditto.
-
- * filter-arg-types.c (arg_address_values_add_xml): free() xml
- stuff, plugs a leak.
- (arg_folder_values_add_xml): Ditto.
-
-2000-03-22 NotZed <NotZed@HelixCode.com>
-
- * filter-driver.c (main): Changed to use async search api.
-
-2000-03-04 NotZed <NotZed@HelixCode.com>
-
- * filter-druid.c (html_write_options): Output 'and' bits between
- the rules.
-
- * filter-driver.c (main): Actually implement filtering, at least,
- from Inbox. Copy messages to folder (in the same store only, so
- far), delete, and stop processing are implemented, and the logic
- to handle default processing.
-
- * filter-xml.c (load_optionvalue): Fix up a bug where we lost the
- name of the arg (ouch).
- * filter-xml.c: Wrapped printf's in debug macros.
-
-2000-03-02 NotZed <NotZed@HelixCode.com>
-
- * filter-druid.c (object_destroy): Disconnect the list signal, so
- we dont get spurious emits during destroy.
- (arg_changed): Callback to update filter arg asynchronously.
- (arg_link_clicked): Edit the value non-modally.
-
- * filter-arg.c (filter_arg_edit_values_1): Changed to use
- non-modal interface.
-
-2000-03-01 Ettore Perazzoli <ettore@helixcode.com>
-
- * Makefile.am: New file.
-
- * Makefile: Removed. I wonder why we are using plain Makefiles
- instead of automake Makefiles at all.
-
-2000-02-29 NotZed <NotZed@HelixCode.com>
-
- * filter-driver.c (main): Remove gui code, this will be actual
- filtering code.
-
- * Makefile: Added filter-editor to the library.
-
- * filter-editor.c (main): Comment out, make it a proper library.
-
-2000-02-28 NotZed <NotZed@HelixCode.com>
-
- * filter-druid.c: Removed unused header.
-
- * Makefile: Removed references to filter-sexp.[ch].
-
- * filter-sexp.[ch]: Removed some unecessary includes. Moved to
- e-util. Renamed callers.
-
-2000-02-24 NotZed <NotZed@HelixCode.com>
-
- * filter-xml.c (filter_description_free):
- (filter_load_ruleset_free):
- (filter_load_optionset_free): Functions for memory management.
-
- * filter-arg.c (filter_arg_copy): Copy the values of one arg into
- another.
-
- * filter-editor.c: New widget, a dialogue which uses filter-druid
- to present the various editing views.
- (druid_dialogue_clicked): On finish, save the user's new filter
- definition where it came from.
-
- * filter-druid.c: Changed to just being a notebook with no tabs,
- rather than a full druid (no next/prev/etc buttons).
- (option_name_changed): Update the option's description as the user
- enters it in.
-
-2000-02-22 NotZed <NotZed@HelixCode.com>
-
- * filter-xml.c (filter_clone_optionrule):
- (filter_clone_optionrule_free):
- (filter_optionrule_new_from_rule): New utility functions for
- working with the internal rule format.
-
- * filter-arg.[ch]: Added new callbacks for editing a single value,
- and a new editor which shows all items in a list, and allows you
- to edit them via the single-edit method. This needs some cleanup
- for some unused/unusable virtual methods (edit_values,
- write_html?).
-
- * Makefile: Add the druid for build.
-
- * filter-druid.c: A 'druid' widget for editing a single filter
- rule.
-
-2000-02-21 Matt Loper <matt@helixcode.com>
-
- * .cvsignore: New file.
-
-2000-02-18 NotZed <NotZed@HelixCode.com>
-
- * blank/check.xpm: Added forgotten files.
-
- * Uh, more changes, lots, its still work in progress.
-
-2000-02-14 NotZed <notzed@helixcode.com>
-
- * Initial import.
-
diff --git a/filter/Makefile.am b/filter/Makefile.am
deleted file mode 100644
index 17b150baa9..0000000000
--- a/filter/Makefile.am
+++ /dev/null
@@ -1,85 +0,0 @@
-
-gladedir = $(datadir)/evolution/glade
-glade_DATA = filter.glade
-
-INCLUDES = \
- -I $(top_srcdir) \
- -I $(top_srcdir)/libibex \
- -I $(top_srcdir)/camel \
- -I $(top_srcdir)/e-util \
- -I $(top_srcdir)/shell \
- -I $(top_srcdir)/camel/providers/mbox \
- -I $(top_builddir)/shell \
- -I $(GNOME_INCLUDEDIR) \
- $(GTKHTML_CFLAGS) \
- $(BONOBO_GNOME_CFLAGS) \
- $(EXTRA_GNOME_CFLAGS) \
- -DFILTER_GLADEDIR=\"$(gladedir)\" \
- -DG_LOG_DOMAIN=\"filter\"
-##
-
-noinst_LTLIBRARIES = \
- libfilter.la
-
-libfilter_la_SOURCES = \
- filter-code.c \
- filter-code.h \
- filter-colour.c \
- filter-colour.h \
- filter-context.c \
- filter-context.h \
- filter-datespec.c \
- filter-datespec.h \
- filter-editor.c \
- filter-editor.h \
- filter-element.c \
- filter-element.h \
- filter-filter.c \
- filter-filter.h \
- filter-folder.c \
- filter-folder.h \
- filter-input.c \
- filter-input.h \
- filter-int.c \
- filter-int.h \
- filter-option.c \
- filter-option.h \
- filter-part.c \
- filter-part.h \
- filter-rule.c \
- filter-rule.h \
- filter-score.c \
- filter-score.h \
- filter-source.h \
- filter-source.c \
- rule-context.c \
- rule-context.h \
- rule-editor.c \
- rule-editor.h \
- score-context.c \
- score-context.h \
- score-editor.c \
- score-editor.h \
- score-rule.c \
- score-rule.h \
- vfolder-context.c \
- vfolder-context.h \
- vfolder-editor.c \
- vfolder-editor.h \
- vfolder-rule.c \
- vfolder-rule.h
-
-libfilter_la_DEPENDENCIES = libfilter-i18n.h
-
-EXTRA_DIST = filtertypes.xml vfoldertypes.xml \
- $(glade_DATA) libfilter-i18n.h
-
-# basic rules.
-filterdir = $(datadir)/evolution
-filter_DATA = filtertypes.xml vfoldertypes.xml
-
-libfilter-i18n.h: filtertypes.xml vfoldertypes.xml
- echo "/* Automatically generated. Do not edit. */" > $@; \
- cat $(srcdir)/filtertypes.xml $(srcdir)/vfoldertypes.xml | \
- sed -n -e 's:.*<title>\(.*\)</title>:char *s = N_("\1");:p' | \
- sort -u >> $@
diff --git a/filter/filter-code.c b/filter/filter-code.c
deleted file mode 100644
index ecdccc4b97..0000000000
--- a/filter/filter-code.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright (C) 2000 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "filter-code.h"
-
-static void build_code(FilterElement *fe, GString *out, struct _FilterPart *ff);
-static void format_sexp(FilterElement *, GString *);
-
-static void filter_code_class_init (FilterCodeClass *class);
-static void filter_code_init (FilterCode *gspaper);
-static void filter_code_finalise (GtkObject *obj);
-
-static FilterInputClass *parent_class;
-
-guint
-filter_code_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "FilterCode",
- sizeof(FilterCode),
- sizeof(FilterCodeClass),
- (GtkClassInitFunc)filter_code_class_init,
- (GtkObjectInitFunc)filter_code_init,
- (GtkArgSetFunc)NULL,
- (GtkArgGetFunc)NULL
- };
-
- type = gtk_type_unique(filter_input_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-filter_code_class_init (FilterCodeClass *class)
-{
- GtkObjectClass *object_class;
- FilterElementClass *filter_element = (FilterElementClass *)class;
-
- object_class = (GtkObjectClass *)class;
- parent_class = gtk_type_class(filter_input_get_type ());
-
- filter_element->build_code = build_code;
- filter_element->format_sexp = format_sexp;
-
- object_class->finalize = filter_code_finalise;
- /* override methods */
-
-}
-
-static void
-filter_code_init (FilterCode *o)
-{
- ((FilterInput *)o)->type = g_strdup("code");
-}
-
-static void
-filter_code_finalise(GtkObject *obj)
-{
- FilterCode *o = (FilterCode *)obj;
-
- o = o;
-
- ((GtkObjectClass *)(parent_class))->finalize(obj);
-}
-
-/**
- * filter_code_new:
- *
- * Create a new FilterCode object.
- *
- * Return value: A new #FilterCode object.
- **/
-FilterCode *
-filter_code_new(void)
-{
- FilterCode *o = (FilterCode *)gtk_type_new(filter_code_get_type ());
- return o;
-}
-
-/* here, the string IS the code */
-static void build_code(FilterElement *fe, GString *out, struct _FilterPart *ff)
-{
- GList *l;
- FilterInput *fi = (FilterInput *)fe;
-
- l = fi->values;
- while (l) {
- g_string_append(out, (char *)l->data);
- l = g_list_next(l);
- }
-}
-
-/* and we have no value */
-static void format_sexp(FilterElement *fe, GString *out)
-{
- return;
-}
diff --git a/filter/filter-code.h b/filter/filter-code.h
deleted file mode 100644
index 32c62f543f..0000000000
--- a/filter/filter-code.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2000 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef _FILTER_CODE_H
-#define _FILTER_CODE_H
-
-#include "filter-input.h"
-
-#define FILTER_CODE(obj) GTK_CHECK_CAST (obj, filter_code_get_type (), FilterCode)
-#define FILTER_CODE_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, filter_code_get_type (), FilterCodeClass)
-#define IS_FILTER_CODE(obj) GTK_CHECK_TYPE (obj, filter_code_get_type ())
-
-typedef struct _FilterCode FilterCode;
-typedef struct _FilterCodeClass FilterCodeClass;
-
-struct _FilterCode {
- FilterInput parent;
-};
-
-struct _FilterCodeClass {
- FilterInputClass parent_class;
-
- /* virtual methods */
-
- /* signals */
-};
-
-guint filter_code_get_type (void);
-FilterCode *filter_code_new (void);
-
-/* methods */
-
-#endif /* ! _FILTER_CODE_H */
-
diff --git a/filter/filter-colour.c b/filter/filter-colour.c
deleted file mode 100644
index d3a3fa022b..0000000000
--- a/filter/filter-colour.c
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * Copyright (C) 2000 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gtk/gtksignal.h>
-#include <libgnomeui/gnome-color-picker.h>
-
-#include "e-util/e-sexp.h"
-#include "filter-colour.h"
-
-#define d(x)
-
-static void xml_create(FilterElement *fe, xmlNodePtr node);
-static xmlNodePtr xml_encode(FilterElement *fe);
-static int xml_decode(FilterElement *fe, xmlNodePtr node);
-static GtkWidget *get_widget(FilterElement *fe);
-static void build_code(FilterElement *fe, GString *out, struct _FilterPart *ff);
-static void format_sexp(FilterElement *, GString *);
-
-static void filter_colour_class_init (FilterColourClass *class);
-static void filter_colour_init (FilterColour *gspaper);
-static void filter_colour_finalise (GtkObject *obj);
-
-#define _PRIVATE(x) (((FilterColour *)(x))->priv)
-
-struct _FilterColourPrivate {
-};
-
-static FilterElementClass *parent_class;
-
-enum {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-guint
-filter_colour_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "FilterColour",
- sizeof(FilterColour),
- sizeof(FilterColourClass),
- (GtkClassInitFunc)filter_colour_class_init,
- (GtkObjectInitFunc)filter_colour_init,
- (GtkArgSetFunc)NULL,
- (GtkArgGetFunc)NULL
- };
-
- type = gtk_type_unique(filter_element_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-filter_colour_class_init (FilterColourClass *class)
-{
- GtkObjectClass *object_class;
- FilterElementClass *filter_element = (FilterElementClass *)class;
-
- object_class = (GtkObjectClass *)class;
- parent_class = gtk_type_class(filter_element_get_type ());
-
- object_class->finalize = filter_colour_finalise;
-
- /* override methods */
- filter_element->xml_create = xml_create;
- filter_element->xml_encode = xml_encode;
- filter_element->xml_decode = xml_decode;
- filter_element->get_widget = get_widget;
- filter_element->build_code = build_code;
- filter_element->format_sexp = format_sexp;
-
- /* signals */
-
- gtk_object_class_add_signals(object_class, signals, LAST_SIGNAL);
-}
-
-static void
-filter_colour_init (FilterColour *o)
-{
- o->priv = g_malloc0(sizeof(*o->priv));
-}
-
-static void
-filter_colour_finalise(GtkObject *obj)
-{
- FilterColour *o = (FilterColour *)obj;
-
- o = o;
-
- ((GtkObjectClass *)(parent_class))->finalize(obj);
-}
-
-/**
- * filter_colour_new:
- *
- * Create a new FilterColour object.
- *
- * Return value: A new #FilterColour object.
- **/
-FilterColour *
-filter_colour_new(void)
-{
- FilterColour *o = (FilterColour *)gtk_type_new(filter_colour_get_type ());
- return o;
-}
-
-static void xml_create(FilterElement *fe, xmlNodePtr node)
-{
- /*FilterColour *fc = (FilterColour *)fe;*/
-
- /* parent implementation */
- ((FilterElementClass *)(parent_class))->xml_create(fe, node);
-}
-
-static xmlNodePtr xml_encode(FilterElement *fe)
-{
- xmlNodePtr value;
- FilterColour *fc = (FilterColour *)fe;
- char hex[16];
-
- d(printf("Encoding colour as xml\n"));
- value = xmlNewNode(NULL, "value");
- xmlSetProp(value, "name", fe->name);
- xmlSetProp(value, "type", "colour");
-
- sprintf(hex, "%04x", fc->r);
- xmlSetProp(value, "red", hex);
- sprintf(hex, "%04x", fc->g);
- xmlSetProp(value, "green", hex);
- sprintf(hex, "%04x", fc->b);
- xmlSetProp(value, "blue", hex);
- sprintf(hex, "%04x", fc->a);
- xmlSetProp(value, "alpha", hex);
-
- return value;
-}
-
-static guint16
-get_value(xmlNodePtr node, char *name)
-{
- unsigned int ret;
- char *value;
-
- value = xmlGetProp(node, name);
- sscanf(value, "%04x", &ret);
- xmlFree(value);
- return ret;
-}
-
-
-static int xml_decode(FilterElement *fe, xmlNodePtr node)
-{
- FilterColour *fc = (FilterColour *)fe;
-
- xmlFree (fe->name);
- fe->name = xmlGetProp(node, "name");
- fc->r = get_value(node, "red");
- fc->g = get_value(node, "green");
- fc->b = get_value(node, "blue");
- fc->a = get_value(node, "alpha");
-
- return 0;
-}
-
-static void set_colour(GnomeColorPicker *cp, guint r, guint g, guint b, guint a, FilterColour *fc)
-{
- fc->r = r;
- fc->g = g;
- fc->b = b;
- fc->a = a;
-}
-
-static GtkWidget *get_widget(FilterElement *fe)
-{
- FilterColour *fc = (FilterColour *)fe;
- GnomeColorPicker *cp;
-
- cp = (GnomeColorPicker *)gnome_color_picker_new();
- gnome_color_picker_set_i16(cp, fc->r, fc->g, fc->b, fc->a);
- gtk_widget_show((GtkWidget *)cp);
- gtk_signal_connect((GtkObject *)cp, "color_set", set_colour, fe);
- return (GtkWidget *)cp;
-}
-
-static void build_code(FilterElement *fe, GString *out, struct _FilterPart *ff)
-{
- return;
-}
-
-static void format_sexp(FilterElement *fe, GString *out)
-{
- char *str;
- FilterColour *fc = (FilterColour *)fe;
-
- str =g_strdup_printf("rgb:%04x/%04x/%04x", fc->r, fc->g, fc->b);
- e_sexp_encode_string(out, str);
- g_free(str);
-}
diff --git a/filter/filter-colour.h b/filter/filter-colour.h
deleted file mode 100644
index 672ae8fc5a..0000000000
--- a/filter/filter-colour.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2000 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef _FILTER_COLOUR_H
-#define _FILTER_COLOUR_H
-
-#include "filter-element.h"
-
-#define FILTER_COLOUR(obj) GTK_CHECK_CAST (obj, filter_colour_get_type (), FilterColour)
-#define FILTER_COLOUR_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, filter_colour_get_type (), FilterColourClass)
-#define IS_FILTER_COLOUR(obj) GTK_CHECK_TYPE (obj, filter_colour_get_type ())
-
-typedef struct _FilterColour FilterColour;
-typedef struct _FilterColourClass FilterColourClass;
-
-struct _FilterColour {
- FilterElement parent;
- struct _FilterColourPrivate *priv;
-
- guint16 r,g,b,a;
-};
-
-struct _FilterColourClass {
- FilterElementClass parent_class;
-
- /* virtual methods */
-
- /* signals */
-};
-
-guint filter_colour_get_type (void);
-FilterColour *filter_colour_new (void);
-
-/* methods */
-
-#endif /* ! _FILTER_COLOUR_H */
-
diff --git a/filter/filter-context.c b/filter/filter-context.c
deleted file mode 100644
index 18a70abd77..0000000000
--- a/filter/filter-context.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Copyright (C) 2000 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gtk/gtktypeutils.h>
-#include <gtk/gtkobject.h>
-
-#include "filter-context.h"
-#include "filter-filter.h"
-
-#define d(x)
-
-static void filter_context_class_init (FilterContextClass *class);
-static void filter_context_init (FilterContext *gspaper);
-static void filter_context_finalise (GtkObject *obj);
-
-#define _PRIVATE(x) (((FilterContext *)(x))->priv)
-
-struct _FilterContextPrivate {
-};
-
-static RuleContextClass *parent_class;
-
-enum {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-guint
-filter_context_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "FilterContext",
- sizeof(FilterContext),
- sizeof(FilterContextClass),
- (GtkClassInitFunc)filter_context_class_init,
- (GtkObjectInitFunc)filter_context_init,
- (GtkArgSetFunc)NULL,
- (GtkArgGetFunc)NULL
- };
-
- type = gtk_type_unique(rule_context_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-filter_context_class_init (FilterContextClass *class)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass *)class;
- parent_class = gtk_type_class(rule_context_get_type ());
-
- object_class->finalize = filter_context_finalise;
- /* override methods */
-
- /* signals */
-
- gtk_object_class_add_signals(object_class, signals, LAST_SIGNAL);
-}
-
-static void
-filter_context_init (FilterContext *o)
-{
- o->priv = g_malloc0(sizeof(*o->priv));
-
- rule_context_add_part_set((RuleContext *)o, "partset", filter_part_get_type(),
- rule_context_add_part, rule_context_next_part);
- rule_context_add_part_set((RuleContext *)o, "actionset", filter_part_get_type(),
- (RCPartFunc)filter_context_add_action,
- (RCNextPartFunc)filter_context_next_action);
-
- rule_context_add_rule_set((RuleContext *)o, "ruleset", filter_filter_get_type(),
- (RCRuleFunc)rule_context_add_rule, rule_context_next_rule);
-}
-
-static void
-filter_context_finalise(GtkObject *obj)
-{
- FilterContext *o = (FilterContext *)obj;
-
- o = o;
-
- ((GtkObjectClass *)(parent_class))->finalize(obj);
-}
-
-/**
- * filter_context_new:
- *
- * Create a new FilterContext object.
- *
- * Return value: A new #FilterContext object.
- **/
-FilterContext *
-filter_context_new(void)
-{
- FilterContext *o = (FilterContext *)gtk_type_new(filter_context_get_type ());
- return o;
-}
-
-void filter_context_add_action(FilterContext *f, FilterPart *action)
-{
- d(printf("find action : "));
- f->actions = g_list_append(f->actions, action);
-}
-
-FilterPart *filter_context_find_action(FilterContext *f, const char *name)
-{
- d(printf("find action : "));
- return filter_part_find_list(f->actions, name);
-}
-
-FilterPart *filter_context_create_action(FilterContext *f, const char *name)
-{
- FilterPart *part;
-
- part = filter_context_find_action(f, name);
- if (part)
- part = filter_part_clone(part);
- return part;
-}
-
-FilterPart *filter_context_next_action(FilterContext *f, FilterPart *last)
-{
- return filter_part_next_list(f->actions, last);
-}
diff --git a/filter/filter-context.h b/filter/filter-context.h
deleted file mode 100644
index e46621c8e6..0000000000
--- a/filter/filter-context.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2000 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef _FILTER_CONTEXT_H
-#define _FILTER_CONTEXT_H
-
-#include "rule-context.h"
-
-#define FILTER_CONTEXT(obj) GTK_CHECK_CAST (obj, filter_context_get_type (), FilterContext)
-#define FILTER_CONTEXT_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, filter_context_get_type (), FilterContextClass)
-#define IS_FILTER_CONTEXT(obj) GTK_CHECK_TYPE (obj, filter_context_get_type ())
-
-typedef struct _FilterContext FilterContext;
-typedef struct _FilterContextClass FilterContextClass;
-
-struct _FilterContext {
- RuleContext parent;
- struct _FilterContextPrivate *priv;
-
- GList *actions;
-};
-
-struct _FilterContextClass {
- RuleContextClass parent_class;
-
- /* virtual methods */
-
- /* signals */
-};
-
-guint filter_context_get_type (void);
-FilterContext *filter_context_new (void);
-
-/* methods */
-void filter_context_add_action(FilterContext *f, FilterPart *action);
-FilterPart *filter_context_find_action(FilterContext *f, const char *name);
-FilterPart *filter_context_create_action(FilterContext *f, const char *name);
-FilterPart *filter_context_next_action(FilterContext *f, FilterPart *last);
-
-#endif /* ! _FILTER_CONTEXT_H */
-
diff --git a/filter/filter-datespec.c b/filter/filter-datespec.c
deleted file mode 100644
index 285b99b31d..0000000000
--- a/filter/filter-datespec.c
+++ /dev/null
@@ -1,750 +0,0 @@
-/*
- * Copyright (C) 2000 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <config.h>
-
-#include <string.h>
-#include <stdlib.h>
-#include <time.h>
-#include <math.h>
-#include <glib.h>
-#include <gtk/gtkcalendar.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkhseparator.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkmenu.h>
-#include <gtk/gtkmenuitem.h>
-#include <gtk/gtkoptionmenu.h>
-#include <gtk/gtkspinbutton.h>
-#include <gtk/gtktable.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-dialog.h>
-#include <libgnomeui/gnome-dialog-util.h>
-#include <libgnomeui/gnome-stock.h>
-
-#include "filter-datespec.h"
-#include "e-util/e-sexp.h"
-
-#define d(x)
-
-static gboolean validate (FilterElement *fe);
-static void xml_create (FilterElement *fe, xmlNodePtr node);
-static xmlNodePtr xml_encode (FilterElement *fe);
-static int xml_decode (FilterElement *fe, xmlNodePtr node);
-static GtkWidget *get_widget (FilterElement *fe);
-static void build_code (FilterElement *fe, GString *out, struct _FilterPart *fds);
-static void format_sexp (FilterElement *, GString *);
-
-static void filter_datespec_class_init (FilterDatespecClass *class);
-static void filter_datespec_init (FilterDatespec *gspaper);
-static void filter_datespec_finalise (GtkObject *obj);
-
-static void make_span_editor (FilterDatespec *fds);
-static void adj_value_changed (GtkAdjustment *adj, gpointer user_data);
-static void omenu_item_activated (GtkMenuItem *item, gpointer user_data);
-static gchar *describe_button (FilterDatespec *fds);
-static gchar *stringify_agoness (FilterDatespec *fds);
-static void set_adjustments (FilterDatespec *fds);
-
-static void cal_day_selected (GtkCalendar *cal, gpointer user_data);
-static void cal_day_selected_double_click (GtkCalendar *cal, gpointer user_data);
-
-#define PRIV(x) (((FilterDatespec *)(x))->priv)
-
-typedef struct _timespan {
- guint32 seconds;
- const gchar *singular;
- const gchar *plural;
- gfloat max;
-} timespan;
-
-static const timespan timespans[] = {
- { 31557600, N_("year"), N_("years"), 1000.0 },
- { 2419200, N_("month"), N_("months"), 12.0 },
- { 604800, N_("week"), N_("weeks"), 52.0 },
- { 86400, N_("day"), N_("days"), 31.0 },
- { 3600, N_("hour"), N_("hours"), 23.0 },
- { 60, N_("minute"), N_("minutes"), 59.0 },
- { 1, N_("second"), N_("seconds"), 59.0 }
-};
-
-#define DAY_INDEX 3
-#define N_TIMESPANS (sizeof (timespans) / sizeof (timespans[0]))
-
-struct _FilterDatespecPrivate {
- GnomeDialog *gd;
- GtkWidget *descriptive_label;
- GtkWidget *cur_extra_widget;
- FilterDatespec_type selected_type;
-
- GtkWidget *date_chooser;
- GtkWidget *span_chooser;
- GtkWidget *omenu, *spinbutton, *recent_item;
- gboolean double_click;
-};
-
-static FilterElementClass *parent_class;
-
-guint
-filter_datespec_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "FilterDatespec",
- sizeof (FilterDatespec),
- sizeof (FilterDatespecClass),
- (GtkClassInitFunc) filter_datespec_class_init,
- (GtkObjectInitFunc) filter_datespec_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- type = gtk_type_unique (filter_element_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-filter_datespec_class_init (FilterDatespecClass *class)
-{
- GtkObjectClass *object_class;
- FilterElementClass *filter_element = (FilterElementClass *)class;
-
- object_class = (GtkObjectClass *)class;
- parent_class = gtk_type_class (filter_element_get_type ());
-
- object_class->finalize = filter_datespec_finalise;
-
- /* override methods */
- filter_element->validate = validate;
- filter_element->xml_create = xml_create;
- filter_element->xml_encode = xml_encode;
- filter_element->xml_decode = xml_decode;
- filter_element->get_widget = get_widget;
- filter_element->build_code = build_code;
- filter_element->format_sexp = format_sexp;
-}
-
-static void
-filter_datespec_init (FilterDatespec *o)
-{
- o->priv = g_malloc0 (sizeof (*o->priv));
- o->type = FDST_UNKNOWN;
- PRIV(o)->selected_type = FDST_UNKNOWN;
-}
-
-static void
-filter_datespec_finalise(GtkObject *obj)
-{
- FilterDatespec *o = (FilterDatespec *)obj;
-
- if (o->priv)
- g_free (o->priv);
-
- ((GtkObjectClass *)(parent_class))->finalize(obj);
-}
-
-/**
- * filter_datespec_new:
- *
- * Create a new FilterDatespec object.
- *
- * Return value: A new #FilterDatespec object.
- **/
-FilterDatespec *
-filter_datespec_new (void)
-{
- FilterDatespec *o = (FilterDatespec *)gtk_type_new (filter_datespec_get_type ());
- return o;
-}
-
-static gboolean
-validate (FilterElement *fe)
-{
- FilterDatespec *fds = (FilterDatespec *) fe;
- gboolean valid = TRUE;
-
- if (fds->value <= 0) {
- GtkWidget *gd;
-
- valid = FALSE;
-
- if (fds->type == FDST_UNKNOWN)
- gd = gnome_ok_dialog (_("Oops. You have forgotten to choose a date."));
- else
- gd = gnome_ok_dialog (_("Oops. You have chosen an invalid date."));
-
- gnome_dialog_run_and_close (GNOME_DIALOG (gd));
- }
-
- return valid;
-}
-
-static void
-xml_create (FilterElement *fe, xmlNodePtr node)
-{
- /* parent implementation */
- ((FilterElementClass *)(parent_class))->xml_create(fe, node);
-}
-
-static xmlNodePtr
-xml_encode (FilterElement *fe)
-{
- xmlNodePtr value, work;
- FilterDatespec *fds = (FilterDatespec *)fe;
- gchar str[32];
-
- d(printf ("Encoding datespec as xml\n"));
-
- value = xmlNewNode (NULL, "value");
- xmlSetProp (value, "name", fe->name);
- xmlSetProp (value, "type", "datespec");
-
- work = xmlNewChild (value, NULL, "datespec", NULL);
- sprintf (str, "%d", fds->type);
- xmlSetProp (work, "type", str);
- sprintf (str, "%d", (int)fds->value);
- xmlSetProp (work, "value", str);
-
- return value;
-}
-
-static int
-xml_decode (FilterElement *fe, xmlNodePtr node)
-{
- FilterDatespec *fds = (FilterDatespec *)fe;
- xmlNodePtr n;
- gchar *val;
-
- d(printf ("Decoding datespec from xml %p\n", fe));
-
- xmlFree (fe->name);
- fe->name = xmlGetProp (node, "name");
-
- n = node->childs;
- while (n) {
- if (!strcmp (n->name, "datespec")) {
- val = xmlGetProp (n, "type");
- fds->type = atoi (val);
- xmlFree (val);
- val = xmlGetProp (n, "value");
- fds->value = atoi (val);
- xmlFree (val);
- break;
- }
- n = n->next;
- }
- return 0;
-}
-
-static void
-activate_now (GtkMenuItem *item, FilterDatespec *fds)
-{
- if (PRIV (fds)->cur_extra_widget) {
- gtk_container_remove (GTK_CONTAINER (PRIV(fds)->gd->vbox),
- PRIV (fds)->cur_extra_widget);
- PRIV (fds)->cur_extra_widget = NULL;
- }
-
- gtk_label_set_text (GTK_LABEL (PRIV (fds)->descriptive_label),
- _("The message's date will be compared against\n"
- "whatever the time is when the filter is run\n"
- "or vfolder is opened."));
-
- PRIV (fds)->selected_type = FDST_NOW;
-}
-
-static void
-activate_specified (GtkMenuItem *item, FilterDatespec *fds)
-{
- struct tm *seltime;
-
- /* Remove other widget if it exists */
-
- if (PRIV (fds)->cur_extra_widget) {
- gtk_container_remove (GTK_CONTAINER (PRIV (fds)->gd->vbox),
- PRIV (fds)->cur_extra_widget);
- PRIV (fds)->cur_extra_widget = NULL;
- }
-
- /* Set description */
-
- gtk_label_set_text (GTK_LABEL (PRIV (fds)->descriptive_label),
- _("The message's date will be compared against\n"
- "the time that you specify here."));
-
- /* Reset if going from one type to another */
- if (PRIV (fds)->selected_type != FDST_SPECIFIED)
- fds->value = 0;
-
- PRIV (fds)->selected_type = FDST_SPECIFIED;
-
- /* Set the calendar's time */
-
- if (fds->value > 0) {
- /* gmtime? */
- seltime = localtime (&(fds->value));
-
- gtk_calendar_select_month (GTK_CALENDAR (PRIV (fds)->date_chooser),
- seltime->tm_mon,
- seltime->tm_year + 1900);
- gtk_calendar_select_day (GTK_CALENDAR (PRIV (fds)->date_chooser),
- seltime->tm_mday);
- /* free seltime?? */
- }
-
- gtk_box_pack_start (GTK_BOX (PRIV (fds)->gd->vbox),
- PRIV (fds)->date_chooser,
- TRUE, TRUE, 3);
- gtk_widget_show (PRIV (fds)->date_chooser);
- PRIV (fds)->cur_extra_widget = PRIV (fds)->date_chooser;
-}
-
-static void
-activate_x_ago (GtkMenuItem *item, FilterDatespec *fds)
-{
- if (PRIV (fds)->cur_extra_widget) {
- gtk_container_remove (GTK_CONTAINER (PRIV (fds)->gd->vbox),
- PRIV (fds)->cur_extra_widget);
- PRIV (fds)->cur_extra_widget = NULL;
- }
-
- gtk_label_set_text (GTK_LABEL (PRIV (fds)->descriptive_label),
- _("The message's date will be compared against\n"
- "a time relative to when the filter is run;\n"
- "\"a week ago\", for example."));
-
- /* Reset if going from one type to another */
- if (PRIV (fds)->selected_type != FDST_X_AGO)
- fds->value = 0;
-
- PRIV (fds)->selected_type = FDST_X_AGO;
-
- if (fds->value > 0)
- set_adjustments (fds);
-
- gtk_box_pack_start (GTK_BOX (PRIV (fds)->gd->vbox),
- PRIV (fds)->span_chooser,
- TRUE, TRUE, 3);
- gtk_widget_show (PRIV (fds)->span_chooser);
- PRIV (fds)->cur_extra_widget = PRIV (fds)->span_chooser;
-}
-
-typedef void (*my_menu_callback) (GtkMenuItem *, FilterDatespec *);
-
-static void
-button_clicked (GtkButton *button, FilterDatespec *fds)
-{
- GnomeDialog *gd;
- GtkWidget *box;
- GtkWidget *label;
- GtkWidget *menu;
- GtkWidget *selectomatic;
- GtkWidget *sep;
- int i;
- gchar *desc;
-
- /* keep in sync with FilterDatespec_type! */
- const char *items[] = { N_("the current time"), N_("a time you specify"),
- N_("a time relative to the current time"), NULL };
- const my_menu_callback callbacks[]
- = { activate_now, activate_specified, activate_x_ago };
-
- PRIV (fds)->descriptive_label = gtk_label_new("");
- PRIV (fds)->cur_extra_widget = NULL;
- PRIV (fds)->double_click = FALSE;
-
- /* The calendar */
-
- PRIV (fds)->date_chooser = gtk_calendar_new ();
- gtk_object_ref (GTK_OBJECT (PRIV (fds)->date_chooser));
- gtk_signal_connect (GTK_OBJECT (PRIV (fds)->date_chooser), "day_selected",
- cal_day_selected, fds);
- gtk_signal_connect (GTK_OBJECT (PRIV (fds)->date_chooser), "day_selected_double_click",
- cal_day_selected_double_click, fds);
-
- /* The span editor thingie */
-
- make_span_editor (fds);
- gtk_object_ref (GTK_OBJECT (PRIV (fds)->span_chooser));
-
- /* The dialog */
-
- gd = (GnomeDialog *) gnome_dialog_new ("Select a time to compare against",
- GNOME_STOCK_BUTTON_OK,
- GNOME_STOCK_BUTTON_CANCEL,
- NULL);
- PRIV (fds)->gd = gd;
-
- /* The menu */
-
- menu = gtk_menu_new ();
-
- for (i = 0; items[i]; i++) {
- GtkWidget *item;
-
- item = gtk_menu_item_new_with_label (gettext (items[i]));
- gtk_signal_connect (GTK_OBJECT (item), "activate",
- callbacks[i], fds);
- gtk_menu_append (GTK_MENU (menu), item);
- gtk_widget_show (item);
- }
-
- gtk_widget_show (menu);
-
- /* The selector */
-
- selectomatic = gtk_option_menu_new();
- gtk_option_menu_set_menu (GTK_OPTION_MENU (selectomatic), GTK_WIDGET (menu));
- if (fds->type != FDST_UNKNOWN)
- /* Keep in sync with FilterDatespec_type! */
- gtk_option_menu_set_history (GTK_OPTION_MENU (selectomatic), fds->type);
-
- gtk_widget_show ((GtkWidget *)selectomatic);
-
- /* The label */
-
- label = gtk_label_new (_("Compare against"));
- gtk_widget_show (label);
-
- /* The hbox */
-
- box = gtk_hbox_new (FALSE, 3);
- gtk_box_pack_start (GTK_BOX (box), label,
- TRUE, TRUE, 2);
- gtk_box_pack_start (GTK_BOX (box), selectomatic,
- TRUE, TRUE, 2);
- gtk_widget_show (box);
- gtk_box_pack_start ((GtkBox *)gd->vbox, (GtkWidget *)box, TRUE, TRUE, 3);
-
- /* The separator */
-
- sep = gtk_hseparator_new ();
- gtk_widget_show (sep);
- gtk_box_pack_start (GTK_BOX (gd->vbox), sep, TRUE, TRUE, 3);
-
- /* The descriptive label */
-
- gtk_box_pack_start (GTK_BOX (gd->vbox), PRIV (fds)->descriptive_label, TRUE, TRUE, 3);
- gtk_misc_set_alignment (GTK_MISC (PRIV (fds)->descriptive_label), 0.5, 0.5);
- gtk_widget_show (PRIV (fds)->descriptive_label);
-
- /* Set up the current view */
-
- if (fds->type == FDST_UNKNOWN)
- fds->type = FDST_NOW;
- PRIV (fds)->selected_type = fds->type;
-
- (callbacks[fds->type]) (NULL, fds);
-
- /* go go gadget gnomedialog! */
-
- switch (gnome_dialog_run_and_close(gd)) {
- case -1: /*wm close*/
- if (PRIV (fds)->double_click == FALSE)
- break;
- /* else fall */
- case 0:
- fds->type = PRIV (fds)->selected_type;
-
- PRIV (fds)->descriptive_label = NULL;
-
- desc = describe_button (fds);
- gtk_label_set_text (GTK_LABEL (GTK_BIN (button)->child), desc);
- g_free (desc);
- /* falllllll */
- case 1:
- /* cancel */
- break;
- }
-
- gtk_widget_destroy (PRIV (fds)->date_chooser);
- gtk_widget_destroy (PRIV (fds)->span_chooser);
-}
-
-static GtkWidget *
-get_widget (FilterElement *fe)
-{
- FilterDatespec *fds = (FilterDatespec *)fe;
- GtkWidget *button;
- GtkWidget *label;
- gchar *desc;
-
- desc = describe_button (fds);
- label = gtk_label_new (desc);
- gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5);
- g_free (desc);
-
- button = gtk_button_new();
- gtk_container_add (GTK_CONTAINER (button), label);
- gtk_signal_connect (GTK_OBJECT (button), "clicked", button_clicked, fds);
-
- gtk_widget_show (button);
- gtk_widget_show (label);
- return button;
-}
-
-static void
-build_code (FilterElement *fe, GString *out, struct _FilterPart *fp)
-{
- return;
-}
-
-static void
-format_sexp (FilterElement *fe, GString *out)
-{
- FilterDatespec *fds = (FilterDatespec *)fe;
-
- switch (fds->type) {
- case FDST_UNKNOWN:
- g_warning ("user hasn't selected a datespec yet!");
- /* fall through */
- case FDST_NOW:
- g_string_append (out, "(get-current-date)");
- break;
- case FDST_SPECIFIED:
- g_string_sprintfa (out, "%d", (int) fds->value);
- break;
- case FDST_X_AGO:
- g_string_sprintfa (out, "(- (get-current-date) %d)", (int) fds->value);
- break;
- }
-}
-
-static gchar *
-stringify_agoness (FilterDatespec *fds)
-{
- time_t val;
- GString *str;
- gchar *ret;
-
- str = g_string_new("");
- val = fds->value;
-
- if (val == 0) {
- g_string_append (str, _("now"));
- } else {
- int where;
-
- where = 0;
-
- while (val) {
- int count;
-
- count = 0;
-
- while (timespans[where].seconds <= val) {
- count++;
- val -= timespans[where].seconds;
- }
-
- if (count != 0 ) {
- if (count > 1)
- g_string_sprintfa (str, "%d %s", (int) count, gettext (timespans[where].plural));
- else
- g_string_sprintfa (str, "%d %s", (int) count, gettext (timespans[where].singular));
-
- if (val)
- g_string_append (str, ", ");
- }
-
- where++;
- }
-
- g_string_append (str, _(" ago"));
- }
-
- ret = str->str;
- g_string_free (str, FALSE);
- return ret;
-}
-
-static void
-make_span_editor (FilterDatespec *fds)
-{
- int i;
- GtkObject *adj;
- GtkWidget *hbox, *menu, *om, *sb, *label;
-
- /*PRIV (fds)->span_chooser = gtk_vbox_new (TRUE, 3);*/
-
- hbox = gtk_hbox_new (TRUE, 3);
-
- adj = gtk_adjustment_new (0.0, 0.0,
- /*timespans[i].max*/100000.0,
- 1.0, 10.0, 0.0);
- sb = gtk_spin_button_new (GTK_ADJUSTMENT (adj), 0, 0);
- gtk_widget_show (GTK_WIDGET (sb));
- gtk_box_pack_start (GTK_BOX (hbox), sb, TRUE, TRUE, 0);
-
- menu = gtk_menu_new ();
- for (i = 0; i < N_TIMESPANS; i++) {
- GtkWidget *item;
-
- item = gtk_menu_item_new_with_label (timespans[i].plural);
- gtk_object_set_data (GTK_OBJECT (item), "timespan", (gpointer) &(timespans[i]));
- gtk_signal_connect (GTK_OBJECT (item), "activate", omenu_item_activated, fds);
- gtk_widget_show (item);
- gtk_menu_prepend (GTK_MENU (menu), item);
-
- if (i == DAY_INDEX)
- PRIV (fds)->recent_item = item;
- }
-
- om = gtk_option_menu_new ();
- gtk_option_menu_set_menu (GTK_OPTION_MENU (om), menu);
- gtk_option_menu_set_history (GTK_OPTION_MENU (om), DAY_INDEX);
- gtk_widget_show (om);
- gtk_box_pack_start (GTK_BOX (hbox), om, FALSE, TRUE, 0);
-
- label = gtk_label_new (_("ago"));
- gtk_widget_show (label);
- gtk_misc_set_padding (GTK_MISC (label), 3, 0);
- gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
-
- gtk_widget_show (hbox);
-
- PRIV (fds)->span_chooser = hbox;
- PRIV (fds)->omenu = om;
- PRIV (fds)->spinbutton = sb;
-
- /* if we do this earlier, we get the signal before the private
- * members have been set up. */
- gtk_signal_connect (adj, "value_changed",
- adj_value_changed, fds);
-}
-
-static void
-omenu_item_activated (GtkMenuItem *item, gpointer user_data)
-{
- FilterDatespec *fds = (FilterDatespec *) user_data;
- GtkOptionMenu *om;
- timespan *old_ts, *new_ts;
- int cur_val;
- gfloat new_val;
-
- if (!PRIV (fds)->recent_item) {
- PRIV (fds)->recent_item = GTK_WIDGET (item);
- return;
- }
-
- om = GTK_OPTION_MENU (PRIV (fds)->omenu);
- old_ts = gtk_object_get_data (GTK_OBJECT (PRIV (fds)->recent_item), "timespan");
- new_ts = gtk_object_get_data (GTK_OBJECT (item), "timespan");
-
- cur_val = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (PRIV (fds)->spinbutton));
-
- /*if (old_ts->seconds > new_ts->seconds)*/
- new_val = ceil (cur_val * old_ts->seconds / new_ts->seconds);
-
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (PRIV (fds)->spinbutton), new_val);
- PRIV (fds)->recent_item = GTK_WIDGET (item);
-}
-
-static void
-adj_value_changed (GtkAdjustment *adj, gpointer user_data)
-{
- FilterDatespec *fds = (FilterDatespec *) user_data;
- GtkOptionMenu *om;
- timespan *ts;
-
- om = GTK_OPTION_MENU (PRIV (fds)->omenu);
-
- if (om->menu_item == NULL) /* this has happened to me... dunno what it means */
- return;
-
- ts = gtk_object_get_data (GTK_OBJECT (om->menu_item), "timespan");
- fds->value = ts->seconds *
- (gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (PRIV (fds)->spinbutton)));
-}
-
-static void
-set_adjustments (FilterDatespec *fds)
-{
- time_t val;
- int i;
-
- val = fds->value;
-
- for (i = 0; i < N_TIMESPANS; i++) {
- if (val % timespans[i].seconds == 0) {
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (PRIV (fds)->spinbutton),
- (gfloat) val / timespans[i].seconds);
- break;
- }
- }
-
- gtk_option_menu_set_history (GTK_OPTION_MENU (PRIV (fds)->omenu),
- N_TIMESPANS - (i + 1));
-}
-
-static gchar *
-describe_button (FilterDatespec *fds)
-{
- gchar *desc = NULL;
-
- switch (fds->type) {
- case FDST_UNKNOWN:
- desc = g_strdup (_("<click here to select a date>"));
- break;
- case FDST_NOW:
- desc = g_strdup (_("now"));
- break;
- case FDST_SPECIFIED:
- desc = g_strdup (ctime (&(fds->value)));
- break;
- case FDST_X_AGO:
- desc = stringify_agoness (fds);
- break;
- }
-
- return desc;
-}
-
-static void
-cal_day_selected (GtkCalendar *cal, gpointer user_data)
-{
- FilterDatespec *fds = (FilterDatespec *)user_data;
- struct tm seltime;
-
- seltime.tm_sec = 0;
- seltime.tm_min = 0;
- seltime.tm_hour = 0;
- seltime.tm_mday = cal->selected_day;
- seltime.tm_mon = cal->month;
- seltime.tm_year = cal->year - 1900;
- seltime.tm_isdst = -1;
-
- fds->value = mktime (&seltime);
-}
-
-static void
-cal_day_selected_double_click (GtkCalendar *cal, gpointer user_data)
-{
- FilterDatespec *fds = (FilterDatespec *)user_data;
-
- cal_day_selected (cal, user_data);
- PRIV (fds)->double_click = TRUE;
- gnome_dialog_close (PRIV (fds)->gd);
-}
diff --git a/filter/filter-datespec.h b/filter/filter-datespec.h
deleted file mode 100644
index ed805d4268..0000000000
--- a/filter/filter-datespec.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2000 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef _FILTER_DATESPEC_H
-#define _FILTER_DATESPEC_H
-
-#include <time.h>
-#include "filter-element.h"
-
-#define FILTER_DATESPEC(obj) GTK_CHECK_CAST (obj, filter_datespec_get_type (), FilterDatespec)
-#define FILTER_DATESPEC_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, filter_datespec_get_type (), FilterDatespecClass)
-#define IS_FILTER_DATESPEC(obj) GTK_CHECK_TYPE (obj, filter_datespec_get_type ())
-
-typedef struct _FilterDatespec FilterDatespec;
-typedef struct _FilterDatespecClass FilterDatespecClass;
-
-typedef enum _FilterDatespec_type { FDST_NOW, FDST_SPECIFIED, FDST_X_AGO, FDST_UNKNOWN } FilterDatespec_type;
-
-struct _FilterDatespec {
- FilterElement parent;
- struct _FilterDatespecPrivate *priv;
-
- FilterDatespec_type type;
-
- /* either a timespan, an absolute time, or 0
- * depending on type -- the above mapping to
- * (X_AGO, SPECIFIED, NOW)
- */
-
- time_t value;
-};
-
-struct _FilterDatespecClass {
- FilterElementClass parent_class;
-
- /* virtual methods */
-
- /* signals */
-};
-
-guint filter_datespec_get_type (void);
-FilterDatespec *filter_datespec_new (void);
-
-/* methods */
-
-#endif /* ! _FILTER_DATESPEC_H */
-
diff --git a/filter/filter-driver.c b/filter/filter-driver.c
deleted file mode 100644
index bc941a9c01..0000000000
--- a/filter/filter-driver.c
+++ /dev/null
@@ -1,778 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2000 Helix Code Inc.
- *
- * Authors: Michael Zucchi <notzed@helixcode.com>
- * Jeffrey Stedfast <fejj@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "filter-driver.h"
-#include "filter-message-search.h"
-
-#include <glib.h>
-#include <gtk/gtk.h>
-#include <gnome.h>
-#include <gtkhtml/gtkhtml.h>
-
-#include <time.h>
-
-#include <gnome-xml/tree.h>
-#include <gnome-xml/parser.h>
-
-#include <camel/camel.h>
-#include "filter-context.h"
-#include "filter-filter.h"
-#include "e-util/e-sexp.h"
-#include "e-util/e-memory.h"
-
-#define d(x)
-
-/* type of status for a log report */
-enum filter_log_t {
- FILTER_LOG_NONE,
- FILTER_LOG_START, /* start of new log entry */
- FILTER_LOG_ACTION, /* an action performed */
- FILTER_LOG_END, /* end of log */
-};
-
-struct _FilterDriverPrivate {
- GHashTable *globals; /* global variables */
-
- CamelFolder *defaultfolder; /* defualt folder */
-
- FDStatusFunc *statusfunc; /* status callback */
- void *statusdata; /* status callback data */
-
- FilterContext *context;
-
- /* for callback */
- FilterGetFolderFunc get_folder;
- void *data;
-
- /* run-time data */
- GHashTable *folders; /* folders that message has been copied to */
- GHashTable *forwards; /* addresses that have been forwarded the message */
-
- gboolean terminated; /* message processing was terminated */
- gboolean deleted; /* message was marked for deletion */
- gboolean copied; /* message was copied to some folder or another */
-
- CamelMimeMessage *message; /* input message */
- CamelMessageInfo *info; /* message summary info */
-
- FILE *logfile; /* log file */
-
- CamelException *ex;
-
- /* evaluator */
- ESExp *eval;
-};
-
-#define _PRIVATE(o) (((FilterDriver *)(o))->priv)
-
-static void filter_driver_class_init (FilterDriverClass *klass);
-static void filter_driver_init (FilterDriver *obj);
-static void filter_driver_finalise (GtkObject *obj);
-
-static void filter_driver_log (FilterDriver *driver, enum filter_log_t status, const char *desc, ...);
-
-static CamelFolder *open_folder (FilterDriver *d, const char *folder_url);
-static int close_folders (FilterDriver *d);
-
-static ESExpResult *do_delete (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *);
-static ESExpResult *mark_forward (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *);
-static ESExpResult *do_copy (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *);
-static ESExpResult *do_move (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *);
-static ESExpResult *do_stop (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *);
-static ESExpResult *do_colour (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *);
-static ESExpResult *do_score (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *);
-static ESExpResult *do_flag (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *);
-
-/* these are our filter actions - each must have a callback */
-static struct {
- char *name;
- ESExpFunc *func;
- int type; /* set to 1 if a function can perform shortcut evaluation, or
- doesn't execute everything, 0 otherwise */
-} symbols[] = {
- { "delete", (ESExpFunc *) do_delete, 0 },
- { "forward-to", (ESExpFunc *) mark_forward, 0 },
- { "copy-to", (ESExpFunc *) do_copy, 0 },
- { "move-to", (ESExpFunc *) do_move, 0 },
- { "stop", (ESExpFunc *) do_stop, 0 },
- { "set-colour", (ESExpFunc *) do_colour, 0 },
- { "set-score", (ESExpFunc *) do_score, 0 },
- { "set-system-flag", (ESExpFunc *) do_flag, 0 }
-};
-
-static GtkObjectClass *filter_driver_parent;
-
-enum SIGNALS {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-guint
-filter_driver_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "FilterDriver",
- sizeof (FilterDriver),
- sizeof (FilterDriverClass),
- (GtkClassInitFunc) filter_driver_class_init,
- (GtkObjectInitFunc) filter_driver_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- type = gtk_type_unique (gtk_object_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-filter_driver_class_init (FilterDriverClass *klass)
-{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
-
- filter_driver_parent = gtk_type_class (gtk_object_get_type ());
-
- object_class->finalize = filter_driver_finalise;
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-filter_driver_init (FilterDriver *obj)
-{
- struct _FilterDriverPrivate *p;
- int i;
-
- p = _PRIVATE (obj) = g_malloc0 (sizeof (*p));
-
- p->eval = e_sexp_new ();
- /* Load in builtin symbols */
- for (i = 0; i < sizeof (symbols) / sizeof (symbols[0]); i++) {
- if (symbols[i].type == 1) {
- e_sexp_add_ifunction (p->eval, 0, symbols[i].name, (ESExpIFunc *)symbols[i].func, obj);
- } else {
- e_sexp_add_function (p->eval, 0, symbols[i].name, symbols[i].func, obj);
- }
- }
-
- p->globals = g_hash_table_new (g_str_hash, g_str_equal);
-
- p->folders = g_hash_table_new (g_str_hash, g_str_equal);
-}
-
-static void
-free_hash_strings (void *key, void *value, void *data)
-{
- g_free (key);
- g_free (value);
-}
-
-static void
-filter_driver_finalise (GtkObject *obj)
-{
- FilterDriver *driver = (FilterDriver *) obj;
- struct _FilterDriverPrivate *p = _PRIVATE (driver);
-
- /* close all folders that were opened for appending */
- close_folders (driver);
- g_hash_table_destroy (p->folders);
-
- g_hash_table_foreach (p->globals, free_hash_strings, driver);
- g_hash_table_destroy (p->globals);
-
- e_sexp_unref(p->eval);
-
- if (p->defaultfolder)
- camel_object_unref (CAMEL_OBJECT (p->defaultfolder));
-
- g_free (p);
-
- ((GtkObjectClass *)(filter_driver_parent))->finalize (GTK_OBJECT (obj));
-}
-
-/**
- * filter_driver_new:
- * @system: path to system rules
- * @user: path to user rules
- * @get_folder: function to call to fetch folders
- *
- * Create a new FilterDriver object.
- *
- * Return value: A new FilterDriver widget.
- **/
-FilterDriver *
-filter_driver_new (FilterContext *context, FilterGetFolderFunc get_folder, void *data)
-{
- FilterDriver *new;
- struct _FilterDriverPrivate *p;
-
- new = FILTER_DRIVER (gtk_type_new (filter_driver_get_type ()));
- p = _PRIVATE (new);
-
- p->get_folder = get_folder;
- p->data = data;
- p->context = context;
- gtk_object_ref (GTK_OBJECT (context));
-
- return new;
-}
-
-void
-filter_driver_set_logfile (FilterDriver *d, FILE *logfile)
-{
- struct _FilterDriverPrivate *p = _PRIVATE (d);
-
- p->logfile = logfile;
-}
-
-void
-filter_driver_set_status_func (FilterDriver *d, FDStatusFunc *func, void *data)
-{
- struct _FilterDriverPrivate *p = _PRIVATE (d);
-
- p->statusfunc = func;
- p->statusdata = data;
-}
-
-void
-filter_driver_set_default_folder (FilterDriver *d, CamelFolder *def)
-{
- struct _FilterDriverPrivate *p = _PRIVATE (d);
-
- if (p->defaultfolder)
- camel_object_unref (CAMEL_OBJECT (p->defaultfolder));
-
- p->defaultfolder = def;
-
- if (p->defaultfolder)
- camel_object_ref (CAMEL_OBJECT (p->defaultfolder));
-}
-
-static void
-report_status (FilterDriver *driver, enum filter_status_t status, const char *desc, ...)
-{
- /* call user-defined status report function */
- struct _FilterDriverPrivate *p = _PRIVATE (driver);
- va_list ap;
- char *str;
-
- if (p->statusfunc) {
- va_start (ap, desc);
- str = g_strdup_vprintf (desc, ap);
- p->statusfunc (driver, status, str, p->statusdata);
- g_free (str);
- }
-}
-
-
-#if 0
-void
-filter_driver_set_global (FilterDriver *d, const char *name, const char *value)
-{
- struct _FilterDriverPrivate *p = _PRIVATE (d);
- char *oldkey, *oldvalue;
-
- if (g_hash_table_lookup_extended (p->globals, name, (void *)&oldkey, (void *)&oldvalue)) {
- g_free (oldvalue);
- g_hash_table_insert (p->globals, oldkey, g_strdup (value));
- } else {
- g_hash_table_insert (p->globals, g_strdup (name), g_strdup (value));
- }
-}
-#endif
-
-static ESExpResult *
-do_delete (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *driver)
-{
- struct _FilterDriverPrivate *p = _PRIVATE (driver);
-
- d(fprintf (stderr, "doing delete\n"));
- p->deleted = TRUE;
- filter_driver_log (driver, FILTER_LOG_ACTION, "Delete");
-
- return NULL;
-}
-
-static ESExpResult *
-mark_forward (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *driver)
-{
- /*struct _FilterDriverPrivate *p = _PRIVATE (driver);*/
-
- d(fprintf (stderr, "marking message for forwarding\n"));
- /* FIXME: do stuff here */
- filter_driver_log (driver, FILTER_LOG_ACTION, "Forward");
-
- return NULL;
-}
-
-static ESExpResult *
-do_copy (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *driver)
-{
- struct _FilterDriverPrivate *p = _PRIVATE (driver);
- int i;
-
- d(fprintf (stderr, "copying message...\n"));
-
- for (i = 0; i < argc; i++) {
- if (argv[i]->type == ESEXP_RES_STRING) {
- /* open folders we intent to copy to */
- char *folder = argv[i]->value.string;
- char *service_url;
- CamelFolder *outbox;
-
- outbox = open_folder (driver, folder);
- if (!outbox)
- continue;
-
- p->copied = TRUE;
- camel_folder_append_message (outbox, p->message, p->info, p->ex);
-
- service_url = camel_service_get_url (CAMEL_SERVICE (camel_folder_get_parent_store (outbox)));
- filter_driver_log (driver, FILTER_LOG_ACTION, "Copy to folder %s", service_url);
- g_free (service_url);
- }
- }
-
- return NULL;
-}
-
-static ESExpResult *
-do_move (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *driver)
-{
- struct _FilterDriverPrivate *p = _PRIVATE (driver);
- int i;
-
- d(fprintf (stderr, "moving message...\n"));
-
- for (i = 0; i < argc; i++) {
- if (argv[i]->type == ESEXP_RES_STRING) {
- /* open folders we intent to move to */
- char *folder = argv[i]->value.string;
- char *service_url;
- CamelFolder *outbox;
-
- outbox = open_folder (driver, folder);
- if (!outbox)
- continue;
-
- p->copied = TRUE;
- p->deleted = TRUE; /* a 'move' is a copy & delete */
-
- camel_folder_append_message (outbox, p->message, p->info, p->ex);
-
- service_url = camel_service_get_url (CAMEL_SERVICE (camel_folder_get_parent_store (outbox)));
- filter_driver_log (driver, FILTER_LOG_ACTION, "Move to folder %s", service_url);
- g_free (service_url);
- }
- }
-
- return NULL;
-}
-
-static ESExpResult *
-do_stop (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *driver)
-{
- struct _FilterDriverPrivate *p = _PRIVATE (driver);
-
- filter_driver_log (driver, FILTER_LOG_ACTION, "Stopped processing");
- d(fprintf (stderr, "terminating message processing\n"));
- p->terminated = TRUE;
-
- return NULL;
-}
-
-static ESExpResult *
-do_colour (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *driver)
-{
- struct _FilterDriverPrivate *p = _PRIVATE (driver);
-
- d(fprintf (stderr, "setting colour tag\n"));
- if (argc > 0 && argv[0]->type == ESEXP_RES_STRING) {
- camel_tag_set (&p->info->user_tags, "colour", argv[0]->value.string);
- filter_driver_log (driver, FILTER_LOG_ACTION, "Set colour to %s", argv[0]->value.string);
- }
-
- return NULL;
-}
-
-static ESExpResult *
-do_score (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *driver)
-{
- struct _FilterDriverPrivate *p = _PRIVATE (driver);
-
- d(fprintf (stderr, "setting score tag\n"));
- if (argc > 0 && argv[0]->type == ESEXP_RES_INT) {
- char *value;
-
- value = g_strdup_printf ("%d", argv[0]->value.number);
- camel_tag_set (&p->info->user_tags, "score", value);
- filter_driver_log (driver, FILTER_LOG_ACTION, "Set score to %d", argv[0]->value.number);
- g_free (value);
- }
-
- return NULL;
-}
-
-static ESExpResult *
-do_flag (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *driver)
-{
- struct _FilterDriverPrivate *p = _PRIVATE (driver);
-
- d(fprintf (stderr, "setting flag\n"));
- if (argc == 1 && argv[0]->type == ESEXP_RES_STRING) {
- p->info->flags |= camel_system_flag (argv[0]->value.string) | CAMEL_MESSAGE_FOLDER_FLAGGED;
- filter_driver_log (driver, FILTER_LOG_ACTION, "Set %s flag", argv[0]->value.string);
- }
-
- return NULL;
-}
-
-static CamelFolder *
-open_folder (FilterDriver *driver, const char *folder_url)
-{
- struct _FilterDriverPrivate *p = _PRIVATE (driver);
- CamelFolder *camelfolder;
-
- /* we have a lookup table of currently open folders */
- camelfolder = g_hash_table_lookup (p->folders, folder_url);
- if (camelfolder)
- return camelfolder;
-
- camelfolder = p->get_folder (driver, folder_url, p->data);
-
- if (camelfolder) {
- g_hash_table_insert (p->folders, g_strdup (folder_url), camelfolder);
- camel_folder_freeze (camelfolder);
- }
-
- return camelfolder;
-}
-
-static void
-close_folder (void *key, void *value, void *data)
-{
- CamelFolder *folder = value;
- FilterDriver *driver = data;
- struct _FilterDriverPrivate *p = _PRIVATE (driver);
-
- g_free (key);
- camel_folder_sync (folder, FALSE, p->ex);
- camel_folder_thaw (folder);
- camel_object_unref (CAMEL_OBJECT (folder));
-}
-
-/* flush/close all folders */
-static int
-close_folders (FilterDriver *driver)
-{
- struct _FilterDriverPrivate *p = _PRIVATE (driver);
-
- g_hash_table_foreach (p->folders, close_folder, driver);
- g_hash_table_destroy (p->folders);
- p->folders = g_hash_table_new (g_str_hash, g_str_equal);
-
- /* FIXME: status from driver */
- return 0;
-}
-
-#if 0
-static void
-free_key (gpointer key, gpointer value, gpointer user_data)
-{
- g_free (key);
-}
-#endif
-
-
-static void
-filter_driver_log (FilterDriver *driver, enum filter_log_t status, const char *desc, ...)
-{
- struct _FilterDriverPrivate *p = _PRIVATE (driver);
-
- if (p->logfile) {
- char *str = NULL;
-
- if (desc) {
- va_list ap;
-
- va_start (ap, desc);
- str = g_strdup_vprintf (desc, ap);
- }
-
- switch (status) {
- case FILTER_LOG_START: {
- /* write log header */
- const char *subject = NULL;
- char *fromstr;
- const CamelInternetAddress *from;
- char date[50];
- time_t t;
-
- /* FIXME: does this need locking? Probably */
-
- from = camel_mime_message_get_from (p->message);
- fromstr = camel_address_format((CamelAddress *)from);
- subject = camel_mime_message_get_subject (p->message);
-
- time (&t);
- strftime (date, 49, "%a, %d %b %Y %H:%M:%S", localtime (&t));
- fprintf (p->logfile, "Applied filter \"%s\" to message from %s - \"%s\" at %s\n",
- str, fromstr ? fromstr : "unknown", subject ? subject : "", date);
- g_free(fromstr);
- break;
- }
- case FILTER_LOG_ACTION:
- fprintf (p->logfile, "Action: %s\n", str);
- break;
- case FILTER_LOG_END:
- fprintf (p->logfile, "\n");
- break;
- default:
- /* nothing else is loggable */
- break;
- }
-
- g_free (str);
- }
-}
-
-
-/* will filter only an mbox - is more efficient as it doesn't need to open the folder through camel directly */
-void
-filter_driver_filter_mbox (FilterDriver *driver, const char *mbox, const char *source, CamelException *ex)
-{
- struct _FilterDriverPrivate *p = _PRIVATE (driver);
- CamelMimeParser *mp = NULL;
- char *source_url = NULL;
- int fd = -1;
- int i = 0;
- struct stat st;
-
- fd = open (mbox, O_RDONLY);
- if (fd == -1) {
- camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, "Unable to open spool folder");
- goto fail;
- }
- /* to get the filesize */
- fstat (fd, &st);
-
- mp = camel_mime_parser_new ();
- camel_mime_parser_scan_from (mp, TRUE);
- if (camel_mime_parser_init_with_fd (mp, fd) == -1) {
- camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, "Unable to process spool folder");
- goto fail;
- }
- fd = -1;
-
- source_url = g_strdup_printf ("file://%s", mbox);
-
- while (camel_mime_parser_step (mp, 0, 0) == HSCAN_FROM) {
- CamelMimeMessage *msg;
- int pc = 0;
-
- if (st.st_size > 0)
- pc = (int)(100.0 * ((double)camel_mime_parser_tell (mp) / (double)st.st_size));
-
- report_status (driver, FILTER_STATUS_START, "Getting message %d (%d%% of file)", i, pc);
-
- msg = camel_mime_message_new ();
- if (camel_mime_part_construct_from_parser (CAMEL_MIME_PART (msg), mp) == -1) {
- report_status (driver, FILTER_STATUS_END, "Failed message %d", i);
- camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, "Cannot open message");
- camel_object_unref (CAMEL_OBJECT (msg));
- goto fail;
- }
-
- filter_driver_filter_message (driver, msg, NULL, source_url, source, ex);
- camel_object_unref (CAMEL_OBJECT (msg));
- if (camel_exception_is_set (ex)) {
- report_status (driver, FILTER_STATUS_END, "Failed message %d", i);
- goto fail;
- }
-
- report_status (driver, FILTER_STATUS_END, "Finished message %d", i);
- i++;
-
- /* skip over the FROM_END state */
- camel_mime_parser_step (mp, 0, 0);
- }
-
- if (p->defaultfolder)
- camel_folder_sync (p->defaultfolder, FALSE, ex);
-
-fail:
- g_free (source_url);
- if (fd != -1)
- close (fd);
- if (mp)
- camel_object_unref (CAMEL_OBJECT (mp));
-}
-
-/* will filter a folder */
-void
-filter_driver_filter_folder (FilterDriver *driver, CamelFolder *folder, const char *source,
- GPtrArray *uids, gboolean remove, CamelException *ex)
-{
- struct _FilterDriverPrivate *p = _PRIVATE (driver);
- int i;
- int freeuids = FALSE;
- CamelMimeMessage *message;
- const CamelMessageInfo *info;
- char *source_url, *service_url;
-
- service_url = camel_service_get_url (CAMEL_SERVICE (camel_folder_get_parent_store (folder)));
- source_url = g_strdup_printf ("%s%s", service_url, camel_folder_get_full_name (folder));
- g_free (service_url);
-
- if (uids == NULL) {
- uids = camel_folder_get_uids (folder);
- freeuids = TRUE;
- }
-
- for (i = 0; i < uids->len; i++) {
- report_status (driver, FILTER_STATUS_START, "Getting message %d of %d", i+1, uids->len);
-
- message = camel_folder_get_message (folder, uids->pdata[i], ex);
- if (camel_exception_is_set (ex)) {
- report_status (driver, FILTER_STATUS_END, "Failed at message %d of %d", i+1, uids->len);
- break;
- }
-
- if (camel_folder_has_summary_capability (folder))
- info = camel_folder_get_message_info (folder, uids->pdata[i]);
- else
- info = NULL;
-
- filter_driver_filter_message (driver, message, (CamelMessageInfo *)info, source_url, source, ex);
- if (camel_exception_is_set (ex)) {
- report_status (driver, FILTER_STATUS_END, "Failed at message %d of %d", i+1, uids->len);
- break;
- }
-
- if (remove)
- camel_folder_set_message_flags (folder, uids->pdata[i],
- CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_DELETED);
-
- camel_object_unref (CAMEL_OBJECT (message));
- }
-
- if (freeuids)
- camel_folder_free_uids (folder, uids);
-
- if (p->defaultfolder)
- camel_folder_sync (p->defaultfolder, FALSE, ex);
-
- g_free (source_url);
-}
-
-void
-filter_driver_filter_message (FilterDriver *driver, CamelMimeMessage *message, CamelMessageInfo *info,
- const char *source_url, const char *source, CamelException *ex)
-{
- struct _FilterDriverPrivate *p = _PRIVATE (driver);
- ESExpResult *r;
- GString *fsearch, *faction;
- FilterFilter *rule;
- gboolean freeinfo = FALSE;
- gboolean filtered = FALSE;
-
- if (info == NULL) {
- struct _header_raw *h = CAMEL_MIME_PART (message)->headers;
-
- info = camel_message_info_new_from_header (h);
- freeinfo = TRUE;
- } else {
- if (info->flags & CAMEL_MESSAGE_DELETED)
- return;
- }
-
- p->ex = ex;
- p->terminated = FALSE;
- p->deleted = FALSE;
- p->copied = FALSE;
- p->message = message;
- p->info = info;
-
- fsearch = g_string_new ("");
- faction = g_string_new ("");
-
- rule = NULL;
- while ((rule = (FilterFilter *)rule_context_next_rule ((RuleContext *)p->context, (FilterRule *)rule, source))) {
- gboolean matched;
-
- g_string_truncate (fsearch, 0);
- g_string_truncate (faction, 0);
-
- filter_rule_build_code (FILTER_RULE (rule), fsearch);
- filter_filter_build_action (rule, faction);
-
- d(fprintf (stderr, "applying rule %s\n action %s\n", fsearch->str, faction->str));
-
- matched = filter_message_search (p->message, p->info, source_url, fsearch->str, p->ex);
-
- if (matched) {
- filtered = TRUE;
- filter_driver_log (driver, FILTER_LOG_START, FILTER_RULE (rule)->name);
-#ifndef NO_WARNINGS
-#warning "Must check expression parsed and executed properly?"
-#endif
- /* perform necessary filtering actions */
- e_sexp_input_text (p->eval, faction->str, strlen (faction->str));
- e_sexp_parse (p->eval);
- r = e_sexp_eval (p->eval);
- e_sexp_result_free (r);
- if (p->terminated)
- break;
- }
- }
-
- g_string_free (fsearch, TRUE);
- g_string_free (faction, TRUE);
-
- /* *Now* we can set the DELETED flag... */
- if (p->deleted)
- info->flags = info->flags | CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_FOLDER_FLAGGED;
-
- /* Logic: if !Moved and there exists a default folder... */
- if (!(p->copied && p->deleted) && p->defaultfolder) {
- /* copy it to the default inbox */
- filtered = TRUE;
- filter_driver_log (driver, FILTER_LOG_ACTION, "Copy to default folder");
- camel_folder_append_message (p->defaultfolder, p->message, p->info, p->ex);
- }
-
- if (freeinfo)
- camel_message_info_free (info);
-
- if (filtered)
- filter_driver_log (driver, FILTER_LOG_END, NULL);
-}
diff --git a/filter/filter-editor.c b/filter/filter-editor.c
deleted file mode 100644
index b27270179d..0000000000
--- a/filter/filter-editor.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Copyright (C) 2000, 2001 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- * Jeffrey Stedfast <fejj@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <config.h>
-
-#include <glib.h>
-#include <gtk/gtkframe.h>
-#include <gtk/gtkmenuitem.h>
-#include <gtk/gtkoptionmenu.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-i18n.h>
-#include <glade/glade.h>
-#include <gal/widgets/e-unicode.h>
-
-#include "filter-editor.h"
-#include "filter-context.h"
-#include "filter-filter.h"
-
-#define d(x)
-
-static FilterRule * create_rule(RuleEditor *re);
-
-static void filter_editor_class_init (FilterEditorClass *class);
-static void filter_editor_init (FilterEditor *gspaper);
-static void filter_editor_finalise (GtkObject *obj);
-
-#define _PRIVATE(x) (((FilterEditor *)(x))->priv)
-
-struct _FilterEditorPrivate {
-};
-
-static GnomeDialogClass *parent_class;
-
-enum {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-guint
-filter_editor_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "FilterEditor",
- sizeof(FilterEditor),
- sizeof(FilterEditorClass),
- (GtkClassInitFunc)filter_editor_class_init,
- (GtkObjectInitFunc)filter_editor_init,
- (GtkArgSetFunc)NULL,
- (GtkArgGetFunc)NULL
- };
-
- type = gtk_type_unique (rule_editor_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-filter_editor_class_init (FilterEditorClass *class)
-{
- GtkObjectClass *object_class = (GtkObjectClass *)class;
- RuleEditorClass *re_class = (RuleEditorClass *)class;
-
- parent_class = gtk_type_class (gnome_dialog_get_type ());
-
- object_class->finalize = filter_editor_finalise;
-
- /* override methods */
- re_class->create_rule = create_rule;
-
- /* signals */
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-filter_editor_init (FilterEditor *o)
-{
- o->priv = g_malloc0 (sizeof (*o->priv));
-}
-
-static void
-filter_editor_finalise (GtkObject *obj)
-{
- FilterEditor *o = (FilterEditor *)obj;
-
- g_free(o->priv);
-
- ((GtkObjectClass *)(parent_class))->finalize (obj);
-}
-
-/**
- * filter_editor_new:
- *
- * Create a new FilterEditor object.
- *
- * Return value: A new #FilterEditor object.
- **/
-FilterEditor *
-filter_editor_new(FilterContext *f, const char **source_names)
-{
- FilterEditor *o = (FilterEditor *)gtk_type_new (filter_editor_get_type ());
- GladeXML *gui;
- GtkWidget *w;
-
- gui = glade_xml_new (FILTER_GLADEDIR "/filter.glade", "rule_editor");
- filter_editor_construct (o, f, gui, source_names);
-
- w = glade_xml_get_widget (gui, "rule_frame");
- gtk_frame_set_label (GTK_FRAME (w), _("Filter Rules"));
-
- gtk_object_unref (GTK_OBJECT (gui));
-
- return o;
-}
-
-static void
-select_source (GtkMenuItem *mi, FilterEditor *fe)
-{
- char *source;
-
- source = gtk_object_get_data (GTK_OBJECT (mi), "source");
- g_assert (source);
-
- rule_editor_set_source ((RuleEditor *)fe, source);
-}
-
-void
-filter_editor_construct (FilterEditor *fe, FilterContext *fc, GladeXML *gui, const char **source_names)
-{
- GtkWidget *menu, *item, *omenu;
- int i;
-
- omenu = glade_xml_get_widget (gui, "filter_source");
- gtk_option_menu_remove_menu (GTK_OPTION_MENU (omenu));
- menu = gtk_menu_new ();
-
- for (i = 0; source_names[i]; i++) {
- item = gtk_menu_item_new_with_label (_(source_names[i]));
- gtk_object_set_data_full (GTK_OBJECT (item), "source", g_strdup (source_names[i]), g_free);
- gtk_menu_append (GTK_MENU (menu), item);
- gtk_widget_show (item);
- gtk_signal_connect (GTK_OBJECT (item), "activate", select_source, fe);
- }
- gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu);
- gtk_widget_show (omenu);
-
- rule_editor_construct ((RuleEditor *)fe, (RuleContext *)fc, gui, source_names[0]);
-}
-
-static FilterRule *
-create_rule (RuleEditor *re)
-{
- FilterRule *rule = filter_rule_new ();
- FilterPart *part;
-
- /* create a rule with 1 part & 1 action in it */
- rule = (FilterRule *)filter_filter_new ();
- part = rule_context_next_part (re->context, NULL);
- filter_rule_add_part (rule, filter_part_clone (part));
- part = filter_context_next_action ((FilterContext *)re->context, NULL);
- filter_filter_add_action ((FilterFilter *)rule, filter_part_clone (part));
-
- return rule;
-}
diff --git a/filter/filter-editor.h b/filter/filter-editor.h
deleted file mode 100644
index 3d65f9c99f..0000000000
--- a/filter/filter-editor.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2000, 2001 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef _FILTER_EDITOR_H
-#define _FILTER_EDITOR_H
-
-#include "rule-editor.h"
-
-#define FILTER_EDITOR(obj) GTK_CHECK_CAST (obj, filter_editor_get_type (), FilterEditor)
-#define FILTER_EDITOR_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, filter_editor_get_type (), FilterEditorClass)
-#define IS_FILTER_EDITOR(obj) GTK_CHECK_TYPE (obj, filter_editor_get_type ())
-
-typedef struct _FilterEditor FilterEditor;
-typedef struct _FilterEditorClass FilterEditorClass;
-
-struct _FilterEditor {
- RuleEditor parent;
- struct _FilterEditorPrivate *priv;
-
-};
-
-struct _FilterEditorClass {
- RuleEditorClass parent_class;
-
- /* virtual methods */
-
- /* signals */
-};
-
-struct _FilterContext;
-
-guint filter_editor_get_type (void);
-FilterEditor *filter_editor_new(struct _FilterContext *f, const char **source_names);
-void filter_editor_construct(FilterEditor *fe, struct _FilterContext *fc, struct _GladeXML *gui, const char **source_names);
-
-#endif /* ! _FILTER_EDITOR_H */
-
diff --git a/filter/filter-element.c b/filter/filter-element.c
deleted file mode 100644
index ea3542b4e2..0000000000
--- a/filter/filter-element.c
+++ /dev/null
@@ -1,312 +0,0 @@
-/*
- * Copyright (C) 2000 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <gtk/gtktypeutils.h>
-
-#include "filter-element.h"
-#include "filter-input.h"
-#include "filter-option.h"
-#include "filter-code.h"
-#include "filter-colour.h"
-#include "filter-datespec.h"
-#include "filter-score.h"
-#include "filter-int.h"
-#include "filter-folder.h"
-#include "filter-source.h"
-
-
-static gboolean validate (FilterElement *fe);
-static void xml_create(FilterElement *fe, xmlNodePtr node);
-static FilterElement *clone(FilterElement *fe);
-
-static void filter_element_class_init (FilterElementClass *class);
-static void filter_element_init (FilterElement *gspaper);
-static void filter_element_finalise (GtkObject *obj);
-
-#define _PRIVATE(x) (((FilterElement *)(x))->priv)
-struct _FilterElementPrivate {
-};
-
-static GtkObjectClass *parent_class;
-
-enum {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-guint
-filter_element_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "FilterElement",
- sizeof(FilterElement),
- sizeof(FilterElementClass),
- (GtkClassInitFunc)filter_element_class_init,
- (GtkObjectInitFunc)filter_element_init,
- (GtkArgSetFunc)NULL,
- (GtkArgGetFunc)NULL
- };
-
- type = gtk_type_unique(gtk_object_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-filter_element_class_init (FilterElementClass *class)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass *)class;
- parent_class = gtk_type_class (gtk_object_get_type ());
-
- object_class->finalize = filter_element_finalise;
-
- /* override methods */
- class->validate = validate;
- class->xml_create = xml_create;
- class->clone = clone;
-
- /* signals */
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-filter_element_init (FilterElement *o)
-{
- o->priv = g_malloc0 (sizeof (*o->priv));
-}
-
-static void
-filter_element_finalise (GtkObject *obj)
-{
- FilterElement *o = (FilterElement *)obj;
-
- o = o;
-
- ((GtkObjectClass *)(parent_class))->finalize(obj);
-}
-
-/**
- * filter_element_new:
- *
- * Create a new FilterElement object.
- *
- * Return value: A new #FilterElement object.
- **/
-FilterElement *
-filter_element_new (void)
-{
- FilterElement *o = (FilterElement *)gtk_type_new(filter_element_get_type ());
- return o;
-}
-
-gboolean
-filter_element_validate (FilterElement *fe)
-{
- return ((FilterElementClass *)((GtkObject *)fe)->klass)->validate (fe);
-}
-
-/**
- * filter_element_xml_create:
- * @fe: filter element
- * @node: xml node
- *
- * Create a new filter element based on an xml definition of
- * that element.
- **/
-void
-filter_element_xml_create (FilterElement *fe, xmlNodePtr node)
-{
- return ((FilterElementClass *)((GtkObject *)fe)->klass)->xml_create(fe, node);
-}
-
-/**
- * filter_element_xml_encode:
- * @fe: filter element
- *
- * Encode the values of a filter element into xml format.
- *
- * Return value:
- **/
-xmlNodePtr
-filter_element_xml_encode (FilterElement *fe)
-{
- return ((FilterElementClass *)((GtkObject *)fe)->klass)->xml_encode(fe);
-}
-
-/**
- * filter_element_xml_decode:
- * @fe: filter element
- * @node: xml node
- *
- * Decode the values of a fitler element from xml format.
- *
- * Return value:
- **/
-int
-filter_element_xml_decode (FilterElement *fe, xmlNodePtr node)
-{
- return ((FilterElementClass *)((GtkObject *)fe)->klass)->xml_decode(fe, node);
-}
-
-/**
- * filter_element_clone:
- * @fe: filter element
- *
- * Clones the FilterElement @fe.
- *
- * Return value:
- **/
-FilterElement *
-filter_element_clone (FilterElement *fe)
-{
- return ((FilterElementClass *)((GtkObject *)fe)->klass)->clone(fe);
-}
-
-/**
- * filter_element_get_widget:
- * @fe: filter element
- * @node: xml node
- *
- * Create a widget to represent this element.
- *
- * Return value:
- **/
-GtkWidget *
-filter_element_get_widget (FilterElement *fe)
-{
- return ((FilterElementClass *)((GtkObject *)fe)->klass)->get_widget(fe);
-}
-
-/**
- * filter_element_build_code:
- * @fe: filter element
- * @out: output buffer
- * @ff:
- *
- * Add the code representing this element to the output string @out.
- **/
-void
-filter_element_build_code (FilterElement *fe, GString *out, struct _FilterPart *ff)
-{
- return ((FilterElementClass *)((GtkObject *)fe)->klass)->build_code(fe, out, ff);
-}
-
-/**
- * filter_element_format_sexp:
- * @fe: filter element
- * @out: output buffer
- *
- * Format the value(s) of this element in a method suitable for the context of
- * sexp where it is used. Usually as space separated, double-quoted strings.
- **/
-void
-filter_element_format_sexp (FilterElement *fe, GString *out)
-{
- return ((FilterElementClass *)((GtkObject *)fe)->klass)->format_sexp(fe, out);
-}
-
-/**
- * filter_element_new_type_name:
- * @type: filter element type
- *
- * Create a new filter element based on its type name.
- *
- * Return value:
- **/
-FilterElement *
-filter_element_new_type_name (const char *type)
-{
- if (type == NULL)
- return NULL;
-
- if (!strcmp (type, "string")) {
- return (FilterElement *)filter_input_new ();
- } else if (!strcmp (type, "folder")) {
- return (FilterElement *)filter_folder_new ();
- } else if (!strcmp (type, "address")) {
- /* FIXME: temporary ... need real address type */
- return (FilterElement *)filter_input_new_type_name (type);
- } else if (!strcmp (type, "code")) {
- return (FilterElement *)filter_code_new ();
- } else if (!strcmp (type, "colour")) {
- return (FilterElement *)filter_colour_new ();
- } else if (!strcmp (type, "optionlist") || !strcmp (type, "system-flag")) {
- return (FilterElement *)filter_option_new ();
- } else if (!strcmp (type, "datespec")) {
- return (FilterElement *)filter_datespec_new ();
- } else if (!strcmp (type, "score")) {
- return (FilterElement *)filter_score_new ();
- } else if (!strcmp (type, "integer")) {
- return (FilterElement *)filter_int_new ();
- } else if (!strcmp (type, "regex")) {
- return (FilterElement *)filter_input_new_type_name (type);
- } else if (!strcmp (type, "source")) {
- return (FilterElement *)filter_source_new ();
- } else {
- g_warning("Unknown filter type '%s'", type);
- return 0;
- }
-}
-
-void
-filter_element_set_data (FilterElement *fe, gpointer data)
-{
- fe->data = data;
-}
-
-/* default implementations */
-static gboolean
-validate (FilterElement *fe)
-{
- return TRUE;
-}
-
-static void
-xml_create (FilterElement *fe, xmlNodePtr node)
-{
- fe->name = xmlGetProp (node, "name");
-}
-
-static FilterElement *
-clone (FilterElement *fe)
-{
- xmlNodePtr node;
- FilterElement *new;
-
- new = (FilterElement *)gtk_type_new (GTK_OBJECT (fe)->klass->type);
- node = filter_element_xml_encode (fe);
- filter_element_xml_decode (new, node);
- xmlFreeNodeList (node);
-
- return new;
-}
diff --git a/filter/filter-element.h b/filter/filter-element.h
deleted file mode 100644
index bb5584d0f7..0000000000
--- a/filter/filter-element.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (C) 2000 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef _FILTER_ELEMENT_H
-#define _FILTER_ELEMENT_H
-
-#include <gtk/gtkobject.h>
-#include <gtk/gtkwidget.h>
-#include <gnome-xml/parser.h>
-#include <gnome-xml/xmlmemory.h>
-
-#define FILTER_ELEMENT(obj) GTK_CHECK_CAST (obj, filter_element_get_type (), FilterElement)
-#define FILTER_ELEMENT_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, filter_element_get_type (), FilterElementClass)
-#define IS_FILTER_ELEMENT(obj) GTK_CHECK_TYPE (obj, filter_element_get_type ())
-
-typedef struct _FilterElement FilterElement;
-typedef struct _FilterElementClass FilterElementClass;
-
-struct _FilterElement {
- GtkObject parent;
- struct _FilterElementPrivate *priv;
-
- char *name;
- gpointer data;
-};
-
-struct _FilterPart;
-
-struct _FilterElementClass {
- GtkObjectClass parent_class;
-
- /* virtual methods */
- gboolean (*validate)(FilterElement *fe);
-
- void (*xml_create)(FilterElement *, xmlNodePtr);
- xmlNodePtr (*xml_encode)(FilterElement *);
- int (*xml_decode)(FilterElement *, xmlNodePtr);
-
- FilterElement *(*clone)(FilterElement *fe);
-
- GtkWidget *(*get_widget)(FilterElement *);
- void (*build_code)(FilterElement *, GString *, struct _FilterPart *ff);
- void (*format_sexp)(FilterElement *, GString *);
-
- /* signals */
-};
-
-guint filter_element_get_type (void);
-FilterElement *filter_element_new (void);
-
-FilterElement *filter_element_new_type_name (const char *type);
-
-void filter_element_set_data (FilterElement *fe, gpointer data);
-
-/* methods */
-gboolean filter_element_validate (FilterElement *fe);
-
-void filter_element_xml_create (FilterElement *fe, xmlNodePtr node);
-
-xmlNodePtr filter_element_xml_encode (FilterElement *fe);
-int filter_element_xml_decode (FilterElement *fe, xmlNodePtr node);
-FilterElement *filter_element_clone (FilterElement *fe);
-
-GtkWidget *filter_element_get_widget (FilterElement *fe);
-void filter_element_build_code (FilterElement *fe, GString *out, struct _FilterPart *ff);
-void filter_element_format_sexp (FilterElement *fe, GString *out);
-
-#endif /* ! _FILTER_ELEMENT_H */
-
diff --git a/filter/filter-filter.c b/filter/filter-filter.c
deleted file mode 100644
index 145be391dd..0000000000
--- a/filter/filter-filter.c
+++ /dev/null
@@ -1,499 +0,0 @@
-/*
- * Copyright (C) 2000-2001 Ximian Inc.
- *
- * Authors: Not Zed <notzed@ximian.com>
- * Jeffrey Stedfast <fejj@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <config.h>
-
-#include <string.h>
-#include <glib.h>
-#include <gtk/gtkframe.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkmenuitem.h>
-#include <gtk/gtkoptionmenu.h>
-#include <gtk/gtkscrolledwindow.h>
-#include <gtk/gtktable.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-stock.h>
-#include <gal/widgets/e-unicode.h>
-
-#include "filter-filter.h"
-#include "filter-context.h"
-
-#define d(x)
-
-static int validate(FilterRule *);
-static xmlNodePtr xml_encode (FilterRule *);
-static int xml_decode (FilterRule *, xmlNodePtr, struct _RuleContext *f);
-/*static void build_code(FilterRule *, GString *out);*/
-static GtkWidget *get_widget (FilterRule *fr, struct _RuleContext *f);
-
-static void filter_filter_class_init (FilterFilterClass *class);
-static void filter_filter_init (FilterFilter *gspaper);
-static void filter_filter_finalise (GtkObject *obj);
-
-#define _PRIVATE(x) (((FilterFilter *)(x))->priv)
-
-struct _FilterFilterPrivate {
-};
-
-static FilterRuleClass *parent_class;
-
-enum {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-guint
-filter_filter_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "FilterFilter",
- sizeof(FilterFilter),
- sizeof(FilterFilterClass),
- (GtkClassInitFunc)filter_filter_class_init,
- (GtkObjectInitFunc)filter_filter_init,
- (GtkArgSetFunc)NULL,
- (GtkArgGetFunc)NULL
- };
-
- type = gtk_type_unique(filter_rule_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-filter_filter_class_init (FilterFilterClass *class)
-{
- GtkObjectClass *object_class;
- FilterRuleClass *filter_rule = (FilterRuleClass *)class;
-
- object_class = (GtkObjectClass *)class;
- parent_class = gtk_type_class (filter_rule_get_type ());
-
- object_class->finalize = filter_filter_finalise;
-
- /* override methods */
- filter_rule->validate = validate;
- filter_rule->xml_encode = xml_encode;
- filter_rule->xml_decode = xml_decode;
- /*filter_rule->build_code = build_code;*/
- filter_rule->get_widget = get_widget;
-
- /* signals */
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-filter_filter_init (FilterFilter *o)
-{
- o->priv = g_malloc0 (sizeof (*o->priv));
-}
-
-static void
-unref_list (GList *l)
-{
- while (l) {
- gtk_object_unref (GTK_OBJECT (l->data));
- l = g_list_next (l);
- }
-}
-
-static void
-filter_filter_finalise (GtkObject *obj)
-{
- FilterFilter *o = (FilterFilter *)obj;
-
- unref_list (o->actions);
-
- ((GtkObjectClass *)(parent_class))->finalize (obj);
-}
-
-/**
- * filter_filter_new:
- *
- * Create a new FilterFilter object.
- *
- * Return value: A new #FilterFilter object.
- **/
-FilterFilter *
-filter_filter_new (void)
-{
- FilterFilter *o = (FilterFilter *)gtk_type_new(filter_filter_get_type ());
- return o;
-}
-
-void
-filter_filter_add_action (FilterFilter *fr, FilterPart *fp)
-{
- fr->actions = g_list_append (fr->actions, fp);
-}
-
-void
-filter_filter_remove_action (FilterFilter *fr, FilterPart *fp)
-{
- fr->actions = g_list_remove (fr->actions, fp);
-}
-
-void
-filter_filter_replace_action (FilterFilter *fr, FilterPart *fp, FilterPart *new)
-{
- GList *l;
-
- l = g_list_find (fr->actions, fp);
- if (l) {
- l->data = new;
- } else {
- fr->actions = g_list_append (fr->actions, new);
- }
-}
-
-void
-filter_filter_build_action (FilterFilter *fr, GString *out)
-{
- g_string_append (out, "(begin\n");
- filter_part_build_code_list (fr->actions, out);
- g_string_append (out, ")\n");
-}
-
-static int
-validate(FilterRule *fr)
-{
- int valid;
- GList *parts;
- FilterFilter *ff = (FilterFilter *)fr;
-
- valid = ((FilterRuleClass *)(parent_class))->validate(fr);
-
- /* validate rule actions */
- parts = ff->actions;
- while (parts && valid) {
- valid = filter_part_validate((FilterPart *)parts->data);
- parts = parts->next;
- }
-
- return valid;
-}
-
-static xmlNodePtr
-xml_encode (FilterRule *fr)
-{
- xmlNodePtr node, set, work;
- GList *l;
- FilterFilter *ff = (FilterFilter *)fr;
-
- node = ((FilterRuleClass *)(parent_class))->xml_encode (fr);
- g_assert (node != NULL);
- set = xmlNewNode (NULL, "actionset");
- xmlAddChild (node, set);
- l = ff->actions;
- while (l) {
- work = filter_part_xml_encode ((FilterPart *)l->data);
- xmlAddChild (set, work);
- l = g_list_next (l);
- }
-
- return node;
-
-}
-
-static void
-load_set (xmlNodePtr node, FilterFilter *ff, RuleContext *f)
-{
- xmlNodePtr work;
- char *rulename;
- FilterPart *part;
-
- work = node->childs;
- while (work) {
- if (!strcmp (work->name, "part")) {
- rulename = xmlGetProp (work, "name");
- part = filter_context_find_action ((FilterContext *)f, rulename);
- if (part) {
- part = filter_part_clone (part);
- filter_part_xml_decode (part, work);
- filter_filter_add_action (ff, part);
- } else {
- g_warning ("cannot find rule part '%s'\n", rulename);
- }
- xmlFree (rulename);
- } else {
- g_warning ("Unknwon xml node in part: %s", work->name);
- }
- work = work->next;
- }
-}
-
-static int
-xml_decode (FilterRule *fr, xmlNodePtr node, struct _RuleContext *f)
-{
- xmlNodePtr work;
- FilterFilter *ff = (FilterFilter *)fr;
- int result;
-
- result = ((FilterRuleClass *)(parent_class))->xml_decode (fr, node, f);
- if (result != 0)
- return result;
-
- work = node->childs;
- while (work) {
- if (!strcmp (work->name, "actionset")) {
- load_set (work, ff, f);
- }
- work = work->next;
- }
-
- return 0;
-}
-
-/*static void build_code(FilterRule *fr, GString *out)
-{
- return ((FilterRuleClass *)(parent_class))->build_code(fr, out);
-}*/
-
-struct _part_data {
- FilterRule *fr;
- FilterContext *f;
- FilterPart *part;
- GtkWidget *partwidget, *container;
-};
-
-static void
-option_activate (GtkMenuItem *item, struct _part_data *data)
-{
- FilterPart *part = gtk_object_get_data (GTK_OBJECT (item), "part");
- FilterPart *newpart;
-
- /* dont update if we haven't changed */
- if (!strcmp (part->title, data->part->title))
- return;
-
- /* here we do a widget shuffle, throw away the old widget/rulepart,
- and create another */
- if (data->partwidget)
- gtk_container_remove (GTK_CONTAINER (data->container), data->partwidget);
-
- newpart = filter_part_clone (part);
- filter_filter_replace_action ((FilterFilter *)data->fr, data->part, newpart);
- gtk_object_unref (GTK_OBJECT (data->part));
- data->part = newpart;
- data->partwidget = filter_part_get_widget (newpart);
- if (data->partwidget)
- gtk_box_pack_start (GTK_BOX (data->container), data->partwidget, FALSE, FALSE, 0);
-
- gtk_object_set_data (GTK_OBJECT (data->container), "part", newpart);
-}
-
-static GtkWidget *
-get_rule_part_widget (FilterContext *f, FilterPart *newpart, FilterRule *fr)
-{
- FilterPart *part = NULL;
- GtkWidget *menu;
- GtkWidget *item;
- GtkWidget *omenu;
- GtkWidget *hbox;
- GtkWidget *p;
- int index = 0, current = 0;
- struct _part_data *data;
-
- data = g_malloc0 (sizeof (*data));
- data->fr = fr;
- data->f = f;
- data->part = newpart;
-
- hbox = gtk_hbox_new (FALSE, 0);
- p = filter_part_get_widget (newpart);
-
- data->partwidget = p;
- data->container = hbox;
-
- menu = gtk_menu_new ();
- while ((part = filter_context_next_action (f, part))) {
- item = gtk_menu_item_new_with_label (_(part->title));
-
- gtk_object_set_data (GTK_OBJECT (item), "part", part);
- gtk_signal_connect (GTK_OBJECT (item), "activate", option_activate, data);
- gtk_menu_append (GTK_MENU (menu), item);
- gtk_widget_show (item);
-
- if (!strcmp (newpart->title, part->title)) {
- current = index;
- }
- index++;
- }
-
- omenu = gtk_option_menu_new ();
- gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu);
- gtk_option_menu_set_history (GTK_OPTION_MENU (omenu), current);
- gtk_widget_show (omenu);
-
- gtk_box_pack_start (GTK_BOX (hbox), omenu, FALSE, FALSE, 0);
- if (p) {
- gtk_box_pack_start (GTK_BOX (hbox), p, FALSE, FALSE, 0);
- }
- gtk_widget_show_all (hbox);
-
- return hbox;
-}
-
-struct _rule_data {
- FilterRule *fr;
- FilterContext *f;
- GtkWidget *parts;
-};
-
-static void
-less_parts (GtkWidget *button, struct _rule_data *data)
-{
- FilterPart *part;
- GtkWidget *rule;
- GList *l;
-
- l = ((FilterFilter *)data->fr)->actions;
- if (g_list_length (l) < 2)
- return;
-
- rule = gtk_object_get_data (GTK_OBJECT (button), "rule");
- part = gtk_object_get_data (GTK_OBJECT (rule), "part");
-
- /* remove the part from the list */
- filter_filter_remove_action ((FilterFilter *)data->fr, part);
- gtk_object_unref (GTK_OBJECT (part));
-
- /* and from the display */
- gtk_container_remove (GTK_CONTAINER (data->parts), rule);
- gtk_container_remove (GTK_CONTAINER (data->parts), button);
-}
-
-static void
-attach_rule (GtkWidget *rule, struct _rule_data *data, FilterPart *part, int row)
-{
- GtkWidget *remove;
- GtkWidget *pixmap;
-
- gtk_table_attach (GTK_TABLE (data->parts), rule, 0, 1, row, row + 1,
- GTK_EXPAND | GTK_FILL, 0, 0, 0);
-
- pixmap = gnome_stock_new_with_icon (GNOME_STOCK_PIXMAP_REMOVE);
- remove = gnome_pixmap_button (pixmap, _("Remove"));
- gtk_object_set_data (GTK_OBJECT (remove), "rule", rule);
- gtk_object_set_data (GTK_OBJECT (rule), "part", part);
- /*gtk_button_set_relief (GTK_BUTTON (remove), GTK_RELIEF_NONE);*/
- gtk_signal_connect (GTK_OBJECT (remove), "clicked", less_parts, data);
- gtk_table_attach (GTK_TABLE (data->parts), remove, 1, 2, row, row + 1,
- 0, 0, 0, 0);
- gtk_widget_show (remove);
-}
-
-static void
-more_parts (GtkWidget *button, struct _rule_data *data)
-{
- FilterPart *new;
-
- /* create a new rule entry, use the first type of rule */
- new = filter_context_next_action ((FilterContext *)data->f, NULL);
- if (new) {
- GtkWidget *w;
- guint16 rows;
-
- new = filter_part_clone (new);
- filter_filter_add_action ((FilterFilter *)data->fr, new);
- w = get_rule_part_widget (data->f, new, data->fr);
-
- rows = GTK_TABLE (data->parts)->nrows;
- gtk_table_resize (GTK_TABLE (data->parts), rows + 1, 2);
- attach_rule (w, data, new, rows);
- }
-}
-
-static GtkWidget *
-get_widget (FilterRule *fr, struct _RuleContext *f)
-{
- GtkWidget *widget;
- GtkWidget *parts, *inframe;
- GtkWidget *hbox;
- GtkWidget *add, *pixmap;
- GtkWidget *w;
- GtkWidget *frame;
- GtkWidget *scrolledwindow;
- GtkObject *hadj, *vadj;
- GList *l;
- FilterPart *part;
- struct _rule_data *data;
- FilterFilter *ff = (FilterFilter *)fr;
- gint rows, i = 0;
-
- widget = ((FilterRuleClass *)(parent_class))->get_widget (fr, f);
-
- /* and now for the action area */
- frame = gtk_frame_new (_("Then"));
- inframe = gtk_vbox_new (FALSE, 3);
- gtk_container_add (GTK_CONTAINER (frame), inframe);
-
- rows = g_list_length (ff->actions);
- parts = gtk_table_new (rows, 2, FALSE);
- data = g_malloc0 (sizeof (*data));
- data->f = (FilterContext *)f;
- data->fr = fr;
- data->parts = parts;
-
- hbox = gtk_hbox_new (FALSE, 3);
-
- pixmap = gnome_stock_new_with_icon (GNOME_STOCK_PIXMAP_ADD);
- add = gnome_pixmap_button (pixmap, _("Add action"));
- /* gtk_button_set_relief (GTK_BUTTON (add), GTK_RELIEF_NONE); */
- gtk_signal_connect (GTK_OBJECT (add), "clicked", more_parts, data);
- gtk_box_pack_start (GTK_BOX (hbox), add, FALSE, FALSE, 3);
-
- gtk_box_pack_start (GTK_BOX (inframe), hbox, FALSE, FALSE, 3);
-
- l = ff->actions;
- while (l) {
- part = l->data;
- d(printf ("adding action %s\n", part->title));
- w = get_rule_part_widget ((FilterContext *)f, part, fr);
- attach_rule (w, data, part, i++);
- l = g_list_next (l);
- }
-
- hadj = gtk_adjustment_new (0.0, 0.0, 1.0, 1.0 ,1.0, 1.0);
- vadj = gtk_adjustment_new (0.0, 0.0, 1.0, 1.0 ,1.0, 1.0);
- scrolledwindow = gtk_scrolled_window_new (GTK_ADJUSTMENT (hadj), GTK_ADJUSTMENT (vadj));
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-
- gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolledwindow), parts);
-
- gtk_box_pack_start (GTK_BOX (inframe), scrolledwindow, TRUE, TRUE, 3);
-
- /*gtk_box_pack_start (GTK_BOX (inframe), parts, FALSE, FALSE, 3);*/
-
- gtk_widget_show_all (frame);
-
- gtk_box_pack_start (GTK_BOX (widget), frame, TRUE, TRUE, 3);
-
- return widget;
-}
diff --git a/filter/filter-filter.h b/filter/filter-filter.h
deleted file mode 100644
index d5076af9e4..0000000000
--- a/filter/filter-filter.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2000 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef _FILTER_FILTER_H
-#define _FILTER_FILTER_H
-
-#include "filter-rule.h"
-
-#define FILTER_FILTER(obj) GTK_CHECK_CAST (obj, filter_filter_get_type (), FilterFilter)
-#define FILTER_FILTER_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, filter_filter_get_type (), FilterFilterClass)
-#define IS_FILTER_FILTER(obj) GTK_CHECK_TYPE (obj, filter_filter_get_type ())
-
-typedef struct _FilterFilter FilterFilter;
-typedef struct _FilterFilterClass FilterFilterClass;
-
-struct _FilterFilter {
- FilterRule parent;
- struct _FilterFilterPrivate *priv;
-
- GList *actions;
-};
-
-struct _FilterFilterClass {
- FilterRuleClass parent_class;
-
- /* virtual methods */
-
- /* signals */
-};
-
-guint filter_filter_get_type (void);
-FilterFilter *filter_filter_new (void);
-
-/* methods */
-void filter_filter_add_action (FilterFilter *fr, FilterPart *fp);
-void filter_filter_remove_action (FilterFilter *fr, FilterPart *fp);
-void filter_filter_replace_action (FilterFilter *fr, FilterPart *fp, FilterPart *new);
-
-void filter_filter_build_action (FilterFilter *fr, GString *out);
-
-#endif /* ! _FILTER_FILTER_H */
-
diff --git a/filter/filter-folder.c b/filter/filter-folder.c
deleted file mode 100644
index 4b43997c2b..0000000000
--- a/filter/filter-folder.c
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
- * Copyright (C) 2000 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <config.h>
-
-#define SHELL
-
-#include <glib.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-dialog.h>
-#include <libgnomeui/gnome-dialog-util.h>
-#include <gal/widgets/e-unicode.h>
-
-#include "filter-folder.h"
-#ifdef SHELL
-#include "shell/evolution-shell-client.h"
-#endif
-#include "e-util/e-sexp.h"
-
-#define d(x)
-
-static gboolean validate (FilterElement *fe);
-static void xml_create(FilterElement *fe, xmlNodePtr node);
-static xmlNodePtr xml_encode(FilterElement *fe);
-static int xml_decode(FilterElement *fe, xmlNodePtr node);
-static GtkWidget *get_widget(FilterElement *fe);
-static void build_code(FilterElement *fe, GString *out, struct _FilterPart *ff);
-static void format_sexp(FilterElement *, GString *);
-
-#ifdef SHELL
-extern EvolutionShellClient *global_shell_client;
-#endif
-
-static void filter_folder_class_init (FilterFolderClass *class);
-static void filter_folder_init (FilterFolder *gspaper);
-static void filter_folder_finalise (GtkObject *obj);
-
-#define _PRIVATE(x) (((FilterFolder *)(x))->priv)
-
-struct _FilterFolderPrivate {
-};
-
-static FilterElementClass *parent_class;
-
-guint
-filter_folder_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "FilterFolder",
- sizeof(FilterFolder),
- sizeof(FilterFolderClass),
- (GtkClassInitFunc)filter_folder_class_init,
- (GtkObjectInitFunc)filter_folder_init,
- (GtkArgSetFunc)NULL,
- (GtkArgGetFunc)NULL
- };
-
- type = gtk_type_unique (filter_element_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-filter_folder_class_init (FilterFolderClass *class)
-{
- GtkObjectClass *object_class;
- FilterElementClass *filter_element = (FilterElementClass *)class;
-
- object_class = (GtkObjectClass *)class;
- parent_class = gtk_type_class (filter_element_get_type ());
-
- object_class->finalize = filter_folder_finalise;
-
- /* override methods */
- filter_element->validate = validate;
- filter_element->xml_create = xml_create;
- filter_element->xml_encode = xml_encode;
- filter_element->xml_decode = xml_decode;
- filter_element->get_widget = get_widget;
- filter_element->build_code = build_code;
- filter_element->format_sexp = format_sexp;
-}
-
-static void
-filter_folder_init (FilterFolder *o)
-{
- o->priv = g_malloc0 (sizeof (*o->priv));
-}
-
-static void
-filter_folder_finalise (GtkObject *obj)
-{
- FilterFolder *o = (FilterFolder *)obj;
-
- g_free (o->uri);
- g_free (o->name);
-
- ((GtkObjectClass *)(parent_class))->finalize(obj);
-}
-
-/**
- * filter_folder_new:
- *
- * Create a new FilterFolder object.
- *
- * Return value: A new #FilterFolder object.
- **/
-FilterFolder *
-filter_folder_new (void)
-{
- FilterFolder *o = (FilterFolder *)gtk_type_new (filter_folder_get_type ());
- return o;
-}
-
-static gboolean
-validate (FilterElement *fe)
-{
- FilterFolder *ff = (FilterFolder *) fe;
-
- if (ff->uri && *ff->uri) {
- return TRUE;
- } else {
- GtkWidget *dialog;
-
- dialog = gnome_ok_dialog (_("Oops, you forgot to choose a folder.\n"
- "Please go back and specify a valid folder to deliver mail to."));
-
- gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
-
- return FALSE;
- }
-}
-
-static void
-xml_create (FilterElement *fe, xmlNodePtr node)
-{
- /* parent implementation */
- ((FilterElementClass *)(parent_class))->xml_create(fe, node);
-}
-
-static xmlNodePtr
-xml_encode (FilterElement *fe)
-{
- xmlNodePtr value, work;
- FilterFolder *ff = (FilterFolder *)fe;
-
- d(printf ("Encoding folder as xml\n"));
-
- value = xmlNewNode (NULL, "value");
- xmlSetProp (value, "name", fe->name);
- xmlSetProp (value, "type", "folder");
-
- work = xmlNewChild (value, NULL, "folder", NULL);
- xmlSetProp (work, "name", ff->name);
- xmlSetProp (work, "uri", ff->uri);
-
- return value;
-}
-
-static int
-xml_decode (FilterElement *fe, xmlNodePtr node)
-{
- FilterFolder *ff = (FilterFolder *)fe;
- xmlNodePtr n;
-
- d(printf ("Decoding folder from xml %p\n", fe));
-
- xmlFree (fe->name);
- fe->name = xmlGetProp (node, "name");
-
- n = node->childs;
- while (n) {
- if (!strcmp (n->name, "folder")) {
- xmlFree (ff->name);
- xmlFree (ff->uri);
- ff->name = xmlGetProp (n, "name");
- ff->uri = xmlGetProp (n, "uri");
- break;
- }
- n = n->next;
- }
-
- return 0;
-}
-
-static void
-button_clicked (GtkButton *button, FilterFolder *ff)
-{
-#ifdef SHELL
- const char *allowed_types[] = { "mail", NULL };
- char *def, *physical_uri, *evolution_uri;
- static gboolean is_active = FALSE;
- gchar *s;
-
- if (is_active)
- return;
-
- is_active = TRUE;
-
- def = ff->uri ? ff->uri : "";
-
- evolution_shell_client_user_select_folder (global_shell_client,
- _("Select Folder"),
- def, allowed_types,
- &evolution_uri,
- &physical_uri);
-
- if (physical_uri != NULL && physical_uri[0] != '\0') {
- g_free (ff->uri);
- ff->uri = physical_uri;
-
- g_free (ff->name);
- ff->name = g_strdup (g_basename (evolution_uri));
- s = e_utf8_to_gtk_string (GTK_WIDGET (button), ff->name);
- gtk_label_set_text (GTK_LABEL (GTK_BIN (button)->child), s);
- g_free (s);
- } else {
- g_free (physical_uri);
- }
- g_free (evolution_uri);
-
- is_active = FALSE;
-#else
- GnomeDialog *gd;
- GtkEntry *entry;
- char *uri, *str;
-
- gd = (GnomeDialog *)gnome_dialog_new(_("Enter folder URI"),
- GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL,
- NULL);
- gtk_window_set_policy(GTK_WINDOW(gd), FALSE, TRUE, FALSE);
- entry = (GtkEntry *)gtk_entry_new();
- if (ff->uri) {
- e_utf8_gtk_entry_set_text(entry, ff->uri);
- }
- gtk_box_pack_start((GtkBox *)gd->vbox, (GtkWidget *)entry, TRUE, TRUE, 3);
- gtk_widget_show((GtkWidget *)entry);
- switch (gnome_dialog_run(gd)) {
- case 0:
- g_free(ff->uri);
- g_free(ff->name);
- uri = e_utf8_gtk_entry_get_text(entry);
- ff->uri = uri;
- str = strstr(uri, "//");
- if (str)
- str = strchr(str+2, '/');
- if (str)
- str++;
- else
- str = uri;
- ff->name = g_strdup(str);
- s = e_utf8_to_gtk_string ((GtkWidget *) button, ff->name);
- gtk_label_set_text((GtkLabel *)GTK_BIN(button)->child, s);
- g_free (s);
- case 1:
- gnome_dialog_close(gd);
- case -1:
- /* nothing */
- }
-
-#endif
-}
-
-static GtkWidget *
-get_widget (FilterElement *fe)
-{
- FilterFolder *ff = (FilterFolder *)fe;
- GtkWidget *button;
- GtkWidget *label;
-
- if (ff->name && ff->name[0])
- label = gtk_label_new (g_basename (ff->name));
- else
- label = gtk_label_new (_("<click here to select a folder>"));
-
- button = gtk_button_new ();
- gtk_container_add (GTK_CONTAINER (button), label);
- gtk_widget_show (button);
- gtk_widget_show (label);
- gtk_signal_connect (GTK_OBJECT (button), "clicked", button_clicked, ff);
-
- return button;
-}
-
-static void
-build_code (FilterElement *fe, GString *out, struct _FilterPart *ff)
-{
- return;
-}
-
-static void
-format_sexp (FilterElement *fe, GString *out)
-{
- FilterFolder *ff = (FilterFolder *)fe;
-
- e_sexp_encode_string (out, ff->uri);
-}
diff --git a/filter/filter-folder.h b/filter/filter-folder.h
deleted file mode 100644
index 3ce2c25afa..0000000000
--- a/filter/filter-folder.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2000 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef _FILTER_FOLDER_H
-#define _FILTER_FOLDER_H
-
-#include "filter-element.h"
-
-#define FILTER_FOLDER(obj) GTK_CHECK_CAST (obj, filter_folder_get_type (), FilterFolder)
-#define FILTER_FOLDER_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, filter_folder_get_type (), FilterFolderClass)
-#define IS_FILTER_FOLDER(obj) GTK_CHECK_TYPE (obj, filter_folder_get_type ())
-
-typedef struct _FilterFolder FilterFolder;
-typedef struct _FilterFolderClass FilterFolderClass;
-
-struct _FilterFolder {
- FilterElement parent;
- struct _FilterFolderPrivate *priv;
-
- char *uri;
- char *name; /* name of folder for display? */
-};
-
-struct _FilterFolderClass {
- FilterElementClass parent_class;
-
- /* virtual methods */
-
- /* signals */
-};
-
-guint filter_folder_get_type (void);
-FilterFolder *filter_folder_new (void);
-
-/* methods */
-
-#endif /* ! _FILTER_FOLDER_H */
-
diff --git a/filter/filter-input.c b/filter/filter-input.c
deleted file mode 100644
index ee531b9ed0..0000000000
--- a/filter/filter-input.c
+++ /dev/null
@@ -1,338 +0,0 @@
-/*
- * Copyright (C) 2000 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <regex.h>
-#include <gtk/gtkobject.h>
-#include <gtk/gtkwidget.h>
-
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-dialog.h>
-#include <libgnomeui/gnome-dialog-util.h>
-#include <gal/widgets/e-unicode.h>
-
-#include "filter-input.h"
-#include "e-util/e-sexp.h"
-
-#define d(x)
-
-static gboolean validate (FilterElement *fe);
-static void xml_create(FilterElement *fe, xmlNodePtr node);
-static xmlNodePtr xml_encode(FilterElement *fe);
-static int xml_decode(FilterElement *fe, xmlNodePtr node);
-static GtkWidget *get_widget(FilterElement *fe);
-static void build_code(FilterElement *fe, GString *out, struct _FilterPart *ff);
-static void format_sexp(FilterElement *, GString *);
-
-static void filter_input_class_init (FilterInputClass *class);
-static void filter_input_init (FilterInput *gspaper);
-static void filter_input_finalise (GtkObject *obj);
-
-#define _PRIVATE(x) (((FilterInput *)(x))->priv)
-
-struct _FilterInputPrivate {
-};
-
-static FilterElementClass *parent_class;
-
-enum {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-guint
-filter_input_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "FilterInput",
- sizeof(FilterInput),
- sizeof(FilterInputClass),
- (GtkClassInitFunc)filter_input_class_init,
- (GtkObjectInitFunc)filter_input_init,
- (GtkArgSetFunc)NULL,
- (GtkArgGetFunc)NULL
- };
-
- type = gtk_type_unique(filter_element_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-filter_input_class_init (FilterInputClass *class)
-{
- GtkObjectClass *object_class;
- FilterElementClass *filter_element = (FilterElementClass *)class;
-
- object_class = (GtkObjectClass *)class;
- parent_class = gtk_type_class(filter_element_get_type ());
-
- object_class->finalize = filter_input_finalise;
-
- /* override methods */
- filter_element->validate = validate;
- filter_element->xml_create = xml_create;
- filter_element->xml_encode = xml_encode;
- filter_element->xml_decode = xml_decode;
- filter_element->get_widget = get_widget;
- filter_element->build_code = build_code;
- filter_element->format_sexp = format_sexp;
-
- /* signals */
-
- gtk_object_class_add_signals(object_class, signals, LAST_SIGNAL);
-}
-
-static void
-filter_input_init (FilterInput *o)
-{
- o->priv = g_malloc0 (sizeof (*o->priv));
-}
-
-static void
-filter_input_finalise (GtkObject *obj)
-{
- FilterInput *o = (FilterInput *)obj;
-
- o = o;
-
- ((GtkObjectClass *)(parent_class))->finalize(obj);
-}
-
-/**
- * filter_input_new:
- *
- * Create a new FilterInput object.
- *
- * Return value: A new #FilterInput object.
- **/
-FilterInput *
-filter_input_new (void)
-{
- FilterInput *o = (FilterInput *)gtk_type_new(filter_input_get_type ());
- return o;
-}
-
-FilterInput *
-filter_input_new_type_name (const char *type)
-{
- FilterInput *o = filter_input_new ();
- o->type = g_strdup (type);
-
- d(printf("new type %s = %p\n", type, o));
- return o;
-}
-
-void
-filter_input_set_value (FilterInput *fi, const char *value)
-{
- GList *l;
-
- l = fi->values;
- while (l) {
- g_free (l->data);
- l = g_list_next (l);
- }
- g_list_free (fi->values);
-
- fi->values = g_list_append (NULL, g_strdup (value));
-}
-
-static gboolean
-validate (FilterElement *fe)
-{
- FilterInput *fi = (FilterInput *)fe;
- gboolean valid = TRUE;
-
- if (!strcmp (fi->type, "regex")) {
- regex_t regexpat; /* regex patern */
- gint regerr;
- char *text;
-
- text = fi->values->data;
-
- regerr = regcomp (&regexpat, text, REG_EXTENDED | REG_NEWLINE | REG_ICASE);
- if (regerr) {
- GtkWidget *dialog;
- gchar *regmsg, *errmsg;
- size_t reglen;
-
- /* regerror gets called twice to get the full error string
- length to do proper posix error reporting */
- reglen = regerror (regerr, &regexpat, 0, 0);
- regmsg = g_malloc0 (reglen + 1);
- regerror (regerr, &regexpat, regmsg, reglen);
-
- errmsg = g_strdup_printf (_("Error in regular expression '%s':\n%s"),
- text, regmsg);
- g_free (regmsg);
-
- dialog = gnome_ok_dialog (errmsg);
-
- gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
-
- g_free (errmsg);
- valid = FALSE;
- }
-
- regfree (&regexpat);
- }
-
- return valid;
-}
-
-static void
-xml_create (FilterElement *fe, xmlNodePtr node)
-{
- /* parent implementation */
- ((FilterElementClass *)(parent_class))->xml_create(fe, node);
-
-}
-
-static xmlNodePtr
-xml_encode (FilterElement *fe)
-{
- xmlNodePtr value;
- GList *l;
- FilterInput *fi = (FilterInput *)fe;
- char *type;
-
- type = fi->type ? fi->type : "string";
-
- d(printf ("Encoding %s as xml\n", type));
-
- value = xmlNewNode (NULL, "value");
- xmlSetProp (value, "name", fe->name);
- xmlSetProp (value, "type", type);
- l = fi->values;
- while (l) {
- xmlNodePtr cur;
- char *str = l->data;
- char *encstr;
-
- cur = xmlNewChild (value, NULL, type, NULL);
- encstr = e_utf8_xml1_encode (str);
- xmlNodeSetContent (cur, encstr);
- g_free (encstr);
- l = g_list_next (l);
- }
-
- return value;
-}
-
-static int
-xml_decode (FilterElement *fe, xmlNodePtr node)
-{
- FilterInput *fi = (FilterInput *)fe;
- char *name, *str, *type;
- xmlNodePtr n;
-
- name = xmlGetProp (node, "name");
- type = xmlGetProp (node, "type");
-
- d(printf("Decoding %s from xml %p\n", type, fe));
- d(printf ("Name = %s\n", name));
- xmlFree (fe->name);
- fe->name = name;
- xmlFree (fi->type);
- fi->type = type;
- n = node->childs;
- while (n) {
- if (!strcmp (n->name, type)) {
- gchar *decstr;
- str = xmlNodeGetContent (n);
- decstr = e_utf8_xml1_decode (str);
- if (str) xmlFree (str);
- d(printf (" '%s'\n", decstr));
- fi->values = g_list_append (fi->values, decstr);
- } else {
- g_warning ("Unknown node type '%s' encountered decoding a %s\n", n->name, type);
- }
- n = n->next;
- }
-
- return 0;
-}
-
-static void
-entry_changed (GtkEntry *entry, FilterElement *fe)
-{
- char *new;
- FilterInput *fi = (FilterInput *)fe;
- GList *l;
-
- new = e_utf8_gtk_entry_get_text(entry);
-
- /* NOTE: entry only supports a single value ... */
- l = fi->values;
- while (l) {
- g_free (l->data);
- l = g_list_next (l);
- }
-
- g_list_free (fi->values);
-
- fi->values = g_list_append (NULL, new);
-}
-
-static GtkWidget *
-get_widget (FilterElement *fe)
-{
- GtkWidget *entry;
- FilterInput *fi = (FilterInput *)fe;
-
- entry = gtk_entry_new ();
- if (fi->values && fi->values->data) {
- e_utf8_gtk_entry_set_text (GTK_ENTRY (entry), fi->values->data);
- }
-
- gtk_signal_connect (GTK_OBJECT (entry), "changed", entry_changed, fe);
-
- return entry;
-}
-
-static void
-build_code (FilterElement *fe, GString *out, struct _FilterPart *ff)
-{
- return;
-}
-
-static void
-format_sexp (FilterElement *fe, GString *out)
-{
- GList *l;
- FilterInput *fi = (FilterInput *)fe;
-
- l = fi->values;
- while (l) {
- e_sexp_encode_string (out, l->data);
- l = g_list_next (l);
- }
-}
diff --git a/filter/filter-input.h b/filter/filter-input.h
deleted file mode 100644
index 2c522d34e5..0000000000
--- a/filter/filter-input.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2000 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef _FILTER_INPUT_H
-#define _FILTER_INPUT_H
-
-#include "filter-element.h"
-
-#define FILTER_INPUT(obj) GTK_CHECK_CAST (obj, filter_input_get_type (), FilterInput)
-#define FILTER_INPUT_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, filter_input_get_type (), FilterInputClass)
-#define IS_FILTER_INPUT(obj) GTK_CHECK_TYPE (obj, filter_input_get_type ())
-
-typedef struct _FilterInput FilterInput;
-typedef struct _FilterInputClass FilterInputClass;
-
-struct _FilterInput {
- FilterElement parent;
- struct _FilterInputPrivate *priv;
-
- char *type; /* name of type */
- GList *values; /* strings */
-};
-
-struct _FilterInputClass {
- FilterElementClass parent_class;
-
- /* virtual methods */
-
- /* signals */
-};
-
-guint filter_input_get_type (void);
-FilterInput *filter_input_new (void);
-
-FilterInput *filter_input_new_type_name (const char *type);
-
-/* methods */
-void filter_input_set_value(FilterInput *fi, const char *value);
-
-#endif /* ! _FILTER_INPUT_H */
-
diff --git a/filter/filter-int.c b/filter/filter-int.c
deleted file mode 100644
index e6d2656b46..0000000000
--- a/filter/filter-int.c
+++ /dev/null
@@ -1,229 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Ripped off by Sam Creasey <sammy@oh.verio.com> from filter-score by:
- *
- * Authors: Jeffrey Stedfast <fejj@helixcode.com>
- *
- * Copyright 2000 Helix Code, Inc. (www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtkspinbutton.h>
-
-#include "e-util/e-sexp.h"
-#include "filter-int.h"
-
-#define d(x)
-
-static void xml_create (FilterElement *fe, xmlNodePtr node);
-static xmlNodePtr xml_encode (FilterElement *fe);
-static int xml_decode (FilterElement *fe, xmlNodePtr node);
-static GtkWidget *get_widget (FilterElement *fe);
-static void build_code (FilterElement *fe, GString *out, struct _FilterPart *ff);
-static void format_sexp (FilterElement *, GString *);
-
-static void filter_int_class_init (FilterIntClass *class);
-static void filter_int_init (FilterInt *gspaper);
-static void filter_int_finalise (GtkObject *obj);
-
-#define _PRIVATE(x) (((FilterInt *)(x))->priv)
-
-struct _FilterIntPrivate {
-};
-
-static FilterElementClass *parent_class;
-
-enum {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-guint
-filter_int_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "FilterInt",
- sizeof (FilterInt),
- sizeof (FilterIntClass),
- (GtkClassInitFunc) filter_int_class_init,
- (GtkObjectInitFunc) filter_int_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- type = gtk_type_unique (filter_element_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-filter_int_class_init (FilterIntClass *class)
-{
- GtkObjectClass *object_class;
- FilterElementClass *filter_element = (FilterElementClass *)class;
-
- object_class = (GtkObjectClass *)class;
- parent_class = gtk_type_class (filter_element_get_type ());
-
- object_class->finalize = filter_int_finalise;
-
- /* override methods */
- filter_element->xml_create = xml_create;
- filter_element->xml_encode = xml_encode;
- filter_element->xml_decode = xml_decode;
- filter_element->get_widget = get_widget;
- filter_element->build_code = build_code;
- filter_element->format_sexp = format_sexp;
-
- /* signals */
-
- gtk_object_class_add_signals(object_class, signals, LAST_SIGNAL);
-}
-
-static void
-filter_int_init (FilterInt *o)
-{
- o->priv = g_malloc0 (sizeof (*o->priv));
-}
-
-static void
-filter_int_finalise(GtkObject *obj)
-{
- FilterInt *o = (FilterInt *)obj;
-
- o = o;
-
- ((GtkObjectClass *)(parent_class))->finalize(obj);
-}
-
-/**
- * filter_int_new:
- *
- * Create a new FilterInt object.
- *
- * Return value: A new #FilterInt object.
- **/
-FilterInt *
-filter_int_new (void)
-{
- FilterInt *o = (FilterInt *)gtk_type_new(filter_int_get_type ());
- return o;
-}
-
-static void
-xml_create (FilterElement *fe, xmlNodePtr node)
-{
- /* parent implementation */
- ((FilterElementClass *)(parent_class))->xml_create(fe, node);
-}
-
-static xmlNodePtr
-xml_encode (FilterElement *fe)
-{
- xmlNodePtr value;
- FilterInt *fs = (FilterInt *)fe;
- char *intval;
-
- d(printf("Encoding integer as xml\n"));
-
- value = xmlNewNode (NULL, "value");
- xmlSetProp (value, "name", fe->name);
- xmlSetProp (value, "type", "integer");
-
- intval = g_strdup_printf ("%d", fs->val);
- xmlSetProp (value, "integer", intval);
- g_free (intval);
-
- return value;
-}
-
-static int
-xml_decode (FilterElement *fe, xmlNodePtr node)
-{
- FilterInt *fs = (FilterInt *)fe;
- char *name;
- char *intval;
-
- d(printf("Decoding integer from xml %p\n", fe));
-
- name = xmlGetProp (node, "name");
- d(printf ("Name = %s\n", name));
- xmlFree (fe->name);
- fe->name = name;
- intval = xmlGetProp (node, "integer");
- if (intval) {
- fs->val = atoi (intval);
- xmlFree (intval);
- } else
- fs->val = 0;
-
- return 0;
-}
-
-static void
-spin_changed (GtkWidget *spin, FilterElement *fe)
-{
- FilterInt *fs = (FilterInt *)fe;
-
- fs->val = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spin));
-}
-
-static GtkWidget *
-get_widget (FilterElement *fe)
-{
- GtkWidget *spin;
- GtkObject *adjustment;
- FilterInt *fs = (FilterInt *)fe;
-
- adjustment = gtk_adjustment_new (0.0, 0.0, (gfloat)G_MAXINT,
- 1.0, 1.0, 1.0);
- spin = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment), 5.0, 0);
- gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin), TRUE);
-
- if (fs->val) {
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin), (gfloat) fs->val);
- }
-
- gtk_signal_connect (GTK_OBJECT (spin), "changed", spin_changed, fe);
-
- return spin;
-}
-
-static void
-build_code (FilterElement *fe, GString *out, struct _FilterPart *ff)
-{
- return;
-}
-
-static void
-format_sexp (FilterElement *fe, GString *out)
-{
- FilterInt *fs = (FilterInt *)fe;
-
- g_string_append(out, g_strdup_printf("%d", fs->val));
-}
diff --git a/filter/filter-int.h b/filter/filter-int.h
deleted file mode 100644
index 1fb702aec1..0000000000
--- a/filter/filter-int.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Ripped off by Sam Creasey <sammy@oh.verio.com> from filter-score by:
- *
- * Authors: Jeffrey Stedfast <fejj@helixcode.com>
- *
- * Copyright 2000 Helix Code, Inc. (www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-#ifndef _FILTER_INT_H
-#define _FILTER_INT_H
-
-#include "filter-element.h"
-
-#define FILTER_INT(obj) GTK_CHECK_CAST (obj, filter_int_get_type (), FilterInt)
-#define FILTER_INT_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, filter_int_get_type (), FilterIntClass)
-#define IS_FILTER_INT(obj) GTK_CHECK_TYPE (obj, filter_int_get_type ())
-
-typedef struct _FilterInt FilterInt;
-typedef struct _FilterIntClass FilterIntClass;
-
-struct _FilterInt {
- FilterElement parent;
- struct _FilterIntPrivate *priv;
-
- gint32 val;
-};
-
-struct _FilterIntClass {
- FilterElementClass parent_class;
-
- /* virtual methods */
-
- /* signals */
-};
-
-guint filter_int_get_type (void);
-FilterInt *filter_int_new (void);
-
-/* methods */
-
-#endif /* ! _FILTER_INT_H */
-
diff --git a/filter/filter-message-search.c b/filter/filter-message-search.c
deleted file mode 100644
index 415bdb170c..0000000000
--- a/filter/filter-message-search.c
+++ /dev/null
@@ -1,806 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors: Jeffrey Stedfast <fejj@helixcode.com>
- *
- * Copyright 2000 Helix Code, Inc. (www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "filter-message-search.h"
-#include <gal/widgets/e-unicode.h>
-#include <e-util/e-sexp.h>
-#include <regex.h>
-#include <string.h>
-#include <ctype.h>
-
-typedef struct {
- CamelMimeMessage *message;
- CamelMessageInfo *info;
- const char *source;
- CamelException *ex;
-} FilterMessageSearch;
-
-/* ESExp callbacks */
-static ESExpResult *header_contains (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
-static ESExpResult *header_matches (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
-static ESExpResult *header_starts_with (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
-static ESExpResult *header_ends_with (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
-static ESExpResult *header_exists (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
-static ESExpResult *header_soundex (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
-static ESExpResult *header_regex (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
-static ESExpResult *header_full_regex (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
-static ESExpResult *match_all (struct _ESExp *f, int argc, struct _ESExpTerm **argv, FilterMessageSearch *fms);
-static ESExpResult *body_contains (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
-static ESExpResult *body_regex (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
-static ESExpResult *user_flag (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
-static ESExpResult *user_tag (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
-static ESExpResult *system_flag (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
-static ESExpResult *get_sent_date (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
-static ESExpResult *get_received_date (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
-static ESExpResult *get_current_date (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
-static ESExpResult *get_score (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
-static ESExpResult *get_source (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
-
-/* builtin functions */
-static struct {
- char *name;
- ESExpFunc *func;
- int type; /* set to 1 if a function can perform shortcut evaluation, or
- doesn't execute everything, 0 otherwise */
-} symbols[] = {
- { "match-all", (ESExpFunc *) match_all, 0 },
- { "body-contains", (ESExpFunc *) body_contains, 0 },
- { "body-regex", (ESExpFunc *) body_regex, 0 },
- { "header-contains", (ESExpFunc *) header_contains, 0 },
- { "header-matches", (ESExpFunc *) header_matches, 0 },
- { "header-starts-with", (ESExpFunc *) header_starts_with, 0 },
- { "header-ends-with", (ESExpFunc *) header_ends_with, 0 },
- { "header-exists", (ESExpFunc *) header_exists, 0 },
- { "header-soundex", (ESExpFunc *) header_soundex, 0 },
- { "header-regex", (ESExpFunc *) header_regex, 0 },
- { "header-full-regex", (ESExpFunc *) header_full_regex, 0 },
- { "user-tag", (ESExpFunc *) user_tag, 0 },
- { "user-flag", (ESExpFunc *) user_flag, 0 },
- { "system-flag", (ESExpFunc *) system_flag, 0 },
- { "get-sent-date", (ESExpFunc *) get_sent_date, 0 },
- { "get-received-date", (ESExpFunc *) get_received_date, 0 },
- { "get-current-date", (ESExpFunc *) get_current_date, 0 },
- { "get-score", (ESExpFunc *) get_score, 0 },
- { "get-source", (ESExpFunc *) get_source, 0 },
-};
-
-static ESExpResult *
-header_contains (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
-{
- gboolean matched = FALSE;
- ESExpResult *r;
-
- if (argc == 2) {
- char *header = (argv[0])->value.string;
- char *match = (argv[1])->value.string;
- const char *contents;
-
- contents = camel_medium_get_header (CAMEL_MEDIUM (fms->message), header);
-
- if (contents) {
- if (e_utf8_strstrcase (contents, match))
- matched = TRUE;
- }
- }
-
- r = e_sexp_result_new (ESEXP_RES_BOOL);
- r->value.bool = matched;
-
- return r;
-}
-
-static ESExpResult *
-header_matches (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
-{
- gboolean matched = FALSE;
- ESExpResult *r;
-
- if (argc == 2) {
- char *header = (argv[0])->value.string;
- char *match = (argv[1])->value.string;
- const char *contents;
-
- contents = camel_medium_get_header (CAMEL_MEDIUM (fms->message), header);
-
- if (contents) {
- /* danw says to use search-engine style matching...
- * This means that if the search match string is
- * lowercase then compare case-insensitive else
- * compare case-sensitive. */
- gboolean is_lowercase = TRUE;
- char *c;
-
- /* remove any leading white space... */
- for ( ; *contents && isspace (*contents); contents++);
-
- for (c = match; *c; c++) {
- if (isalpha (*c) && isupper (*c)) {
- is_lowercase = FALSE;
- break;
- }
- }
-
- if (is_lowercase) {
- if (!g_strcasecmp (contents, match))
- matched = TRUE;
- } else {
- if (!strcmp (contents, match))
- matched = TRUE;
- }
- }
- }
-
- r = e_sexp_result_new (ESEXP_RES_BOOL);
- r->value.bool = matched;
-
- return r;
-}
-
-static ESExpResult *
-header_starts_with (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
-{
- gboolean matched = FALSE;
- ESExpResult *r;
-
- if (argc == 2) {
- char *header = (argv[0])->value.string;
- char *match = (argv[1])->value.string;
- const char *contents;
-
- contents = camel_medium_get_header (CAMEL_MEDIUM (fms->message), header);
-
- if (contents && strlen (contents) >= strlen (match)) {
- /* danw says to use search-engine style matching...
- * This means that if the search match string is
- * lowercase then compare case-insensitive else
- * compare case-sensitive. */
- gboolean is_lowercase = TRUE;
- char *c;
-
- /* remove any leading white space... */
- for ( ; *contents && isspace (*contents); contents++);
-
- for (c = match; *c; c++) {
- if (isalpha (*c) && isupper (*c)) {
- is_lowercase = FALSE;
- break;
- }
- }
-
- if (is_lowercase) {
- if (!g_strncasecmp (contents, match, strlen (match)))
- matched = TRUE;
- } else {
- if (!strncmp (contents, match, strlen (match)))
- matched = TRUE;
- }
- }
- }
-
- r = e_sexp_result_new (ESEXP_RES_BOOL);
- r->value.bool = matched;
-
- return r;
-}
-
-static ESExpResult *
-header_ends_with (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
-{
- gboolean matched = FALSE;
- ESExpResult *r;
-
- if (argc == 2) {
- char *header = (argv[0])->value.string;
- char *match = (argv[1])->value.string;
- const char *contents;
-
- contents = camel_medium_get_header (CAMEL_MEDIUM (fms->message), header);
-
- if (contents && strlen (contents) >= strlen (match)) {
- /* danw says to use search-engine style matching...
- * This means that if the search match string is
- * lowercase then compare case-insensitive else
- * compare case-sensitive. */
- gboolean is_lowercase = TRUE;
- char *c, *end;
-
- /* remove any leading white space... */
- for ( ; *contents && isspace (*contents); contents++);
-
- for (c = match; *c; c++) {
- if (isalpha (*c) && isupper (*c)) {
- is_lowercase = FALSE;
- break;
- }
- }
-
- end = (char *) contents + strlen (contents) - strlen (match);
-
- if (is_lowercase) {
- if (!g_strcasecmp (end, match))
- matched = TRUE;
- } else {
- if (!strcmp (end, match))
- matched = TRUE;
- }
- }
- }
-
- r = e_sexp_result_new (ESEXP_RES_BOOL);
- r->value.bool = matched;
-
- return r;
-}
-
-static ESExpResult *
-header_exists (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
-{
- gboolean matched = FALSE;
- ESExpResult *r;
-
- if (argc == 1) {
- char *header = (argv[0])->value.string;
- const char *contents;
-
- contents = camel_medium_get_header (CAMEL_MEDIUM (fms->message), header);
-
- if (contents)
- matched = TRUE;
- }
-
- r = e_sexp_result_new (ESEXP_RES_BOOL);
- r->value.bool = matched;
-
- return r;
-}
-
-static unsigned char soundex_table[256] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 49, 50, 51, 0, 49, 50, 0, 0, 50, 50, 52, 53, 53, 0,
- 49, 50, 54, 50, 51, 0, 49, 0, 50, 0, 50, 0, 0, 0, 0, 0,
- 0, 0, 49, 50, 51, 0, 49, 50, 0, 0, 50, 50, 52, 53, 53, 0,
- 49, 50, 54, 50, 51, 0, 49, 0, 50, 0, 50, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-};
-
-static void
-soundexify (const gchar *sound, gchar code[5])
-{
- guchar *c, last = '\0';
- gint n;
-
- for (c = (guchar *) sound; *c && !isalpha (*c); c++);
- code[0] = toupper (*c);
- memset (code + 1, '0', 3);
- for (n = 1; *c && n < 5; c++) {
- guchar ch = soundex_table[*c];
-
- if (ch && ch != last) {
- code[n++] = ch;
- last = ch;
- }
- }
- code[4] = '\0';
-}
-
-static gint
-soundexcmp (const gchar *sound1, const gchar *sound2)
-{
- gchar code1[5], code2[5];
-
- soundexify (sound1, code1);
- soundexify (sound2, code2);
-
- return strcmp (code1, code2);
-}
-
-static ESExpResult *
-header_soundex (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
-{
- gboolean matched = FALSE;
- ESExpResult *r;
-
- if (argc == 2) {
- char *header = (argv[0])->value.string;
- char *match = (argv[1])->value.string;
- const char *contents;
-
- contents = camel_medium_get_header (CAMEL_MEDIUM (fms->message), header);
-
- if (contents) {
- /* remove any leading white space... */
- for ( ; *contents && isspace (*contents); contents++);
-
- if (!soundexcmp (contents, match))
- matched = TRUE;
- }
- }
-
- r = e_sexp_result_new (ESEXP_RES_BOOL);
- r->value.bool = matched;
-
- return r;
-}
-
-static ESExpResult *
-header_regex (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
-{
- gboolean matched = FALSE;
- ESExpResult *r;
-
- if (argc == 2) {
- char *header = (argv[0])->value.string;
- char *match = (argv[1])->value.string;
- regex_t regexpat; /* regex patern */
- regmatch_t *fltmatch;
- gint regerr = 0;
- size_t reglen = 0;
- gchar *regmsg;
- const char *contents;
-
- contents = camel_medium_get_header (CAMEL_MEDIUM (fms->message), header);
-
- regerr = regcomp (&regexpat, match, REG_EXTENDED | REG_NEWLINE | REG_ICASE);
- if (regerr) {
- /* regerror gets called twice to get the full error string
- length to do proper posix error reporting */
- reglen = regerror (regerr, &regexpat, 0, 0);
- regmsg = g_malloc0 (reglen + 1);
- regerror (regerr, &regexpat, regmsg, reglen);
- camel_exception_setv (fms->ex, CAMEL_EXCEPTION_SYSTEM,
- _("Failed to perform regex search on message header: %s"),
- regmsg);
- g_free (regmsg);
- regfree (&regexpat);
- } else {
- if (contents) {
- fltmatch = g_new0 (regmatch_t, regexpat.re_nsub);
-
- if (!regexec (&regexpat, contents, regexpat.re_nsub, fltmatch, 0))
- matched = TRUE;
-
- g_free (fltmatch);
- regfree (&regexpat);
- }
- }
- }
-
- r = e_sexp_result_new (ESEXP_RES_BOOL);
- r->value.bool = matched;
-
- return r;
-}
-
-static gchar *
-get_full_header (CamelMimeMessage *message)
-{
- CamelMimePart *mp = CAMEL_MIME_PART (message);
- GString *str = g_string_new ("");
- char *ret;
- struct _header_raw *h;
-
- for (h = mp->headers; h; h = h->next) {
- if (h->value != NULL)
- g_string_sprintfa (str, "%s%s%s\n", h->name,
- isspace (h->value[0]) ? ":" : ": ", h->value);
- }
-
- ret = str->str;
- g_string_free (str, FALSE);
-
- return ret;
-}
-
-static ESExpResult *
-header_full_regex (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
-{
- gboolean matched = FALSE;
- ESExpResult *r;
-
- if (argc == 1) {
- char *match = (argv[0])->value.string;
- regex_t regexpat; /* regex patern */
- regmatch_t *fltmatch;
- gint regerr = 0;
- size_t reglen = 0;
- gchar *regmsg;
- char *contents;
-
- contents = get_full_header (fms->message);
-
- regerr = regcomp (&regexpat, match, REG_EXTENDED | REG_NEWLINE | REG_ICASE);
- if (regerr) {
- /* regerror gets called twice to get the full error string
- length to do proper posix error reporting */
- reglen = regerror (regerr, &regexpat, 0, 0);
- regmsg = g_malloc0 (reglen + 1);
- regerror (regerr, &regexpat, regmsg, reglen);
- camel_exception_setv (fms->ex, CAMEL_EXCEPTION_SYSTEM,
- _("Failed to perform regex search on message header: %s"),
- regmsg);
- g_free (regmsg);
- regfree (&regexpat);
- } else {
- if (contents) {
- fltmatch = g_new0 (regmatch_t, regexpat.re_nsub);
-
- if (!regexec (&regexpat, contents, regexpat.re_nsub, fltmatch, 0))
- matched = TRUE;
-
- g_free (fltmatch);
- regfree (&regexpat);
- }
- }
- g_free (contents);
- }
-
- r = e_sexp_result_new (ESEXP_RES_BOOL);
- r->value.bool = matched;
-
- return r;
-}
-
-static ESExpResult *
-match_all (struct _ESExp *f, int argc, struct _ESExpTerm **argv, FilterMessageSearch *fms)
-{
- /* match-all: when dealing with single messages is a no-op */
- ESExpResult *r;
-
- r = e_sexp_result_new (ESEXP_RES_BOOL);
- if (argv[0]->type == ESEXP_RES_BOOL)
- r->value.bool = argv[0]->value.bool;
- else
- r->value.bool = FALSE;
-
- return r;
-}
-
-static gboolean
-mime_part_matches (CamelMimePart *mime_part, const char *match, gboolean regex, CamelException *ex)
-{
- CamelStream *stream;
- GByteArray *array;
- char *text;
- regex_t regexpat; /* regex patern */
- regmatch_t *fltmatch;
- gint regerr = 0;
- size_t reglen = 0;
- gchar *regmsg;
- gboolean matched = FALSE;
-
- array = g_byte_array_new ();
- stream = camel_stream_mem_new_with_byte_array (array);
- camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (mime_part), stream);
- camel_object_unref (CAMEL_OBJECT (stream));
-
- g_byte_array_append (array, "", 1);
-
- text = array->data;
-
- if (regex) {
- regerr = regcomp (&regexpat, match, REG_EXTENDED | REG_NEWLINE | REG_ICASE);
- if (regerr) {
- /* regerror gets called twice to get the full error string
- length to do proper posix error reporting */
- reglen = regerror (regerr, &regexpat, 0, 0);
- regmsg = g_malloc0 (reglen + 1);
- regerror (regerr, &regexpat, regmsg, reglen);
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "Failed to perform regex search on message body: %s",
- regmsg);
- g_free (regmsg);
- regfree (&regexpat);
- } else {
- fltmatch = g_new0 (regmatch_t, regexpat.re_nsub);
-
- if (!regexec (&regexpat, text, regexpat.re_nsub, fltmatch, 0))
- matched = TRUE;
-
- g_free (fltmatch);
- regfree (&regexpat);
- }
- } else {
- if (strstr (text, match))
- matched = TRUE;
- }
-
- g_byte_array_free (array, TRUE);
-
- return matched;
-}
-
-static gboolean
-handle_multipart (CamelMultipart *multipart, const char *match, gboolean regex, CamelException *ex)
-{
- gboolean matched = FALSE;
- int i, nparts;
-
- nparts = camel_multipart_get_number (multipart);
-
- for (i = 0; i < nparts && !matched; i++) {
- CamelContentType *content;
- CamelMimePart *mime_part;
-
- mime_part = camel_multipart_get_part (multipart, i);
- content = camel_mime_part_get_content_type (mime_part);
-
- if (header_content_type_is (content, "text", "*")) {
- /* we only want to match text parts */
- matched = mime_part_matches (mime_part, match, regex, ex);
-
- if (camel_exception_is_set (ex))
- break;
- } else if (header_content_type_is (content, "multipart", "*")) {
- CamelDataWrapper *wrapper;
- CamelMultipart *mpart;
-
- wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (mime_part));
- mpart = CAMEL_MULTIPART (wrapper);
-
- matched = handle_multipart (mpart, match, regex, ex);
-
- if (camel_exception_is_set (ex))
- break;
- }
- }
-
- return matched;
-}
-
-static ESExpResult *
-body_contains (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
-{
- gboolean matched = FALSE;
- ESExpResult *r;
-
- if (argc > 0) {
- CamelContentType *content;
- char *match;
-
- match = (*argv)->value.string;
-
- content = camel_mime_part_get_content_type (CAMEL_MIME_PART (fms->message));
-
- if (header_content_type_is (content, "multipart", "*")) {
- CamelDataWrapper *wrapper;
- CamelMultipart *multipart;
-
- wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (CAMEL_MIME_PART (fms->message)));
- multipart = CAMEL_MULTIPART (wrapper);
-
- matched = handle_multipart (multipart, match, FALSE, fms->ex);
- } else {
- /* single-part message so just search the entire message */
- matched = mime_part_matches (CAMEL_MIME_PART (fms->message), match, FALSE, fms->ex);
- }
- }
-
- r = e_sexp_result_new (ESEXP_RES_BOOL);
- r->value.bool = matched;
-
- return r;
-}
-
-static ESExpResult *
-body_regex (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
-{
- gboolean matched = FALSE;
- ESExpResult *r;
-
- if (argc > 0) {
- CamelContentType *content;
- char *match;
-
- match = (*argv)->value.string;
-
- content = camel_mime_part_get_content_type (CAMEL_MIME_PART (fms->message));
-
- if (header_content_type_is (content, "multipart", "*")) {
- CamelDataWrapper *wrapper;
- CamelMultipart *multipart;
-
- wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (CAMEL_MIME_PART (fms->message)));
- multipart = CAMEL_MULTIPART (wrapper);
-
- matched = handle_multipart (multipart, match, TRUE, fms->ex);
- } else {
- /* single-part message so just search the entire message */
- matched = mime_part_matches (CAMEL_MIME_PART (fms->message), match, TRUE, fms->ex);
- }
- }
-
- r = e_sexp_result_new (ESEXP_RES_BOOL);
- r->value.bool = matched;
-
- return r;
-}
-
-static ESExpResult *
-user_flag (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
-{
- ESExpResult *r;
- gboolean truth = FALSE;
- int i;
-
- /* performs an OR of all words */
- for (i = 0; i < argc && !truth; i++) {
- if (argv[i]->type == ESEXP_RES_STRING
- && camel_flag_get (&fms->info->user_flags, argv[i]->value.string)) {
- truth = TRUE;
- break;
- }
- }
-
- r = e_sexp_result_new (ESEXP_RES_BOOL);
- r->value.bool = truth;
-
- return r;
-}
-
-static ESExpResult *
-system_flag (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
-{
- ESExpResult *r;
- gboolean truth = FALSE;
-
- if (argc == 1)
- truth = camel_system_flag_get (fms->info->flags, argv[0]->value.string);
-
- r = e_sexp_result_new (ESEXP_RES_BOOL);
- r->value.bool = truth;
-
- return r;
-}
-
-static ESExpResult *
-user_tag (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
-{
- ESExpResult *r;
- const char *tag;
-
- tag = camel_tag_get (&fms->info->user_tags, argv[0]->value.string);
-
- r = e_sexp_result_new (ESEXP_RES_STRING);
- r->value.string = g_strdup (tag ? tag : "");
-
- return r;
-}
-
-static ESExpResult *
-get_sent_date (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
-{
- ESExpResult *r;
-
- r = e_sexp_result_new(ESEXP_RES_INT);
- r->value.number = camel_mime_message_get_date(fms->message, NULL);
-
- return r;
-}
-
-static ESExpResult *
-get_received_date (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
-{
- ESExpResult *r;
-
- r = e_sexp_result_new(ESEXP_RES_INT);
- r->value.number = camel_mime_message_get_date_received(fms->message, NULL);
-
- return r;
-}
-
-static ESExpResult *
-get_current_date (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
-{
- ESExpResult *r;
-
- r = e_sexp_result_new (ESEXP_RES_INT);
- r->value.number = time (NULL);
-
- return r;
-}
-
-static ESExpResult *
-get_score (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
-{
- ESExpResult *r;
- const char *tag;
-
- tag = camel_tag_get (&fms->info->user_tags, "score");
-
- r = e_sexp_result_new (ESEXP_RES_INT);
- if (tag)
- r->value.number = atoi (tag);
- else
- r->value.number = 0;
-
- return r;
-}
-
-static ESExpResult *
-get_source (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
-{
- ESExpResult *r;
-
- r = e_sexp_result_new (ESEXP_RES_STRING);
- r->value.string = g_strdup (fms->source);
-
- return r;
-}
-
-gboolean
-filter_message_search (CamelMimeMessage *message, CamelMessageInfo *info,
- const char *source, const char *expression, CamelException *ex)
-{
- FilterMessageSearch *fms;
- ESExp *sexp;
- ESExpResult *result;
- gboolean retval;
- int i;
-
- fms = g_new (FilterMessageSearch, 1);
- fms->message = message;
- fms->info = info;
- fms->source = source;
- fms->ex = ex;
-
- sexp = e_sexp_new ();
-
- for (i = 0; i < sizeof (symbols) / sizeof (symbols[0]); i++) {
- if (symbols[i].type == 1) {
- e_sexp_add_ifunction (sexp, 0, symbols[i].name,
- (ESExpIFunc *)symbols[i].func, fms);
- } else {
- e_sexp_add_function (sexp, 0, symbols[i].name,
- symbols[i].func, fms);
- }
- }
-
- e_sexp_input_text (sexp, expression, strlen (expression));
- e_sexp_parse (sexp);
- result = e_sexp_eval (sexp);
-
- g_free (fms);
-
- if (result->type == ESEXP_RES_BOOL)
- retval = result->value.bool;
- else
- retval = FALSE;
-
- e_sexp_unref(sexp);
- e_sexp_result_free (result);
-
- return retval;
-}
diff --git a/filter/filter-option.c b/filter/filter-option.c
deleted file mode 100644
index 5167a3df9b..0000000000
--- a/filter/filter-option.c
+++ /dev/null
@@ -1,351 +0,0 @@
-/*
- * Copyright (C) 2000 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <config.h>
-
-#include <string.h>
-#include <glib.h>
-#include <gtk/gtkmenuitem.h>
-#include <gtk/gtkoptionmenu.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-i18n.h>
-#include <gal/widgets/e-unicode.h>
-
-#include "filter-option.h"
-#include "filter-part.h"
-#include "e-util/e-sexp.h"
-
-#define d(x)
-
-static void xml_create(FilterElement *fe, xmlNodePtr node);
-static xmlNodePtr xml_encode(FilterElement *fe);
-static int xml_decode(FilterElement *fe, xmlNodePtr node);
-static FilterElement *clone(FilterElement *fe);
-static GtkWidget *get_widget(FilterElement *fe);
-static void build_code(FilterElement *fe, GString *out, struct _FilterPart *ff);
-static void format_sexp(FilterElement *, GString *);
-
-static void filter_option_class_init (FilterOptionClass *class);
-static void filter_option_init (FilterOption *gspaper);
-static void filter_option_finalise (GtkObject *obj);
-
-#define _PRIVATE(x) (((FilterOption *)(x))->priv)
-
-struct _FilterOptionPrivate {
-};
-
-static FilterElementClass *parent_class;
-
-enum {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-guint
-filter_option_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "FilterOption",
- sizeof(FilterOption),
- sizeof(FilterOptionClass),
- (GtkClassInitFunc)filter_option_class_init,
- (GtkObjectInitFunc)filter_option_init,
- (GtkArgSetFunc)NULL,
- (GtkArgGetFunc)NULL
- };
-
- type = gtk_type_unique (filter_element_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-filter_option_class_init (FilterOptionClass *class)
-{
- GtkObjectClass *object_class;
- FilterElementClass *filter_element = (FilterElementClass *)class;
-
- object_class = (GtkObjectClass *)class;
- parent_class = gtk_type_class(filter_element_get_type ());
-
- object_class->finalize = filter_option_finalise;
-
- /* override methods */
- filter_element->xml_create = xml_create;
- filter_element->xml_encode = xml_encode;
- filter_element->xml_decode = xml_decode;
- filter_element->clone = clone;
- filter_element->get_widget = get_widget;
- filter_element->build_code = build_code;
- filter_element->format_sexp = format_sexp;
-
- /* signals */
-
- gtk_object_class_add_signals(object_class, signals, LAST_SIGNAL);
-}
-
-static void
-filter_option_init (FilterOption *o)
-{
- o->priv = g_malloc0 (sizeof (*o->priv));
-}
-
-static void
-filter_option_finalise (GtkObject *obj)
-{
- FilterOption *o = (FilterOption *)obj;
-
- o = o;
-
- ((GtkObjectClass *)(parent_class))->finalize(obj);
-}
-
-/**
- * filter_option_new:
- *
- * Create a new FilterOption object.
- *
- * Return value: A new #FilterOption object.
- **/
-FilterOption *
-filter_option_new (void)
-{
- FilterOption *o = (FilterOption *)gtk_type_new (filter_option_get_type ());
- return o;
-}
-
-static struct _filter_option *
-find_option (FilterOption *fo, const char *name)
-{
- GList *l = fo->options;
- struct _filter_option *op;
-
- while (l) {
- op = l->data;
- if (!strcmp (name, op->value)) {
- return op;
- }
- l = g_list_next (l);
- }
-
- return NULL;
-}
-
-void
-filter_option_set_current (FilterOption *option, const char *name)
-{
- g_assert(IS_FILTER_OPTION(option));
-
- option->current = find_option (option, name);
-}
-
-static void
-xml_create (FilterElement *fe, xmlNodePtr node)
-{
- FilterOption *fo = (FilterOption *)fe;
- xmlNodePtr n, work;
- struct _filter_option *op;
-
- /* parent implementation */
- ((FilterElementClass *)(parent_class))->xml_create(fe, node);
-
- n = node->childs;
- while (n) {
- if (!strcmp (n->name, "option")) {
- op = g_malloc0 (sizeof (*op));
- op->value = xmlGetProp (n, "value");
- work = n->childs;
- while (work) {
- if (!strcmp (work->name, "title")) {
- if (!op->title) {
- gchar *str, *decstr;
- str = xmlNodeGetContent (work);
- decstr = e_utf8_xml1_decode (str);
- if (str) xmlFree (str);
- op->title = decstr;
- }
- } else if (!strcmp (work->name, "code")) {
- if (!op->code) {
- gchar *str, *decstr;
- str = xmlNodeGetContent (work);
- decstr = e_utf8_xml1_decode (str);
- if (str) xmlFree (str);
- op->code = decstr;
- }
- }
- work = work->next;
- }
- d(printf ("creating new option:\n title %s\n value %s\n code %s\n",
- op->title, op->value, op->code ? op->code : "none"));
- fo->options = g_list_append (fo->options, op);
- if (fo->current == NULL)
- fo->current = op;
- } else {
- g_warning ("Unknown xml node within optionlist: %s\n", n->name);
- }
- n = n->next;
- }
-}
-
-static xmlNodePtr
-xml_encode (FilterElement *fe)
-{
- xmlNodePtr value;
- FilterOption *fo = (FilterOption *)fe;
-
- d(printf ("Encoding option as xml\n"));
- value = xmlNewNode (NULL, "value");
- xmlSetProp (value, "name", fe->name);
- xmlSetProp (value, "type", "option");
- if (fo->current) {
- xmlSetProp (value, "value", fo->current->value);
- }
-
- return value;
-}
-
-static int
-xml_decode (FilterElement *fe, xmlNodePtr node)
-{
- FilterOption *fo = (FilterOption *)fe;
- char *value;
-
- d(printf ("Decoding option from xml\n"));
- xmlFree (fe->name);
- fe->name = xmlGetProp (node, "name");
- value = xmlGetProp (node, "value");
- if (value) {
- fo->current = find_option (fo, value);
- xmlFree (value);
- } else {
- fo->current = NULL;
- }
- return 0;
-}
-
-static void
-option_changed (GtkWidget *widget, FilterElement *fe)
-{
- FilterOption *fo = (FilterOption *)fe;
-
- fo->current = gtk_object_get_data (GTK_OBJECT (widget), "option");
-}
-
-static GtkWidget *
-get_widget (FilterElement *fe)
-{
- FilterOption *fo = (FilterOption *)fe;
- GtkWidget *menu;
- GtkWidget *omenu;
- GtkWidget *item;
- GtkWidget *first = NULL;
- GList *l = fo->options;
- struct _filter_option *op;
- int index = 0, current = 0;
-
- menu = gtk_menu_new ();
- while (l) {
- op = l->data;
- item = gtk_menu_item_new_with_label (_(op->title));
- gtk_object_set_data (GTK_OBJECT (item), "option", op);
- gtk_signal_connect (GTK_OBJECT (item), "activate", option_changed, fe);
- gtk_menu_append (GTK_MENU (menu), item);
- gtk_widget_show (item);
- if (op == fo->current) {
- current = index;
- first = item;
- } else if (!first) {
- first = item;
- }
-
- l = g_list_next (l);
- index++;
- }
-
- omenu = gtk_option_menu_new ();
- gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu);
-
- if (first)
- gtk_signal_emit_by_name (GTK_OBJECT (first), "activate", fe);
-
- gtk_option_menu_set_history (GTK_OPTION_MENU (omenu), current);
-
- return omenu;
-}
-
-static void
-build_code (FilterElement *fe, GString *out, struct _FilterPart *ff)
-{
- FilterOption *fo = (FilterOption *)fe;
-
- d(printf ("building option code %p, current = %p\n", fo, fo->current));
-
- if (fo->current && fo->current->code) {
- filter_part_expand_code (ff, fo->current->code, out);
- }
-}
-
-static void
-format_sexp (FilterElement *fe, GString *out)
-{
- FilterOption *fo = (FilterOption *)fe;
-
- if (fo->current) {
- e_sexp_encode_string (out, fo->current->value);
- }
-}
-
-static FilterElement *
-clone (FilterElement *fe)
-{
- FilterOption *fo = (FilterOption *)fe, *new;
- GList *l;
- struct _filter_option *fn, *op;
-
- d(printf ("cloning option\n"));
-
- new = FILTER_OPTION (((FilterElementClass *)(parent_class))->clone(fe));
- l = fo->options;
- while (l) {
- op = l->data;
- fn = g_malloc (sizeof (*fn));
- d(printf (" option %s\n", op->title));
- fn->title = g_strdup (op->title);
- fn->value = g_strdup (op->value);
- if (op->code)
- fn->code = g_strdup (op->code);
- else
- fn->code = NULL;
- new->options = g_list_append (new->options, fn);
- l = g_list_next (l);
-
- if (new->current == NULL)
- new->current = fn;
- }
-
- d(printf ("cloning option code %p, current = %p\n", new, new->current));
-
- return (FilterElement *)new;
-}
diff --git a/filter/filter-option.h b/filter/filter-option.h
deleted file mode 100644
index ebd2d3dd09..0000000000
--- a/filter/filter-option.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2000 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef _FILTER_OPTION_H
-#define _FILTER_OPTION_H
-
-#include "filter-element.h"
-
-#define FILTER_OPTION(obj) GTK_CHECK_CAST (obj, filter_option_get_type (), FilterOption)
-#define FILTER_OPTION_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, filter_option_get_type (), FilterOptionClass)
-#define IS_FILTER_OPTION(obj) GTK_CHECK_TYPE (obj, filter_option_get_type ())
-
-typedef struct _FilterOption FilterOption;
-typedef struct _FilterOptionClass FilterOptionClass;
-
-struct _filter_option {
- char *title; /* button title */
- char *value; /* value, if it has one */
- char *code; /* used to string code segments together */
-};
-
-struct _FilterOption {
- FilterElement parent;
- struct _FilterOptionPrivate *priv;
-
- GList *options;
- struct _filter_option *current;
-};
-
-struct _FilterOptionClass {
- FilterElementClass parent_class;
-
- /* virtual methods */
-
- /* signals */
-};
-
-guint filter_option_get_type (void);
-FilterOption *filter_option_new (void);
-
-/* methods */
-void filter_option_set_current(FilterOption *option, const char *name);
-
-#endif /* ! _FILTER_OPTION_H */
-
diff --git a/filter/filter-part.c b/filter/filter-part.c
deleted file mode 100644
index d056441567..0000000000
--- a/filter/filter-part.c
+++ /dev/null
@@ -1,501 +0,0 @@
-/*
- * Copyright (C) 2000 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <config.h>
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <glib.h>
-#include <gtk/gtkbox.h>
-#include <gtk/gtkhbox.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-i18n.h>
-#include <gal/widgets/e-unicode.h>
-
-#include "filter-part.h"
-#include "filter-element.h"
-
-
-#define d(x)
-
-static void filter_part_class_init (FilterPartClass *class);
-static void filter_part_init (FilterPart *gspaper);
-static void filter_part_finalise (GtkObject *obj);
-
-#define _PRIVATE(x) (((FilterPart *)(x))->priv)
-
-struct _FilterPartPrivate {
-};
-
-static GtkObjectClass *parent_class;
-
-enum {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-guint
-filter_part_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "FilterPart",
- sizeof(FilterPart),
- sizeof(FilterPartClass),
- (GtkClassInitFunc)filter_part_class_init,
- (GtkObjectInitFunc)filter_part_init,
- (GtkArgSetFunc)NULL,
- (GtkArgGetFunc)NULL
- };
-
- type = gtk_type_unique(gtk_object_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-filter_part_class_init (FilterPartClass *class)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass *)class;
- parent_class = gtk_type_class (gtk_object_get_type ());
-
- object_class->finalize = filter_part_finalise;
- /* override methods */
-
- /* signals */
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-filter_part_init (FilterPart *o)
-{
- o->priv = g_malloc0 (sizeof (*o->priv));
-}
-
-static void
-filter_part_finalise(GtkObject *obj)
-{
- FilterPart *o = (FilterPart *)obj;
- GList *l;
-
- o = o;
-
- l = o->elements;
- while (l) {
- gtk_object_unref((GtkObject *)l->data);
- l = g_list_next(l);
- }
-
- g_list_free(o->elements);
- g_free(o->name);
- g_free(o->title);
- g_free(o->code);
-
-
- ((GtkObjectClass *)(parent_class))->finalize(obj);
-}
-
-/**
- * filter_part_new:
- *
- * Create a new FilterPart object.
- *
- * Return value: A new #FilterPart object.
- **/
-FilterPart *
-filter_part_new (void)
-{
- FilterPart *o = (FilterPart *)gtk_type_new(filter_part_get_type ());
- return o;
-}
-
-gboolean
-filter_part_validate (FilterPart *fp)
-{
- gboolean correct = TRUE;
- GList *l;
-
- l = fp->elements;
- while (l && correct) {
- FilterElement *fe = l->data;
-
- correct = filter_element_validate (fe);
-
- l = l->next;
- }
-
- return correct;
-}
-
-int
-filter_part_xml_create (FilterPart *ff, xmlNodePtr node)
-{
- xmlNodePtr n;
- char *type, *str, *decstr;
- FilterElement *el;
-
- str = xmlGetProp(node, "name");
- ff->name = g_strdup(str);
- if (str)
- xmlFree(str);
- n = node->childs;
- while (n) {
- if (!strcmp (n->name, "input")) {
- type = xmlGetProp (n, "type");
- d(printf ("creating new element type input '%s'\n", type));
- if (type != NULL
- && (el = filter_element_new_type_name (type)) != NULL) {
- filter_element_xml_create (el, n);
- xmlFree(type);
- d(printf ("adding element part %p %s\n", ff, el, el->name));
- ff->elements = g_list_append (ff->elements, el);
- } else {
- g_warning ("Invalid xml format, missing/unknown input type");
- }
- } else if (!strcmp(n->name, "title")) {
- if (!ff->title) {
- str = xmlNodeGetContent (n);
- ff->title = e_utf8_xml1_decode (str);
- if (str)
- xmlFree (str);
- }
- } else if (!strcmp (n->name, "code")) {
- if (!ff->code) {
- str = xmlNodeGetContent (n);
- ff->code = e_utf8_xml1_decode (str);
- if (str)
- xmlFree (str);
- }
- } else {
- g_warning ("Unknwon part element in xml: %s\n", n->name);
- }
- n = n->next;
- }
-
- return 0;
-}
-
-xmlNodePtr
-filter_part_xml_encode (FilterPart *fp)
-{
- GList *l;
- FilterElement *fe;
- xmlNodePtr part, value;
-
- g_return_val_if_fail (fp != NULL, NULL);
-
- part = xmlNewNode (NULL, "part");
- xmlSetProp (part, "name", fp->name);
- l = fp->elements;
- while (l) {
- fe = l->data;
- value = filter_element_xml_encode (fe);
- xmlAddChild (part, value);
- l = g_list_next (l);
- }
-
- return part;
-}
-
-
-int
-filter_part_xml_decode (FilterPart *fp, xmlNodePtr node)
-{
- FilterElement *fe;
- xmlNodePtr n;
- char *name;
-
- g_return_val_if_fail (fp != NULL, -1);
- g_return_val_if_fail (node != NULL, -1);
-
- n = node->childs;
- while (n) {
- if (!strcmp (n->name, "value")) {
- name = xmlGetProp (n, "name");
- d(printf ("finding element part %p %s = %p\n", name, name, fe));
- fe = filter_part_find_element (fp, name);
- d(printf ("finding element part %p %s = %p\n", name, name, fe));
- xmlFree (name);
- if (fe) {
- filter_element_xml_decode (fe, n);
- }
- }
- n = n->next;
- }
-
- return 0;
-}
-
-FilterPart *
-filter_part_clone (FilterPart *fp)
-{
- FilterPart *new;
- GList *l;
- FilterElement *fe, *ne;
-
- new = (FilterPart *)gtk_type_new ((GTK_OBJECT (fp))->klass->type);
- new->name = g_strdup(fp->name);
- new->title = g_strdup(fp->title);
- new->code = g_strdup(fp->code);
- l = fp->elements;
- while (l) {
- fe = l->data;
- ne = filter_element_clone (fe);
- new->elements = g_list_append (new->elements, ne);
- l = g_list_next (l);
- }
-
- return new;
-}
-
-FilterElement *
-filter_part_find_element (FilterPart *ff, const char *name)
-{
- GList *l = ff->elements;
- FilterElement *fe;
-
- if (name == NULL)
- return NULL;
-
- while (l) {
- fe = l->data;
- if (fe->name && !strcmp (fe->name, name))
- return fe;
- l = g_list_next (l);
- }
-
- return NULL;
-}
-
-
-GtkWidget *
-filter_part_get_widget (FilterPart *ff)
-{
- GtkWidget *hbox;
- GList *l = ff->elements;
- FilterElement *fe;
- GtkWidget *w;
-
- hbox = gtk_hbox_new (FALSE, 3);
-
- while (l) {
- fe = l->data;
- w = filter_element_get_widget (fe);
- if (w) {
- gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 3);
- }
- l = g_list_next (l);
- }
-
- gtk_widget_show_all (hbox);
-
- return hbox;
-}
-
-/**
- * filter_part_build_code:
- * @ff:
- * @out:
- *
- * Outputs the code of a part.
- **/
-void
-filter_part_build_code (FilterPart *ff, GString *out)
-{
- GList *l = ff->elements;
- FilterElement *fe;
-
- if (ff->code) {
- filter_part_expand_code (ff, ff->code, out);
- }
- while (l) {
- fe = l->data;
- filter_element_build_code (fe, out, ff);
- l = g_list_next (l);
- }
-}
-
-/**
- * filter_part_build_code_list:
- * @l:
- * @out:
- *
- * Construct a list of the filter parts code into
- * a single string.
- **/
-void
-filter_part_build_code_list (GList *l, GString *out)
-{
- FilterPart *fp;
-
- while (l) {
- fp = l->data;
- filter_part_build_code (fp, out);
- g_string_append (out, "\n ");
- l = g_list_next (l);
- }
-}
-
-/**
- * filter_part_find_list:
- * @l:
- * @name:
- *
- * Find a filter part stored in a list.
- *
- * Return value:
- **/
-FilterPart *
-filter_part_find_list (GList *l, const char *name)
-{
- FilterPart *part;
-
- d(printf ("Find part named %s\n", name));
-
- while (l) {
- part = l->data;
- if (!strcmp (part->name, name)) {
- d(printf ("Found!\n"));
- return part;
- }
- l = g_list_next (l);
- }
-
- return NULL;
-}
-
-/**
- * filter_part_next_list:
- * @l:
- * @last: The last item retrieved, or NULL to start
- * from the beginning of the list.
- *
- * Iterate through a filter part list.
- *
- * Return value: The next value in the list, or NULL if the
- * list is expired.
- **/
-FilterPart *
-filter_part_next_list (GList *l, FilterPart *last)
-{
- GList *node = l;
-
- if (last != NULL) {
- node = g_list_find (node, last);
- if (node == NULL)
- node = l;
- else
- node = g_list_next (node);
- }
- if (node)
- return node->data;
-
- return NULL;
-}
-
-/**
- * filter_part_expand_code:
- * @ff:
- * @str:
- * @out:
- *
- * Expands the variables in string @str based on the values of the part.
- **/
-void
-filter_part_expand_code (FilterPart *ff, const char *source, GString *out)
-{
- const char *newstart, *start, *end;
- char *name = alloca (32);
- int len, namelen = 32;
- FilterElement *fe;
-
- start = source;
- while (start && (newstart = strstr (start, "${"))
- && (end = strstr (newstart+2, "}")) ) {
- len = end - newstart - 2;
- if (len + 1 > namelen) {
- namelen = (len + 1) * 2;
- name = alloca (namelen);
- }
- memcpy (name, newstart+2, len);
- name[len] = 0;
- fe = filter_part_find_element (ff, name);
- d(printf("expand code: looking up variab le '%s' = %p\n", ff, name, fe));
- if (fe) {
- g_string_sprintfa (out, "%.*s", newstart-start, start);
- filter_element_format_sexp (fe, out);
-#if 0
- } else if ( (val = g_hash_table_lookup (ff->globals, name)) ) {
- g_string_sprintfa (out, "%.*s", newstart-start, start);
- e_sexp_encode_string (out, val);
-#endif
- } else {
- g_string_sprintfa (out, "%.*s", end-start+1, start);
- }
- start = end + 1;
- }
- g_string_append (out, start);
-}
-
-#if 0
-int main(int argc, char **argv)
-{
- xmlDocPtr system;
- FilterPart *ff;
- GtkWidget *w;
- GnomeDialog *gd;
- xmlNodePtr node;
- GString *code;
-
- gnome_init("test", "0.0", argc, argv);
-
- system = xmlParseFile("form.xml");
- if (system==NULL) {
- printf("i/o error\n");
- return 1;
- }
-
- ff = filter_part_new();
- filter_part_xml_create(ff, system->root);
-
- w = filter_part_get_widget(ff);
-
- gd = (GnomeDialog *)gnome_dialog_new(_("Test"), GNOME_STOCK_BUTTON_OK, NULL);
- gtk_window_set_policy(GTK_WINDOW(gd), FALSE, TRUE, FALSE);
- gtk_box_pack_start((GtkBox *)gd->vbox, w, TRUE, TRUE, 0);
- gtk_widget_show((GtkWidget *)gd);
-
- gnome_dialog_run_and_close(gd);
-
- code = g_string_new("");
- filter_part_build_code(ff, code);
- printf("code is:\n%s\n", code->str);
-
- return 0;
-}
-#endif
diff --git a/filter/filter-part.h b/filter/filter-part.h
deleted file mode 100644
index da8e3d7215..0000000000
--- a/filter/filter-part.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2000 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef _FILTER_PART_H
-#define _FILTER_PART_H
-
-#include <gtk/gtkobject.h>
-#include "filter-input.h"
-
-#define FILTER_PART(obj) GTK_CHECK_CAST (obj, filter_part_get_type (), FilterPart)
-#define FILTER_PART_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, filter_part_get_type (), FilterPartClass)
-#define IS_FILTER_PART(obj) GTK_CHECK_TYPE (obj, filter_part_get_type ())
-
-typedef struct _FilterPart FilterPart;
-typedef struct _FilterPartClass FilterPartClass;
-
-struct _FilterPart {
- GtkObject parent;
- struct _FilterPartPrivate *priv;
-
- char *name;
- char *title;
- char *code;
- GList *elements;
-};
-
-struct _FilterPartClass {
- GtkObjectClass parent_class;
-
- /* virtual methods */
-
- /* signals */
-};
-
-guint filter_part_get_type (void);
-FilterPart *filter_part_new (void);
-
-/* methods */
-gboolean filter_part_validate (FilterPart *fp);
-
-int filter_part_xml_create (FilterPart *ff, xmlNodePtr node);
-
-xmlNodePtr filter_part_xml_encode (FilterPart *fe);
-int filter_part_xml_decode (FilterPart *fe, xmlNodePtr node);
-
-FilterPart *filter_part_clone (FilterPart *fp);
-
-FilterElement *filter_part_find_element(FilterPart *ff, const char *name);
-
-GtkWidget *filter_part_get_widget (FilterPart *ff);
-void filter_part_build_code (FilterPart *ff, GString *out);
-void filter_part_expand_code (FilterPart *ff, const char *str, GString *out);
-
-/* static functions */
-void filter_part_build_code_list (GList *l, GString *out);
-FilterPart *filter_part_find_list (GList *l, const char *name);
-FilterPart *filter_part_next_list (GList *l, FilterPart *last);
-
-#endif /* ! _FILTER_PART_H */
-
diff --git a/filter/filter-rule.c b/filter/filter-rule.c
deleted file mode 100644
index 038db489c5..0000000000
--- a/filter/filter-rule.c
+++ /dev/null
@@ -1,779 +0,0 @@
-/*
- * Copyright (C) 2000 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- * Jeffrey Stedfast <fejj@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <config.h>
-#include <string.h>
-#include <glib.h>
-#include <gtk/gtkframe.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkmenuitem.h>
-#include <gtk/gtkoptionmenu.h>
-#include <gtk/gtkscrolledwindow.h>
-#include <gtk/gtktable.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-stock.h>
-#include <gal/widgets/e-unicode.h>
-
-#include "filter-rule.h"
-#include "filter-context.h"
-
-#define d(x)
-
-static int validate(FilterRule *);
-static xmlNodePtr xml_encode (FilterRule *);
-static int xml_decode (FilterRule *, xmlNodePtr, RuleContext *);
-static void build_code (FilterRule *, GString * out);
-static GtkWidget *get_widget (FilterRule * fr, struct _RuleContext *f);
-
-static void filter_rule_class_init (FilterRuleClass * class);
-static void filter_rule_init (FilterRule * gspaper);
-static void filter_rule_finalise (GtkObject * obj);
-
-#define _PRIVATE(x) (((FilterRule *)(x))->priv)
-
-struct _FilterRulePrivate {
- GtkWidget *parts; /* where the parts are stored */
-};
-
-static GtkObjectClass *parent_class;
-
-enum {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-guint
-filter_rule_get_type ()
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "FilterRule",
- sizeof (FilterRule),
- sizeof (FilterRuleClass),
- (GtkClassInitFunc) filter_rule_class_init,
- (GtkObjectInitFunc) filter_rule_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- type = gtk_type_unique (gtk_object_get_type(), &type_info);
- }
-
- return type;
-}
-
-static void
-filter_rule_class_init (FilterRuleClass * class)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass *) class;
- parent_class = gtk_type_class (gtk_object_get_type());
-
- object_class->finalize = filter_rule_finalise;
-
- /* override methods */
- class->validate = validate;
- class->xml_encode = xml_encode;
- class->xml_decode = xml_decode;
- class->build_code = build_code;
- class->get_widget = get_widget;
-
- /* signals */
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-filter_rule_init (FilterRule * o)
-{
- o->priv = g_malloc0 (sizeof (*o->priv));
-}
-
-static void
-unref_list (GList * l)
-{
- while (l) {
- gtk_object_unref (GTK_OBJECT (l->data));
- l = g_list_next (l);
- }
-}
-
-static void
-filter_rule_finalise (GtkObject * obj)
-{
- FilterRule *o = (FilterRule *) obj;
-
- g_free (o->name);
- g_free (o->source);
- unref_list (o->parts);
-
- ((GtkObjectClass *) (parent_class))->finalize(obj);
-}
-
-/**
- * filter_rule_new:
- *
- * Create a new FilterRule object.
- *
- * Return value: A new #FilterRule object.
- **/
-FilterRule *
-filter_rule_new ()
-{
- FilterRule *o = (FilterRule *) gtk_type_new (filter_rule_get_type());
-
- return o;
-}
-
-FilterRule *
-filter_rule_clone(FilterRule *base, RuleContext *f)
-{
- xmlNodePtr xml;
- FilterRule *rule;
-
- g_assert (IS_FILTER_RULE (base));
- g_assert (IS_RULE_CONTEXT (f));
-
- /* TODO: do this more directly/efficiently */
- xml = filter_rule_xml_encode (base);
- rule = gtk_type_new (GTK_OBJECT (base)->klass->type);
- filter_rule_xml_decode (rule, xml, f);
- xmlFreeNodeList (xml);
-
- return rule;
-}
-
-void
-filter_rule_set_name (FilterRule *fr, const char *name)
-{
- g_assert (IS_FILTER_RULE (fr));
-
- g_free (fr->name);
- fr->name = g_strdup (name);
-}
-
-void
-filter_rule_set_source (FilterRule *fr, const char *source)
-{
- g_assert (IS_FILTER_RULE (fr));
-
- g_free (fr->source);
- fr->source = g_strdup (source);
-}
-
-int
-filter_rule_validate (FilterRule *fr)
-{
- g_assert (IS_FILTER_RULE (fr));
-
- return ((FilterRuleClass *) ((GtkObject *) fr)->klass)->validate (fr);
-}
-
-static int
-validate (FilterRule *fr)
-{
- int valid = TRUE;
- GList *parts;
-
- /* validate rule parts */
- parts = fr->parts;
- while (parts && valid) {
- valid = filter_part_validate ((FilterPart *)parts->data);
- parts = parts->next;
- }
-
- return valid;
-}
-
-xmlNodePtr
-filter_rule_xml_encode (FilterRule *fr)
-{
- g_assert (IS_FILTER_RULE (fr));
-
- return ((FilterRuleClass *) ((GtkObject *) fr)->klass)->xml_encode (fr);
-}
-
-static xmlNodePtr
-xml_encode (FilterRule *fr)
-{
- xmlNodePtr node, set, work;
- GList *l;
-
- node = xmlNewNode (NULL, "rule");
- switch (fr->grouping) {
- case FILTER_GROUP_ALL:
- xmlSetProp (node, "grouping", "all");
- break;
- case FILTER_GROUP_ANY:
- xmlSetProp (node, "grouping", "any");
- break;
- }
-
- if (fr->source) {
- xmlSetProp (node, "source", fr->source);
- } else {
- /* set to the default filter type */
- xmlSetProp (node, "source", "incoming");
- }
-
- if (fr->name) {
- char *encstr;
-
- work = xmlNewNode (NULL, "title");
- encstr = e_utf8_xml1_encode (fr->name);
- xmlNodeSetContent (work, encstr);
- g_free (encstr);
- xmlAddChild (node, work);
- }
-
- set = xmlNewNode (NULL, "partset");
- xmlAddChild (node, set);
- l = fr->parts;
- while (l) {
- work = filter_part_xml_encode ((FilterPart *) l->data);
- xmlAddChild (set, work);
- l = g_list_next (l);
- }
-
- return node;
-}
-
-static void
-load_set (xmlNodePtr node, FilterRule *fr, RuleContext *f)
-{
- xmlNodePtr work;
- char *rulename;
- FilterPart *part;
-
- work = node->childs;
- while (work) {
- if (!strcmp (work->name, "part")) {
- rulename = xmlGetProp (work, "name");
- part = rule_context_find_part (f, rulename);
- if (part) {
- part = filter_part_clone (part);
- filter_part_xml_decode (part, work);
- filter_rule_add_part (fr, part);
- } else {
- g_warning ("cannot find rule part '%s'\n", rulename);
- }
- xmlFree (rulename);
- } else {
- g_warning ("Unknwon xml node in part: %s", work->name);
- }
- work = work->next;
- }
-}
-
-int
-filter_rule_xml_decode (FilterRule *fr, xmlNodePtr node, RuleContext *f)
-{
- g_assert (IS_FILTER_RULE (fr));
- g_assert (IS_RULE_CONTEXT (f));
- g_assert (node != NULL);
-
- return ((FilterRuleClass *) ((GtkObject *) fr)->klass)->xml_decode (fr, node, f);
-}
-
-static int
-xml_decode (FilterRule *fr, xmlNodePtr node, RuleContext *f)
-{
- xmlNodePtr work;
- char *grouping;
- char *source;
-
- if (fr->name) {
- g_free (fr->name);
- fr->name = NULL;
- }
-
- grouping = xmlGetProp (node, "grouping");
- if (!strcmp (grouping, "any"))
- fr->grouping = FILTER_GROUP_ANY;
- else
- fr->grouping = FILTER_GROUP_ALL;
- xmlFree (grouping);
-
- g_free (fr->source);
- source = xmlGetProp (node, "source");
- if (source) {
- fr->source = g_strdup (source);
- xmlFree (source);
- } else {
- /* default filter type */
- fr->source = g_strdup ("incoming");
- }
-
- work = node->childs;
- while (work) {
- if (!strcmp (work->name, "partset")) {
- load_set (work, fr, f);
- } else if (!strcmp (work->name, "title")) {
- if (!fr->name) {
- gchar *str, *decstr;
- str = xmlNodeGetContent (work);
- decstr = e_utf8_xml1_decode (str);
- if (str)
- xmlFree (str);
- fr->name = decstr;
- }
- }
- work = work->next;
- }
-
- return 0;
-}
-
-void
-filter_rule_add_part (FilterRule *fr, FilterPart *fp)
-{
- g_assert (IS_FILTER_RULE (fr));
- g_assert (IS_FILTER_PART (fp));
-
- fr->parts = g_list_append (fr->parts, fp);
-}
-
-void
-filter_rule_remove_part (FilterRule *fr, FilterPart *fp)
-{
- g_assert (IS_FILTER_RULE (fr));
- g_assert (IS_FILTER_PART (fp));
-
- fr->parts = g_list_remove (fr->parts, fp);
-}
-
-void
-filter_rule_replace_part (FilterRule *fr, FilterPart *fp, FilterPart *new)
-{
- GList *l;
-
- g_assert (IS_FILTER_RULE (fr));
- g_assert (IS_FILTER_PART (fp));
- g_assert (IS_FILTER_PART (new));
-
- l = g_list_find (fr->parts, fp);
- if (l) {
- l->data = new;
- } else {
- fr->parts = g_list_append (fr->parts, new);
- }
-}
-
-void
-filter_rule_build_code (FilterRule *fr, GString *out)
-{
- g_assert (IS_FILTER_RULE (fr));
- g_assert (out != NULL);
-
- ((FilterRuleClass *) ((GtkObject *) fr)->klass)->build_code (fr, out);
-
- d(printf ("build_code: [%s](%d)", out->str, out->len));
-}
-
-static void
-build_code (FilterRule *fr, GString *out)
-{
- switch (fr->grouping) {
- case FILTER_GROUP_ALL:
- g_string_append (out, " (and\n ");
- break;
- case FILTER_GROUP_ANY:
- g_string_append (out, " (or\n ");
- break;
- default:
- g_warning ("Invalid grouping");
- }
-
- filter_part_build_code_list (fr->parts, out);
- g_string_append (out, ")\n");
-}
-
-static void
-match_all (GtkWidget *widget, FilterRule *fr)
-{
- fr->grouping = FILTER_GROUP_ALL;
-}
-
-static void
-match_any (GtkWidget *widget, FilterRule *fr)
-{
- fr->grouping = FILTER_GROUP_ANY;
-}
-
-struct _part_data {
- FilterRule *fr;
- RuleContext *f;
- FilterPart *part;
- GtkWidget *partwidget, *container;
-};
-
-static void
-option_activate (GtkMenuItem *item, struct _part_data *data)
-{
- FilterPart *part = gtk_object_get_data (GTK_OBJECT (item), "part");
- FilterPart *newpart;
-
- /* dont update if we haven't changed */
- if (!strcmp (part->title, data->part->title))
- return;
-
- /* here we do a widget shuffle, throw away the old widget/rulepart,
- and create another */
- if (data->partwidget)
- gtk_container_remove (GTK_CONTAINER (data->container), data->partwidget);
-
- newpart = filter_part_clone (part);
- filter_rule_replace_part (data->fr, data->part, newpart);
- gtk_object_unref (GTK_OBJECT (data->part));
- data->part = newpart;
- data->partwidget = filter_part_get_widget (newpart);
- if (data->partwidget)
- gtk_box_pack_start (GTK_BOX (data->container), data->partwidget, FALSE, FALSE, 0);
-
- gtk_object_set_data (GTK_OBJECT (data->container), "part", newpart);
-}
-
-static GtkWidget *
-get_rule_part_widget (RuleContext *f, FilterPart *newpart, FilterRule *fr)
-{
- FilterPart *part = NULL;
- GtkWidget *menu;
- GtkWidget *item;
- GtkWidget *omenu;
- GtkWidget *hbox;
- GtkWidget *p;
- int index = 0, current = 0;
- struct _part_data *data;
-
- data = g_malloc0 (sizeof (*data));
- data->fr = fr;
- data->f = f;
- data->part = newpart;
-
- hbox = gtk_hbox_new (FALSE, 0);
- /* only set to automatically clean up the memory */
- gtk_object_set_data_full (GTK_OBJECT (hbox), "data", data, g_free);
-
- p = filter_part_get_widget (newpart);
-
- data->partwidget = p;
- data->container = hbox;
-
- menu = gtk_menu_new ();
- /* sigh, this is a little ugly */
- while ((part = rule_context_next_part (f, part))) {
- item = gtk_menu_item_new_with_label (_(part->title));
- gtk_object_set_data (GTK_OBJECT (item), "part", part);
- gtk_signal_connect (GTK_OBJECT (item), "activate", option_activate, data);
- gtk_menu_append (GTK_MENU (menu), item);
- gtk_widget_show (item);
- if (!strcmp (newpart->title, part->title)) {
- current = index;
- }
- index++;
- }
-
- omenu = gtk_option_menu_new ();
- gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu);
- gtk_option_menu_set_history (GTK_OPTION_MENU (omenu), current);
- gtk_widget_show (omenu);
-
- gtk_box_pack_start (GTK_BOX (hbox), omenu, FALSE, FALSE, 0);
- if (p) {
- gtk_box_pack_start (GTK_BOX (hbox), p, FALSE, FALSE, 0);
- }
- gtk_widget_show_all (hbox);
-
- return hbox;
-}
-
-struct _rule_data {
- FilterRule *fr;
- RuleContext *f;
- GtkWidget *parts;
-};
-
-static void
-less_parts (GtkWidget *button, struct _rule_data *data)
-{
- FilterPart *part;
- GtkWidget *rule;
-
- if (g_list_length (data->fr->parts) < 2)
- return;
-
- rule = gtk_object_get_data (GTK_OBJECT (button), "rule");
- part = gtk_object_get_data (GTK_OBJECT (rule), "part");
-
- /* remove the part from the list */
- filter_rule_remove_part (data->fr, part);
- gtk_object_unref (GTK_OBJECT (part));
-
- /* and from the display */
- gtk_container_remove (GTK_CONTAINER (data->parts), rule);
- gtk_container_remove (GTK_CONTAINER (data->parts), button);
-}
-
-static void
-attach_rule (GtkWidget *rule, struct _rule_data *data, FilterPart *part, int row)
-{
- GtkWidget *remove;
- GtkWidget *pixmap;
-
- gtk_table_attach (GTK_TABLE (data->parts), rule, 0, 1, row, row + 1,
- GTK_EXPAND | GTK_FILL, 0, 0, 0);
-
- pixmap = gnome_stock_new_with_icon (GNOME_STOCK_PIXMAP_REMOVE);
- remove = gnome_pixmap_button (pixmap, _("Remove"));
- gtk_object_set_data (GTK_OBJECT (remove), "rule", rule);
- gtk_object_set_data (GTK_OBJECT (rule), "part", part);
- /*gtk_button_set_relief (GTK_BUTTON (remove), GTK_RELIEF_NONE);*/
- gtk_signal_connect (GTK_OBJECT (remove), "clicked", less_parts, data);
- gtk_table_attach (GTK_TABLE (data->parts), remove, 1, 2, row, row + 1,
- 0, 0, 0, 0);
- gtk_widget_show (remove);
-}
-
-static void
-more_parts (GtkWidget *button, struct _rule_data *data)
-{
- FilterPart *new;
-
- /* first make sure that the last part is ok */
- if (data->fr->parts) {
- FilterPart *part;
- GList *l;
-
- l = g_list_last (data->fr->parts);
- part = l->data;
- if (!filter_part_validate (part))
- return;
- }
-
- /* create a new rule entry, use the first type of rule */
- new = rule_context_next_part (data->f, NULL);
- if (new) {
- GtkWidget *w;
- int rows;
-
- new = filter_part_clone (new);
- filter_rule_add_part (data->fr, new);
- w = get_rule_part_widget (data->f, new, data->fr);
-
- rows = GTK_TABLE (data->parts)->nrows;
- gtk_table_resize (GTK_TABLE (data->parts), rows + 1, 2);
- attach_rule (w, data, new, rows);
- }
-}
-
-static void
-name_changed (GtkEntry *entry, FilterRule *fr)
-{
- g_free (fr->name);
- fr->name = e_utf8_gtk_entry_get_text (entry);
-}
-
-GtkWidget *
-filter_rule_get_widget (FilterRule *fr, struct _RuleContext *f)
-{
- return ((FilterRuleClass *) ((GtkObject *) fr)->klass)->get_widget(fr, f);
-}
-
-static void
-grab_focus (GtkWidget *entry, gpointer data)
-{
- gtk_widget_grab_focus (entry);
-}
-
-static GtkWidget *
-get_widget (FilterRule *fr, struct _RuleContext *f)
-{
- GtkWidget *vbox, *parts, *inframe;
- GtkWidget *hbox;
- GtkWidget *add, *pixmap;
- GtkWidget *w;
- GtkWidget *menu, *item, *omenu;
- GtkWidget *frame;
- GtkWidget *name;
- GtkWidget *label;
- GtkWidget *scrolledwindow;
- GtkObject *hadj, *vadj;
- GList *l;
- FilterPart *part;
- struct _rule_data *data;
- gint rows, i = 0;
-
- /* this stuff should probably be a table, but the
- rule parts need to be a vbox */
- vbox = gtk_vbox_new (FALSE, 3);
-
- label = gtk_label_new (_("Rule name: "));
- name = gtk_entry_new ();
-
- if (!fr->name) {
- fr->name = g_strdup (_("Untitled"));
- gtk_entry_set_text (GTK_ENTRY (name), fr->name);
- /* FIXME: do we want the following code in the future? */
- /*gtk_editable_select_region (GTK_EDITABLE (name), 0, -1);*/
- } else {
- e_utf8_gtk_entry_set_text (GTK_ENTRY (name), fr->name);
- }
-
- /* evil kludgy hack because gtk sucks */
- gtk_signal_connect (GTK_OBJECT (name), "realize", grab_focus, name);
-
- hbox = gtk_hbox_new (FALSE, 3);
- gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), name, TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
- gtk_signal_connect (GTK_OBJECT (name), "changed", name_changed, fr);
-
- frame = gtk_frame_new (_("If"));
- inframe = gtk_vbox_new (FALSE, 3);
- gtk_container_add (GTK_CONTAINER (frame), inframe);
-
- /* this is the parts table, it should probably be inside a scrolling list */
- rows = g_list_length (fr->parts);
- parts = gtk_table_new (rows, 2, FALSE);
-
- /* data for the parts part of the display */
- data = g_malloc0 (sizeof (*data));
- data->f = f;
- data->fr = fr;
- data->parts = parts;
-
- /* only set to automatically clean up the memory */
- gtk_object_set_data_full (GTK_OBJECT (vbox), "data", data, g_free);
-
- hbox = gtk_hbox_new (FALSE, 3);
- label = gtk_label_new (_("Execute actions"));
-
- menu = gtk_menu_new ();
-
- item = gtk_menu_item_new_with_label (_("if all criteria are met"));
- gtk_signal_connect (GTK_OBJECT (item), "activate", match_all, fr);
- gtk_menu_append (GTK_MENU (menu), item);
- gtk_widget_show (item);
-
- item = gtk_menu_item_new_with_label (_("if any criteria are met"));
- gtk_signal_connect (GTK_OBJECT (item), "activate", match_any, fr);
- gtk_menu_append (GTK_MENU (menu), item);
- gtk_widget_show (item);
-
- omenu = gtk_option_menu_new ();
- gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu);
- gtk_option_menu_set_history (GTK_OPTION_MENU (omenu), fr->grouping == FILTER_GROUP_ALL ? 0 : 1);
- gtk_widget_show (omenu);
-
- pixmap = gnome_stock_new_with_icon (GNOME_STOCK_PIXMAP_ADD);
- add = gnome_pixmap_button (pixmap, _("Add criterion"));
- gtk_signal_connect (GTK_OBJECT (add), "clicked", more_parts, data);
- gtk_box_pack_start (GTK_BOX (hbox), add, FALSE, FALSE, 3);
-
- gtk_box_pack_end (GTK_BOX (hbox), omenu, FALSE, FALSE, 0);
- gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0);
-
- gtk_box_pack_start (GTK_BOX (inframe), hbox, FALSE, FALSE, 0);
-
- l = fr->parts;
- while (l) {
- part = l->data;
- d(printf ("adding rule %s\n", part->title));
- w = get_rule_part_widget (f, part, fr);
- attach_rule (w, data, part, i++);
- l = g_list_next (l);
- }
-
- hadj = gtk_adjustment_new (0.0, 0.0, 1.0, 1.0, 1.0, 1.0);
- vadj = gtk_adjustment_new (0.0, 0.0, 1.0, 1.0, 1.0, 1.0);
- scrolledwindow = gtk_scrolled_window_new (GTK_ADJUSTMENT (hadj), GTK_ADJUSTMENT (vadj));
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
-
- gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolledwindow), parts);
-
- gtk_box_pack_start (GTK_BOX (inframe), scrolledwindow, TRUE, TRUE, 0);
-
- /*gtk_box_pack_start (GTK_BOX (inframe), parts, FALSE, FALSE, 3); */
-
- gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
-
- gtk_widget_show_all (vbox);
-
- return vbox;
-}
-
-FilterRule *
-filter_rule_next_list (GList * l, FilterRule * last, const char *source)
-{
- GList *node = l;
-
- if (last != NULL) {
- node = g_list_find (node, last);
- if (node == NULL)
- node = l;
- else
- node = g_list_next (node);
- }
-
- if (source) {
- while (node) {
- FilterRule *rule = node->data;
-
- if (rule->source && strcmp (rule->source, source) == 0)
- break;
- node = g_list_next (node);
- }
- }
-
- if (node)
- return node->data;
-
- return NULL;
-}
-
-FilterRule *
-filter_rule_find_list (GList * l, const char *name, const char *source)
-{
- while (l) {
- FilterRule *rule = l->data;
-
- if (strcmp (rule->name, name) == 0)
- if (source == NULL || (rule->source != NULL && strcmp (rule->source, source) == 0))
- return rule;
- l = g_list_next (l);
- }
-
- return NULL;
-}
-
-#ifdef FOR_TRANSLATIONS_ONLY
-
-static char *list[] = {
- N_("incoming"), N_("outgoing")
-};
-#endif
diff --git a/filter/filter-rule.h b/filter/filter-rule.h
deleted file mode 100644
index ffad99e627..0000000000
--- a/filter/filter-rule.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2000 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef _FILTER_RULE_H
-#define _FILTER_RULE_H
-
-#include <gtk/gtkobject.h>
-#include "filter-part.h"
-
-#define FILTER_RULE(obj) GTK_CHECK_CAST (obj, filter_rule_get_type (), FilterRule)
-#define FILTER_RULE_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, filter_rule_get_type (), FilterRuleClass)
-#define IS_FILTER_RULE(obj) GTK_CHECK_TYPE (obj, filter_rule_get_type ())
-
-typedef struct _FilterRule FilterRule;
-typedef struct _FilterRuleClass FilterRuleClass;
-
-struct _RuleContext;
-
-enum _filter_grouping_t {
- FILTER_GROUP_ALL, /* all rules must match */
- FILTER_GROUP_ANY /* any rule must match */
-};
-
-
-#define FILTER_SOURCE_INCOMING "incoming" /* performed on incoming email */
-#define FILTER_SOURCE_DEMAND "demand" /* performed on the selected folder
- * when the user asks for it */
-#define FILTER_SOURCE_OUTGOING "outgoing"/* performed on outgoing mail */
-
-struct _FilterRule {
- GtkObject parent;
- struct _FilterRulePrivate *priv;
-
- char *name;
- char *source;
-
- enum _filter_grouping_t grouping;
- GList *parts;
-};
-
-struct _FilterRuleClass {
- GtkObjectClass parent_class;
-
- /* virtual methods */
- int (*validate)(FilterRule *);
-
- xmlNodePtr (*xml_encode)(FilterRule *);
- int (*xml_decode)(FilterRule *, xmlNodePtr, struct _RuleContext *);
-
- void (*build_code)(FilterRule *, GString *out);
-
- GtkWidget *(*get_widget)(FilterRule *fr, struct _RuleContext *f);
-
- /* signals */
-};
-
-guint filter_rule_get_type (void);
-FilterRule *filter_rule_new (void);
-
-FilterRule *filter_rule_clone (FilterRule *base, struct _RuleContext *f);
-
-/* methods */
-void filter_rule_set_name (FilterRule *fr, const char *name);
-void filter_rule_set_source (FilterRule *fr, const char *source);
-
-int filter_rule_validate (FilterRule *fr);
-
-xmlNodePtr filter_rule_xml_encode (FilterRule *fr);
-int filter_rule_xml_decode (FilterRule *fr, xmlNodePtr node, struct _RuleContext *f);
-
-void filter_rule_add_part (FilterRule *fr, FilterPart *fp);
-void filter_rule_remove_part (FilterRule *fr, FilterPart *fp);
-void filter_rule_replace_part(FilterRule *fr, FilterPart *fp, FilterPart *new);
-
-GtkWidget *filter_rule_get_widget (FilterRule *fr, struct _RuleContext *f);
-
-void filter_rule_build_code (FilterRule *fr, GString *out);
-/*
-void filter_rule_build_action(FilterRule *fr, GString *out);
-*/
-
-/* static functions */
-FilterRule *filter_rule_next_list (GList *l, FilterRule *last, const char *source);
-FilterRule *filter_rule_find_list (GList *l, const char *name, const char *source);
-
-#endif /* ! _FILTER_RULE_H */
-
diff --git a/filter/filter-score.c b/filter/filter-score.c
deleted file mode 100644
index cd954e134e..0000000000
--- a/filter/filter-score.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors: Jeffrey Stedfast <fejj@ximian.com>
- *
- * Copyright 2000 Ximian, Inc. (www.ximian.com)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtkspinbutton.h>
-
-#include "e-util/e-sexp.h"
-#include "filter-score.h"
-
-#define d(x)
-
-static void xml_create (FilterElement *fe, xmlNodePtr node);
-static xmlNodePtr xml_encode (FilterElement *fe);
-static int xml_decode (FilterElement *fe, xmlNodePtr node);
-static GtkWidget *get_widget (FilterElement *fe);
-static void build_code (FilterElement *fe, GString *out, struct _FilterPart *ff);
-static void format_sexp (FilterElement *, GString *);
-
-static void filter_score_class_init (FilterScoreClass *class);
-static void filter_score_init (FilterScore *gspaper);
-static void filter_score_finalise (GtkObject *obj);
-
-#define _PRIVATE(x) (((FilterScore *)(x))->priv)
-
-struct _FilterScorePrivate {
-};
-
-static FilterElementClass *parent_class;
-
-enum {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-guint
-filter_score_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "FilterScore",
- sizeof (FilterScore),
- sizeof (FilterScoreClass),
- (GtkClassInitFunc) filter_score_class_init,
- (GtkObjectInitFunc) filter_score_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- type = gtk_type_unique (filter_element_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-filter_score_class_init (FilterScoreClass *class)
-{
- GtkObjectClass *object_class;
- FilterElementClass *filter_element = (FilterElementClass *)class;
-
- object_class = (GtkObjectClass *)class;
- parent_class = gtk_type_class (filter_element_get_type ());
-
- object_class->finalize = filter_score_finalise;
-
- /* override methods */
- filter_element->xml_create = xml_create;
- filter_element->xml_encode = xml_encode;
- filter_element->xml_decode = xml_decode;
- filter_element->get_widget = get_widget;
- filter_element->build_code = build_code;
- filter_element->format_sexp = format_sexp;
-
- /* signals */
-
- gtk_object_class_add_signals(object_class, signals, LAST_SIGNAL);
-}
-
-static void
-filter_score_init (FilterScore *o)
-{
- o->priv = g_malloc0 (sizeof (*o->priv));
-}
-
-static void
-filter_score_finalise(GtkObject *obj)
-{
- FilterScore *o = (FilterScore *)obj;
-
- o = o;
-
- ((GtkObjectClass *)(parent_class))->finalize(obj);
-}
-
-/**
- * filter_score_new:
- *
- * Create a new FilterScore object.
- *
- * Return value: A new #FilterScore object.
- **/
-FilterScore *
-filter_score_new (void)
-{
- FilterScore *o = (FilterScore *)gtk_type_new(filter_score_get_type ());
- return o;
-}
-
-static void
-xml_create (FilterElement *fe, xmlNodePtr node)
-{
- /*FilterScore *fs = (FilterScore *)fe;*/
-
- /* parent implementation */
- ((FilterElementClass *)(parent_class))->xml_create(fe, node);
-}
-
-static xmlNodePtr
-xml_encode (FilterElement *fe)
-{
- xmlNodePtr value;
- FilterScore *fs = (FilterScore *)fe;
- char *score;
-
- d(printf("Encoding score as xml\n"));
-
- value = xmlNewNode (NULL, "value");
- xmlSetProp (value, "name", fe->name);
- xmlSetProp (value, "type", "score");
-
- score = g_strdup_printf ("%d", fs->score);
- xmlSetProp (value, "score", score);
- g_free (score);
-
- return value;
-}
-
-static int
-xml_decode (FilterElement *fe, xmlNodePtr node)
-{
- FilterScore *fs = (FilterScore *)fe;
- char *name;
- char *score;
-
- d(printf("Decoding score from xml %p\n", fe));
-
- name = xmlGetProp (node, "name");
- d(printf ("Name = %s\n", name));
- xmlFree (fe->name);
- fe->name = name;
- score = xmlGetProp (node, name);
- if (score) {
- fs->score = atoi (score);
- xmlFree (score);
- } else
- fs->score = 0;
-
- if (fs->score > 3)
- fs->score = 3;
- else if (fs->score < -3)
- fs->score = -3;
-
- return 0;
-}
-
-static void
-spin_changed (GtkWidget *spin, FilterElement *fe)
-{
- FilterScore *fs = (FilterScore *)fe;
-
- fs->score = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spin));
-}
-
-static GtkWidget *
-get_widget (FilterElement *fe)
-{
- GtkWidget *spin;
- GtkObject *adjustment;
- FilterScore *fs = (FilterScore *)fe;
-
- adjustment = gtk_adjustment_new (0.0, -3.0, 3.0, 1.0, 1.0, 1.0);
- spin = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment), 1.0, 0);
- gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin), TRUE);
-
- if (fs->score) {
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin), (gfloat) fs->score);
- }
-
- gtk_signal_connect (GTK_OBJECT (spin), "changed", spin_changed, fe);
-
- return spin;
-}
-
-static void
-build_code (FilterElement *fe, GString *out, struct _FilterPart *ff)
-{
- return;
-}
-
-static void
-format_sexp (FilterElement *fe, GString *out)
-{
- FilterScore *fs = (FilterScore *)fe;
- char *score;
-
- score = g_strdup_printf ("%d", fs->score);
- e_sexp_encode_string (out, score);
- g_free (score);
-}
diff --git a/filter/filter-score.h b/filter/filter-score.h
deleted file mode 100644
index 468d28c28f..0000000000
--- a/filter/filter-score.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors: Jeffrey Stedfast <fejj@ximian.com>
- *
- * Copyright 2000 Ximian, Inc. (www.ximian.com)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-#ifndef _FILTER_SCORE_H
-#define _FILTER_SCORE_H
-
-#include "filter-element.h"
-
-#define FILTER_SCORE(obj) GTK_CHECK_CAST (obj, filter_score_get_type (), FilterScore)
-#define FILTER_SCORE_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, filter_score_get_type (), FilterScoreClass)
-#define IS_FILTER_SCORE(obj) GTK_CHECK_TYPE (obj, filter_score_get_type ())
-
-typedef struct _FilterScore FilterScore;
-typedef struct _FilterScoreClass FilterScoreClass;
-
-struct _FilterScore {
- FilterElement parent;
- struct _FilterScorePrivate *priv;
-
- gint32 score;
-};
-
-struct _FilterScoreClass {
- FilterElementClass parent_class;
-
- /* virtual methods */
-
- /* signals */
-};
-
-guint filter_score_get_type (void);
-FilterScore *filter_score_new (void);
-
-/* methods */
-
-#endif /* ! _FILTER_SCORE_H */
-
diff --git a/filter/filter-source.c b/filter/filter-source.c
deleted file mode 100644
index 5111a0b106..0000000000
--- a/filter/filter-source.c
+++ /dev/null
@@ -1,366 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * filter-source.c
- *
- * Copyright (C) 2001 Ximian, Inc.
- *
- * Developed by Jon Trowbridge <trow@ximian.com>
- */
-
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA.
- */
-
-#include <config.h>
-#include "filter-source.h"
-
-#include <gtk/gtk.h>
-#include <gnome.h>
-#include <gal/widgets/e-unicode.h>
-#include <e-util/e-url.h>
-#include <e-util/e-sexp.h>
-#include <bonobo/bonobo-object.h>
-#include <bonobo/bonobo-generic-factory.h>
-#include <bonobo/bonobo-context.h>
-#include <bonobo/bonobo-moniker-util.h>
-#include <bonobo/bonobo-exception.h>
-#include <bonobo-conf/bonobo-config-database.h>
-
-
-typedef struct _SourceInfo SourceInfo;
-struct _SourceInfo {
- gchar *name;
- gchar *address;
- gchar *url;
-};
-
-struct _FilterSourcePrivate {
- GList *sources;
- gchar *current_url;
-};
-
-static FilterElementClass *parent_class = NULL;
-enum {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-static void filter_source_class_init (FilterSourceClass *);
-static void filter_source_init (FilterSource *);
-static void filter_source_finalize (GtkObject *);
-
-static void xml_create(FilterElement *fe, xmlNodePtr node);
-static xmlNodePtr xml_encode(FilterElement *fe);
-static int xml_decode(FilterElement *fe, xmlNodePtr node);
-static FilterElement *clone(FilterElement *fe);
-static GtkWidget *get_widget(FilterElement *fe);
-static void build_code(FilterElement *fe, GString *out, struct _FilterPart *ff);
-static void format_sexp(FilterElement *, GString *);
-
-static void filter_source_add_source (FilterSource *fs, const gchar *name, const gchar *addr, const gchar *url);
-static void filter_source_get_sources (FilterSource *fs);
-
-
-GtkType
-filter_source_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "FilterSource",
- sizeof(FilterSource),
- sizeof(FilterSourceClass),
- (GtkClassInitFunc)filter_source_class_init,
- (GtkObjectInitFunc)filter_source_init,
- (GtkArgSetFunc)NULL,
- (GtkArgGetFunc)NULL
- };
-
- type = gtk_type_unique (filter_element_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-filter_source_class_init (FilterSourceClass *class)
-{
- GtkObjectClass *object_class;
- FilterElementClass *filter_element = (FilterElementClass *)class;
-
- object_class = (GtkObjectClass *)class;
- parent_class = gtk_type_class(filter_element_get_type ());
-
- object_class->finalize = filter_source_finalize;
-
- /* override methods */
- filter_element->xml_create = xml_create;
- filter_element->xml_encode = xml_encode;
- filter_element->xml_decode = xml_decode;
- filter_element->clone = clone;
- filter_element->get_widget = get_widget;
- filter_element->build_code = build_code;
- filter_element->format_sexp = format_sexp;
-
- /* signals */
-
- gtk_object_class_add_signals(object_class, signals, LAST_SIGNAL);
-}
-
-static void
-filter_source_init (FilterSource *fs)
-{
- fs->priv = g_new0 (struct _FilterSourcePrivate, 1);
-}
-
-static void
-filter_source_finalize (GtkObject *obj)
-{
- FilterSource *fs = FILTER_SOURCE (obj);
- GList *i = fs->priv->sources;
-
- while (i) {
- SourceInfo *info = i->data;
- g_free (info->name);
- g_free (info->address);
- g_free (info->url);
- g_free (info);
- i = g_list_next (i);
- }
-
- g_list_free (fs->priv->sources);
-
- g_free (fs->priv);
-
- if (GTK_OBJECT_CLASS (parent_class)->finalize)
- GTK_OBJECT_CLASS (parent_class)->finalize (obj);
-}
-
-FilterSource *
-filter_source_new (void)
-{
- FilterSource *s = (FilterSource *) gtk_type_new (filter_source_get_type ());
- return s;
-}
-
-static void
-xml_create (FilterElement *fe, xmlNodePtr node)
-{
- /* Call parent implementation */
- ((FilterElementClass *)parent_class)->xml_create (fe, node);
-}
-
-static xmlNodePtr
-xml_encode (FilterElement *fe)
-{
- xmlNodePtr value;
-
- FilterSource *fs = (FilterSource *) fe;
-
- value = xmlNewNode (NULL, "value");
- xmlSetProp (value, "name", fe->name);
- xmlSetProp (value, "type", "uri");
-
- if (fs->priv->current_url)
- xmlNewTextChild (value, NULL, "uri", fs->priv->current_url);
-
- return value;
-}
-
-static gint
-xml_decode (FilterElement *fe, xmlNodePtr node)
-{
- FilterSource *fs = (FilterSource *) fe;
- gchar *value;
-
- node = node->childs;
- if (node && node->name && !strcmp (node->name, "uri")) {
- g_free (fs->priv->current_url);
- fs->priv->current_url = xmlNodeGetContent (node);
- }
-
- return 0;
-}
-
-static FilterElement *
-clone (FilterElement *fe)
-{
- FilterSource *fs = (FilterSource *) fe;
- FilterSource *cpy = filter_source_new ();
- GList *i;
-
- ((FilterElement *)cpy)->name = g_strdup (fe->name);
-
- cpy->priv->current_url = g_strdup (fs->priv->current_url);
-
- for (i = fs->priv->sources; i != NULL; i = g_list_next (i)) {
- SourceInfo *info = (SourceInfo *) i->data;
- filter_source_add_source (cpy, info->name, info->address, info->url);
- }
-
- return (FilterElement *) cpy;
-}
-
-static void
-source_changed (GtkWidget *w, FilterSource *fs)
-{
- SourceInfo *info = (SourceInfo *) gtk_object_get_data (GTK_OBJECT (w), "source");
-
- g_free (fs->priv->current_url);
- fs->priv->current_url = g_strdup (info->url);
-}
-
-static GtkWidget *
-get_widget (FilterElement *fe)
-{
- FilterSource *fs = (FilterSource *) fe;
- GtkWidget *menu;
- GtkWidget *omenu;
- GtkWidget *item;
- GList *i;
- SourceInfo *first = NULL;
- gint index, current_index;
-
- if (fs->priv->sources == NULL)
- filter_source_get_sources (fs);
-
- menu = gtk_menu_new ();
-
- index = 0;
- current_index = -1;
-
- for (i = fs->priv->sources; i != NULL; i = g_list_next (i)) {
- SourceInfo *info = (SourceInfo *) i->data;
- gchar *label, *native_label;
-
- if (info->url != NULL) {
-
- if (first == NULL)
- first = info;
-
- label = g_strdup_printf ("%s <%s>", info->name, info->address);
- native_label = e_utf8_to_gtk_string (GTK_WIDGET (menu), label);
- item = gtk_menu_item_new_with_label (native_label);
- g_free (label);
- g_free (native_label);
-
- gtk_object_set_data (GTK_OBJECT (item), "source", info);
- gtk_signal_connect (GTK_OBJECT (item), "activate", GTK_SIGNAL_FUNC (source_changed), fs);
- gtk_menu_append (GTK_MENU (menu), item);
- gtk_widget_show (item);
-
- if (fs->priv->current_url && e_url_equal (info->url, fs->priv->current_url)) {
- current_index = index;
- }
-
- ++index;
- }
- }
-
- omenu = gtk_option_menu_new ();
- gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu);
-
- if (current_index >= 0) {
- gtk_option_menu_set_history (GTK_OPTION_MENU (omenu), current_index);
- } else {
- gtk_option_menu_set_history (GTK_OPTION_MENU (omenu), 0);
- g_free (fs->priv->current_url);
-
- if (first)
- fs->priv->current_url = g_strdup (first->url);
- else
- fs->priv->current_url = NULL;
- }
-
- return omenu;
-}
-
-static void
-build_code (FilterElement *fe, GString *out, struct _FilterPart *ff)
-{
- /* We are doing nothing on purpose. */
-}
-
-static void
-format_sexp (FilterElement *fe, GString *out)
-{
- FilterSource *fs = (FilterSource *) fe;
-
- e_sexp_encode_string (out, fs->priv->current_url);
-}
-
-
-static void
-filter_source_add_source (FilterSource *fs, const gchar *name, const gchar *addr, const gchar *url)
-{
- SourceInfo *info;
- g_return_if_fail (fs && IS_FILTER_SOURCE (fs));
-
- info = g_new0 (SourceInfo, 1);
- info->name = g_strdup (name);
- info->address = g_strdup (addr);
- info->url = g_strdup (url);
-
- fs->priv->sources = g_list_append (fs->priv->sources, info);
-}
-
-static void
-filter_source_get_sources (FilterSource *fs)
-{
- Bonobo_ConfigDatabase db;
- CORBA_Environment ev;
- gint i, len;
-
- CORBA_exception_init (&ev);
- db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev);
-
- if (BONOBO_EX (&ev) || db == CORBA_OBJECT_NIL) {
- CORBA_exception_free (&ev);
- return;
- }
-
- CORBA_exception_free (&ev);
-
- len = bonobo_config_get_long_with_default (db, "/Mail/Accounts/num", 0, NULL);
-
- for (i = 0; i < len; ++i) {
- gchar *path;
- gchar *name;
- gchar *addr;
- gchar *url;
-
- path = g_strdup_printf ("/Mail/Accounts/identity_name_%d", i);
- name = bonobo_config_get_string (db, path, NULL);
- g_free (path);
-
- path = g_strdup_printf ("/Mail/Accounts/identity_address_%d", i);
- addr = bonobo_config_get_string (db, path, NULL);
- g_free (path);
-
- path = g_strdup_printf ("/Mail/Accounts/source_url_%d", i);
- url = bonobo_config_get_string (db, path, NULL);
- g_free (path);
-
- filter_source_add_source (fs, name, addr, url);
-
- g_free (name);
- g_free (addr);
- g_free (url);
- }
-}
diff --git a/filter/filter-source.h b/filter/filter-source.h
deleted file mode 100644
index 4d14b3bf8c..0000000000
--- a/filter/filter-source.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * filter-source.h
- *
- * Copyright (C) 2001 Ximian, Inc.
- *
- * Developed by Jon Trowbridge <trow@ximian.com>
- */
-
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA.
- */
-
-#ifndef __FILTER_SOURCE_H__
-#define __FILTER_SOURCE_H__
-
-#include "filter-element.h"
-
-#define FILTER_SOURCE(obj) GTK_CHECK_CAST (obj, filter_source_get_type (), FilterSource)
-#define FILTER_SOURCE_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, filter_source_get_type (), FilterSourceClass)
-#define IS_FILTER_SOURCE(obj) GTK_CHECK_TYPE (obj, filter_source_get_type ())
-
-typedef struct _FilterSource FilterSource;
-typedef struct _FilterSourceClass FilterSourceClass;
-struct _FilterSourcePrivate;
-
-struct _FilterSource {
- FilterElement parent;
- struct _FilterSourcePrivate *priv;
-};
-
-struct _FilterSourceClass {
- FilterElementClass parent_class;
-};
-
-GtkType filter_source_get_type (void);
-FilterSource *filter_source_new (void);
-
-void filter_source_set_current (FilterSource *src, const gchar *url);
-
-#endif /* __FILTER_SOURCE_H__ */
-
diff --git a/filter/filter.glade b/filter/filter.glade
deleted file mode 100644
index 478ed32ad2..0000000000
--- a/filter/filter.glade
+++ /dev/null
@@ -1,721 +0,0 @@
-<?xml version="1.0"?>
-<GTK-Interface>
-
-<project>
- <name>Filter</name>
- <program_name>filter</program_name>
- <directory></directory>
- <source_directory>src</source_directory>
- <pixmaps_directory>pixmaps</pixmaps_directory>
- <language>C</language>
- <gnome_support>True</gnome_support>
- <gettext_support>True</gettext_support>
-</project>
-
-<widget>
- <class>GnomeDialog</class>
- <name>edit_filter_2</name>
- <title>Edit Filters</title>
- <type>GTK_WINDOW_TOPLEVEL</type>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>True</allow_grow>
- <auto_shrink>False</auto_shrink>
- <auto_close>False</auto_close>
- <hide_on_close>False</hide_on_close>
-
- <widget>
- <class>GtkVBox</class>
- <child_name>GnomeDialog:vbox</child_name>
- <name>dialog-vbox1</name>
- <homogeneous>False</homogeneous>
- <spacing>8</spacing>
- <child>
- <padding>4</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHButtonBox</class>
- <child_name>GnomeDialog:action_area</child_name>
- <name>dialog-action_area1</name>
- <layout_style>GTK_BUTTONBOX_END</layout_style>
- <spacing>8</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>7</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- <pack>GTK_PACK_END</pack>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button1</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button3</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
- </widget>
- </widget>
-
- <widget>
- <class>GtkOptionMenu</class>
- <name>filter_source</name>
- <can_focus>True</can_focus>
- <items>Incoming
-Outgoing
-</items>
- <initial_choice>0</initial_choice>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkFrame</class>
- <name>frame1</name>
- <label>Filter Rules</label>
- <label_xalign>0</label_xalign>
- <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox1</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
-
- <widget>
- <class>GtkScrolledWindow</class>
- <name>scrolledwindow1</name>
- <width>256</width>
- <hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
- <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
- <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
- <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkViewport</class>
- <name>viewport1</name>
- <shadow_type>GTK_SHADOW_IN</shadow_type>
-
- <widget>
- <class>GtkList</class>
- <name>rule_list</name>
- <selection_mode>GTK_SELECTION_SINGLE</selection_mode>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox1</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
-
- <widget>
- <class>GtkVButtonBox</class>
- <name>vbuttonbox1</name>
- <layout_style>GTK_BUTTONBOX_DEFAULT_STYLE</layout_style>
- <spacing>0</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>6</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>rule_add</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <label>Add</label>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>rule_edit</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <label>Edit</label>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>rule_delete</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <label>Delete</label>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>rule_up</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_UP</stock_button>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>rule_down</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_DOWN</stock_button>
- </widget>
- </widget>
- </widget>
- </widget>
- </widget>
- </widget>
-</widget>
-
-<widget>
- <class>GnomeDialog</class>
- <name>edit_vfolder_2</name>
- <title>Edit VFolders</title>
- <type>GTK_WINDOW_TOPLEVEL</type>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>True</allow_grow>
- <auto_shrink>False</auto_shrink>
- <auto_close>False</auto_close>
- <hide_on_close>False</hide_on_close>
-
- <widget>
- <class>GtkVBox</class>
- <child_name>GnomeDialog:vbox</child_name>
- <name>dialog-vbox2</name>
- <homogeneous>False</homogeneous>
- <spacing>8</spacing>
- <child>
- <padding>4</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHButtonBox</class>
- <child_name>GnomeDialog:action_area</child_name>
- <name>dialog-action_area2</name>
- <layout_style>GTK_BUTTONBOX_END</layout_style>
- <spacing>8</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>7</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- <pack>GTK_PACK_END</pack>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button13</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button15</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
- </widget>
- </widget>
-
- <widget>
- <class>GtkFrame</class>
- <name>frame2</name>
- <label>Virtual Folders</label>
- <label_xalign>0</label_xalign>
- <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox2</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
-
- <widget>
- <class>GtkScrolledWindow</class>
- <name>scrolledwindow2</name>
- <width>256</width>
- <height>167</height>
- <hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
- <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
- <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
- <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkViewport</class>
- <name>viewport2</name>
- <shadow_type>GTK_SHADOW_IN</shadow_type>
-
- <widget>
- <class>GtkList</class>
- <name>rule_list</name>
- <selection_mode>GTK_SELECTION_SINGLE</selection_mode>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox2</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
-
- <widget>
- <class>GtkVButtonBox</class>
- <name>vbuttonbox2</name>
- <layout_style>GTK_BUTTONBOX_DEFAULT_STYLE</layout_style>
- <spacing>0</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>6</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>rule_add</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <label>Add</label>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>rule_edit</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <label>Edit</label>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>rule_delete</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <label>Delete</label>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>rule_up</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_UP</stock_button>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>rule_down</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_DOWN</stock_button>
- </widget>
- </widget>
- </widget>
- </widget>
- </widget>
- </widget>
-</widget>
-
-<widget>
- <class>GnomeDialog</class>
- <name>vfolder_source</name>
- <type>GTK_WINDOW_TOPLEVEL</type>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>False</allow_grow>
- <auto_shrink>False</auto_shrink>
- <auto_close>False</auto_close>
- <hide_on_close>False</hide_on_close>
-
- <widget>
- <class>GtkVBox</class>
- <child_name>GnomeDialog:vbox</child_name>
- <name>dialog-vbox3</name>
- <homogeneous>False</homogeneous>
- <spacing>8</spacing>
- <child>
- <padding>4</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHButtonBox</class>
- <child_name>GnomeDialog:action_area</child_name>
- <name>dialog-action_area3</name>
- <layout_style>GTK_BUTTONBOX_END</layout_style>
- <spacing>8</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>7</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- <pack>GTK_PACK_END</pack>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button16</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button17</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_APPLY</stock_button>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button18</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
- </widget>
- </widget>
-
- <widget>
- <class>GtkFrame</class>
- <name>vfolder_source_frame</name>
- <label>vFolder Sources</label>
- <label_xalign>0</label_xalign>
- <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox3</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
-
- <widget>
- <class>GtkOptionMenu</class>
- <name>source_option</name>
- <can_focus>True</can_focus>
- <items>specific folders only
-with all local folders
-with all active remote folders
-with all local and active remote folders
-</items>
- <initial_choice>0</initial_choice>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox3</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkScrolledWindow</class>
- <name>scrolledwindow3</name>
- <width>256</width>
- <height>125</height>
- <hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
- <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
- <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
- <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkViewport</class>
- <name>viewport3</name>
- <shadow_type>GTK_SHADOW_IN</shadow_type>
-
- <widget>
- <class>GtkList</class>
- <name>source_list</name>
- <selection_mode>GTK_SELECTION_SINGLE</selection_mode>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox3</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
-
- <widget>
- <class>GtkVButtonBox</class>
- <name>vbuttonbox3</name>
- <layout_style>GTK_BUTTONBOX_DEFAULT_STYLE</layout_style>
- <spacing>0</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>6</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>source_add</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <label>Add</label>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>source_remove</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <label>Remove</label>
- </widget>
- </widget>
- </widget>
- </widget>
- </widget>
- </widget>
- </widget>
-</widget>
-
-<widget>
- <class>GtkWindow</class>
- <name>edit_filter</name>
- <title>window1</title>
- <type>GTK_WINDOW_TOPLEVEL</type>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>True</allow_grow>
- <auto_shrink>False</auto_shrink>
-
- <widget>
- <class>GtkVBox</class>
- <name>rule_editor</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
-
- <widget>
- <class>GtkOptionMenu</class>
- <name>filter_source</name>
- <visible>False</visible>
- <can_focus>True</can_focus>
- <items>Incoming
-</items>
- <initial_choice>0</initial_choice>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkFrame</class>
- <name>rule_frame</name>
- <label>Filter Rules</label>
- <label_xalign>0</label_xalign>
- <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox4</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
-
- <widget>
- <class>GtkScrolledWindow</class>
- <name>scrolledwindow4</name>
- <width>256</width>
- <hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
- <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
- <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
- <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkViewport</class>
- <name>viewport4</name>
- <shadow_type>GTK_SHADOW_IN</shadow_type>
-
- <widget>
- <class>GtkList</class>
- <name>rule_list</name>
- <selection_mode>GTK_SELECTION_SINGLE</selection_mode>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox5</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
-
- <widget>
- <class>GtkVButtonBox</class>
- <name>vbuttonbox4</name>
- <layout_style>GTK_BUTTONBOX_DEFAULT_STYLE</layout_style>
- <spacing>0</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>6</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>rule_add</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <label>Add</label>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>rule_edit</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <label>Edit</label>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>rule_delete</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <label>Delete</label>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>rule_up</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_UP</stock_button>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>rule_down</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_DOWN</stock_button>
- </widget>
- </widget>
- </widget>
- </widget>
- </widget>
- </widget>
-</widget>
-
-</GTK-Interface>
diff --git a/filter/filtertypes.xml b/filter/filtertypes.xml
deleted file mode 100644
index bca26ca0b3..0000000000
--- a/filter/filtertypes.xml
+++ /dev/null
@@ -1,628 +0,0 @@
-<?xml version="1.0"?>
-<filterdescription>
-<partset>
- <part name="sender">
- <title>Sender</title>
- <input type="optionlist" name="sender-type">
- <option value="contains">
- <title>contains</title>
- <code>
- (match-all (header-contains "From" ${sender}))
- </code>
- </option>
- <option value="not contains">
- <title>does not contain</title>
- <code>
- (match-all (not (header-contains "From" ${sender})))
- </code>
- </option>
- <option value="is">
- <title>is</title>
- <code>
- (match-all (header-matches "From" ${sender}))
- </code>
- </option>
- <option value="is not">
- <title>is not</title>
- <code>
- (match-all (not (header-matches "From" ${sender})))
- </code>
- </option>
- <option value="starts with">
- <title>starts with</title>
- <code>
- (match-all (header-starts-with "From" ${sender}))
- </code>
- </option>
- <option value="not starts with">
- <title>does not start with</title>
- <code>
- (match-all (not (header-starts-with "From" ${sender})))
- </code>
- </option>
- <option value="ends with">
- <title>ends with</title>
- <code>
- (match-all (header-ends-with "From" ${sender}))
- </code>
- </option>
- <option value="not ends with">
- <title>does not end with</title>
- <code>
- (match-all (not (header-ends-with "From" ${sender})))
- </code>
- </option>
- <option value="matches soundex">
- <title>sounds like</title>
- <code>
- (match-all (header-soundex "From" ${sender}))
- </code>
- </option>
- <option value="not match soundex">
- <title>does not sound like</title>
- <code>
- (match-all (not (header-soundex "From" ${sender})))
- </code>
- </option>
- </input>
- <input type="string" name="sender"/>
- </part>
-
- <part name="to">
- <title>Recipients</title>
- <input type="optionlist" name="recipient-type">
- <option value="contains">
- <title>contains</title>
- <code>
- (match-all (or (header-contains "To" ${recipient})
- (header-contains "Cc" ${recipient})))
- </code>
- </option>
- <option value="not contains">
- <title>does not contain</title>
- <code>
- (match-all (not (or
- (header-contains "To" ${recipient})
- (header-contains "Cc" ${recipient}))))
- </code>
- </option>
- <option value="is">
- <title>is</title>
- <code>
- (match-all (or (header-matches "To" ${recipient})
- (header-matches "Cc" ${recipient})))
- </code>
- </option>
- <option value="is not">
- <title>is not</title>
- <code>
- (match-all (not (or
- (header-matches "To" ${recipient})
- (header-matches "Cc" ${recipient}))))
- </code>
- </option>
- <option value="starts with">
- <title>starts with</title>
- <code>
- (match-all (or (header-starts-with "To" ${recipient})
- (header-starts-with "Cc" ${recipient})))
- </code>
- </option>
- <option value="not starts with">
- <title>does not start with</title>
- <code>
- (match-all (not (or
- (header-starts-with "To" ${recipient})
- (header-starts-with "Cc" ${recipient}))))
- </code>
- </option>
- <option value="ends with">
- <title>ends with</title>
- <code>
- (match-all (or (header-ends-with "To" ${recipient})
- (header-ends-with "Cc" ${recipient})))
- </code>
- </option>
- <option value="not ends with">
- <title>does not end with</title>
- <code>
- (match-all (not (or
- (header-ends-with "To" ${recipient})
- (header-ends-with "Cc" ${recipient}))))
- </code>
- </option>
- <option value="matches soundex">
- <title>sounds like</title>
- <code>
- (match-all (or (header-soundex "To" ${recipient})
- (header-soundex "Cc" ${recipient})))
- </code>
- </option>
- <option value="not match soundex">
- <title>does not sound like</title>
- <code>
- (match-all (not (or
- (header-soundex "To" ${recipient})
- (header-soundex "Cc" ${recipient}))))
- </code>
- </option>
- </input>
- <input type="address" name="recipient"/>
- </part>
-
- <part name="subject">
- <title>Subject</title>
- <input type="optionlist" name="subject-type">
- <option value="contains">
- <title>contains</title>
- <code>
- (match-all (header-contains "Subject" ${subject}))
- </code>
- </option>
- <option value="not contains">
- <title>does not contain</title>
- <code>
- (match-all (not (header-contains "Subject" ${subject})))
- </code>
- </option>
- <option value="is">
- <title>is</title>
- <code>
- (match-all (header-matches "Subject" ${subject}))
- </code>
- </option>
- <option value="is not">
- <title>is not</title>
- <code>
- (match-all (not (header-matches "Subject" ${subject}))
- </code>
- </option>
- <option value="starts with">
- <title>starts with</title>
- <code>
- (match-all (header-starts-with "Subject" ${subject}))
- </code>
- </option>
- <option value="not starts with">
- <title>does not start with</title>
- <code>
- (match-all (not (header-starts-with "Subject" ${subject}))
- </code>
- </option>
- <option value="ends with">
- <title>ends with</title>
- <code>
- (match-all (header-ends-with "Subject" ${subject}))
- </code>
- </option>
- <option value="not ends with">
- <title>does not end with</title>
- <code>
- (match-all (not (header-ends-with "Subject" ${subject}))
- </code>
- </option>
- <option value="matches soundex">
- <title>sounds like</title>
- <code>
- (match-all (header-soundex "Subject" ${subject}))
- </code>
- </option>
- <option value="not match soundex">
- <title>does not sound like</title>
- <code>
- (match-all (not (header-soundex "Subject" ${subject})))
- </code>
- </option>
- </input>
- <input type="string" name="subject"/>
- </part>
-
- <part name="header">
- <title>Specific header</title>
- <input type="string" name="header-field"/>
- <input type="optionlist" name="header-type">
- <option value="contains">
- <title>contains</title>
- <code>
- (match-all (header-contains ${header-field} ${word}))
- </code>
- </option>
- <option value="not contains">
- <title>does not contain</title>
- <code>
- (match-all (not (header-contains ${header-field} ${word})))
- </code>
- </option>
- <option value="is">
- <title>is</title>
- <code>
- (match-all (header-matches ${header-field} ${word}))
- </code>
- </option>
- <option value="is not">
- <title>is not</title>
- <code>
- (match-all (not (header-matches ${header-field} ${word}))
- </code>
- </option>
- <option value="starts with">
- <title>starts with</title>
- <code>
- (match-all (header-starts-with ${header-field} ${word}))
- </code>
- </option>
- <option value="not starts with">
- <title>does not start with</title>
- <code>
- (match-all (not (header-starts-with ${header-field} ${word}))
- </code>
- </option>
- <option value="ends with">
- <title>ends with</title>
- <code>
- (match-all (header-ends-with ${header-field} ${word}))
- </code>
- </option>
- <option value="not ends with">
- <title>does not end with</title>
- <code>
- (match-all (not (header-ends-with ${header-field} ${word}))
- </code>
- </option>
- <option value="exists">
- <title>exists</title>
- <code>
- (match-all (header-exists ${header-field}))
- </code>
- </option>
- <option value="not exists">
- <title>does not exist</title>
- <code>
- (match-all (not (header-exists ${header-field}))
- </code>
- </option>
- <option value="matches soundex">
- <title>sounds like</title>
- <code>
- (match-all (header-soundex ${header-field} ${word}))
- </code>
- </option>
- <option value="not match soundex">
- <title>does not sound like</title>
- <code>
- (match-all (not (header-soundex ${header-field} ${word})))
- </code>
- </option>
- </input>
- <input type="string" name="word"/>
- </part>
-
- <part name="body">
- <title>Message Body</title>
- <input type="optionlist" name="body-type">
- <option value="contains">
- <title>contains</title>
- <code>
- (body-contains ${word})
- </code>
- </option>
- <option value="not contains">
- <title>does not contain</title>
- <code>
- (match-all (not (body-contains ${word})))
- </code>
- </option>
- </input>
- <input type="string" name="word"/>
- </part>
-
- <part name="sexp">
- <title>Expression</title>
- <input type="code" name="code"/>
- </part>
-
- <part name="sent-date">
- <title>Date sent</title>
- <input type="optionlist" name="date-spec-type">
- <option value="is">
- <title>is</title>
- <code>
- (match-all (= (get-sent-date) ${versus}))
- </code>
- </option>
- <option value="is-not">
- <title>is not</title>
- <code>
- (match-all (not (= (get-sent-date) ${versus})))
- </code>
- </option>
- <option value="before">
- <title>was before</title>
- <code>
- (match-all (&lt; (get-sent-date) ${versus}))
- </code>
- </option>
- <option value="after">
- <title>was after</title>
- <code>
- (match-all (&gt; (get-sent-date) ${versus}))
- </code>
- </option>
- </input>
- <input type="datespec" name="versus"/>
- </part>
-
- <part name="recv-date">
- <title>Date received</title>
- <input type="optionlist" name="date-spec-type">
- <option value="is">
- <title>is</title>
- <code>
- (match-all (= (get-received-date) ${versus}))
- </code>
- </option>
- <option value="is-not">
- <title>is not</title>
- <code>
- (match-all (not (= (get-received-date) ${versus})))
- </code>
- </option>
- <option value="before">
- <title>was before</title>
- <code>
- (match-all (&lt; (get-received-date) ${versus}))
- </code>
- </option>
- <option value="after">
- <title>was after</title>
- <code>
- (match-all (&gt; (get-received-date) ${versus}))
- </code>
- </option>
- </input>
- <input type="datespec" name="versus"/>
- </part>
-
- <part name="score">
- <title>Score</title>
- <input type="optionlist" name="score-type">
- <option value="less-than">
- <title>is</title>
- <code>
- (match-all (= (get-score) ${versus}))
- </code>
- </option>
- <option value="is-not">
- <title>is not</title>
- <code>
- (match-all (not (= (get-score) ${versus})))
- </code>
- </option>
- <option value="greater-than">
- <title>is greater than</title>
- <code>
- (match-all (&gt; (get-score) ${versus}))
- </code>
- </option>
- <option value="less-than">
- <title>is less than</title>
- <code>
- (match-all (&lt; (get-score) ${versus}))
- </code>
- </option>
- </input>
- <input type="score" name="versus"/>
- </part>
-
-
- <part name="size">
- <title>Size (kB)</title>
- <input type="optionlist" name="size-type">
- <option value="greater-than">
- <title>is greater than</title>
- <code>
- (match-all (&gt; (get-size) ${versus}))
- </code>
- </option>
- <option value="less-than">
- <title>is less than</title>
- <code>
- (match-all (&lt; (get-size) ${versus}))
- </code>
- </option>
- </input>
- <input type="integer" name="versus"/>
- </part>
-
- <part name="status">
- <title>Status</title>
- <input type="optionlist" name="match-type">
- <option value="is">
- <title>is</title>
- <code>
- (match-all (system-flag ${flag}))
- </code>
- </option>
- <option value="is not">
- <title>is not</title>
- <code>
- (match-all (not (system-flag ${flag})))
- </code>
- </option>
- </input>
- <input type="optionlist" name="flag">
- <option value="Answered">
- <title>Replied to</title>
- </option>
- <option value="Draft">
- <title>Draft</title>
- </option>
- <option value="Flagged">
- <title>Important</title>
- </option>
- <option value="Seen">
- <title>Read</title>
- </option>
- </input>
- </part>
-
- <part name="attachments">
- <title>Attachments</title>
- <input type="optionlist" name="match-type">
- <option value="exist">
- <title>Exist</title>
- <code>
- (match-all (system-flag "Attachments"))
- </code>
- </option>
- <option value="not exist">
- <title>Do Not Exist</title>
- <code>
- (match-all (not (system-flag "Attachments")))
- </code>
- </option>
- </input>
- </part>
-
- <part name="mlist">
- <title>Mailing list</title>
- <input type="optionlist" name="mlist-type">
- <option value="contains">
- <title>contains</title>
- <code>(match-all (header-contains "x-camel-mlist" ${mlist}))</code>
- </option>
- <option value="not contains">
- <title>does not contain</title>
- <code>(match-all (not (header-contains "x-camel-mlist" ${mlist})))</code>
- </option>
- <option value="is">
- <title>is</title>
- <code>(match-all (header-matches "x-camel-mlist" ${mlist}))</code>
- </option>
- <option value="is not">
- <title>is not</title>
- <code>(match-all (not (header-matches "x-camel-mlist" ${mlist})))</code>
- </option>
- <option value="starts with">
- <title>starts with</title>
- <code>
- (match-all (header-starts-with "x-camel-mlist" ${mlist}))
- </code>
- </option>
- <option value="not starts with">
- <title>does not start with</title>
- <code>
- (match-all (not (header-starts-with "x-camel-mlist" ${mlist})))
- </code>
- </option>
- <option value="ends with">
- <title>ends with</title>
- <code>
- (match-all (header-ends-with "x-camel-mlist" ${mlist}))
- </code>
- </option>
- <option value="not ends with">
- <title>does not end with</title>
- <code>
- (match-all (not (header-ends-with "x-camel-mlist" ${mlist})))
- </code>
- </option>
- </input>
- <input type="string" name="mlist"/>
- </part>
-
- <part name="regex">
- <title>Regex Match</title>
- <input type="optionlist" name="match-type">
- <option value="header">
- <title>Message Header</title>
- <code>
- (match-all (header-full-regex ${expression}))
- </code>
- </option>
- <option value="body">
- <title>Message Body</title>
- <code>
- (match-all (body-regex ${expression}))
- </code>
- </option>
- </input>
- <input type="regex" name="expression"/>
- </part>
-
- <part name="source">
- <title>Source Account</title>
- <input type="optionlist" name="srcmatch-type">
- <option value="is">
- <title>is</title>
- <code>
- (match-all (= (get-source) ${source}))
- </code>
- </option>
- <option value="is-not">
- <title>is not</title>
- <code>
- (match-all (not (= (get-source) ${source})))
- </code>
- </option>
- </input>
- <input type="source" name="source"/>
- </part>
-
-</partset>
-
-
-<actionset>
- <part name="move-to-folder">
- <title>Move to Folder</title>
- <code>(move-to ${folder})</code>
- <input type="folder" name="folder"/>
- </part>
- <part name="copy-to-folder">
- <title>Copy to Folder</title>
- <code>(copy-to ${folder})</code>
- <input type="folder" name="folder"/>
- </part>
- <part name="delete">
- <title>Delete</title>
- <code>(delete)</code>
- </part>
- <part name="stop">
- <title>Stop Processing</title>
- <code>(stop)</code>
- </part>
- <part name="colour">
- <title>Assign Color</title>
- <code>(set-colour ${colour})</code>
- <input type="colour" name="colour"/>
- </part>
- <part name="score">
- <title>Assign Score</title>
- <code>(set-score ${score})</code>
- <input type="score" name="score"/>
- </part>
- <part name="set-status">
- <title>Set Status</title>
- <code>
- (set-system-flag ${flag})
- </code>
- <input type="optionlist" name="flag">
- <option value="Answered">
- <title>Replied to</title>
- </option>
- <option value="Deleted">
- <title>Deleted</title>
- </option>
- <option value="Draft">
- <title>Draft</title>
- </option>
- <option value="Flagged">
- <title>Important</title>
- </option>
- <option value="Seen">
- <title>Read</title>
- </option>
- </input>
- </part>
-</actionset>
-</filterdescription>
diff --git a/filter/libfilter-i18n.h b/filter/libfilter-i18n.h
deleted file mode 100644
index d3cc5cbb36..0000000000
--- a/filter/libfilter-i18n.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Automatically generated. Do not edit. */
-char *s = N_("after");
-char *s = N_("Assign Color");
-char *s = N_("Assign Score");
-char *s = N_("Attachments");
-char *s = N_("before");
-char *s = N_("contains");
-char *s = N_("Copy to Folder");
-char *s = N_("Date received");
-char *s = N_("Date sent");
-char *s = N_("Delete");
-char *s = N_("Deleted");
-char *s = N_("does not contain");
-char *s = N_("does not end with");
-char *s = N_("does not exist");
-char *s = N_("does not sound like");
-char *s = N_("does not start with");
-char *s = N_("Do Not Exist");
-char *s = N_("Draft");
-char *s = N_("ends with");
-char *s = N_("Exist");
-char *s = N_("exists");
-char *s = N_("Expression");
-char *s = N_("Important");
-char *s = N_("is");
-char *s = N_("is greater than");
-char *s = N_("is less than");
-char *s = N_("is not");
-char *s = N_("Mailing list");
-char *s = N_("Message Body");
-char *s = N_("Message Header");
-char *s = N_("Message was received");
-char *s = N_("Message was sent");
-char *s = N_("Move to Folder");
-char *s = N_("on or after");
-char *s = N_("on or before");
-char *s = N_("Read");
-char *s = N_("Recipients");
-char *s = N_("Regex Match");
-char *s = N_("Replied to");
-char *s = N_("Score");
-char *s = N_("Sender");
-char *s = N_("Set Status");
-char *s = N_("Size (kB)");
-char *s = N_("sounds like");
-char *s = N_("Source Account");
-char *s = N_("Specific header");
-char *s = N_("starts with");
-char *s = N_("Status");
-char *s = N_("Stop Processing");
-char *s = N_("Subject");
-char *s = N_("was after");
-char *s = N_("was before");
diff --git a/filter/rule-context.c b/filter/rule-context.c
deleted file mode 100644
index f24e9948be..0000000000
--- a/filter/rule-context.c
+++ /dev/null
@@ -1,473 +0,0 @@
-/*
- * Copyright (C) 2000 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <errno.h>
-#include <string.h>
-#include <gtk/gtksignal.h>
-#include <libgnomeui/gnome-dialog.h>
-#include <libgnomeui/gnome-stock.h>
-
-#include "rule-context.h"
-
-#define d(x)
-
-static int load(RuleContext * f, const char *system, const char *user);
-static int save(RuleContext * f, const char *user);
-
-static void rule_context_class_init(RuleContextClass * class);
-static void rule_context_init(RuleContext * gspaper);
-static void rule_context_finalise(GtkObject * obj);
-
-#define _PRIVATE(x) (((RuleContext *)(x))->priv)
-
-struct _RuleContextPrivate {
-};
-
-static GtkObjectClass *parent_class;
-
-enum {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-guint
-rule_context_get_type(void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "RuleContext",
- sizeof(RuleContext),
- sizeof(RuleContextClass),
- (GtkClassInitFunc) rule_context_class_init,
- (GtkObjectInitFunc) rule_context_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- type = gtk_type_unique(gtk_object_get_type(), &type_info);
- }
-
- return type;
-}
-
-static void
-rule_context_class_init(RuleContextClass * class)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass *) class;
- parent_class = gtk_type_class(gtk_object_get_type());
-
- object_class->finalize = rule_context_finalise;
-
- /* override methods */
- class->load = load;
- class->save = save;
-
- /* signals */
-
- gtk_object_class_add_signals(object_class, signals, LAST_SIGNAL);
-}
-
-static void
-rule_context_init(RuleContext * o)
-{
- o->priv = g_malloc0(sizeof(*o->priv));
-
- o->part_set_map = g_hash_table_new(g_str_hash, g_str_equal);
- o->rule_set_map = g_hash_table_new(g_str_hash, g_str_equal);
-}
-
-static void
-rule_context_finalise(GtkObject * obj)
-{
- RuleContext *o = (RuleContext *) obj;
- struct _part_set_map *psm;
- struct _rule_set_map *rsm;
- GList *next;
-
- g_free(o->priv);
- g_hash_table_destroy(o->part_set_map);
- g_hash_table_destroy(o->rule_set_map);
-
- for (; o->part_set_list; o->part_set_list = next) {
- psm = o->part_set_list->data;
- g_free (psm->name);
- g_free (psm);
- next = o->part_set_list->next;
- g_list_free_1 (o->part_set_list);
- }
- for (; o->rule_set_list; o->rule_set_list = next) {
- rsm = o->rule_set_list->data;
- g_free (rsm->name);
- g_free (rsm);
- next = o->rule_set_list->next;
- g_list_free_1 (o->rule_set_list);
- }
-
- if (o->system)
- xmlFreeDoc(o->system);
- if (o->user)
- xmlFreeDoc(o->user);
-
- ((GtkObjectClass *) (parent_class))->finalize(obj);
-}
-
-/**
- * rule_context_new:
- *
- * Create a new RuleContext object.
- *
- * Return value: A new #RuleContext object.
- **/
-RuleContext *
-rule_context_new(void)
-{
- RuleContext *o = (RuleContext *) gtk_type_new(rule_context_get_type());
-
- return o;
-}
-
-void
-rule_context_add_part_set(RuleContext * f, const char *setname, int part_type, RCPartFunc append, RCNextPartFunc next)
-{
- struct _part_set_map *map;
-
- map = g_malloc0(sizeof(*map));
- map->type = part_type;
- map->append = append;
- map->next = next;
- map->name = g_strdup(setname);
- g_hash_table_insert(f->part_set_map, map->name, map);
- f->part_set_list = g_list_append(f->part_set_list, map);
- d(printf("adding part set '%s'\n", setname));
-}
-
-void
-rule_context_add_rule_set(RuleContext * f, const char *setname, int rule_type, RCRuleFunc append, RCNextRuleFunc next)
-{
- struct _rule_set_map *map;
-
- map = g_malloc0(sizeof(*map));
- map->type = rule_type;
- map->append = append;
- map->next = next;
- map->name = g_strdup(setname);
- g_hash_table_insert(f->rule_set_map, map->name, map);
- f->rule_set_list = g_list_append(f->rule_set_list, map);
- d(printf("adding rule set '%s'\n", setname));
-}
-
-/**
- * rule_context_set_error:
- * @f:
- * @error:
- *
- * Set the text error for the context, or NULL to clear it.
- **/
-static void
-rule_context_set_error(RuleContext * f, char *error)
-{
- g_free(f->error);
- f->error = error;
-}
-
-/**
- * rule_context_load:
- * @f:
- * @system:
- * @user:
- *
- * Load a rule context from a system and user description file.
- *
- * Return value:
- **/
-int
-rule_context_load(RuleContext * f, const char *system, const char *user)
-{
- d(printf("rule_context: loading %s %s\n", system, user));
-
- return ((RuleContextClass *) ((GtkObject *) f)->klass)->load(f, system, user);
-}
-
-static int
-load(RuleContext * f, const char *system, const char *user)
-{
- xmlNodePtr set, rule;
- struct _part_set_map *part_map;
- struct _rule_set_map *rule_map;
-
- rule_context_set_error(f, NULL);
-
- d(printf("loading rules %s %s\n", system, user));
-
- f->system = xmlParseFile(system);
- if (f->system == NULL) {
- rule_context_set_error(f, g_strdup_printf("Unable to load system rules '%s': %s",
- system, strerror(errno)));
- return -1;
- }
- if (strcmp(f->system->root->name, "filterdescription")) {
- rule_context_set_error(f, g_strdup_printf("Unable to load system rules '%s': Invalid format", system));
- xmlFreeDoc(f->system);
- f->system = NULL;
- return -1;
- }
- /* doesn't matter if this doens't exist */
- f->user = xmlParseFile(user);
-
- /* now parse structure */
- /* get rule parts */
- set = f->system->root->childs;
- while (set) {
- d(printf("set name = %s\n", set->name));
- part_map = g_hash_table_lookup(f->part_set_map, set->name);
- if (part_map) {
- d(printf("loading parts ...\n"));
- rule = set->childs;
- while (rule) {
- if (!strcmp(rule->name, "part")) {
- FilterPart *part = FILTER_PART(gtk_type_new(part_map->type));
-
- if (filter_part_xml_create(part, rule) == 0) {
- part_map->append(f, part);
- } else {
- gtk_object_unref((GtkObject *) part);
- g_warning("Cannot load filter part");
- }
- }
- rule = rule->next;
- }
- }
- set = set->next;
- }
-
- /* now load actual rules */
- if (f->user) {
- set = f->user->root->childs;
- while (set) {
- d(printf("set name = %s\n", set->name));
- rule_map = g_hash_table_lookup(f->rule_set_map, set->name);
- if (rule_map) {
- d(printf("loading rules ...\n"));
- rule = set->childs;
- while (rule) {
- d(printf("checking node: %s\n", rule->name));
- if (!strcmp(rule->name, "rule")) {
- FilterRule *part = FILTER_RULE(gtk_type_new(rule_map->type));
-
- if (filter_rule_xml_decode(part, rule, f) == 0) {
- rule_map->append(f, part);
- } else {
- gtk_object_unref((GtkObject *) part);
- g_warning("Cannot load filter part");
- }
- }
- rule = rule->next;
- }
- }
- set = set->next;
- }
- }
- return 0;
-}
-
-/**
- * rule_context_save:
- * @f:
- * @user:
- *
- * Save a rule context to disk.
- *
- * Return value:
- **/
-int
-rule_context_save(RuleContext * f, const char *user)
-{
- return ((RuleContextClass *) ((GtkObject *) f)->klass)->save(f, user);
-}
-
-static int
-save(RuleContext * f, const char *user)
-{
- xmlDocPtr doc;
- xmlNodePtr root, rules, work;
- GList *l;
- FilterRule *rule;
- struct _rule_set_map *map;
-
- doc = xmlNewDoc("1.0");
- root = xmlNewDocNode(doc, NULL, "filteroptions", NULL);
- xmlDocSetRootElement(doc, root);
- l = f->rule_set_list;
- while (l) {
- map = l->data;
- rules = xmlNewDocNode(doc, NULL, map->name, NULL);
- xmlAddChild(root, rules);
- rule = NULL;
- while ((rule = map->next(f, rule, NULL))) {
- d(printf("processing rule %s\n", rule->name));
- work = filter_rule_xml_encode(rule);
- xmlAddChild(rules, work);
- }
- l = g_list_next(l);
- }
- xmlSaveFile(user, doc);
- xmlFreeDoc(doc);
- return 0;
-}
-
-FilterPart *
-rule_context_find_part(RuleContext * f, const char *name)
-{
- d(printf("find part : "));
- return filter_part_find_list(f->parts, name);
-}
-
-FilterPart *
-rule_context_create_part(RuleContext * f, const char *name)
-{
- FilterPart *part;
-
- part = rule_context_find_part(f, name);
- if (part)
- part = filter_part_clone(part);
- return part;
-}
-
-FilterPart *
-rule_context_next_part(RuleContext * f, FilterPart * last)
-{
- return filter_part_next_list(f->parts, last);
-}
-
-FilterRule *
-rule_context_next_rule(RuleContext * f, FilterRule * last, const char *source)
-{
- return filter_rule_next_list(f->rules, last, source);
-}
-
-FilterRule *
-rule_context_find_rule(RuleContext * f, const char *name, const char *source)
-{
- return filter_rule_find_list(f->rules, name, source);
-}
-
-void
-rule_context_add_part(RuleContext * f, FilterPart * part)
-{
- f->parts = g_list_append(f->parts, part);
-}
-
-void
-rule_context_add_rule(RuleContext * f, FilterRule * new)
-{
- f->rules = g_list_append(f->rules, new);
-}
-
-static void
-new_rule_clicked (GtkWidget *dialog, int button, RuleContext *context)
-{
-#ifndef NO_WARNINGS
-#warning "Need a changed signal for this to work best"
-#endif
- if (button == 0) {
- FilterRule *rule = gtk_object_get_data (GTK_OBJECT (dialog), "rule");
- char *user = gtk_object_get_data (GTK_OBJECT (dialog), "path");
-
- if (!filter_rule_validate (rule)) {
- /* no need to popup a dialog because the validate code does that. */
- return;
- }
-
- gtk_object_ref (GTK_OBJECT (rule));
- rule_context_add_rule (context, rule);
- if (user) {
- rule_context_save ((RuleContext *) context, user);
- }
- }
-
- if (button != -1) {
- gnome_dialog_close (GNOME_DIALOG (dialog));
- }
-}
-
-/* add a rule, with a gui, asking for confirmation first ... optionally save to path */
-void
-rule_context_add_rule_gui(RuleContext * f, FilterRule * rule, const char *title, const char *path)
-{
- GtkWidget *w;
- GnomeDialog *gd;
-
- w = filter_rule_get_widget(rule, f);
- gd = (GnomeDialog *) gnome_dialog_new(title, GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, NULL);
- gtk_window_set_policy(GTK_WINDOW(gd), FALSE, TRUE, FALSE);
- gtk_box_pack_start((GtkBox *) gd->vbox, w, TRUE, TRUE, 0);
- gtk_window_set_default_size(GTK_WINDOW(gd), 600, 400);
- gtk_widget_show((GtkWidget *) gd);
- gtk_object_set_data_full((GtkObject *) gd, "rule", rule, (GtkDestroyNotify) gtk_object_unref);
- if (path)
- gtk_object_set_data_full((GtkObject *) gd, "path", g_strdup(path), (GtkDestroyNotify) g_free);
- gtk_signal_connect((GtkObject *) gd, "clicked", new_rule_clicked, f);
- gtk_object_ref((GtkObject *) f);
- gtk_object_set_data_full((GtkObject *) gd, "context", f, (GtkDestroyNotify) gtk_object_unref);
- gtk_widget_show((GtkWidget *) gd);
-}
-
-void
-rule_context_remove_rule (RuleContext *f, FilterRule *rule)
-{
- f->rules = g_list_remove (f->rules, rule);
-}
-
-void
-rule_context_rank_rule (RuleContext *f, FilterRule *rule, int rank)
-{
- f->rules = g_list_remove (f->rules, rule);
- f->rules = g_list_insert (f->rules, rule, rank);
-}
-
-int
-rule_context_get_rank_rule (RuleContext *f, FilterRule *rule, const char *source)
-{
- GList *node = f->rules;
- int i = 0;
-
- while (node) {
- FilterRule *r = node->data;
-
- if (r == rule)
- return i;
-
- if (source == NULL || (r->source && strcmp (r->source, source) == 0))
- i++;
-
- node = node->next;
- }
-
- return -1;
-}
diff --git a/filter/rule-context.h b/filter/rule-context.h
deleted file mode 100644
index a06bad9acd..0000000000
--- a/filter/rule-context.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (C) 2000 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef _RULE_CONTEXT_H
-#define _RULE_CONTEXT_H
-
-#include <gtk/gtkobject.h>
-#include <gnome-xml/parser.h>
-
-#include "filter-part.h"
-#include "filter-rule.h"
-
-#define RULE_CONTEXT(obj) GTK_CHECK_CAST (obj, rule_context_get_type (), RuleContext)
-#define RULE_CONTEXT_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, rule_context_get_type (), RuleContextClass)
-#define IS_RULE_CONTEXT(obj) GTK_CHECK_TYPE (obj, rule_context_get_type ())
-
-typedef struct _RuleContext RuleContext;
-typedef struct _RuleContextClass RuleContextClass;
-
-struct _RuleContext {
- GtkObject parent;
- struct _RuleContextPrivate *priv;
-
- char *error; /* string version of error */
-
- xmlDocPtr system; /* system rules source */
- xmlDocPtr user; /* user defined rules source */
-
- GList *parts;
- GList *rules;
-
- GHashTable *part_set_map;/* map set types to part types */
- GList *part_set_list;
- GHashTable *rule_set_map;/* map set types to rule types */
- GList *rule_set_list;
-};
-
-typedef void (*RCRegisterFunc)(RuleContext *f, FilterRule *rule, gpointer data);
-
-struct _RuleContextClass {
- GtkObjectClass parent_class;
-
- /* virtual methods */
- int (*load)(RuleContext *f, const char *system, const char *user);
- int (*save)(RuleContext *f, const char *user);
-
- /* signals */
-};
-
-typedef void (*RCPartFunc)(RuleContext *f, FilterPart *part);
-typedef void (*RCRuleFunc)(RuleContext *f, FilterRule *part);
-typedef FilterPart * (*RCNextPartFunc)(RuleContext *f, FilterPart *part);
-typedef FilterRule * (*RCNextRuleFunc)(RuleContext *f, FilterRule *rule, const char *source);
-
-struct _part_set_map {
- char *name;
- int type;
- RCPartFunc append;
- RCNextPartFunc next;
-};
-
-struct _rule_set_map {
- char *name;
- int type;
- RCRuleFunc append;
- RCNextRuleFunc next;
-};
-
-guint rule_context_get_type (void);
-RuleContext *rule_context_new (void);
-
-/* methods */
-int rule_context_load(RuleContext *f, const char *system, const char *user);
-int rule_context_save(RuleContext *f, const char *user);
-
-void rule_context_add_part(RuleContext *f, FilterPart *new);
-FilterPart *rule_context_find_part(RuleContext *f, const char *name);
-FilterPart *rule_context_create_part(RuleContext *f, const char *name);
-FilterPart *rule_context_next_part(RuleContext *f, FilterPart *last);
-
-FilterRule *rule_context_next_rule(RuleContext *f, FilterRule *last, const char *source);
-FilterRule *rule_context_find_rule(RuleContext *f, const char *name, const char *source);
-void rule_context_add_rule(RuleContext *f, FilterRule *new);
-void rule_context_add_rule_gui(RuleContext *f, FilterRule *rule, const char *title, const char *path);
-void rule_context_remove_rule(RuleContext *f, FilterRule *rule);
-
-/* get/set the rank (position) of a rule */
-void rule_context_rank_rule(RuleContext *f, FilterRule *rule, int rank);
-int rule_context_get_rank_rule(RuleContext *f, FilterRule *rule, const char *source);
-
-/* setup type for set parts */
-void rule_context_add_part_set(RuleContext *f, const char *setname, int part_type, RCPartFunc append, RCNextPartFunc next);
-void rule_context_add_rule_set(RuleContext *f, const char *setname, int rule_type, RCRuleFunc append, RCNextRuleFunc next);
-
-#endif /* ! _RULE_CONTEXT_H */
-
diff --git a/filter/rule-editor.c b/filter/rule-editor.c
deleted file mode 100644
index 5a6718660d..0000000000
--- a/filter/rule-editor.c
+++ /dev/null
@@ -1,491 +0,0 @@
-/*
- * Copyright (C) 2000 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- * Jeffrey Stedfast <fejj@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <config.h>
-
-#include <glib.h>
-#include <gtk/gtkframe.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-stock.h>
-#include <glade/glade.h>
-
-#include <gal/widgets/e-unicode.h>
-#include "rule-editor.h"
-#include "rule-context.h"
-#include "filter-rule.h"
-
-#define d(x)
-
-static void set_source(RuleEditor *re, const char *source);
-static void set_sensitive(RuleEditor *re);
-static FilterRule *create_rule(RuleEditor *re);
-
-static void rule_editor_class_init(RuleEditorClass *class);
-static void rule_editor_init(RuleEditor *gspaper);
-static void rule_editor_finalise(GtkObject *obj);
-
-#define _PRIVATE(x)(((RuleEditor *)(x))->priv)
-
-enum {
- BUTTON_ADD,
- BUTTON_EDIT,
- BUTTON_DELETE,
- BUTTON_UP,
- BUTTON_DOWN,
- BUTTON_LAST
-};
-
-struct _RuleEditorPrivate {
- GtkButton *buttons[BUTTON_LAST];
-};
-
-static GnomeDialogClass *parent_class;
-
-enum {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-guint
-rule_editor_get_type(void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "RuleEditor",
- sizeof (RuleEditor),
- sizeof (RuleEditorClass),
- (GtkClassInitFunc) rule_editor_class_init,
- (GtkObjectInitFunc) rule_editor_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- type = gtk_type_unique (gnome_dialog_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-rule_editor_class_init (RuleEditorClass *class)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass *)class;
- parent_class = gtk_type_class(gnome_dialog_get_type());
-
- object_class->finalize = rule_editor_finalise;
-
- /* override methods */
- class->set_source = set_source;
- class->set_sensitive = set_sensitive;
- class->create_rule = create_rule;
-
- /* signals */
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-rule_editor_init (RuleEditor *o)
-{
- o->priv = g_malloc0 (sizeof (*o->priv));
-}
-
-static void
-rule_editor_finalise (GtkObject *obj)
-{
- RuleEditor *o = (RuleEditor *)obj;
-
- gtk_object_unref (GTK_OBJECT (o->context));
-
- g_free (o->priv);
-
- ((GtkObjectClass *)(parent_class))->finalize (obj);
-}
-
-/**
- * rule_editor_new:
- *
- * Create a new RuleEditor object.
- *
- * Return value: A new #RuleEditor object.
- **/
-RuleEditor *
-rule_editor_new (RuleContext *f, const char *source)
-{
- GladeXML *gui;
- RuleEditor *o = (RuleEditor *)gtk_type_new (rule_editor_get_type ());
- GtkWidget *w;
-
- gui = glade_xml_new (FILTER_GLADEDIR "/filter.glade", "rule_editor");
- rule_editor_construct (o, f, gui, source);
-
- w = glade_xml_get_widget (gui, "rule_frame");
- gtk_frame_set_label ((GtkFrame *)w, _("Rules"));
-
- gtk_object_unref (GTK_OBJECT (gui));
-
- return o;
-}
-
-/* used internally by implementations if required */
-void
-rule_editor_set_sensitive (RuleEditor *re)
-{
- return ((RuleEditorClass *)((GtkObject *)re)->klass)->set_sensitive(re);
-}
-
-/* used internally by implementations */
-void
-rule_editor_set_source (RuleEditor *re, const char *source)
-{
- return ((RuleEditorClass *)((GtkObject *)re)->klass)->set_source(re, source);
-}
-
-/* factory method for "add" button */
-FilterRule *
-rule_editor_create_rule (RuleEditor *re)
-{
- return ((RuleEditorClass *)((GtkObject *)re)->klass)->create_rule(re);
-}
-
-static FilterRule *
-create_rule (RuleEditor *re)
-{
- FilterRule *rule = filter_rule_new ();
- FilterPart *part;
-
- /* create a rule with 1 part in it */
- part = rule_context_next_part (re->context, NULL);
- filter_rule_add_part (rule, filter_part_clone (part));
-
- return rule;
-}
-
-static void
-add_editor_clicked (GtkWidget *dialog, int button, RuleEditor *re)
-{
- GtkWidget *item;
- GList *l = NULL;
- char *string;
-
- switch (button) {
- case 0:
- if (!filter_rule_validate (re->edit)) {
- /* no need to popup a dialog because the validate code does that. */
- return;
- }
-
- gtk_object_ref (GTK_OBJECT (re->edit));
- string = e_utf8_to_gtk_string (GTK_WIDGET (re->list), re->edit->name);
- item = gtk_list_item_new_with_label (string);
- g_free (string);
-
- gtk_object_set_data (GTK_OBJECT (item), "rule", re->edit);
- gtk_widget_show (item);
-
- l = g_list_append (l, GTK_LIST_ITEM (item));
-
- gtk_list_append_items (re->list, l);
- gtk_list_select_child (re->list, item);
-
- re->current = re->edit;
- rule_context_add_rule (re->context, re->current);
- case 1:
- default:
- gnome_dialog_close (GNOME_DIALOG (dialog));
- case -1:
- gtk_object_unref (GTK_OBJECT (re->edit));
- re->edit = NULL;
-
- rule_editor_set_sensitive (re);
- }
-}
-
-static void
-rule_add (GtkWidget *widget, RuleEditor *re)
-{
- GtkWidget *dialog;
- GtkWidget *rules;
-
- d(printf ("add rule\n"));
-
- re->edit = rule_editor_create_rule (re);
- filter_rule_set_source (re->edit, re->source);
- rules = filter_rule_get_widget (re->edit, re->context);
-
- dialog = gnome_dialog_new (_("Add Rule"),
- GNOME_STOCK_BUTTON_OK,
- GNOME_STOCK_BUTTON_CANCEL,
- NULL);
-
- gtk_window_set_default_size (GTK_WINDOW (dialog), 600, 400);
- gtk_window_set_policy (GTK_WINDOW (dialog), FALSE, TRUE, FALSE);
- gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
- gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), rules, TRUE, TRUE, 0);
- gtk_signal_connect (GTK_OBJECT (dialog), "clicked", add_editor_clicked, re);
-
- gtk_widget_show (dialog);
-}
-
-static void
-edit_editor_clicked (GtkWidget *dialog, int button, RuleEditor *re)
-{
- GtkWidget *item;
- char *string;
- int pos;
-
- switch (button) {
- case 0:
- if (!filter_rule_validate (re->edit)) {
- /* no need to popup a dialog because the validate code does that. */
- return;
- }
-
- pos = rule_context_get_rank_rule (re->context, re->current, re->source);
- if (pos != -1) {
- item = g_list_nth_data (((GtkList *)re->list)->children, pos);
- string = e_utf8_to_gtk_string (GTK_WIDGET (item), re->current->name);
- gtk_label_set_text (GTK_LABEL (GTK_BIN (item)->child), string);
- g_free (string);
- }
- case 1:
- default:
- gnome_dialog_close (GNOME_DIALOG (dialog));
- case -1:
- gtk_object_unref (GTK_OBJECT (re->edit));
- re->edit = NULL;
-
- rule_editor_set_sensitive (re);
- }
-}
-
-static void
-rule_edit (GtkWidget *widget, RuleEditor *re)
-{
- GtkWidget *dialog;
- GtkWidget *rules;
-
- if (re->current == NULL)
- return;
-
- re->edit = re->current;
- gtk_object_ref (GTK_OBJECT (re->edit));
-
- rules = filter_rule_get_widget (re->current, re->context);
- dialog = gnome_dialog_new (_("Edit Rule"),
- GNOME_STOCK_BUTTON_OK,
- GNOME_STOCK_BUTTON_CANCEL,
- NULL);
-
- gtk_window_set_default_size (GTK_WINDOW (dialog), 600, 400);
- gtk_window_set_policy (GTK_WINDOW (dialog), FALSE, TRUE, FALSE);
- gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
- gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), rules, TRUE, TRUE, 0);
- gtk_signal_connect (GTK_OBJECT (dialog), "clicked", edit_editor_clicked, re);
-
- gtk_widget_show (dialog);
-}
-
-static void
-rule_delete (GtkWidget *widget, RuleEditor *re)
-{
- int pos;
- GList *l;
- GtkListItem *item;
-
- d(printf ("delete rule\n"));
- pos = rule_context_get_rank_rule (re->context, re->current, re->source);
- if (pos != -1) {
- gint len;
-
- rule_context_remove_rule (re->context, re->current);
-
- item = g_list_nth_data (GTK_LIST (re->list)->children, pos);
- l = g_list_append (NULL, item);
- gtk_list_remove_items (re->list, l);
- g_list_free (l);
-
- gtk_object_unref (GTK_OBJECT (re->current));
- re->current = NULL;
-
- /* now select the next rule */
- len = g_list_length (GTK_LIST (re->list)->children);
- pos = pos >= len ? len - 1 : pos;
- gtk_list_select_item (GTK_LIST (re->list), pos);
- }
-
- rule_editor_set_sensitive (re);
-}
-
-static void
-rule_move (RuleEditor *re, int from, int to)
-{
- GList *l;
- GtkListItem *item;
-
- d(printf ("moving %d to %d\n", from, to));
- rule_context_rank_rule (re->context, re->current, to);
-
- item = g_list_nth_data (re->list->children, from);
- l = g_list_append (NULL, item);
- gtk_list_remove_items_no_unref (re->list, l);
- gtk_list_insert_items (re->list, l, to);
- gtk_list_select_child (re->list, GTK_WIDGET (item));
-
- rule_editor_set_sensitive (re);
-}
-
-static void
-rule_up (GtkWidget *widget, RuleEditor *re)
-{
- int pos;
-
- d(printf ("up rule\n"));
- pos = rule_context_get_rank_rule (re->context, re->current, re->source);
- if (pos > 0)
- rule_move (re, pos, pos - 1);
-}
-
-static void
-rule_down (GtkWidget *widget, RuleEditor *re)
-{
- int pos;
-
- d(printf ("down rule\n"));
- pos = rule_context_get_rank_rule (re->context, re->current, re->source);
- if (pos >= 0)
- rule_move (re, pos, pos + 1);
-}
-
-static struct {
- char *name;
- GtkSignalFunc func;
-} edit_buttons[] = {
- { "rule_add", rule_add },
- { "rule_edit", rule_edit },
- { "rule_delete", rule_delete },
- { "rule_up", rule_up },
- { "rule_down", rule_down },
-};
-
-static void
-set_sensitive (RuleEditor *re)
-{
- FilterRule *rule = NULL;
- int index = -1, count = 0;
-
- while ((rule = rule_context_next_rule(re->context, rule, re->source))) {
- if (rule == re->current)
- index = count;
- count++;
- }
-
- d(printf("index = %d count=%d\n", index, count));
-
- count--;
-
- gtk_widget_set_sensitive (GTK_WIDGET (re->priv->buttons[BUTTON_EDIT]), index != -1);
- gtk_widget_set_sensitive (GTK_WIDGET (re->priv->buttons[BUTTON_DELETE]), index != -1);
- gtk_widget_set_sensitive (GTK_WIDGET (re->priv->buttons[BUTTON_UP]), index > 0);
- gtk_widget_set_sensitive (GTK_WIDGET (re->priv->buttons[BUTTON_DOWN]), index >= 0 && index < count);
-}
-
-
-static void
-select_rule (GtkWidget *w, GtkWidget *child, RuleEditor *re)
-{
- re->current = gtk_object_get_data (GTK_OBJECT (child), "rule");
-
- g_assert (re->current);
-
- rule_editor_set_sensitive (re);
-}
-
-static void
-double_click (GtkWidget *widget, GdkEventButton *event, RuleEditor *re)
-{
- if (re->current && event->type == GDK_2BUTTON_PRESS)
- rule_edit (widget, re);
-}
-
-static void
-set_source (RuleEditor *re, const char *source)
-{
- FilterRule *rule = NULL;
- GList *newitems = NULL;
-
- gtk_list_clear_items(GTK_LIST(re->list), 0, -1);
-
- d(printf("Checking for rules that are of type %s\n", source));
- while ((rule = rule_context_next_rule(re->context, rule, source)) != NULL) {
- GtkWidget *item;
- char *s;
-
- d(printf(" hit %s(%d)\n", rule->name, source));
- s = e_utf8_to_gtk_string (GTK_WIDGET (re->list), rule->name);
- item = gtk_list_item_new_with_label (s);
- g_free (s);
- gtk_object_set_data (GTK_OBJECT (item), "rule", rule);
- gtk_widget_show (GTK_WIDGET (item));
- newitems = g_list_append (newitems, item);
- }
-
- gtk_list_append_items (re->list, newitems);
- g_free (re->source);
- re->source = g_strdup (source);
- re->current = NULL;
- rule_editor_set_sensitive (re);
-}
-
-void
-rule_editor_construct (RuleEditor *re, RuleContext *context, GladeXML *gui, const char *source)
-{
- GtkWidget *w;
- int i;
-
- re->context = context;
- gtk_object_ref (GTK_OBJECT (context));
-
- gtk_window_set_policy (GTK_WINDOW (re), FALSE, TRUE, FALSE);
-
- w = glade_xml_get_widget (gui, "rule_editor");
- gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (re)->vbox), w, TRUE, TRUE, 0);
-
- for (i = 0; i < BUTTON_LAST; i++) {
- re->priv->buttons[i] = (GtkButton *)w = glade_xml_get_widget (gui, edit_buttons[i].name);
- gtk_signal_connect (GTK_OBJECT (w), "clicked", edit_buttons[i].func, re);
- }
-
- re->list = (GtkList *) w = glade_xml_get_widget(gui, "rule_list");
- gtk_signal_connect (GTK_OBJECT (w), "select_child", select_rule, re);
- gtk_signal_connect (GTK_OBJECT (w), "button_press_event", double_click, re);
-
- rule_editor_set_source (re, source);
-
- gnome_dialog_append_buttons (GNOME_DIALOG (re), GNOME_STOCK_BUTTON_OK,
- GNOME_STOCK_BUTTON_CANCEL, NULL);
-}
diff --git a/filter/rule-editor.h b/filter/rule-editor.h
deleted file mode 100644
index 2a474725b5..0000000000
--- a/filter/rule-editor.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2000 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef _RULE_EDITOR_H
-#define _RULE_EDITOR_H
-
-#include <gtk/gtklist.h>
-#include <libgnomeui/gnome-dialog.h>
-
-#define RULE_EDITOR(obj) GTK_CHECK_CAST (obj, rule_editor_get_type (), RuleEditor)
-#define RULE_EDITOR_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, rule_editor_get_type (), RuleEditorClass)
-#define IS_RULE_EDITOR(obj) GTK_CHECK_TYPE (obj, rule_editor_get_type ())
-
-typedef struct _RuleEditor RuleEditor;
-typedef struct _RuleEditorClass RuleEditorClass;
-
-struct _RuleEditor {
- GnomeDialog parent;
-
- GtkList *list;
- struct _RuleContext *context;
- struct _FilterRule *current;
- struct _FilterRule *edit; /* for editing/adding rules, so we only do 1 at a time */
-
- char *source;
-
- struct _RuleEditorPrivate *priv;
-};
-
-struct _RuleEditorClass {
- GnomeDialogClass parent_class;
-
- /* virtual methods */
- void (*set_sensitive)(RuleEditor *);
- void (*set_source)(RuleEditor *, const char *source);
-
- struct _FilterRule *(*create_rule)(RuleEditor *);
-
- /* signals */
-};
-
-struct _GladeXML;
-struct _RuleContext;
-
-guint rule_editor_get_type (void);
-RuleEditor *rule_editor_new (struct _RuleContext *, const char *source);
-void rule_editor_construct (RuleEditor *re, struct _RuleContext *context, struct _GladeXML *gui, const char *source);
-
-/* methods */
-void rule_editor_set_source(RuleEditor *re, const char *source);
-/* calculates the sensitivity of the editor */
-void rule_editor_set_sensitive(RuleEditor *re);
-/* used internally to create a new rule appropriate for the editor */
-struct _FilterRule *rule_editor_create_rule(RuleEditor *re);
-
-#endif /* ! _RULE_EDITOR_H */
-
diff --git a/filter/score-context.c b/filter/score-context.c
deleted file mode 100644
index 9b9bbfb410..0000000000
--- a/filter/score-context.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2000 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gtk/gtkobject.h>
-
-#include "score-context.h"
-#include "score-rule.h"
-
-
-static void score_context_class_init (ScoreContextClass *class);
-static void score_context_init (ScoreContext *gspaper);
-static void score_context_finalise (GtkObject *obj);
-
-static RuleContextClass *parent_class;
-
-guint
-score_context_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "ScoreContext",
- sizeof(ScoreContext),
- sizeof(ScoreContextClass),
- (GtkClassInitFunc)score_context_class_init,
- (GtkObjectInitFunc)score_context_init,
- (GtkArgSetFunc)NULL,
- (GtkArgGetFunc)NULL
- };
-
- type = gtk_type_unique(rule_context_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-score_context_class_init (ScoreContextClass *class)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass *)class;
- parent_class = gtk_type_class(rule_context_get_type ());
-
- object_class->finalize = score_context_finalise;
- /* override methods */
-
-}
-
-static void
-score_context_init (ScoreContext *o)
-{
- rule_context_add_part_set((RuleContext *)o, "partset", filter_part_get_type(),
- rule_context_add_part, rule_context_next_part);
-
- rule_context_add_rule_set((RuleContext *)o, "ruleset", score_rule_get_type(),
- rule_context_add_rule, rule_context_next_rule);
-}
-
-static void
-score_context_finalise(GtkObject *obj)
-{
- ScoreContext *o = (ScoreContext *)obj;
-
- o = o;
-
- ((GtkObjectClass *)(parent_class))->finalize(obj);
-}
-
-/**
- * score_context_new:
- *
- * Create a new ScoreContext object.
- *
- * Return value: A new #ScoreContext object.
- **/
-ScoreContext *
-score_context_new(void)
-{
- ScoreContext *o = (ScoreContext *)gtk_type_new(score_context_get_type ());
- return o;
-}
diff --git a/filter/score-context.h b/filter/score-context.h
deleted file mode 100644
index 261a1d8c4c..0000000000
--- a/filter/score-context.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2000 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef _SCORE_CONTEXT_H
-#define _SCORE_CONTEXT_H
-
-#include "rule-context.h"
-
-#define SCORE_CONTEXT(obj) GTK_CHECK_CAST (obj, score_context_get_type (), ScoreContext)
-#define SCORE_CONTEXT_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, score_context_get_type (), ScoreContextClass)
-#define IS_SCORE_CONTEXT(obj) GTK_CHECK_TYPE (obj, score_context_get_type ())
-
-typedef struct _ScoreContext ScoreContext;
-typedef struct _ScoreContextClass ScoreContextClass;
-
-struct _ScoreContext {
- RuleContext parent;
-};
-
-struct _ScoreContextClass {
- RuleContextClass parent_class;
-
- /* virtual methods */
-
- /* signals */
-};
-
-guint score_context_get_type (void);
-ScoreContext *score_context_new (void);
-
-/* methods */
-
-#endif /* ! _SCORE_CONTEXT_H */
-
diff --git a/filter/score-editor.c b/filter/score-editor.c
deleted file mode 100644
index 956e33816f..0000000000
--- a/filter/score-editor.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Copyright (C) 2001 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- * Jeffrey Stedfast <fejj@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <config.h>
-
-#include <glib.h>
-#include <gtk/gtkframe.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-i18n.h>
-#include <glade/glade.h>
-#include <gal/widgets/e-unicode.h>
-
-#include "score-editor.h"
-#include "score-context.h"
-#include "score-rule.h"
-
-#define d(x)
-
-static FilterRule * create_rule(RuleEditor *re);
-
-static void score_editor_class_init (ScoreEditorClass *class);
-static void score_editor_init (ScoreEditor *gspaper);
-static void score_editor_finalise (GtkObject *obj);
-
-#define _PRIVATE(x) (((ScoreEditor *)(x))->priv)
-
-struct _ScoreEditorPrivate {
-};
-
-static RuleEditorClass *parent_class;
-
-enum {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-guint
-score_editor_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "ScoreEditor",
- sizeof(ScoreEditor),
- sizeof(ScoreEditorClass),
- (GtkClassInitFunc)score_editor_class_init,
- (GtkObjectInitFunc)score_editor_init,
- (GtkArgSetFunc)NULL,
- (GtkArgGetFunc)NULL
- };
-
- type = gtk_type_unique (rule_editor_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-score_editor_class_init (ScoreEditorClass *class)
-{
- GtkObjectClass *object_class = (GtkObjectClass *)class;
- RuleEditorClass *re_class = (RuleEditorClass *)class;
-
- parent_class = gtk_type_class (rule_editor_get_type ());
-
- object_class->finalize = score_editor_finalise;
-
- /* override methods */
- re_class->create_rule = create_rule;
-
- /* signals */
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-score_editor_init (ScoreEditor *o)
-{
- o->priv = g_malloc0 (sizeof (*o->priv));
-}
-
-static void
-score_editor_finalise(GtkObject *obj)
-{
- ScoreEditor *o = (ScoreEditor *)obj;
-
- g_free(o->priv);
-
- ((GtkObjectClass *)(parent_class))->finalize(obj);
-}
-
-/**
- * score_editor_new:
- *
- * Create a new ScoreEditor object.
- *
- * Return value: A new #ScoreEditor object.
- **/
-ScoreEditor *
-score_editor_new(ScoreContext *f)
-{
- GladeXML *gui;
- ScoreEditor *o = (ScoreEditor *)gtk_type_new (score_editor_get_type ());
- GtkWidget *w;
-
- gui = glade_xml_new(FILTER_GLADEDIR "/filter.glade", "rule_editor");
- rule_editor_construct((RuleEditor *)o, (RuleContext *)f, gui, NULL);
-
- w = glade_xml_get_widget(gui, "rule_frame");
- gtk_frame_set_label((GtkFrame *)w, _("Score Rules"));
-
- gtk_object_unref((GtkObject *)gui);
-
- return o;
-}
-
-static FilterRule *
-create_rule(RuleEditor *re)
-{
- FilterRule *rule = filter_rule_new();
- FilterPart *part;
-
- /* create a rule with 1 part in it */
- rule = (FilterRule *)score_rule_new ();
- part = rule_context_next_part(re->context, NULL);
- filter_rule_add_part(rule, filter_part_clone(part));
-
- return rule;
-}
diff --git a/filter/score-editor.h b/filter/score-editor.h
deleted file mode 100644
index ad1a5ad2d7..0000000000
--- a/filter/score-editor.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2000 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef _SCORE_EDITOR_H
-#define _SCORE_EDITOR_H
-
-#include "rule-editor.h"
-
-#define SCORE_EDITOR(obj) GTK_CHECK_CAST (obj, score_editor_get_type (), ScoreEditor)
-#define SCORE_EDITOR_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, score_editor_get_type (), ScoreEditorClass)
-#define IS_SCORE_EDITOR(obj) GTK_CHECK_TYPE (obj, score_editor_get_type ())
-
-typedef struct _ScoreEditor ScoreEditor;
-typedef struct _ScoreEditorClass ScoreEditorClass;
-
-struct _ScoreEditor {
- RuleEditor parent;
-
- struct _ScoreEditorPrivate *priv;
-};
-
-struct _ScoreEditorClass {
- RuleEditorClass parent_class;
-
- /* virtual methods */
-
- /* signals */
-};
-
-struct _ScoreContext;
-
-guint score_editor_get_type (void);
-ScoreEditor *score_editor_new (struct _ScoreContext *f);
-
-#endif /* ! _SCORE_EDITOR_H */
-
diff --git a/filter/score-rule.c b/filter/score-rule.c
deleted file mode 100644
index 9eaefe6134..0000000000
--- a/filter/score-rule.c
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * Copyright (C) 2000 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- * Jeffrey Stedfast <fejj@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <config.h>
-
-#include <string.h>
-
-#include <glib.h>
-#include <gtk/gtkbox.h>
-#include <gtk/gtkframe.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtkspinbutton.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-i18n.h>
-
-#include "score-rule.h"
-
-static xmlNodePtr xml_encode(FilterRule *);
-static int xml_decode(FilterRule *, xmlNodePtr, struct _RuleContext *f);
-/*static void build_code(FilterRule *, GString *out);*/
-static GtkWidget *get_widget(FilterRule *fr, struct _RuleContext *f);
-
-static void score_rule_class_init (ScoreRuleClass *class);
-static void score_rule_init (ScoreRule *gspaper);
-static void score_rule_finalise (GtkObject *obj);
-
-#define _PRIVATE(x) (((ScoreRule *)(x))->priv)
-
-struct _ScoreRulePrivate {
-};
-
-static FilterRuleClass *parent_class;
-
-enum {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-guint
-score_rule_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "ScoreRule",
- sizeof(ScoreRule),
- sizeof(ScoreRuleClass),
- (GtkClassInitFunc)score_rule_class_init,
- (GtkObjectInitFunc)score_rule_init,
- (GtkArgSetFunc)NULL,
- (GtkArgGetFunc)NULL
- };
-
- type = gtk_type_unique (filter_rule_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-score_rule_class_init (ScoreRuleClass *class)
-{
- GtkObjectClass *object_class;
- FilterRuleClass *rule_class = (FilterRuleClass *)class;
-
- object_class = (GtkObjectClass *)class;
- parent_class = gtk_type_class (filter_rule_get_type ());
-
- object_class->finalize = score_rule_finalise;
-
- /* override methods */
- rule_class->xml_encode = xml_encode;
- rule_class->xml_decode = xml_decode;
-/* rule_class->build_code = build_code;*/
- rule_class->get_widget = get_widget;
-
- /* signals */
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-score_rule_init (ScoreRule *o)
-{
- o->priv = g_malloc0 (sizeof (*o->priv));
-}
-
-static void
-score_rule_finalise (GtkObject *obj)
-{
- ScoreRule *o = (ScoreRule *)obj;
-
- o = o;
-
- ((GtkObjectClass *)(parent_class))->finalize (obj);
-}
-
-/**
- * score_rule_new:
- *
- * Create a new ScoreRule object.
- *
- * Return value: A new #ScoreRule object.
- **/
-ScoreRule *
-score_rule_new (void)
-{
- ScoreRule *o = (ScoreRule *)gtk_type_new (score_rule_get_type ());
- return o;
-}
-
-static xmlNodePtr
-xml_encode (FilterRule *fr)
-{
- ScoreRule *sr = (ScoreRule *)fr;
- xmlNodePtr node, value;
- char number[16];
-
- node = ((FilterRuleClass *)(parent_class))->xml_encode (fr);
- sprintf (number, "%d", sr->score);
- value = xmlNewNode (NULL, "score");
- xmlSetProp (value, "value", number);
- xmlAddChild (node, value);
-
- return node;
-}
-
-static int
-xml_decode (FilterRule *fr, xmlNodePtr node, struct _RuleContext *f)
-{
- ScoreRule *sr = (ScoreRule *)fr;
- xmlNodePtr value;
- int result;
- char *str;
-
- result = ((FilterRuleClass *)(parent_class))->xml_decode (fr, node, f);
- if (result != 0)
- return result;
-
- value = node->childs;
- while (value) {
- if (!strcmp (value->name, "score")) {
- str = xmlGetProp (value, "value");
- sscanf (str, "%d", &sr->score);
- xmlFree (str);
-
- /* score range is -3 to +3 */
- if (sr->score > 3)
- sr->score = 3;
- else if (sr->score < -3)
- sr->score = -3;
- }
- value = value->next;
- }
-
- return 0;
-}
-
-/*static void build_code(FilterRule *fr, GString *out)
-{
-}*/
-
-static void
-spin_changed (GtkAdjustment *adj, ScoreRule *sr)
-{
- sr->score = adj->value;
-}
-
-static GtkWidget *
-get_widget (FilterRule *fr, struct _RuleContext *f)
-{
- GtkWidget *widget;
- GtkWidget *frame;
- GtkWidget *label;
- GtkWidget *hbox;
- GtkAdjustment *adj;
- ScoreRule *sr = (ScoreRule *)fr;
- GtkWidget *spin;
-
- widget = ((FilterRuleClass *)(parent_class))->get_widget (fr, f);
-
- frame = gtk_frame_new (_("Score"));
- hbox = gtk_hbox_new (FALSE, 3);
- label = gtk_label_new (_("Score"));
-
- gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 3);
- adj = (GtkAdjustment *)gtk_adjustment_new ((float) sr->score, -3.0, 3.0, 1.0, 1.0, 1.0);
- gtk_signal_connect (GTK_OBJECT (adj), "value_changed", spin_changed, sr);
-
- spin = gtk_spin_button_new (adj, 1.0, 0);
- gtk_box_pack_start (GTK_BOX (hbox), spin, FALSE, FALSE, 3);
- gtk_container_add (GTK_CONTAINER (frame), hbox);
-
- gtk_widget_show_all (frame);
-
- gtk_box_pack_start (GTK_BOX (widget), frame, FALSE, FALSE, 3);
-
- return widget;
-}
diff --git a/filter/score-rule.h b/filter/score-rule.h
deleted file mode 100644
index 1ac9eb71f3..0000000000
--- a/filter/score-rule.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2000 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef _SCORE_RULE_H
-#define _SCORE_RULE_H
-
-#include "filter-rule.h"
-
-#define SCORE_RULE(obj) GTK_CHECK_CAST (obj, score_rule_get_type (), ScoreRule)
-#define SCORE_RULE_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, score_rule_get_type (), ScoreRuleClass)
-#define IS_SCORE_RULE(obj) GTK_CHECK_TYPE (obj, score_rule_get_type ())
-
-typedef struct _ScoreRule ScoreRule;
-typedef struct _ScoreRuleClass ScoreRuleClass;
-
-struct _ScoreRule {
- FilterRule parent;
- struct _ScoreRulePrivate *priv;
-
- int score;
-};
-
-struct _ScoreRuleClass {
- FilterRuleClass parent_class;
-
- /* virtual methods */
-
- /* signals */
-};
-
-guint score_rule_get_type (void);
-ScoreRule *score_rule_new (void);
-
-/* methods */
-
-#endif /* ! _SCORE_RULE_H */
-
diff --git a/filter/vfolder-context.c b/filter/vfolder-context.c
deleted file mode 100644
index 3a05aa6c6e..0000000000
--- a/filter/vfolder-context.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright (C) 2000 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gtk/gtkobject.h>
-
-#include "vfolder-context.h"
-#include "vfolder-rule.h"
-
-static void vfolder_context_class_init (VfolderContextClass *class);
-static void vfolder_context_init (VfolderContext *gspaper);
-static void vfolder_context_finalise (GtkObject *obj);
-
-#define _PRIVATE(x) (((VfolderContext *)(x))->priv)
-
-struct _VfolderContextPrivate {
-};
-
-static RuleContextClass *parent_class;
-
-enum {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-guint
-vfolder_context_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "VfolderContext",
- sizeof(VfolderContext),
- sizeof(VfolderContextClass),
- (GtkClassInitFunc)vfolder_context_class_init,
- (GtkObjectInitFunc)vfolder_context_init,
- (GtkArgSetFunc)NULL,
- (GtkArgGetFunc)NULL
- };
-
- type = gtk_type_unique(rule_context_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-vfolder_context_class_init (VfolderContextClass *class)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass *)class;
- parent_class = gtk_type_class(rule_context_get_type ());
-
- object_class->finalize = vfolder_context_finalise;
- /* override methods */
-
- /* signals */
-
- gtk_object_class_add_signals(object_class, signals, LAST_SIGNAL);
-}
-
-static void
-vfolder_context_init (VfolderContext *o)
-{
- o->priv = g_malloc0(sizeof(*o->priv));
-
- rule_context_add_part_set((RuleContext *)o, "partset", filter_part_get_type(),
- rule_context_add_part, rule_context_next_part);
-
- rule_context_add_rule_set((RuleContext *)o, "ruleset", vfolder_rule_get_type(),
- rule_context_add_rule, rule_context_next_rule);
-}
-
-static void
-vfolder_context_finalise(GtkObject *obj)
-{
- VfolderContext *o = (VfolderContext *)obj;
-
- o = o;
-
- ((GtkObjectClass *)(parent_class))->finalize(obj);
-}
-
-/**
- * vfolder_context_new:
- *
- * Create a new VfolderContext object.
- *
- * Return value: A new #VfolderContext object.
- **/
-VfolderContext *
-vfolder_context_new(void)
-{
- VfolderContext *o = (VfolderContext *)gtk_type_new(vfolder_context_get_type ());
- return o;
-}
diff --git a/filter/vfolder-context.h b/filter/vfolder-context.h
deleted file mode 100644
index 86f9910437..0000000000
--- a/filter/vfolder-context.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2000 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef _VFOLDER_CONTEXT_H
-#define _VFOLDER_CONTEXT_H
-
-#include "rule-context.h"
-
-#define VFOLDER_CONTEXT(obj) GTK_CHECK_CAST (obj, vfolder_context_get_type (), VfolderContext)
-#define VFOLDER_CONTEXT_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, vfolder_context_get_type (), VfolderContextClass)
-#define IS_VFOLDER_CONTEXT(obj) GTK_CHECK_TYPE (obj, vfolder_context_get_type ())
-
-typedef struct _VfolderContext VfolderContext;
-typedef struct _VfolderContextClass VfolderContextClass;
-
-struct _VfolderContext {
- RuleContext parent;
- struct _VfolderContextPrivate *priv;
-
-};
-
-struct _VfolderContextClass {
- RuleContextClass parent_class;
-
- /* virtual methods */
-
- /* signals */
-};
-
-guint vfolder_context_get_type (void);
-VfolderContext *vfolder_context_new (void);
-
-/* methods */
-
-#endif /* ! _VFOLDER_CONTEXT_H */
-
diff --git a/filter/vfolder-editor.c b/filter/vfolder-editor.c
deleted file mode 100644
index a2566e344a..0000000000
--- a/filter/vfolder-editor.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Copyright (C) 2001 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- * Jeffrey Stedfast <fejj@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <config.h>
-
-#include <glib.h>
-#include <gtk/gtkframe.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-i18n.h>
-#include <glade/glade.h>
-#include <gal/widgets/e-unicode.h>
-
-#include "vfolder-editor.h"
-#include "vfolder-context.h"
-#include "vfolder-rule.h"
-
-#define d(x)
-
-static FilterRule * create_rule(RuleEditor *re);
-
-static void vfolder_editor_class_init (VfolderEditorClass *class);
-static void vfolder_editor_init (VfolderEditor *gspaper);
-static void vfolder_editor_finalise (GtkObject *obj);
-
-#define _PRIVATE(x) (((VfolderEditor *)(x))->priv)
-
-struct _VfolderEditorPrivate {
-};
-
-static RuleEditorClass *parent_class;
-
-enum {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-guint
-vfolder_editor_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "VfolderEditor",
- sizeof(VfolderEditor),
- sizeof(VfolderEditorClass),
- (GtkClassInitFunc)vfolder_editor_class_init,
- (GtkObjectInitFunc)vfolder_editor_init,
- (GtkArgSetFunc)NULL,
- (GtkArgGetFunc)NULL
- };
-
- type = gtk_type_unique (rule_editor_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-vfolder_editor_class_init (VfolderEditorClass *class)
-{
- GtkObjectClass *object_class = (GtkObjectClass *)class;
- RuleEditorClass *re_class = (RuleEditorClass *)class;
-
- parent_class = gtk_type_class (rule_editor_get_type ());
-
- object_class->finalize = vfolder_editor_finalise;
-
- /* override methods */
- re_class->create_rule = create_rule;
-
- /* signals */
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-vfolder_editor_init (VfolderEditor *o)
-{
- o->priv = g_malloc0 (sizeof (*o->priv));
-}
-
-static void
-vfolder_editor_finalise(GtkObject *obj)
-{
- VfolderEditor *o = (VfolderEditor *)obj;
-
- g_free(o->priv);
-
- ((GtkObjectClass *)(parent_class))->finalize(obj);
-}
-
-/**
- * vfolder_editor_new:
- *
- * Create a new VfolderEditor object.
- *
- * Return value: A new #VfolderEditor object.
- **/
-VfolderEditor *
-vfolder_editor_new(VfolderContext *f)
-{
- GladeXML *gui;
- VfolderEditor *o = (VfolderEditor *)gtk_type_new (vfolder_editor_get_type ());
- GtkWidget *w;
-
- gui = glade_xml_new(FILTER_GLADEDIR "/filter.glade", "rule_editor");
- rule_editor_construct((RuleEditor *)o, (RuleContext *)f, gui, NULL);
-
- w = glade_xml_get_widget(gui, "rule_frame");
- gtk_frame_set_label((GtkFrame *)w, _("Virtual Folders"));
-
- gtk_object_unref((GtkObject *)gui);
-
- return o;
-}
-
-static FilterRule *
-create_rule(RuleEditor *re)
-{
- FilterRule *rule = filter_rule_new();
- FilterPart *part;
-
- /* create a rule with 1 part in it */
- rule = (FilterRule *)vfolder_rule_new ();
- part = rule_context_next_part(re->context, NULL);
- filter_rule_add_part(rule, filter_part_clone(part));
-
- return rule;
-}
diff --git a/filter/vfolder-editor.h b/filter/vfolder-editor.h
deleted file mode 100644
index f8fe85503f..0000000000
--- a/filter/vfolder-editor.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2000, 2001 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef _VFOLDER_EDITOR_H
-#define _VFOLDER_EDITOR_H
-
-#include "rule-editor.h"
-
-#define VFOLDER_EDITOR(obj) GTK_CHECK_CAST (obj, vfolder_editor_get_type (), VfolderEditor)
-#define VFOLDER_EDITOR_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, vfolder_editor_get_type (), VfolderEditorClass)
-#define IS_VFOLDER_EDITOR(obj) GTK_CHECK_TYPE (obj, vfolder_editor_get_type ())
-
-typedef struct _VfolderEditor VfolderEditor;
-typedef struct _VfolderEditorClass VfolderEditorClass;
-
-struct _VfolderEditor {
- RuleEditor parent;
-
- struct _VfolderEditorPrivate *priv;
-
-};
-
-struct _VfolderEditorClass {
- RuleEditorClass parent_class;
-
- /* virtual methods */
-
- /* signals */
-};
-
-struct _VfolderContext;
-
-guint vfolder_editor_get_type (void);
-VfolderEditor *vfolder_editor_new (struct _VfolderContext *);
-
-#endif /* ! _VFOLDER_EDITOR_H */
-
diff --git a/filter/vfolder-rule.c b/filter/vfolder-rule.c
deleted file mode 100644
index 385a751f89..0000000000
--- a/filter/vfolder-rule.c
+++ /dev/null
@@ -1,446 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Copyright (C) 2000 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <config.h>
-
-#include <glib.h>
-#include <gtk/gtkbox.h>
-#include <gtk/gtklist.h>
-#include <gtk/gtkoptionmenu.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-dialog.h>
-#include <libgnomeui/gnome-dialog-util.h>
-#include <glade/glade.h>
-#include <gal/widgets/e-unicode.h>
-
-#include "vfolder-context.h"
-#include "vfolder-rule.h"
-#include "shell/evolution-shell-client.h"
-
-#define d(x) x
-
-static gint validate(FilterRule *);
-static xmlNodePtr xml_encode(FilterRule *);
-static int xml_decode(FilterRule *, xmlNodePtr, struct _RuleContext *f);
-/*static void build_code(FilterRule *, GString *out);*/
-static GtkWidget *get_widget(FilterRule *fr, struct _RuleContext *f);
-
-extern EvolutionShellClient *global_shell_client;
-
-static void vfolder_rule_class_init (VfolderRuleClass *class);
-static void vfolder_rule_init (VfolderRule *gspaper);
-static void vfolder_rule_finalise (GtkObject *obj);
-
-#define _PRIVATE(x) (((VfolderRule *)(x))->priv)
-
-struct _VfolderRulePrivate {
-};
-
-static FilterRuleClass *parent_class;
-
-guint
-vfolder_rule_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "VfolderRule",
- sizeof(VfolderRule),
- sizeof(VfolderRuleClass),
- (GtkClassInitFunc)vfolder_rule_class_init,
- (GtkObjectInitFunc)vfolder_rule_init,
- (GtkArgSetFunc)NULL,
- (GtkArgGetFunc)NULL
- };
-
- type = gtk_type_unique(filter_rule_get_type (), &type_info);
- }
-
- return type;
-}
-
-static void
-vfolder_rule_class_init (VfolderRuleClass *class)
-{
- GtkObjectClass *object_class;
- FilterRuleClass *filter_rule = (FilterRuleClass *)class;
-
- object_class = (GtkObjectClass *)class;
- parent_class = gtk_type_class(filter_rule_get_type ());
-
- object_class->finalize = vfolder_rule_finalise;
-
- /* override methods */
- filter_rule->validate = validate;
- filter_rule->xml_encode = xml_encode;
- filter_rule->xml_decode = xml_decode;
- /*filter_rule->build_code = build_code;*/
- filter_rule->get_widget = get_widget;
-}
-
-static void
-vfolder_rule_init (VfolderRule *o)
-{
- o->priv = g_malloc0(sizeof(*o->priv));
-}
-
-static void
-vfolder_rule_finalise(GtkObject *obj)
-{
- VfolderRule *o = (VfolderRule *)obj;
- o = o;
- ((GtkObjectClass *)(parent_class))->finalize(obj);
-}
-
-/**
- * vfolder_rule_new:
- *
- * Create a new VfolderRule object.
- *
- * Return value: A new #VfolderRule object.
- **/
-VfolderRule *
-vfolder_rule_new (void)
-{
- VfolderRule *o = (VfolderRule *)gtk_type_new(vfolder_rule_get_type ());
- return o;
-}
-
-void
-vfolder_rule_add_source (VfolderRule *vr, const char *uri)
-{
- g_assert(IS_VFOLDER_RULE(vr));
-
- vr->sources = g_list_append(vr->sources, g_strdup(uri));
-}
-
-const char *
-vfolder_rule_find_source (VfolderRule *vr, const char *uri)
-{
- GList *l;
-
- g_assert(IS_VFOLDER_RULE(vr));
-
- /* only does a simple string or address comparison, should
- probably do a decoded url comparison */
- l = vr->sources;
- while (l) {
- if (l->data == uri || !strcmp(l->data, uri))
- return l->data;
- l = g_list_next(l);
- }
- return NULL;
-}
-
-void
-vfolder_rule_remove_source (VfolderRule *vr, const char *uri)
-{
- char *found;
-
- g_assert(IS_VFOLDER_RULE(vr));
-
- found = (char *)vfolder_rule_find_source(vr, uri);
- if (found) {
- vr->sources = g_list_remove(vr->sources, found);
- g_free(found);
- }
-}
-
-const char *
-vfolder_rule_next_source (VfolderRule *vr, const char *last)
-{
- GList *node;
-
- if (last == NULL) {
- node = vr->sources;
- } else {
- node = g_list_find(vr->sources, (char *)last);
- if (node == NULL)
- node = vr->sources;
- else
- node = g_list_next(node);
- }
- if (node)
- return (const char *)node->data;
- return NULL;
-}
-
-static gint
-validate (FilterRule *fr)
-{
- /* We have to have at least one source set in the "specific" case.
- Do not translate this string! */
- if (fr && fr->source && !strcmp (fr->source, "specific") && VFOLDER_RULE (fr)->sources == NULL) {
-
- GtkWidget *gd;
-
- gd = gnome_ok_dialog (_("Oops. You need to to specify at least one folder as a source."));
- gnome_dialog_run_and_close (GNOME_DIALOG (gd));
-
- return 0;
- }
-
- if (FILTER_RULE_CLASS (parent_class)->validate)
- return FILTER_RULE_CLASS (parent_class)->validate (fr);
-
- return 1;
-}
-
-static xmlNodePtr
-xml_encode (FilterRule *fr)
-{
- xmlNodePtr node, set, work;
- GList *l;
- VfolderRule *vr = (VfolderRule *)fr;
-
- node = ((FilterRuleClass *)(parent_class))->xml_encode(fr);
- g_assert(node != NULL);
- set = xmlNewNode(NULL, "sources");
- xmlAddChild(node, set);
- l = vr->sources;
- while (l) {
- work = xmlNewNode(NULL, "folder");
- xmlSetProp(work, "uri", l->data);
- xmlAddChild(set, work);
- l = g_list_next(l);
- }
- return node;
-}
-
-static int
-xml_decode (FilterRule *fr, xmlNodePtr node, struct _RuleContext *f)
-{
- xmlNodePtr set, work;
- int result;
- VfolderRule *vr = (VfolderRule *)fr;
- char *uri;
-
- result = ((FilterRuleClass *)(parent_class))->xml_decode(fr, node, f);
- if (result != 0)
- return result;
-
- set = node->childs;
- while (set) {
- if (!strcmp(set->name, "sources")) {
- work = set->childs;
- while (work) {
- if (!strcmp(work->name, "folder")) {
- uri = xmlGetProp(work, "uri");
- if (uri)
- vr->sources = g_list_append(vr->sources, uri);
- }
- work = work->next;
- }
- }
- set = set->next;
- }
- return 0;
-}
-
-enum {
- BUTTON_ADD,
- BUTTON_REMOVE,
- BUTTON_LAST,
-};
-
-struct _source_data {
- RuleContext *f;
- VfolderRule *vr;
- const char *current;
- GtkList *list;
- GtkButton *buttons[BUTTON_LAST];
-};
-
-static void source_add(GtkWidget *widget, struct _source_data *data);
-static void source_remove(GtkWidget *widget, struct _source_data *data);
-
-static struct {
- char *name;
- GtkSignalFunc func;
-} edit_buttons[] = {
- { "source_add", source_add },
- { "source_remove", source_remove },
-};
-
-static void
-set_sensitive(struct _source_data *data)
-{
- gtk_widget_set_sensitive((GtkWidget *)data->buttons[BUTTON_ADD], TRUE);
- gtk_widget_set_sensitive((GtkWidget *)data->buttons[BUTTON_REMOVE], data->current != NULL);
-}
-
-static void
-select_source(GtkWidget *w, GtkWidget *child, struct _source_data *data)
-{
- data->current = gtk_object_get_data((GtkObject *)child, "source");
- set_sensitive(data);
-}
-
-static void
-select_source_with(GtkWidget *w, struct _source_data *data)
-{
- char *source = gtk_object_get_data((GtkObject *)w, "source");
-
- filter_rule_set_source((FilterRule *)data->vr, source);
-}
-
-static void
-source_add(GtkWidget *widget, struct _source_data *data)
-{
- const char *allowed_types[] = { "mail", NULL };
- char *def, *uri;
- GtkListItem *item;
- GList *l;
- gchar *s;
-
- def = "";
- evolution_shell_client_user_select_folder (global_shell_client,
- _("Select Folder"),
- def, allowed_types, NULL, &uri);
-
- if (uri != NULL && uri[0] != '\0') {
- data->vr->sources = g_list_append(data->vr->sources, uri);
-
- l = NULL;
- s = e_utf8_to_gtk_string ((GtkWidget *) data->list, uri);
- item = (GtkListItem *)gtk_list_item_new_with_label (s);
- g_free (s);
- gtk_object_set_data((GtkObject *)item, "source", uri);
- gtk_widget_show((GtkWidget *)item);
- l = g_list_append(NULL, item);
- gtk_list_append_items(data->list, l);
- gtk_list_select_child(data->list, (GtkWidget *)item);
- data->current = uri;
- } else {
- g_free(uri);
- }
- set_sensitive(data);
-}
-
-static void
-source_remove(GtkWidget *widget, struct _source_data *data)
-{
- const char *source;
- int index = 0;
- GList *l;
- GtkListItem *item;
-
- source = NULL;
- while ((source = vfolder_rule_next_source(data->vr, source))) {
- if (data->current == source) {
- vfolder_rule_remove_source(data->vr, source);
- item = g_list_nth_data(data->list->children, index);
- l = g_list_append(NULL, item);
- gtk_list_remove_items(data->list, l);
- g_list_free(l);
- data->current = NULL;
- break;
- }
- index++;
- }
- set_sensitive(data);
-}
-
-/* DO NOT internationalise these strings */
-const char *source_names[] = {
- "specific",
- "local",
- "remote_active",
- "local_remote_active"
-};
-
-static GtkWidget *
-get_widget(FilterRule *fr, struct _RuleContext *f)
-{
- GtkWidget *widget, *frame, *w;
- GladeXML *gui;
- const char *source;
- VfolderRule *vr = (VfolderRule *)fr;
- struct _source_data *data;
- int i, row;
- GList *l;
-
- widget = ((FilterRuleClass *)(parent_class))->get_widget(fr, f);
-
- data = g_malloc0(sizeof(*data));
- data->f = f;
- data->vr = vr;
-
- gui = glade_xml_new(FILTER_GLADEDIR "/filter.glade", "vfolder_source_frame");
- frame = glade_xml_get_widget (gui, "vfolder_source_frame");
-
- gtk_object_set_data_full((GtkObject *)frame, "data", data, g_free);
-
- for (i=0;i<BUTTON_LAST;i++) {
- data->buttons[i] = (GtkButton *)w = glade_xml_get_widget (gui, edit_buttons[i].name);
- gtk_signal_connect((GtkObject *)w, "clicked", edit_buttons[i].func, data);
- }
-
- w = glade_xml_get_widget (gui, "source_list");
- data->list = (GtkList *)w;
- l = NULL;
- source = NULL;
- while ((source = vfolder_rule_next_source(vr, source))) {
- GtkListItem *item;
- gchar *s = e_utf8_to_gtk_string ((GtkWidget *) data->list, source);
- item = (GtkListItem *)gtk_list_item_new_with_label (s);
- g_free (s);
- gtk_object_set_data((GtkObject *)item, "source", (void *)source);
- gtk_widget_show((GtkWidget *)item);
- l = g_list_append(l, item);
- }
- gtk_list_append_items(data->list, l);
- gtk_signal_connect((GtkObject *)w, "select_child", select_source, data);
-
- w = glade_xml_get_widget (gui, "source_option");
- l = GTK_MENU_SHELL (GTK_OPTION_MENU (w)->menu)->children;
- i = 0;
- row = 0;
- while (l) {
- GtkWidget *b = GTK_WIDGET (l->data);
-
- /* make sure that the glade is in sync with the source list! */
- if (i < sizeof (source_names) / sizeof (source_names[0])) {
- gtk_object_set_data (GTK_OBJECT (b), "source", (char *)source_names[i]);
- if (fr->source && strcmp(source_names[i], fr->source) == 0) {
- row = i;
- }
- } else {
- g_warning("Glade file " FILTER_GLADEDIR "/filter.glade out of sync with editor code");
- }
- gtk_signal_connect (GTK_OBJECT (b), "activate", select_source_with, data);
-
- i++;
- l = l->next;
- }
-
- gtk_option_menu_set_history(GTK_OPTION_MENU(w), row);
- if (fr->source == NULL)
- filter_rule_set_source (fr, (char *)source_names[row]);
-
- set_sensitive(data);
-
- gtk_box_pack_start(GTK_BOX(widget), frame, TRUE, TRUE, 3);
- return widget;
-}
diff --git a/filter/vfolder-rule.h b/filter/vfolder-rule.h
deleted file mode 100644
index 20dcb6f017..0000000000
--- a/filter/vfolder-rule.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Copyright (C) 2000 Ximian Inc.
- *
- * Authors: Not Zed <notzed@lostzed.mmc.com.au>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef _VFOLDER_RULE_H
-#define _VFOLDER_RULE_H
-
-#include "filter-rule.h"
-
-#define VFOLDER_RULE(obj) GTK_CHECK_CAST (obj, vfolder_rule_get_type (), VfolderRule)
-#define VFOLDER_RULE_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, vfolder_rule_get_type (), VfolderRuleClass)
-#define IS_VFOLDER_RULE(obj) GTK_CHECK_TYPE (obj, vfolder_rule_get_type ())
-
-typedef struct _VfolderRule VfolderRule;
-typedef struct _VfolderRuleClass VfolderRuleClass;
-
-struct _VfolderRule {
- FilterRule parent;
- struct _VfolderRulePrivate *priv;
-
- GList *sources; /* uri's of the source folders */
-};
-
-struct _VfolderRuleClass {
- FilterRuleClass parent_class;
-
- /* virtual methods */
-
- /* signals */
-};
-
-guint vfolder_rule_get_type (void);
-VfolderRule *vfolder_rule_new (void);
-
-/* methods */
-void vfolder_rule_add_source (VfolderRule *vr, const char *uri);
-void vfolder_rule_remove_source (VfolderRule *vr, const char *uri);
-const char *vfolder_rule_find_source (VfolderRule *vr, const char *uri);
-const char *vfolder_rule_next_source (VfolderRule *vr, const char *last);
-
-#endif /* ! _VFOLDER_RULE_H */
-
diff --git a/filter/vfoldertypes.xml b/filter/vfoldertypes.xml
deleted file mode 100644
index 73625ef25c..0000000000
--- a/filter/vfoldertypes.xml
+++ /dev/null
@@ -1,360 +0,0 @@
-<?xml version="1.0"?>
-<filterdescription>
-<partset>
- <part name="sender">
- <title>Sender</title>
- <input type="optionlist" name="sender-type">
- <option value="contains">
- <title>contains</title>
- <code>(match-all (header-contains "From" ${sender}))</code>
- </option>
- <option value="not contains">
- <title>does not contain</title>
- <code>(match-all (not (header-contains "From" ${sender})))</code>
- </option>
- <option value="is">
- <title>is</title>
- <code>(match-all (header-matches "From" ${sender}))</code>
- </option>
- <option value="is not">
- <title>is not</title>
- <code>(match-all (not (header-matches "From" ${sender})))</code>
- </option>
- <option value="starts with">
- <title>starts with</title>
- <code>
- (match-all (header-starts-with "From" ${sender}))
- </code>
- </option>
- <option value="not starts with">
- <title>does not start with</title>
- <code>
- (match-all (not (header-starts-with "From" ${sender})))
- </code>
- </option>
- <option value="ends with">
- <title>ends with</title>
- <code>
- (match-all (header-ends-with "From" ${sender}))
- </code>
- </option>
- <option value="not ends with">
- <title>does not end with</title>
- <code>
- (match-all (not (header-ends-with "From" ${sender})))
- </code>
- </option>
- </input>
- <input type="string" name="sender"/>
- </part>
-
- <part name="to">
- <title>Recipients</title>
- <input type="optionlist" name="recipient-type">
- <option value="contains">
- <title>contains</title>
- <code>
- (match-all (or (header-contains "To" ${recipient})
- (header-contains "Cc" ${recipient})))
- </code>
- </option>
- <option value="not contains">
- <title>does not contain</title>
- <code>
- (match-all (not (or
- (header-contains "To" ${recipient})
- (header-contains "Cc" ${recipient}))))
- </code>
- </option>
- <option value="is">
- <title>is</title>
- <code>
- (match-all (or (header-matches "To" ${recipient})
- (header-matches "Cc" ${recipient})))
- </code>
- </option>
- <option value="is not">
- <title>is not</title>
- <code>
- (match-all (not (or
- (header-matches "To" ${recipient})
- (header-matches "Cc" ${recipient}))))
- </code>
- </option>
- <option value="starts with">
- <title>starts with</title>
- <code>
- (match-all (or (header-starts-with "To" ${recipient})
- (header-starts-with "Cc" ${recipient})))
- </code>
- </option>
- <option value="not starts with">
- <title>does not start with</title>
- <code>
- (match-all (not (or
- (header-starts-with "To" ${recipient})
- (header-starts-with "Cc" ${recipient}))))
- </code>
- </option>
- <option value="ends with">
- <title>ends with</title>
- <code>
- (match-all (or (header-ends-with "To" ${recipient})
- (header-ends-with "Cc" ${recipient})))
- </code>
- </option>
- <option value="not ends with">
- <title>does not end with</title>
- <code>
- (match-all (not (or
- (header-ends-with "To" ${recipient})
- (header-ends-with "Cc" ${recipient}))))
- </code>
- </option>
- </input>
- <input type="address" name="recipient"/>
- </part>
-
- <part name="subject">
- <title>Subject</title>
- <input type="optionlist" name="subject-type">
- <option value="contains">
- <title>contains</title>
- <code>
- (match-all (header-contains "Subject" ${subject}))
- </code>
- </option>
- <option value="not contains">
- <title>does not contain</title>
- <code>
- (match-all (not (header-contains "Subject" ${subject})))
- </code>
- </option>
- <option value="is">
- <title>is</title>
- <code>
- (match-all (header-matches "Subject" ${subject}))
- </code>
- </option>
- <option value="is not">
- <title>is not</title>
- <code>
- (match-all (not (header-matches "Subject" ${subject}))
- </code>
- </option>
- <option value="starts with">
- <title>starts with</title>
- <code>
- (match-all (header-starts-with "Subject" ${subject}))
- </code>
- </option>
- <option value="not starts with">
- <title>does not start with</title>
- <code>
- (match-all (not (header-starts-with "Subject" ${subject}))
- </code>
- </option>
- <option value="ends with">
- <title>ends with</title>
- <code>
- (match-all (header-ends-with "Subject" ${subject}))
- </code>
- </option>
- <option value="not ends with">
- <title>does not end with</title>
- <code>
- (match-all (not (header-ends-with "Subject" ${subject}))
- </code>
- </option>
- </input>
- <input type="string" name="subject"/>
- </part>
- <part name="body">
- <title>Message Body</title>
- <input type="optionlist" name="body-type">
- <option value="contains">
- <title>contains</title>
- <code>
- (body-contains ${word})
- </code>
- </option>
- <option value="not contains">
- <title>does not contain</title>
- <code>
- (match-all (not (body-contains ${word})))
- </code>
- </option>
- </input>
- <input type="string" name="word"/>
- </part>
- <part name="sexp">
- <title>Expression</title>
- <input type="code" name="code"/>
- </part>
-
- <part name="sent-date">
- <title>Message was sent</title>
- <input type="optionlist" name="date-spec-type">
- <option value="before">
- <title>before</title>
- <code>
- (match-all (&lt; (get-sent-date) ${versus}))
- </code>
- </option>
- <option value="on-or-before">
- <title>on or before</title>
- <code>
- (match-all (not (&gt; (get-sent-date) ${versus})))
- </code>
- </option>
- <option value="after">
- <title>after</title>
- <code>
- (match-all (&gt; (get-sent-date) ${versus}))
- </code>
- </option>
- <option value="on-or-after">
- <title>on or after</title>
- <code>
- (match-all (not (&lt; (get-sent-date) ${versus})))
- </code>
- </option>
- </input>
- <input type="datespec" name="versus">
- </input>
- </part>
-
- <part name="recv-date">
- <title>Message was received</title>
- <input type="optionlist" name="date-spec-type">
- <option value="before">
- <title>before</title>
- <code>
- (match-all (&lt; (get-received-date) ${versus}))
- </code>
- </option>
- <option value="on-or-before">
- <title>on or before</title>
- <code>
- (match-all (not (&gt; (get-received-date) ${versus})))
- </code>
- </option>
- <option value="after">
- <title>after</title>
- <code>
- (match-all (&gt; (get-received-date) ${versus}))
- </code>
- </option>
- <option value="on-or-after">
- <title>on or after</title>
- <code>
- (match-all (not (&lt; (get-received-date) ${versus})))
- </code>
- </option>
- </input>
- <input type="datespec" name="versus">
- </input>
- </part>
-
- <part name="status">
- <title>Status</title>
- <input type="optionlist" name="match-type">
- <option value="is">
- <title>is</title>
- <code>
- (match-all (system-flag ${flag}))
- </code>
- </option>
- <option value="is not">
- <title>is not</title>
- <code>
- (match-all (not (system-flag ${flag})))
- </code>
- </option>
- </input>
- <input type="optionlist" name="flag">
- <option value="Answered">
- <title>Replied to</title>
- </option>
- <option value="Deleted">
- <title>Deleted</title>
- </option>
- <option value="Draft">
- <title>Draft</title>
- </option>
- <option value="Flagged">
- <title>Important</title>
- </option>
- <option value="Seen">
- <title>Read</title>
- </option>
- </input>
- </part>
-
- <part name="attachments">
- <title>Attachments</title>
- <input type="optionlist" name="match-type">
- <option value="exist">
- <title>Exist</title>
- <code>
- (match-all (system-flag "Attachments"))
- </code>
- </option>
- <option value="not exist">
- <title>Do Not Exist</title>
- <code>
- (match-all (not (system-flag "Attachments")))
- </code>
- </option>
- </input>
- </part>
-
- <part name="mlist">
- <title>Mailing list</title>
- <input type="optionlist" name="mlist-type">
- <option value="contains">
- <title>contains</title>
- <code>(match-all (header-contains "x-camel-mlist" ${mlist}))</code>
- </option>
- <option value="not contains">
- <title>does not contain</title>
- <code>(match-all (not (header-contains "x-camel-mlist" ${mlist})))</code>
- </option>
- <option value="is">
- <title>is</title>
- <code>(match-all (header-matches "x-camel-mlist" ${mlist}))</code>
- </option>
- <option value="is not">
- <title>is not</title>
- <code>(match-all (not (header-matches "x-camel-mlist" ${mlist})))</code>
- </option>
- <option value="starts with">
- <title>starts with</title>
- <code>
- (match-all (header-starts-with "x-camel-mlist" ${mlist}))
- </code>
- </option>
- <option value="not starts with">
- <title>does not start with</title>
- <code>
- (match-all (not (header-starts-with "x-camel-mlist" ${mlist})))
- </code>
- </option>
- <option value="ends with">
- <title>ends with</title>
- <code>
- (match-all (header-ends-with "x-camel-mlist" ${mlist}))
- </code>
- </option>
- <option value="not ends with">
- <title>does not end with</title>
- <code>
- (match-all (not (header-ends-with "x-camel-mlist" ${mlist})))
- </code>
- </option>
- </input>
- <input type="string" name="mlist"/>
- </part>
-
-</partset>
-</filterdescription>