[gnome-builder] beautifier plugin: port warnings to message API



commit e87303f340a5e27d6f197b509bc299ba35f3ea21
Author: Sebastien Lafargue <slafargue gnome org>
Date:   Tue Jan 9 00:03:25 2018 +0100

    beautifier plugin: port warnings to message API

 po/POTFILES.in                                     |    3 +
 src/plugins/beautifier/gb-beautifier-config.c      |   95 +++++++++++++-------
 .../beautifier/gb-beautifier-editor-addin.c        |   23 +++--
 .../beautifier/gb-beautifier-editor-addin.h        |    2 +-
 src/plugins/beautifier/gb-beautifier-helper.c      |   42 ++++++---
 src/plugins/beautifier/gb-beautifier-helper.h      |    9 ++-
 src/plugins/beautifier/gb-beautifier-private.h     |    3 +
 src/plugins/beautifier/gb-beautifier-process.c     |   22 +++--
 8 files changed, 131 insertions(+), 68 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 416f3d2..f6ee697 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -119,7 +119,10 @@ src/libide/workbench/ide-workbench-shortcuts.c
 src/plugins/autotools/ide-autotools-makecache-stage.c
 src/plugins/autotools/ide-autotools-pipeline-addin.c
 src/plugins/autotools-templates/autotools_templates/__init__.py
+src/plugins/beautifier/gb-beautifier-config.c
 src/plugins/beautifier/gb-beautifier-editor-addin.c
+src/plugins/beautifier/gb-beautifier-helper.c
+src/plugins/beautifier/gb-beautifier-process.c
 src/plugins/beautifier/gtk/menus.ui
 src/plugins/cargo/cargo_plugin.py
 src/plugins/clang/ide-clang-preferences-addin.c
diff --git a/src/plugins/beautifier/gb-beautifier-config.c b/src/plugins/beautifier/gb-beautifier-config.c
index 9be22c1..bd7ca54 100644
--- a/src/plugins/beautifier/gb-beautifier-config.c
+++ b/src/plugins/beautifier/gb-beautifier-config.c
@@ -20,6 +20,7 @@
 
 #include <string.h>
 
+#include <glib/gi18n.h>
 #include <glib/gstdio.h>
 #include <ide.h>
 #include <libpeas/peas.h>
@@ -118,9 +119,10 @@ gb_beautifier_map_check_duplicates (GbBeautifierEditorAddin *self,
 }
 
 static gchar *
-copy_to_tmp_file (const gchar *tmp_dir,
-                  const gchar *source_path,
-                  gboolean     is_executable)
+copy_to_tmp_file (GbBeautifierEditorAddin *self,
+                  const gchar             *tmp_dir,
+                  const gchar             *source_path,
+                  gboolean                 is_executable)
 {
   g_autoptr (GFile) src_file = NULL;
   g_autoptr (GFile) dst_file = NULL;
@@ -147,11 +149,20 @@ copy_to_tmp_file (const gchar *tmp_dir,
     }
 
   if (error != NULL)
-    g_warning ("beautifier plugin: error copying the gresource config file for '%s':%s",
-               source_path,
-               error->message);
+    {
+      /* translators: %s and %s are replaced with source file path and the error message */
+      ide_object_warning (self,
+                          _("Beautifier plugin: error copying the gresource config file for “%s”: %s"),
+                          source_path,
+                          error->message);
+    }
   else
-    g_warning ("beautifier plugin: error creating config temp file for '%s'", source_path);
+    {
+      /* translators: %s is replaced with the source file path */
+      ide_object_warning (self,
+                          _("Beautifier plugin: error creating temporary config file for “%s”"),
+                          source_path);
+    }
 
   return NULL;
 }
