[rhythmbox] lib: change RBUriRecurseFunc to take a GFileInfo
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox] lib: change RBUriRecurseFunc to take a GFileInfo
- Date: Sat, 24 May 2014 07:45:47 +0000 (UTC)
commit d5528a4a5aa4c733c802f795b5d3ae0e4e3d09cb
Author: Jonathan Matthew <jonathan d14n org>
Date: Sat May 24 16:33:37 2014 +1000
lib: change RBUriRecurseFunc to take a GFileInfo
This lets callers get more information about the things being recursed
through without overcomplicating the interface.
lib/rb-file-helpers.c | 9 +++++----
lib/rb-file-helpers.h | 2 +-
rhythmdb/rhythmdb-import-job.c | 4 ++--
rhythmdb/rhythmdb-monitor.c | 4 ++--
4 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/lib/rb-file-helpers.c b/lib/rb-file-helpers.c
index 3f1d0bc..aef521e 100644
--- a/lib/rb-file-helpers.c
+++ b/lib/rb-file-helpers.c
@@ -88,7 +88,8 @@ static const char *recurse_attributes =
G_FILE_ATTRIBUTE_STANDARD_TYPE ","
G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN ","
G_FILE_ATTRIBUTE_ID_FILE ","
- G_FILE_ATTRIBUTE_ACCESS_CAN_READ;
+ G_FILE_ATTRIBUTE_ACCESS_CAN_READ ","
+ G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK;
/**
* rb_locale_dir:
@@ -748,7 +749,7 @@ _uri_handle_file (GFile *dir, GFileInfo *fileinfo, GHashTable *handled, RBUriRec
}
child = g_file_get_child (dir, g_file_info_get_name (fileinfo));
- ret = (func) (child, is_dir, user_data);
+ ret = (func) (child, fileinfo, user_data);
if (is_dir && ret) {
*descend = child;
} else {
@@ -779,7 +780,7 @@ _uri_handle_recurse (GFile *dir,
info = g_file_query_info (dir, recurse_attributes, G_FILE_QUERY_INFO_NONE, cancel,
&error);
if (error == NULL) {
if (_should_process (info)) {
- (func) (dir, FALSE, user_data);
+ (func) (dir, info, user_data);
}
g_object_unref (info);
return;
@@ -936,7 +937,7 @@ _uri_handle_recursively_enum_files (GObject *src, GAsyncResult *result, gpointer
info = g_file_query_info (G_FILE (src), recurse_attributes, G_FILE_QUERY_INFO_NONE,
data->cancel, &error);
if (error == NULL) {
if (_should_process (info)) {
- (data->func) (G_FILE (src), FALSE, data->user_data);
+ (data->func) (G_FILE (src), info, data->user_data);
}
g_object_unref (info);
}
diff --git a/lib/rb-file-helpers.h b/lib/rb-file-helpers.h
index 96ce50a..4fef68b 100644
--- a/lib/rb-file-helpers.h
+++ b/lib/rb-file-helpers.h
@@ -64,7 +64,7 @@ char * rb_uri_get_mount_point (const char *uri);
/* return TRUE to recurse further, FALSE to stop */
-typedef gboolean (*RBUriRecurseFunc) (GFile *file, gboolean dir, gpointer data);
+typedef gboolean (*RBUriRecurseFunc) (GFile *file, GFileInfo *info, gpointer data);
void rb_uri_handle_recursively(const char *uri,
GCancellable *cancel,
diff --git a/rhythmdb/rhythmdb-import-job.c b/rhythmdb/rhythmdb-import-job.c
index 7193e86..e26fc68 100644
--- a/rhythmdb/rhythmdb-import-job.c
+++ b/rhythmdb/rhythmdb-import-job.c
@@ -314,12 +314,12 @@ emit_status_changed (RhythmDBImportJob *job)
}
static gboolean
-uri_recurse_func (GFile *file, gboolean dir, RhythmDBImportJob *job)
+uri_recurse_func (GFile *file, GFileInfo *info, RhythmDBImportJob *job)
{
RhythmDBEntry *entry;
char *uri;
- if (dir) {
+ if (g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_STANDARD_TYPE) == G_FILE_TYPE_DIRECTORY)
{
return TRUE;
}
diff --git a/rhythmdb/rhythmdb-monitor.c b/rhythmdb/rhythmdb-monitor.c
index 9c5caf9..a596002 100644
--- a/rhythmdb/rhythmdb-monitor.c
+++ b/rhythmdb/rhythmdb-monitor.c
@@ -145,12 +145,12 @@ actually_add_monitor (RhythmDB *db, GFile *directory, GError **error)
}
static gboolean
-monitor_subdirectory (GFile *file, gboolean dir, RhythmDB *db)
+monitor_subdirectory (GFile *file, GFileInfo *info, RhythmDB *db)
{
char *uri;
uri = g_file_get_uri (file);
- if (dir) {
+ if (g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_STANDARD_TYPE) == G_FILE_TYPE_DIRECTORY)
{
actually_add_monitor (db, file, NULL);
} else {
/* add the file to the database if it's not already there */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]