[gnome-commander] Replaced warn_print() with g_warning()



commit 28daebcec60a80c2b065265af9d0c780b211d4d7
Author: Piotr Eljasiak <epiotr src gnome org>
Date:   Mon Dec 13 21:32:19 2010 +0100

    Replaced warn_print() with g_warning()

 src/gnome-cmd-data.cc          |   10 +++++-----
 src/gnome-cmd-file-list.cc     |    2 +-
 src/gnome-cmd-search-dialog.cc |    6 +++---
 src/imageloader.cc             |   10 ++++------
 src/plugin_manager.cc          |    6 +++---
 src/utils.cc                   |   12 ------------
 src/utils.h                    |    1 -
 7 files changed, 16 insertions(+), 31 deletions(-)
---
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 6b07fbe..35242f8 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -165,7 +165,7 @@ inline void save_connections (const gchar *fname)
         fclose (fd);
     }
     else
-        warn_print ("Failed to open the file %s for writing\n", path);
+        g_warning ("Failed to open the file %s for writing", path);
 
     g_free (path);
 }
@@ -210,7 +210,7 @@ inline void save_devices (const gchar *fname)
         fclose (fd);
     }
     else
-        warn_print ("Failed to open the file %s for writing\n", path);
+        g_warning ("Failed to open the file %s for writing", path);
 
     g_free (path);
 }
@@ -252,7 +252,7 @@ inline void save_fav_apps (const gchar *fname)
         fclose (fd);
     }
     else
-        warn_print ("Failed to open the file %s for writing\n", path);
+        g_warning ("Failed to open the file %s for writing", path);
 
     g_free (path);
 }
@@ -344,7 +344,7 @@ inline gboolean load_connections (const gchar *fname)
     }
     else
         if (errno != ENOENT)
-            warn_print ("Failed to open the file %s for reading\n", path);
+            g_warning ("Failed to open the file %s for reading", path);
 
     g_free (path);
 
@@ -643,7 +643,7 @@ inline void load_devices (const gchar *fname)
     }
     else
         if (errno != ENOENT)
-            warn_print ("Failed to open the file %s for reading\n", path);
+            g_warning ("Failed to open the file %s for reading", path);
 
     load_vfs_auto_devices ();
 
diff --git a/src/gnome-cmd-file-list.cc b/src/gnome-cmd-file-list.cc
index b96d1e1..a5f6b08 100644
--- a/src/gnome-cmd-file-list.cc
+++ b/src/gnome-cmd-file-list.cc
@@ -2832,7 +2832,7 @@ static void drag_data_received (GtkWidget *widget, GdkDragContext *context, gint
             break;
 
         default:
-            warn_print ("Unknown context->action in drag_data_received\n");
+            g_warning ("Unknown context->action in drag_data_received");
             return;
     }
 
