[gedit] Do not complain about metadata for non existing files
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Do not complain about metadata for non existing files
- Date: Tue, 3 Mar 2015 09:25:31 +0000 (UTC)
commit c6ac14306bb4021a2a8bd6e917e4702f1bd0b94c
Author: Paolo Borelli <pborelli gnome org>
Date: Tue Mar 3 09:14:23 2015 +0100
Do not complain about metadata for non existing files
If the file is not on disk at all, let's not worry about metadata
gedit/gedit-document.c | 22 +++++++++++++++-------
1 files changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/gedit/gedit-document.c b/gedit/gedit-document.c
index ab4fab6..ebd2b85 100644
--- a/gedit/gedit-document.c
+++ b/gedit/gedit-document.c
@@ -708,13 +708,13 @@ on_location_changed (GtkSourceFile *file,
if (error != NULL)
{
- /* TODO document why the warning is not displayed in
- * certain cases.
+ /* Do not complain about metadata if we are opening a
+ * non existing file.
*/
- if (error->domain != G_FILE_ERROR ||
- (error->code != G_FILE_ERROR_ISDIR &&
- error->code != G_FILE_ERROR_NOTDIR &&
- error->code != G_FILE_ERROR_NOENT))
+ if (!g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_ISDIR) &&
+ !g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOTDIR) &&
+ !g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT) &&
+ !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
{
g_warning ("%s", error->message);
}
@@ -1693,7 +1693,15 @@ gedit_document_set_metadata (GeditDocument *doc,
if (error != NULL)
{
- g_warning ("Set document metadata failed: %s", error->message);
+ /* Do not complain about metadata if we are closing a
+ * document for a non existing file.
+ */
+ if (!g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT) &&
+ !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
+ {
+ g_warning ("Set document metadata failed: %s", error->message);
+ }
+
g_error_free (error);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]