[latexila] Use warning() instead of stderr.printf()



commit c041ad5811336ae87c8f84a5090af651ebc5eb0d
Author: SÃbastien Wilmet <swilmet src gnome org>
Date:   Tue Aug 16 17:14:56 2011 +0200

    Use warning() instead of stderr.printf()
    
    It's better late than never ;)

 src/application.vala          |    4 ++--
 src/build_tool_dialog.vala    |    2 +-
 src/build_tool_runner.vala    |   10 +++++-----
 src/build_tools.vala          |    5 ++---
 src/clean_build_files.vala    |    4 ++--
 src/completion.vala           |    3 +--
 src/custom_statusbar.vala     |    2 +-
 src/document.vala             |    4 ++--
 src/document_structure.vala   |   14 +++++++-------
 src/document_view.vala        |    2 +-
 src/file_browser.vala         |    2 +-
 src/latex_post_processor.vala |    4 ++--
 src/main.vala                 |    2 +-
 src/main_window.vala          |    8 ++++----
 src/most_used_symbols.vala    |    6 ++----
 src/post_processors.vala      |    8 ++++----
 src/preferences_dialog.vala   |    2 +-
 src/projects.vala             |    6 ++----
 src/search.vala               |    2 +-
 src/symbols.vala              |    5 ++---
 src/templates.vala            |   17 +++++++----------
 src/utils.vala                |    3 +--
 22 files changed, 52 insertions(+), 63 deletions(-)
---
diff --git a/src/application.vala b/src/application.vala
index 846a6c9..57e0091 100644
--- a/src/application.vala
+++ b/src/application.vala
@@ -162,7 +162,7 @@ public class Application : GLib.Object
             }
             catch (Error e)
             {
-                stderr.printf ("Error with an icon: %s\n", e.message);
+                warning ("Error with an icon: %s", e.message);
             }
         }
 
@@ -344,7 +344,7 @@ public class Application : GLib.Object
             }
             catch (Error e)
             {
-                stderr.printf ("Warning: get theme icon failed: %s\n", e.message);
+                warning ("Get theme icon failed: %s", e.message);
                 continue;
             }
 
diff --git a/src/build_tool_dialog.vala b/src/build_tool_dialog.vala
index fc96238..4bd4a9b 100644
--- a/src/build_tool_dialog.vala
+++ b/src/build_tool_dialog.vala
@@ -106,7 +106,7 @@ private class BuildToolDialog : Dialog
         catch (Error e)
         {
             string message = "Error: %s".printf (e.message);
-            stderr.printf ("%s\n", message);
+            warning ("%s", message);
 
             Label label_error = new Label (message);
             label_error.set_line_wrap (true);
diff --git a/src/build_tool_runner.vala b/src/build_tool_runner.vala
index 5b20732..79a8b98 100644
--- a/src/build_tool_runner.vala
+++ b/src/build_tool_runner.vala
@@ -72,7 +72,7 @@ public class BuildToolRunner : GLib.Object
         if (0 < tool.extensions.length
             && ! (Utils.get_extension (filename) in extensions))
         {
-            stderr.printf ("Warning: bad file extension\n");
+            warning ("Bad file extension");
             return;
         }
 
@@ -176,11 +176,11 @@ public class BuildToolRunner : GLib.Object
         }
         catch (ConvertError e)
         {
-            stderr.printf ("Read output: convert error: %s\n", e.message);
+            warning ("Read output: convert error: %s", e.message);
         }
         catch (IOChannelError e)
         {
-            stderr.printf ("Read output: IO channel error: %s\n", e.message);
+            warning ("Read output: IO channel error: %s", e.message);
         }
 
         if (length <= 0)
@@ -213,7 +213,7 @@ public class BuildToolRunner : GLib.Object
             if (line_utf8 != null && line_utf8.validate ())
                 output += line_utf8 + "\n";
             else
-                stderr.printf ("Read output failed: %s\n", line);
+                warning ("Read output failed: %s", line);
         }
 
         return true;
@@ -248,7 +248,7 @@ public class BuildToolRunner : GLib.Object
                 post_processor = new RubberPostProcessor ();
                 break;
             default:
