aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Lillqvist <tml@novell.com>2005-12-18 01:28:29 +0800
committerTor Lillqvist <tml@src.gnome.org>2005-12-18 01:28:29 +0800
commit47a79ac8066193a636ff502249a8661d0fb28687 (patch)
tree937431d214ae1966b850c0bdabec2c3df1e7264d
parent2fdce9196969f13b32d7918401a7dd7dc01e582b (diff)
downloadgsoc2013-evolution-47a79ac8066193a636ff502249a8661d0fb28687.tar.gz
gsoc2013-evolution-47a79ac8066193a636ff502249a8661d0fb28687.tar.zst
gsoc2013-evolution-47a79ac8066193a636ff502249a8661d0fb28687.zip
filter-file.c Use libedataserver's e_xml_parse_file(). Use gstdio
2005-12-17 Tor Lillqvist <tml@novell.com> * filter-file.c * rule-context.c: Use libedataserver's e_xml_parse_file(). Use gstdio wrappers. Use g_file_test(). svn path=/trunk/; revision=30834
-rw-r--r--filter/ChangeLog4
-rw-r--r--filter/filter-file.c5
-rw-r--r--filter/rule-context.c39
3 files changed, 25 insertions, 23 deletions
diff --git a/filter/ChangeLog b/filter/ChangeLog
index e9e2341a03..a99ef7594c 100644
--- a/filter/ChangeLog
+++ b/filter/ChangeLog
@@ -1,6 +1,8 @@
2005-12-17 Tor Lillqvist <tml@novell.com>
- * filter-file.c: Use gstdio wrappers.
+ * filter-file.c
+ * rule-context.c: Use libedataserver's e_xml_parse_file(). Use
+ gstdio wrappers. Use g_file_test().
2005-08-23 Not Zed <NotZed@Ximian.com>
diff --git a/filter/filter-file.c b/filter/filter-file.c
index 9934d92b54..a385d3330b 100644
--- a/filter/filter-file.c
+++ b/filter/filter-file.c
@@ -20,12 +20,10 @@
*
*/
-
#include <config.h>
#include <string.h>
#include <sys/types.h>
-#include <sys/stat.h>
#include <glib.h>
#include <glib/gstdio.h>
@@ -158,7 +156,6 @@ static gboolean
validate (FilterElement *fe)
{
FilterFile *file = (FilterFile *) fe;
- struct stat st;
if (!file->path) {
/* FIXME: FilterElement should probably have a
@@ -173,7 +170,7 @@ validate (FilterElement *fe)
/* FIXME: do more to validate command-lines? */
if (strcmp (file->type, "file") == 0) {
- if (g_stat (file->path, &st) == -1 || !S_ISREG (st.st_mode)) {
+ if (!g_file_test (file->path, G_FILE_TEST_IS_REGULAR)) {
/* FIXME: FilterElement should probably have a
GtkWidget member pointing to the value gotten with
::get_widget() so that we can get the parent window
diff --git a/filter/rule-context.c b/filter/rule-context.c
index ffab5bf655..b984b67593 100644
--- a/filter/rule-context.c
+++ b/filter/rule-context.c
@@ -20,10 +20,7 @@
* Boston, MA 02111-1307, USA.
*/
-
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <string.h>
#include <sys/types.h>
@@ -32,23 +29,30 @@
#include <fcntl.h>
#include <errno.h>
+#include <glib.h>
+#include <glib/gstdio.h>
+
#include <gtk/gtk.h>
+
#include <libgnome/gnome-i18n.h>
-#include <e-util/e-xml-utils.h>
-#include "e-util/e-error.h"
-#include "rule-context.h"
-#include "filter-rule.h"
-#include "filter-marshal.h"
+#include <libedataserver/e-xml-hash-utils.h>
+#include <libedataserver/e-xml-utils.h>
+
+#include "e-util/e-error.h"
+#include "e-util/e-xml-utils.h"
-#include "filter-input.h"
-#include "filter-option.h"
#include "filter-code.h"
#include "filter-colour.h"
#include "filter-datespec.h"
-#include "filter-int.h"
#include "filter-file.h"
+#include "filter-input.h"
+#include "filter-int.h"
#include "filter-label.h"
+#include "filter-marshal.h"
+#include "filter-option.h"
+#include "filter-rule.h"
+#include "rule-context.h"
#define d(x)
@@ -300,13 +304,12 @@ load(RuleContext *rc, const char *system, const char *user)
xmlDocPtr systemdoc, userdoc;
struct _part_set_map *part_map;
struct _rule_set_map *rule_map;
- struct stat st;
-
+
rule_context_set_error(rc, NULL);
d(printf("loading rules %s %s\n", system, user));
- systemdoc = xmlParseFile(system);
+ systemdoc = e_xml_parse_file (system);
if (systemdoc == NULL) {
rule_context_set_error(rc, g_strdup_printf("Unable to load system rules '%s': %s",
system, g_strerror(errno)));
@@ -321,9 +324,9 @@ load(RuleContext *rc, const char *system, const char *user)
}
/* doesn't matter if this doens't exist */
userdoc = NULL;
- if (stat (user, &st) != -1 && S_ISREG (st.st_mode))
- userdoc = xmlParseFile(user);
-
+ if (g_file_test(user, G_FILE_TEST_IS_REGULAR))
+ userdoc = e_xml_parse_file (user);
+
/* now parse structure */
/* get rule parts */
set = root->children;
@@ -528,7 +531,7 @@ revert(RuleContext *rc, const char *user)
d(printf("restoring rules %s\n", user));
- userdoc = xmlParseFile(user);
+ userdoc = e_xml_parse_file (user);
if (userdoc == NULL)
/* clear out anythign we have? */
return 0;