[gnome-builder] buffer: use object helpers for contextual logging



commit bbc24d207e397b4f45468c610eb9772ba900f632
Author: Christian Hergert <chergert redhat com>
Date:   Sat Jan 6 01:22:44 2018 -0800

    buffer: use object helpers for contextual logging

 src/libide/buffers/ide-buffer.c        |   13 +++++++------
 src/libide/buffers/ide-unsaved-files.c |   11 +++++++++--
 2 files changed, 16 insertions(+), 8 deletions(-)
---
diff --git a/src/libide/buffers/ide-buffer.c b/src/libide/buffers/ide-buffer.c
index 1e07801..c8c0c8d 100644
--- a/src/libide/buffers/ide-buffer.c
+++ b/src/libide/buffers/ide-buffer.c
@@ -904,7 +904,7 @@ ide_buffer__file_notify_file (IdeBuffer  *self,
 
   if (gfile != NULL)
     {
-      GError *error = NULL;
+      g_autoptr(GError) error = NULL;
 
       priv->file_monitor = g_file_monitor_file (gfile, G_FILE_MONITOR_NONE, NULL, &error);
 
@@ -916,11 +916,12 @@ ide_buffer__file_notify_file (IdeBuffer  *self,
                                    self,
                                    G_CONNECT_SWAPPED);
         }
-      else if (error != NULL)
-        {
-          g_debug ("Failed to create GFileMonitor: %s", error->message);
-          g_clear_error (&error);
-        }
+
+      if (error != NULL)
+        ide_object_message (self,
+                            /* translators: %s is replaced with the error message */
+                            _("Failed to establish a monitor for background changes: %s"),
+                            error->message);
     }
 }
 
diff --git a/src/libide/buffers/ide-unsaved-files.c b/src/libide/buffers/ide-unsaved-files.c
index d830d49..7900e06 100644
--- a/src/libide/buffers/ide-unsaved-files.c
+++ b/src/libide/buffers/ide-unsaved-files.c
@@ -19,6 +19,7 @@
 #define G_LOG_DOMAIN "ide-unsaved-files"
 
 #include <dazzle.h>
+#include <glib/gi18n.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <glib/gstdio.h>
@@ -246,7 +247,10 @@ ide_unsaved_files_save_worker (GTask        *task,
       path = g_build_filename (state->drafts_directory, hash, NULL);
 
       if (!unsaved_file_save (uf, path, &error))
-        g_warning ("Failed to save draft: %s", error->message);
+        ide_object_warning (source_object,
+                            /* translators: %s is replaced with the error message */
+                            _("Failed to save draft: %s"),
+                            error->message);
     }
 
   if (!g_file_set_contents (manifest_path, manifest->str, manifest->len, &write_error))
@@ -409,7 +413,10 @@ ide_unsaved_files_restore_worker (GTask        *task,
 
       if (!g_file_get_contents (path, &contents, &data_len, &error))
         {
-          g_warning ("Failed to load \"%s\": %s", path, error->message);
+          ide_object_warning (source_object,
+                              /* translators: the first %s is the path, th second is the error message */
+                              "Failed to load draft for %s: %s",
+                              line, error->message);
           continue;
         }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]