[epiphany] extensions-manager: use GDir instead of dirent
- From: Diego Escalante Urrelo <diegoe src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [epiphany] extensions-manager: use GDir instead of dirent
- Date: Tue, 26 Jan 2010 00:21:30 +0000 (UTC)
commit 23875ed89857851cd7e27541049a7cf74f593310
Author: Diego Escalante Urrelo <descalante igalia com>
Date: Sat Jan 23 13:21:36 2010 -0500
extensions-manager: use GDir instead of dirent
Bug #607881
src/ephy-extensions-manager.c | 25 ++++++++++++++++---------
1 files changed, 16 insertions(+), 9 deletions(-)
---
diff --git a/src/ephy-extensions-manager.c b/src/ephy-extensions-manager.c
index cb01571..d50f5f8 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]