-                stderr.printf ("Warning: unknown post processor. Use no-output.");
+                warning ("Unknown post processor. Use no-output.");
                 post_processor = new NoOutputPostProcessor ();
                 break;
         }
diff --git a/src/build_tools.vala b/src/build_tools.vala
index b34caf9..b2579b2 100644
--- a/src/build_tools.vala
+++ b/src/build_tools.vala
@@ -281,8 +281,7 @@ public class BuildTools
             }
             catch (GLib.Error e)
             {
-                stderr.printf ("Warning: impossible to load build tools: %s\n",
-                    e.message);
+                warning ("Impossible to load build tools: %s", e.message);
             }
         }
     }
@@ -434,7 +433,7 @@ public class BuildTools
         }
         catch (Error e)
         {
-            stderr.printf ("Warning: impossible to save build tools: %s\n", e.message);
+            warning ("Impossible to save build tools: %s", e.message);
         }
     }
 
diff --git a/src/clean_build_files.vala b/src/clean_build_files.vala
index 66e2151..330d597 100644
--- a/src/clean_build_files.vala
+++ b/src/clean_build_files.vala
@@ -119,7 +119,7 @@ public class CleanBuildFiles : GLib.Object
         }
         catch (Error e)
         {
-            stderr.printf ("Error: clean build files: %s\n", e.message);
+            warning ("Clean build files: %s", e.message);
             return files_to_delete;
         }
 
@@ -133,7 +133,7 @@ public class CleanBuildFiles : GLib.Object
             }
             catch (Error e)
             {
-                stderr.printf ("Error: clean build files: %s\n", e.message);
+                warning ("Clean build files: %s", e.message);
                 break;
             }
 
diff --git a/src/completion.vala b/src/completion.vala
index b0c5980..cc42ab5 100644
--- a/src/completion.vala
+++ b/src/completion.vala
@@ -101,8 +101,7 @@ public class CompletionProvider : GLib.Object, SourceCompletionProvider
         }
         catch (GLib.Error e)
         {
-            stderr.printf ("Warning: impossible to load completion data: %s\n",
-                e.message);
+            warning ("Impossible to load completion data: %s", e.message);
         }
     }
 
