aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDiego Escalante Urrelo <descalante@igalia.com>2010-01-24 02:21:36 +0800
committerDiego Escalante Urrelo <diegoe@gnome.org>2010-01-26 08:15:44 +0800
commit23875ed89857851cd7e27541049a7cf74f593310 (patch)
treea074242981811a0ff0b766f9b33f15df2b7c3639 /src
parentc0b52d834cbc43fa7cbba5d92411d2114b8650c1 (diff)
downloadgsoc2013-epiphany-23875ed89857851cd7e27541049a7cf74f593310.tar
gsoc2013-epiphany-23875ed89857851cd7e27541049a7cf74f593310.tar.gz
gsoc2013-epiphany-23875ed89857851cd7e27541049a7cf74f593310.tar.bz2
gsoc2013-epiphany-23875ed89857851cd7e27541049a7cf74f593310.tar.lz
gsoc2013-epiphany-23875ed89857851cd7e27541049a7cf74f593310.tar.xz
gsoc2013-epiphany-23875ed89857851cd7e27541049a7cf74f593310.tar.zst
gsoc2013-epiphany-23875ed89857851cd7e27541049a7cf74f593310.zip
extensions-manager: use GDir instead of dirent
Bug #607881
Diffstat (limited to 'src')
-rw-r--r--src/ephy-extensions-manager.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/ephy-extensions-manager.c b/src/ephy-extensions-manager.c
index cb0157117..d50f5f8fb 100644
--- a/src/ephy-extensions-manager.c
+++ b/src/ephy-extensions-manager.c
@@ -50,7 +50,6 @@
#include <gio/gio.h>
#include <gmodule.h>
-#include <dirent.h>
#include <string.h>
#ifdef ENABLE_SEED
@@ -995,9 +994,10 @@ static void
ephy_extensions_manager_load_dir (EphyExtensionsManager *manager,
const char *path)
{
- DIR *d;
- struct dirent *e;
char *file_path;
+ GError *error = NULL;
+ GDir *dir;
+ const char *dir_elem;
GFile *directory;
GFileMonitor *monitor;
@@ -1005,21 +1005,28 @@ ephy_extensions_manager_load_dir (EphyExtensionsManager *manager,
START_PROFILER ("Scanning directory")
- d = opendir (path);
- if (d == NULL)
+ dir = g_dir_open (path, 0, &error);
+ if (error)
{
+ LOG ("Failed to open extension directory %s: %s",
+ path, error->message);
+ g_error_free (error);
return;
}
- while ((e = readdir (d)) != NULL)
+
+ dir_elem = g_dir_read_name (dir);
+ while (dir_elem)
{
- if (format_from_path (e->d_name) != FORMAT_UNKNOWN)
+ if (format_from_path (dir_elem) != FORMAT_UNKNOWN)
{
- file_path = g_build_filename (path, e->d_name, NULL);
+ file_path = g_build_filename (path, dir_elem, NULL);
ephy_extensions_manager_load_file (manager, file_path);
g_free (file_path);
}
+
+ dir_elem = g_dir_read_name (dir);
}
- closedir (d);
+ g_dir_close (dir);
directory = g_file_new_for_path (path);
monitor = g_file_monitor_directory (directory, 0, NULL, NULL);