[evolution-data-server] ESourceRegistry: Ignore hidden files from .source folder monitoring
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] ESourceRegistry: Ignore hidden files from .source folder monitoring
- Date: Fri, 22 Nov 2013 15:58:10 +0000 (UTC)
commit 43feee44173ea2cefccff92127389598517bf79f
Author: Milan Crha <mcrha redhat com>
Date: Fri Nov 22 16:53:44 2013 +0100
ESourceRegistry: Ignore hidden files from .source folder monitoring
There used to be a critical warning on the source registry console:
** Failed to load key file at
'file:///home/user/.config/evolution/sources/.goutputstream-1P9V6W':
File must have a '.source' extension
There is nothing the source registry can do with these files (because
they are created by GIO), but ignore them during the folder monitoring,
instead of spreading useless runtime warning.
libebackend/e-server-side-source.c | 4 +++-
libebackend/e-source-registry-server.c | 10 +++-------
2 files changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/libebackend/e-server-side-source.c b/libebackend/e-server-side-source.c
index 686df0c..cbea9cd 100644
--- a/libebackend/e-server-side-source.c
+++ b/libebackend/e-server-side-source.c
@@ -1428,7 +1428,9 @@ e_server_side_source_uid_from_file (GFile *file,
basename = g_file_get_basename (file);
- if (g_str_has_suffix (basename, ".source")) {
+ if (*basename == '.') {
+ /* ignore hidden files */
+ } else if (g_str_has_suffix (basename, ".source")) {
/* strlen(".source") --> 7 */
uid = g_strndup (basename, strlen (basename) - 7);
} else {
diff --git a/libebackend/e-source-registry-server.c b/libebackend/e-source-registry-server.c
index 562fd03..6d39142 100644
--- a/libebackend/e-source-registry-server.c
+++ b/libebackend/e-source-registry-server.c
@@ -900,14 +900,10 @@ source_registry_server_monitor_changed_cb (GFileMonitor *monitor,
ESource *source;
GError *error = NULL;
+ /* it can return NULL source for hidden files */
source = e_server_side_source_new (server, file, &error);
- /* Sanity check. */
- g_return_if_fail (
- ((source != NULL) && (error == NULL)) ||
- ((source == NULL) && (error != NULL)));
-
- if (error == NULL) {
+ if (!error && source) {
/* File monitors are only placed on directories
* where data sources are writable and removable,
* so it should be safe to assume these flags. */
@@ -918,7 +914,7 @@ source_registry_server_monitor_changed_cb (GFileMonitor *monitor,
e_source_registry_server_add_source (server, source);
g_object_unref (source);
- } else {
+ } else if (error) {
e_source_registry_server_load_error (
server, file, error);
g_error_free (error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]