@@ -192,7 +203,8 @@ add_entries_from_config_ini_file (GbBeautifierEditorAddin *self,
 
   if (!g_file_load_contents (file, NULL, &data, &data_len, NULL, &error))
     {
-      g_debug ("Can't read .ini file:%s", error->message);
+      /* translators: %s is replaced with the .ini source file path */
+      ide_object_warning (self, _("Beautifier plugin: Can't read .ini file: %s"), error->message);
       return FALSE;
     }
 
@@ -238,15 +250,20 @@ add_entries_from_config_ini_file (GbBeautifierEditorAddin *self,
           has_command_pattern = g_key_file_has_key (key_file, profile, "command-pattern", NULL);
           if (!has_command && !has_command_pattern)
             {
-              g_warning ("beautifier plugin: neither command nor command-pattern keys found");
-              g_warning ("entry \"%s\" disabled", display_name);
+              /* translators: %s is replaced with the config entry name */
+              ide_object_warning (self,
+                                  _("Beautifier plugin: neither command nor command-pattern keys found: 
entry “%s” disabling"),
+                                  display_name);
+
               continue;
             }
 
           if (has_command && has_command_pattern)
             {
-              g_warning ("beautifier plugin: both command and command-pattern keys found");
-              g_warning ("entry \"%s\" disabled", display_name);
+              /* translators: %s is replaced with the config entry name */
+              ide_object_warning (self,
+                                  _("Beautifier plugin: both command and command-pattern keys found: entry 
“%s” disabling"),
+                                  display_name);
               continue;
             }
 
@@ -255,7 +272,7 @@ add_entries_from_config_ini_file (GbBeautifierEditorAddin *self,
               config_path = g_build_filename (base_path, real_lang_id, config_name, NULL);
               if (g_str_has_prefix (config_path, "resource://"))
                 {
-                  gchar *tmp_config_path = copy_to_tmp_file (self->tmp_dir, config_path, FALSE);
+                  gchar *tmp_config_path = copy_to_tmp_file (self, self->tmp_dir, config_path, FALSE);
 
                   g_free (config_path);
                   config_path = tmp_config_path;
@@ -267,8 +284,11 @@ add_entries_from_config_ini_file (GbBeautifierEditorAddin *self,
                   config_file = g_file_new_for_path (config_path);
                   if (!g_file_query_exists (config_file, NULL))
                     {
-                      g_warning ("beautifier plugin: \"%s\" does not exist", config_path);
-                      g_warning ("entry \"%s\" disabled", display_name);
+                      /* translators: %s and %s are replaced with the config path and the entry name */
+                      ide_object_warning (self,
+                                          _("Beautifier plugin: config path “%s” does not exist, entry “%s” 
disabling"),
+                                          config_path,
+                                          display_name);
                       continue;
                     }
                 }
@@ -281,11 +301,13 @@ add_entries_from_config_ini_file (GbBeautifierEditorAddin *self,
                 entry.command = GB_BEAUTIFIER_CONFIG_COMMAND_CLANG_FORMAT;
               else
                 {
-                  g_warning ("beautifier plugin: command key out of possible values");
-                  g_warning ("entry \"%s\" disabled", display_name);
+                  /* translators: %s is replaced with the entry name */
+                  ide_object_warning (self,
+                                      _("Beautifier plugin: command key out of possible values: entry “%s” 
disabling"),
+                                      display_name);
 
                   if (entry.is_config_file_temp)
-                    gb_beautifier_helper_remove_temp_for_file (config_file);
+                    gb_beautifier_helper_remove_temp_for_file (self, config_file);
 
                   continue;
                 }
@@ -304,16 +326,18 @@ add_entries_from_config_ini_file (GbBeautifierEditorAddin *self,
 
               if (g_strstr_len (command_pattern, -1, "@c@") != NULL && config_file == NULL)
                 {
-                  g_warning ("beautifier plugin: @c@ in \"%s\" command-pattern key but no config file set",
-                             profile);
-                  g_warning ("entry \"%s\" disabled", display_name);
+                  /* translators: %s and %s are replaced with the profile name and the entry name */
+                  ide_object_warning (self,
+                                      _("Beautifier plugin: @c@ in “%s” command-pattern key but no config 
file set: entry “%s” disabling"),
+                                      profile,
+                                      display_name);
                   continue;
                 }
 
               if (!g_shell_parse_argv (command_pattern, &argc, &strv, &error))
                 {
                   if (entry.is_config_file_temp)
-                    gb_beautifier_helper_remove_temp_for_file (config_file);
+                    gb_beautifier_helper_remove_temp_for_file (self, config_file);
 
                   goto fail;
                 }
@@ -332,15 +356,18 @@ add_entries_from_config_ini_file (GbBeautifierEditorAddin *self,
                       if (g_strstr_len (strv[j], -1, "internal"))
                         is_executable = TRUE;
 
-                      if (NULL == (arg.str = copy_to_tmp_file (self->tmp_dir, strv[j], is_executable)))
+                      if (NULL == (arg.str = copy_to_tmp_file (self, self->tmp_dir, strv[j], is_executable)))
                         {
-                          g_warning ("beautifier plugin: can't create tmp file for:%s", strv[j]);
-                          g_warning ("entry \"%s\" disabled", display_name);
+                          /* translators: %s and %s are replaced with the profile name and the entry name */
+                          ide_object_warning (self,
+                                              _("Beautifier plugin: can't create temporary file for “%s”: 
entry “%s” disabling"),
+                                              strv[j],
+                                              display_name);
 
                           if (entry.is_config_file_temp)
-                            gb_beautifier_helper_remove_temp_for_file (config_file);
+                            gb_beautifier_helper_remove_temp_for_file (self, config_file);
 
-                          gb_beautifier_helper_config_entry_remove_temp_files (&entry);
+                          gb_beautifier_helper_config_entry_remove_temp_files (self, &entry);
                           config_entry_clear_func (&entry);
 
                           continue;
@@ -374,7 +401,8 @@ add_entries_from_config_ini_file (GbBeautifierEditorAddin *self,
   return TRUE;
 
 fail:
-  g_warning ("Beautifier plugin:\"%s\"", error->message);
+  /* translators: %s is replaced with the error message */
+  ide_object_warning (self, _("Beautifier plugin: “%s”"), error->message);
 
   return FALSE;
 }
@@ -473,7 +501,10 @@ add_entries_from_base_path (GbBeautifierEditorAddin *self,
     }
 
   if (error != NULL)
-    g_warning ("\"%s\"", error->message);
+    {
+      /* translators: %s is replaced with the error message */
+      ide_object_warning (self,_("Beautifier plugin: %s"), error->message);
+    }
 
   return ret;
 }
@@ -507,13 +538,15 @@ gb_beautifier_config_get_map (GbBeautifierEditorAddin *self,
   key_file = g_key_file_new ();
   if (!g_file_query_exists (file, NULL))
     {
-      g_debug ("%s doesn't exist", file_name);
+      /* translators: %s is replaced with a path name */
+      ide_object_warning (self, _("Beautifier plugin: the path “%s” doesn't exist"), file_name);
       return map;
     }
 
   if (!g_file_load_contents (file, NULL, &data, &data_len, NULL, NULL))
     {
-      g_debug ("Can't read the resource file:%s", file_name);
+      /* translators: %s is replaced with a path name */
+      ide_object_warning (self, _("Beautifier plugin: can't read the following resource file: “%s”"), 
file_name);
       return map;
     }
 
diff --git a/src/plugins/beautifier/gb-beautifier-editor-addin.c 
b/src/plugins/beautifier/gb-beautifier-editor-addin.c
index 14f2524..d3ca177 100644
--- a/src/plugins/beautifier/gb-beautifier-editor-addin.c
+++ b/src/plugins/beautifier/gb-beautifier-editor-addin.c
@@ -35,7 +35,7 @@
 
 static void editor_addin_iface_init (IdeEditorAddinInterface *iface);
 
-G_DEFINE_TYPE_EXTENDED (GbBeautifierEditorAddin, gb_beautifier_editor_addin, G_TYPE_OBJECT, 0,
+G_DEFINE_TYPE_EXTENDED (GbBeautifierEditorAddin, gb_beautifier_editor_addin, IDE_TYPE_OBJECT, 0,
                         G_IMPLEMENT_INTERFACE (IDE_TYPE_EDITOR_ADDIN, editor_addin_iface_init))
 
 static void
@@ -50,7 +50,10 @@ process_launch_async_cb (GObject      *object,
   g_assert (G_IS_ASYNC_RESULT (result));
 
   if (!gb_beautifier_process_launch_finish (self, result, &error))
-    g_warning ("\"%s\"", error->message);
+    {
+      /* translators: %s is replaced with the error message */
+      ide_object_warning (self, _("Beautifier plugin: %s"), error->message);
+    }
 }
 
 static void
@@ -80,20 +83,20 @@ view_activate_beautify_action_cb (GSimpleAction *action,
   source_view = ide_editor_view_get_view (view);
   if (!GTK_SOURCE_IS_VIEW (source_view))
     {
-      g_warning ("Beautifier Plugin: the view is not a GtkSourceView");
+      ide_object_warning (self, _("Beautifier Plugin: the view is not a GtkSourceView"));
       return;
     }
 
   param = g_variant_get_string (variant, NULL);
   if (g_strcmp0 (param, "none") == 0)
     {
-      g_warning ("Beautifier Plugin: no default beautifier found");
+      ide_object_warning (self, _("Beautifier Plugin: no default beautifier found"));
       return;
     }
 
   if (!gtk_text_view_get_editable (GTK_TEXT_VIEW (source_view)))
     {
-      g_warning ("Beautifier Plugin: the buffer is not writable");
+      ide_object_warning (self, _("Beautifier Plugin: the buffer is not writable"));
       return;
     }
 
@@ -101,7 +104,7 @@ view_activate_beautify_action_cb (GSimpleAction *action,
   gtk_text_buffer_get_selection_bounds (buffer, &begin, &end);
   if (gtk_text_iter_equal (&begin, &end))
     {
-      g_warning ("Beautifier Plugin: Nothing selected");
+      ide_object_warning (self, _("Beautifier Plugin: Nothing selected"));
       return;
     }
 
@@ -364,8 +367,8 @@ get_entries_async_cb (GObject      *object,
 
   if (NULL == (ret = gb_beautifier_config_get_entries_finish (self, result, &error)))
     {
-      g_warning ("\"%s\"", error->message);
-      g_warning ("Beautifier plugin disabled");
+      /* translators: %s is replaced with the error message */
+      ide_object_warning (self, _("Beautifier plugin: no valid entries, disabling: %s"), error->message);
 
       /* TODO: properly disable the plugin */
       return;
@@ -421,7 +424,7 @@ gb_beautifier_editor_addin_unload (IdeEditorAddin       *addin,
       for (guint i = 0; i < self->entries->len; i++)
         {
           entry = &g_array_index (self->entries, GbBeautifierConfigEntry, i);
-          gb_beautifier_helper_config_entry_remove_temp_files (entry);
+          gb_beautifier_helper_config_entry_remove_temp_files (self, entry);
         }
 
       g_clear_pointer (&self->entries, g_array_unref);
@@ -431,7 +434,7 @@ gb_beautifier_editor_addin_unload (IdeEditorAddin       *addin,
   if (self->tmp_dir != NULL)
     {
       tmp_file = g_file_new_for_path (self->tmp_dir);
-      gb_beautifier_helper_remove_temp_for_file (tmp_file);
+      gb_beautifier_helper_remove_temp_for_file (self, tmp_file);
       g_clear_pointer (&self->tmp_dir, g_free);
     }
 
diff --git a/src/plugins/beautifier/gb-beautifier-editor-addin.h 
b/src/plugins/beautifier/gb-beautifier-editor-addin.h
index 4353081..642bc8c 100644
--- a/src/plugins/beautifier/gb-beautifier-editor-addin.h
+++ b/src/plugins/beautifier/gb-beautifier-editor-addin.h
@@ -24,6 +24,6 @@ G_BEGIN_DECLS
 
 #define GB_TYPE_BEAUTIFIER_EDITOR_ADDIN (gb_beautifier_editor_addin_get_type())
 
-G_DECLARE_FINAL_TYPE (GbBeautifierEditorAddin, gb_beautifier_editor_addin, GB, BEAUTIFIER_EDITOR_ADDIN, 
GObject)
+G_DECLARE_FINAL_TYPE (GbBeautifierEditorAddin, gb_beautifier_editor_addin, GB, BEAUTIFIER_EDITOR_ADDIN, 
IdeObject)
 
 G_END_DECLS
diff --git a/src/plugins/beautifier/gb-beautifier-helper.c b/src/plugins/beautifier/gb-beautifier-helper.c
index ffc620d..b68bd62 100644
--- a/src/plugins/beautifier/gb-beautifier-helper.c
+++ b/src/plugins/beautifier/gb-beautifier-helper.c
@@ -19,12 +19,14 @@
 #define G_LOG_DOMAIN "gb-beautifier-helper"
 
 #include <glib.h>
+#include <glib/gi18n.h>
 #include <glib/gstdio.h>
 #include <gtksourceview/gtksource.h>
 #include <ide.h>
 #include <string.h>
 
 #include "gb-beautifier-helper.h"
+#include "gb-beautifier-private.h"
 
 typedef struct
 {
@@ -45,7 +47,8 @@ check_path_is_in_tmp_dir (const gchar *path,
 }
 
 void
-gb_beautifier_helper_remove_temp_for_path (const gchar *path)
+gb_beautifier_helper_remove_temp_for_path (GbBeautifierEditorAddin *self,
+                                           const gchar             *path)
 {
   const gchar *tmp_dir;
 
@@ -57,15 +60,18 @@ gb_beautifier_helper_remove_temp_for_path (const gchar *path)
     g_unlink (path);
   else
     {
-      g_warning ("Beautifier plugin: blocked attempt to remove a config file outside of the tmp dir '%s': 
'%s'",
-                 tmp_dir,
-                 path);
+      /* translators: %s and %s are replaced with the temporary dir and the file path */
+      ide_object_warning (self,
+                          _("Beautifier plugin: blocked attempt to remove a file outside of the “%s” 
temporary dir: “%s”"),
+                          tmp_dir,
+                          path);
       return;
     }
 }
 
 void
-gb_beautifier_helper_remove_temp_for_file (GFile *file)
+gb_beautifier_helper_remove_temp_for_file (GbBeautifierEditorAddin *self,
+                                           GFile                   *file)
 {
   const gchar *tmp_dir;
   g_autofree gchar *path = NULL;
@@ -79,15 +85,18 @@ gb_beautifier_helper_remove_temp_for_file (GFile *file)
     g_file_delete (file, NULL, NULL);
   else
     {
-      g_warning ("Beautifier plugin: blocked attempt to remove a config file outside of the tmp dir '%s': 
'%s'",
-                 tmp_dir,
-                 path);
+      /* translators: %s and %s are replaced with the temporary dir and the file path */
+      ide_object_warning (self,
+                          _("Beautifier plugin: blocked attempt to remove a file outside of the “%s” 
temporary dir: “%s”"),
+                          tmp_dir,
+                          path);
       return;
     }
 }
 
 void
-gb_beautifier_helper_config_entry_remove_temp_files (GbBeautifierConfigEntry *config_entry)
+gb_beautifier_helper_config_entry_remove_temp_files (GbBeautifierEditorAddin *self,
+                                                     GbBeautifierConfigEntry *config_entry)
 {
   GbBeautifierCommandArg *arg;
   g_autofree gchar *config_path = NULL;
@@ -106,9 +115,11 @@ gb_beautifier_helper_config_entry_remove_temp_files (GbBeautifierConfigEntry *co
             g_file_delete (config_entry->config_file, NULL, NULL);
           else
             {
-              g_warning ("Beautifier plugin: blocked attempt to remove a config file outside of the tmp dir 
'%s': '%s'",
-                         tmp_dir,
-                         config_path);
+              /* translators: %s and %s are replaced with the temporary dir and the file path */
+              ide_object_warning (self,
+                                  _("Beautifier plugin: blocked attempt to remove a file outside of the “%s” 
temporary dir: “%s”"),
+                                  tmp_dir,
+                                  config_path);
               return;
             }
         }
@@ -125,9 +136,10 @@ gb_beautifier_helper_config_entry_remove_temp_files (GbBeautifierConfigEntry *co
                 g_unlink (arg->str);
               else
                 {
-                  g_warning ("Beautifier plugin: blocked attempt to remove a config file outside of the tmp 
dir '%s': '%s'",
-                             tmp_dir,
-                             arg->str);
+                  ide_object_warning (self,
+                                      _("Beautifier plugin: blocked attempt to remove a file outside of the 
“%s” temporary dir: “%s”"),
+                                      tmp_dir,
+                                      arg->str);
                   return;
                 }
             }
diff --git a/src/plugins/beautifier/gb-beautifier-helper.h b/src/plugins/beautifier/gb-beautifier-helper.h
index 0882c3c..6c662ba 100644
--- a/src/plugins/beautifier/gb-beautifier-helper.h
+++ b/src/plugins/beautifier/gb-beautifier-helper.h
@@ -41,8 +41,11 @@ const gchar  *gb_beautifier_helper_get_lang_id                    (GbBeautifierE
 gchar        *gb_beautifier_helper_match_and_replace              (const gchar              *str,
                                                                    const gchar              *pattern,
                                                                    const gchar              *replacement);
-void          gb_beautifier_helper_config_entry_remove_temp_files (GbBeautifierConfigEntry  *config_entry);
-void          gb_beautifier_helper_remove_temp_for_path           (const gchar              *path);
-void          gb_beautifier_helper_remove_temp_for_file           (GFile                    *file);
+void          gb_beautifier_helper_config_entry_remove_temp_files (GbBeautifierEditorAddin  *self,
+                                                                   GbBeautifierConfigEntry  *config_entry);
+void          gb_beautifier_helper_remove_temp_for_path           (GbBeautifierEditorAddin  *self,
+                                                                   const gchar              *path);
+void          gb_beautifier_helper_remove_temp_for_file           (GbBeautifierEditorAddin  *self,
+                                                                   GFile                    *file);
 
 G_END_DECLS
diff --git a/src/plugins/beautifier/gb-beautifier-private.h b/src/plugins/beautifier/gb-beautifier-private.h
index 18a1313..48a4626 100644
--- a/src/plugins/beautifier/gb-beautifier-private.h
+++ b/src/plugins/beautifier/gb-beautifier-private.h
@@ -21,6 +21,7 @@
 #include <glib-object.h>
 
 #include "ide.h"
+#include "gb-beautifier-editor-addin.h"
 
 G_BEGIN_DECLS
 
@@ -38,4 +39,6 @@ struct _GbBeautifierEditorAddin
   gboolean               has_default;
 };
 
+GbBeautifierEditorAddin    *gb_beautifier_editor_addin_get_editor_perspective    (GbBeautifierEditorAddin 
*self);
+
 G_END_DECLS
diff --git a/src/plugins/beautifier/gb-beautifier-process.c b/src/plugins/beautifier/gb-beautifier-process.c
index 5dc4a8d..4ef0693 100644
--- a/src/plugins/beautifier/gb-beautifier-process.c
+++ b/src/plugins/beautifier/gb-beautifier-process.c
@@ -17,6 +17,7 @@
  */
 
 #include <glib.h>
+#include <glib/gi18n.h>
 #include <gtksourceview/gtksource.h>
 #include <ide.h>
 #include <string.h>
@@ -55,17 +56,17 @@ process_state_free (gpointer data)
   gtk_text_buffer_delete_mark (buffer, state->begin_mark);
   gtk_text_buffer_delete_mark (buffer, state->end_mark);
 
-  gb_beautifier_helper_remove_temp_for_file (state->src_file);
+  gb_beautifier_helper_remove_temp_for_file (state->self, state->src_file);
 
   g_clear_object (&state->src_file);
   g_clear_object (&state->config_file);
 
   if (state->tmp_config_file != NULL)
-    gb_beautifier_helper_remove_temp_for_file (state->tmp_config_file);
+    gb_beautifier_helper_remove_temp_for_file (state->self, state->tmp_config_file);
   if (state->tmp_src_file != NULL)
-    gb_beautifier_helper_remove_temp_for_file (state->tmp_src_file);
+    gb_beautifier_helper_remove_temp_for_file (state->self, state->tmp_src_file);
   if (state->tmp_workdir_file != NULL)
-    gb_beautifier_helper_remove_temp_for_file (state->tmp_workdir_file);
+    gb_beautifier_helper_remove_temp_for_file (state->self, state->tmp_workdir_file);
 
   g_clear_object (&state->tmp_workdir_file);
   g_clear_object (&state->tmp_config_file);
@@ -238,13 +239,19 @@ process_communicate_utf8_cb (GObject      *object,
   if (g_task_return_error_if_cancelled (task))
     return;
 
+  state = (ProcessState *)g_task_get_task_data (task);
   if (stderr_gb != NULL &&
       NULL != (stderr_str = g_bytes_get_data (stderr_gb, NULL)) &&
       !dzl_str_empty0 (stderr_str) &&
       g_utf8_validate (stderr_str, -1, NULL))
     {
       if (g_subprocess_get_if_exited (process) && g_subprocess_get_exit_status (process) != 0)
-        g_warning ("beautify plugin:\n%s", stderr_str);
+        {
+          /* translators: %s is replaced with the command error message */
+          ide_object_warning (state->self,
+                              _("Beautifier plugin: command error output: %s"),
+                              stderr_str);
+        }
     }
 
   if (stdout_gb != NULL)
@@ -252,11 +259,10 @@ process_communicate_utf8_cb (GObject      *object,
 
   if (stdout_gb != NULL && dzl_str_empty0 (stdout_str))
     {
-      g_warning ("beautify plugin: output empty");
+      ide_object_warning (state->self, _("Beautifier plugin: the command output is empty"));
     }
   else if (g_utf8_validate (stdout_str, -1, NULL))
     {
-      state = (ProcessState *)g_task_get_task_data (task);
       buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (state->source_view));
       completion = gtk_source_view_get_completion (GTK_SOURCE_VIEW (state->source_view));
 
@@ -280,7 +286,7 @@ process_communicate_utf8_cb (GObject      *object,
       g_task_return_boolean (task, TRUE);
     }
   else
-    g_warning ("beautify plugin: output is not a valid uft8 text");
+    ide_object_warning (state->self,_("Beautify plugin: the output is not a valid utf8 text"));
 }
 
 static void


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