diff --git a/src/gnome-cmd-search-dialog.cc b/src/gnome-cmd-search-dialog.cc
index 530c025..2982f89 100644
--- a/src/gnome-cmd-search-dialog.cc
+++ b/src/gnome-cmd-search-dialog.cc
@@ -160,7 +160,7 @@ static SearchFileData *read_search_file (SearchData *data, SearchFileData *searc
 
         if (result != GNOME_VFS_OK)
         {
-           warn_print (_("Failed to open file %s: %s\n"), searchfile_data->uri_str, gnome_vfs_result_to_string (result));
+           g_warning (_("Failed to open file %s: %s"), searchfile_data->uri_str, gnome_vfs_result_to_string (result));
            search_file_data_free (searchfile_data);
            return NULL;
         }
@@ -201,14 +201,14 @@ static SearchFileData *read_search_file (SearchData *data, SearchFileData *searc
     result = gnome_vfs_seek (searchfile_data->handle, GNOME_VFS_SEEK_START, searchfile_data->offset);
     if (result != GNOME_VFS_OK)
     {
-        warn_print (_("Failed to seek in file %s: %s\n"), searchfile_data->uri_str, gnome_vfs_result_to_string (result));
+        g_warning (_("Failed to seek in file %s: %s"), searchfile_data->uri_str, gnome_vfs_result_to_string (result));
         search_file_data_free (searchfile_data);
         return NULL;
     }
     result = gnome_vfs_read (searchfile_data->handle, data->search_mem, searchfile_data->len, &ret);
     if (result != GNOME_VFS_OK)
     {
-        warn_print (_("Failed to read from file %s: %s\n"), searchfile_data->uri_str, gnome_vfs_result_to_string (result));
+        g_warning (_("Failed to read from file %s: %s"), searchfile_data->uri_str, gnome_vfs_result_to_string (result));
         search_file_data_free (searchfile_data);
         return NULL;
     }
diff --git a/src/imageloader.cc b/src/imageloader.cc
index 878d393..78b2bde 100644
--- a/src/imageloader.cc
+++ b/src/imageloader.cc
@@ -107,12 +107,11 @@ void IMAGE_init ()
         {
             gchar *path2 = g_build_filename ("../pixmaps", pixmap_files[i], NULL);
 
-            warn_print (_("Couldn't load installed file type pixmap, trying to load from source-dir\n"));
-            warn_print (_("Trying to load %s instead\n"), path2);
+            g_warning (_("Couldn't load installed file type pixmap, trying to load %s instead"), path2);
 
             pixmaps[i] = gnome_cmd_pixmap_new_from_file (path2);
             if (!pixmaps[i])
-                warn_print (_("Can't find the pixmap anywhere. Make sure you have installed the program or is executing gnome-commander from the gnome-commander-%s/src directory\n"), VERSION);
+                g_warning (_("Can't find the pixmap anywhere. Make sure you have installed the program or is executing gnome-commander from the gnome-commander-%s/src directory"), VERSION);
 
             g_free (path2);
         }
@@ -133,11 +132,10 @@ void IMAGE_init ()
         {
             gchar *path2 = g_build_filename ("../pixmaps", pixmap_files[i], NULL);
 
-            warn_print (_("Couldn't load installed pixmap, trying to load from source-dir\n"));
-            warn_print (_("Trying to load %s instead\n"), path2);
+            g_warning (_("Couldn't load installed pixmap, trying to load %s instead"), path2);
 
             if (!load_icon (path2, &e->pixmap, &e->mask, &e->lnk_pixmap, &e->lnk_mask))
-                warn_print (_("Can't find the pixmap anywhere. Make sure you have installed the program or is executing gnome-commander from the gnome-commander-%s/src directory\n"), VERSION);
+                g_warning (_("Can't find the pixmap anywhere. Make sure you have installed the program or is executing gnome-commander from the gnome-commander-%s/src directory"), VERSION);
             g_free (path2);
         }
 
diff --git a/src/plugin_manager.cc b/src/plugin_manager.cc
index 3cdbc0c..33d669f 100644
--- a/src/plugin_manager.cc
+++ b/src/plugin_manager.cc
@@ -150,8 +150,8 @@ static void scan_plugins_in_dir (const gchar *dpath)
 
     if (dir == NULL)
     {
-        gchar *msg = g_strdup_printf ("Could not list files in %s: %s\n", dpath, strerror (errno));
-        warn_print (msg);
+        gchar *msg = g_strdup_printf ("Could not list files in %s: %s", dpath, strerror (errno));
+        g_warning (msg);
         g_free (msg);
         return;
     }
@@ -206,7 +206,7 @@ void plugin_manager_init ()
 {
     if (plugins)
     {
-        warn_print ("plugin_manager already initiated\n");
+        g_warning ("plugin_manager already initiated");
         return;
     }
 
diff --git a/src/utils.cc b/src/utils.cc
index f3bad07..c3780a9 100644
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -93,18 +93,6 @@ void DEBUG (gchar flag, const gchar *format, ...)
 }
 
 
-void warn_print (const gchar *fmt, ...)
-{
-    va_list     argptr;
-    char        string[1024];
-
-    va_start (argptr,fmt);
-    vsnprintf (string,sizeof(string),fmt,argptr);
-    va_end (argptr);
-    g_printerr ("WARNING: %s", string);
-}
-
-
 void run_command_indir (const gchar *in_command, const gchar *dir, gboolean term)
 {
     gchar *command;
diff --git a/src/utils.h b/src/utils.h
index e721520..09acf5f 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -45,7 +45,6 @@ inline gboolean DEBUG_ENABLED (gchar flag)
 }
 
 void DEBUG (gchar flag, const gchar *fmt, ...);
-void warn_print (const gchar *fmt, ...);
 
 void gnome_cmd_error_message (const gchar *title, GError *error);
 



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