diff --git a/src/custom_statusbar.vala b/src/custom_statusbar.vala
index f876633..8cb4e52 100644
--- a/src/custom_statusbar.vala
+++ b/src/custom_statusbar.vala
@@ -1,7 +1,7 @@
 /*
  * This file is part of LaTeXila.
  *
- * Copyright  2010 SÃbastien Wilmet
+ * Copyright  2010-2011 SÃbastien Wilmet
  *
  * LaTeXila is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/src/document.vala b/src/document.vala
index 6ae7dd3..c35c53a 100644
--- a/src/document.vala
+++ b/src/document.vala
@@ -135,7 +135,7 @@ public class Document : Gtk.SourceBuffer
         }
         catch (Error e)
         {
-            stderr.printf ("Error: %s\n", e.message);
+            warning ("%s", e.message);
 
             string primary_msg = _("Impossible to load the file '%s'.")
                 .printf (location.get_parse_name ());
@@ -231,7 +231,7 @@ public class Document : Gtk.SourceBuffer
             }
             else
             {
-                stderr.printf ("Error: %s\n", e.message);
+                warning ("%s", e.message);
 
                 string primary_msg = _("Impossible to save the file.");
                 TabInfoBar infobar = tab.add_message (primary_msg, e.message,
diff --git a/src/document_structure.vala b/src/document_structure.vala
index 18e8e37..76c079c 100644
--- a/src/document_structure.vala
+++ b/src/document_structure.vala
@@ -108,7 +108,7 @@ public class DocumentStructure : GLib.Object
         }
         catch (RegexError e)
         {
-            stderr.printf ("Structure: %s\n", e.message);
+            warning ("Structure: %s", e.message);
         }
     }
 
@@ -200,7 +200,7 @@ public class DocumentStructure : GLib.Object
         if (_measure_parsing_time)
         {
             _timer.stop ();
-            stdout.printf ("Structure parsing took %f seconds\n", _timer.elapsed ());
+            message ("Structure parsing took %f seconds", _timer.elapsed ());
             _timer.reset ();
         }
 
@@ -227,7 +227,7 @@ public class DocumentStructure : GLib.Object
         }
         catch (Error e)
         {
-            stderr.printf ("Structure parsing: chars regex: %s\n", e.message);
+            warning ("Structure parsing: chars regex: %s", e.message);
             return false;
         }
 
@@ -236,7 +236,7 @@ public class DocumentStructure : GLib.Object
             int after_char_index;
             if (! match_info.fetch_pos (0, out start_match_index, out after_char_index))
             {
-                stderr.printf ("Structure parsing: position can not be fetched\n");
+                warning ("Structure parsing: position can not be fetched");
                 return false;
             }
 
@@ -272,7 +272,7 @@ public class DocumentStructure : GLib.Object
             }
             catch (RegexError e)
             {
-                stderr.printf ("Structure parsing: %s\n", e.message);
+                warning ("Structure parsing: %s", e.message);
                 break;
             }
         }
@@ -806,7 +806,7 @@ public class DocumentStructure : GLib.Object
         }
         catch (StructError e)
         {
-            stderr.printf ("Structure: get next sibling or parent: %s\n", e.message);
+            warning ("Structure: get next sibling or parent: %s", e.message);
             return false;
         }
 
@@ -879,7 +879,7 @@ public class DocumentStructure : GLib.Object
             }
             catch (StructError e)
             {
-                stderr.printf ("Structure: get next sibling or parent: %s\n", e.message);
+                warning ("Structure: get next sibling or parent: %s", e.message);
                 return false;
             }
 
diff --git a/src/document_view.vala b/src/document_view.vala
index ce45279..881e8fd 100644
--- a/src/document_view.vala
+++ b/src/document_view.vala
@@ -74,7 +74,7 @@ public class DocumentView : Gtk.SourceView
         }
         catch (GLib.Error e)
         {
-            stderr.printf ("Error completion: %s\n", e.message);
+            warning ("Completion: %s", e.message);
         }
 
         // smart backspace (if indent with spaces)
diff --git a/src/file_browser.vala b/src/file_browser.vala
index e2cfcd0..b70445a 100644
--- a/src/file_browser.vala
+++ b/src/file_browser.vala
@@ -419,7 +419,7 @@ public class FileBrowser : VBox
         }
         catch (Error e)
         {
-            stderr.printf ("Error: %s\n", e.message);
+            warning ("%s", e.message);
 
             // warning dialog
             MessageDialog dialog = new MessageDialog (main_window,
diff --git a/src/latex_post_processor.vala b/src/latex_post_processor.vala
index 6814e4d..411fb4e 100644
--- a/src/latex_post_processor.vala
+++ b/src/latex_post_processor.vala
@@ -125,7 +125,7 @@ private class LatexPostProcessor : PostProcessor
         }
         catch (RegexError e)
         {
-            stderr.printf ("LatexPostProcessor: %s\n", e.message);
+            warning ("LatexPostProcessor: %s", e.message);
         }
     }
 
@@ -828,7 +828,7 @@ private class LatexPostProcessor : PostProcessor
         }
         catch (RegexError e)
         {
-            stderr.printf ("Latex post processor warning: %s\n", e.message);
+            warning ("Latex post processor: %s", e.message);
         }
 
         switch (msg.type)
diff --git a/src/main.vala b/src/main.vala
index 32f9e90..e5460bb 100644
--- a/src/main.vala
+++ b/src/main.vala
@@ -80,7 +80,7 @@ int main (string[] args)
     }
     catch (OptionError e)
     {
-        stderr.printf ("%s\n", e.message);
+        warning ("%s", e.message);
         stderr.printf (_("Run '%s --help' to see a full list of available command line options.\n"),
             args[0]);
         return 1;
diff --git a/src/main_window.vala b/src/main_window.vala
index cf41088..01b9a40 100644
--- a/src/main_window.vala
+++ b/src/main_window.vala
@@ -1731,7 +1731,7 @@ public class MainWindow : Window
         DocumentTab? tab = open_document (file);
 
         if (tab == null)
-            stderr.printf ("Warning: impossible to view log\n");
+            warning ("Impossible to view log");
         else
             tab.document.readonly = true;
     }
@@ -1857,7 +1857,7 @@ public class MainWindow : Window
         }
         catch (Error e)
         {
-            stderr.printf ("Impossible to open the documentation: %s\n", e.message);
+            warning ("Impossible to open the documentation: %s", e.message);
         }
     }
 
@@ -1871,7 +1871,7 @@ public class MainWindow : Window
         }
         catch (Error e)
         {
-            stderr.printf ("Impossible to open the LaTeX reference: %s\n", e.message);
+            warning ("Impossible to open the LaTeX reference: %s", e.message);
         }
     }
 
@@ -1919,7 +1919,7 @@ along with LaTeXila.  If not, see <http://www.gnu.org/licenses/>.""";
         }
         catch (Error e)
         {
-            stderr.printf ("Error with the logo: %s\n", e.message);
+            warning ("Logo: %s", e.message);
         }
 
         show_about_dialog (this,
diff --git a/src/most_used_symbols.vala b/src/most_used_symbols.vala
index 54fa706..8474e32 100644
--- a/src/most_used_symbols.vala
+++ b/src/most_used_symbols.vala
@@ -56,8 +56,7 @@ public class MostUsedSymbols : GLib.Object
         }
         catch (GLib.Error e)
         {
-            stderr.printf ("Warning: impossible to load most used symbols: %s\n",
-                e.message);
+            warning ("Impossible to load the most used symbols: %s", e.message);
         }
     }
 
@@ -254,8 +253,7 @@ public class MostUsedSymbols : GLib.Object
         }
         catch (Error e)
         {
-            stderr.printf ("Warning: impossible to save most used symbols: %s\n",
-                e.message);
+            warning ("Impossible to save the most used symbols: %s", e.message);
         }
     }
 }
diff --git a/src/post_processors.vala b/src/post_processors.vala
index 9c4358d..878d7d6 100644
--- a/src/post_processors.vala
+++ b/src/post_processors.vala
@@ -112,7 +112,7 @@ private class RubberPostProcessor : PostProcessor
         }
         catch (RegexError e)
         {
-            stderr.printf ("RubberPostProcessor: %s\n", e.message);
+            warning ("RubberPostProcessor: %s", e.message);
         }
     }
 
@@ -161,7 +161,7 @@ private class RubberPostProcessor : PostProcessor
             }
             catch (RegexError e)
             {
-                stderr.printf ("Warning: RubberPostProcessor: %s\n", e.message);
+                warning ("RubberPostProcessor: %s", e.message);
                 break;
             }
         }
@@ -206,7 +206,7 @@ private class LatexmkPostProcessor : PostProcessor
         }
         catch (RegexError e)
         {
-            stderr.printf ("LatexmkPostProcessor: %s\n", e.message);
+            warning ("LatexmkPostProcessor: %s", e.message);
         }
     }
 
@@ -284,7 +284,7 @@ private class LatexmkPostProcessor : PostProcessor
             }
             catch (RegexError e)
             {
-                stderr.printf ("Warning: LatexmkPostProcessor: %s\n", e.message);
+                warning ("LatexmkPostProcessor: %s", e.message);
                 break;
             }
         }
diff --git a/src/preferences_dialog.vala b/src/preferences_dialog.vala
index be667c2..f2e9424 100644
--- a/src/preferences_dialog.vala
+++ b/src/preferences_dialog.vala
@@ -71,7 +71,7 @@ public class PreferencesDialog : Dialog
         catch (Error e)
         {
             string message = "Error: %s".printf (e.message);
-            stderr.printf ("%s\n", message);
+            warning ("%s", message);
 
             Label label_error = new Label (message);
             label_error.set_line_wrap (true);
diff --git a/src/projects.vala b/src/projects.vala
index b18569c..1118f8b 100644
--- a/src/projects.vala
+++ b/src/projects.vala
@@ -55,8 +55,7 @@ public class Projects
         }
         catch (GLib.Error e)
         {
-            stderr.printf ("Warning: impossible to load projects: %s\n",
-                e.message);
+            warning ("Impossible to load the projects: %s", e.message);
         }
     }
 
@@ -261,8 +260,7 @@ public class Projects
         }
         catch (Error e)
         {
-            stderr.printf ("Warning: impossible to save projects: %s\n",
-                e.message);
+            warning ("Impossible to save the projects: %s", e.message);
         }
     }
 
diff --git a/src/search.vala b/src/search.vala
index 445cf17..43046d1 100644
--- a/src/search.vala
+++ b/src/search.vala
@@ -285,7 +285,7 @@ public class SearchAndReplace : GLib.Object
         }
         catch (Error e)
         {
-            stderr.printf ("Error search and replace: %s\n", e.message);
+            warning ("Search and replace: %s", e.message);
             Label label = new Label (e.message);
             label.set_line_wrap (true);
             widget = label;
diff --git a/src/symbols.vala b/src/symbols.vala
index 9a1a284..b691a56 100644
--- a/src/symbols.vala
+++ b/src/symbols.vala
@@ -733,8 +733,7 @@ public class Symbols : VBox
                 }
                 catch (Error e)
                 {
-                    stderr.printf ("Warning: impossible to load the symbol: %s\n",
-                        e.message);
+                    warning ("Impossible to load the symbol: %s", e.message);
                     continue;
                 }
             }
@@ -950,7 +949,7 @@ public class Symbols : VBox
         }
         catch (Error e)
         {
-            stderr.printf ("Warning: impossible to load the symbol: %s\n", e.message);
+            warning ("Impossible to load the symbol: %s", e.message);
         }
     }
 
diff --git a/src/templates.vala b/src/templates.vala
index 899a805..187d406 100644
--- a/src/templates.vala
+++ b/src/templates.vala
@@ -88,7 +88,7 @@ public class Templates : GLib.Object
         }
         catch (Error e)
         {
-            stderr.printf ("Warning: load templates failed: %s\n", e.message);
+            warning ("Load templates failed: %s", e.message);
             return;
         }
     }
@@ -338,8 +338,7 @@ public class Templates : GLib.Object
         }
         catch (Error e)
         {
-            stderr.printf ("Warning: impossible to load the icon of the template: %s\n",
-                e.message);
+            warning ("Impossible to load the icon of the template: %s", e.message);
         }
     }
 
@@ -354,8 +353,7 @@ public class Templates : GLib.Object
         }
         catch (Error e)
         {
-            stderr.printf ("Warning: impossible to load the template \"%s\": %s\n", name,
-                e.message);
+            warning ("Impossible to load the template '%s': %s", name, e.message);
         }
     }
 
@@ -379,7 +377,7 @@ public class Templates : GLib.Object
             return;
         }
 
-        stderr.printf ("Warning: template \"%s\" not found.\n", name);
+        warning ("Template '%s' not found.", name);
     }
 
     private IconView create_icon_view (ListStore store)
@@ -426,7 +424,7 @@ public class Templates : GLib.Object
         }
         catch (Error e)
         {
-            stderr.printf ("Warning: impossible to save templates: %s\n", e.message);
+            warning ("Impossible to save the templates: %s", e.message);
         }
     }
 
@@ -481,7 +479,7 @@ public class Templates : GLib.Object
         }
         catch (Error e)
         {
-            stderr.printf ("Warning: impossible to save templates: %s\n", e.message);
+            warning ("Impossible to save the templates: %s", e.message);
         }
     }
 
@@ -514,8 +512,7 @@ public class Templates : GLib.Object
             }
             catch (Error e)
             {
-                stderr.printf ("Warning: impossible to save the template: %s\n",
-                    e.message);
+                warning ("Impossible to save the template: %s", e.message);
             }
 
             valid_iter = model.iter_next (ref iter);
diff --git a/src/utils.vala b/src/utils.vala
index d30d2e8..52104bb 100644
--- a/src/utils.vala
+++ b/src/utils.vala
@@ -160,8 +160,7 @@ namespace Utils
         }
         catch (Error e)
         {
-            stderr.printf ("Warning: delete file \"%s\" failed: %s\n",
-                file.get_parse_name (), e.message);
+            warning ("Delete file '%s' failed: %s", file.get_parse_name (), e.message);
         }
     }
 



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