diff options
author | Marco Pesenti Gritti <marco@it.gnome.org> | 2003-01-08 04:34:09 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <mpeseng@src.gnome.org> | 2003-01-08 04:34:09 +0800 |
commit | 977e13469d48102bc3812140bdf3faf955e9f11a (patch) | |
tree | 133d157d8c0399adf9792a32207fcfa41ccbfeab /lib/ephy-file-helpers.c | |
parent | c088c9ab24ffeafeef6b7b092facb6f3f57efc28 (diff) | |
download | gsoc2013-epiphany-977e13469d48102bc3812140bdf3faf955e9f11a.tar gsoc2013-epiphany-977e13469d48102bc3812140bdf3faf955e9f11a.tar.gz gsoc2013-epiphany-977e13469d48102bc3812140bdf3faf955e9f11a.tar.bz2 gsoc2013-epiphany-977e13469d48102bc3812140bdf3faf955e9f11a.tar.lz gsoc2013-epiphany-977e13469d48102bc3812140bdf3faf955e9f11a.tar.xz gsoc2013-epiphany-977e13469d48102bc3812140bdf3faf955e9f11a.tar.zst gsoc2013-epiphany-977e13469d48102bc3812140bdf3faf955e9f11a.zip |
More work on the start here page.
2003-01-07 Marco Pesenti Gritti <marco@it.gnome.org>
* data/starthere/Makefile.am:
* data/starthere/index.xml.in:
* data/starthere/section.css:
* data/starthere/section.xsl:
* embed/mozilla/StartHereProtocolHandler.cpp:
* embed/mozilla/mozilla-embed-shell.cpp:
* lib/ephy-file-helpers.c: (ephy_ensure_dir_exists),
(ephy_find_file_recursive), (ephy_file_find):
* lib/ephy-file-helpers.h:
* lib/ephy-start-here.c: (ephy_start_here_init),
(ephy_start_here_finalize), (is_my_lang), (mozilla_bookmarks),
(attach_content), (build_content), (ephy_start_here_get_page),
(ephy_start_here_get_base_uri):
* lib/ephy-start-here.h:
More work on the start here page.
Diffstat (limited to 'lib/ephy-file-helpers.c')
-rw-r--r-- | lib/ephy-file-helpers.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/ephy-file-helpers.c b/lib/ephy-file-helpers.c index 2e867e3f5..1b66004f0 100644 --- a/lib/ephy-file-helpers.c +++ b/lib/ephy-file-helpers.c @@ -22,6 +22,7 @@ #include <config.h> #endif +#include <string.h> #include <stdlib.h> #include <unistd.h> #include <sys/stat.h> @@ -324,3 +325,43 @@ ephy_ensure_dir_exists (const char *dir) g_error (_("Failed to create directory %s."), dir); } } + +static void +ephy_find_file_recursive (const char *path, + const char *fname, GSList **l, + gint depth, gint maxdepth) +{ + GDir *d = g_dir_open (path, 0, NULL); + const gchar *f; + if (d) + { + while ((f = g_dir_read_name (d))) + { + char *new_path = g_build_filename (path, f, NULL); + if (depth < maxdepth) + { + ephy_find_file_recursive (new_path, fname, l, + depth + 1, maxdepth); + } + if (!strcmp (f, fname)) + { + *l = g_slist_prepend (*l, new_path); + } + else + { + g_free (new_path); + } + } + g_dir_close (d); + } +} + +GSList * +ephy_file_find (const char *path, + const char *fname, + gint maxdepth) +{ + GSList *ret = NULL; + ephy_find_file_recursive (path, fname, &ret, 0, maxdepth); + return ret; +} |