gedit r6801 - in trunk: . plugins/taglist
- From: pborelli svn gnome org
- To: svn-commits-list gnome org
- Subject: gedit r6801 - in trunk: . plugins/taglist
- Date: Sat, 3 Jan 2009 11:38:19 +0000 (UTC)
Author: pborelli
Date: Sat Jan 3 11:38:19 2009
New Revision: 6801
URL: http://svn.gnome.org/viewvc/gedit?rev=6801&view=rev
Log:
2009-01-03 Paolo Borelli <pborelli katamail com>
* plugins/taglist/gedit-taglist-plugin-parser.c: use glib
functions to open the taglist directories.
Modified:
trunk/ChangeLog
trunk/plugins/taglist/gedit-taglist-plugin-parser.c
Modified: trunk/plugins/taglist/gedit-taglist-plugin-parser.c
==============================================================================
--- trunk/plugins/taglist/gedit-taglist-plugin-parser.c (original)
+++ trunk/plugins/taglist/gedit-taglist-plugin-parser.c Sat Jan 3 11:38:19 2009
@@ -34,10 +34,7 @@
#include <config.h>
#endif
-#include <dirent.h>
#include <string.h>
-#include <errno.h>
-
#include <libxml/parser.h>
#include <glib.h>
#include <glib/gi18n.h>
@@ -562,30 +559,32 @@
static TagList *
parse_taglist_dir (const gchar *dir)
{
- DIR *d;
- struct dirent *e;
+ GError *error = NULL;
+ GDir *d;
+ const gchar *dirent;
gedit_debug_message (DEBUG_PLUGINS, "DIR: %s", dir);
- d = opendir (dir);
-
- if (d == NULL)
- {
- gedit_debug_message (DEBUG_PLUGINS, "%s", strerror (errno));
+ d = g_dir_open (dir, 0, &error);
+ if (!d)
+ {
+ gedit_debug_message (DEBUG_PLUGINS, "%s", error->message);
+ g_error_free (error);
return taglist;
}
-
- while ((e = readdir (d)) != NULL)
+
+ while ((dirent = g_dir_read_name (d)))
{
- if (strncmp (e->d_name + strlen (e->d_name) - 5, ".tags", 5) == 0 ||
- strncmp (e->d_name + strlen (e->d_name) - 8, ".tags.gz", 8) == 0)
+ if (g_str_has_suffix (dirent, ".tags") ||
+ g_str_has_suffix (dirent, ".tags.gz"))
{
- gchar *tags_file = g_build_filename (dir, e->d_name, NULL);
+ gchar *tags_file = g_build_filename (dir, dirent, NULL);
parse_taglist_file (tags_file);
g_free (tags_file);
}
}
- closedir (d);
+
+ g_dir_close (d);
return taglist;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]