commit 4ce7e38881ec0cd8f19b34c536e55169e6c62631 Author: phantomjinx <p.g.richard...@phantomjinx.co.uk> Date: Thu Apr 21 21:24:14 2011 +0100
Move and rename filetype_log_error to gtkpod_log_error * Allow function to be used more widely in the application libgtkpod/filetype_iface.c | 9 +-------- libgtkpod/filetype_iface.h | 2 -- libgtkpod/gp_private.c | 7 +++++++ libgtkpod/gp_private.h | 2 ++ libgtkpod/misc.c | 7 ++----- plugins/filetype_flac/flacfile.c | 5 +++-- plugins/filetype_mp3/mp3file.c | 10 +++++----- plugins/filetype_mp4/mp4file.c | 19 ++++++++++--------- plugins/filetype_ogg/oggfile.c | 5 +++-- plugins/filetype_wav/wavfile.c | 5 +++-- 10 files changed, 36 insertions(+), 35 deletions(-) --- diff --git a/libgtkpod/filetype_iface.c b/libgtkpod/filetype_iface.c index 3fa5325..06bb952 100644 --- a/libgtkpod/filetype_iface.c +++ b/libgtkpod/filetype_iface.c @@ -186,7 +186,7 @@ gchar *filetype_no_gain_cmd() { } gboolean filetype_no_read_lyrics(const gchar *filename, gchar **lyrics, GError **error) { - filetype_log_error (error, + gtkpod_log_error (error, _("Error: Lyrics not supported for this file format.")); return FALSE; } @@ -206,10 +206,3 @@ gboolean filetype_no_convert() { gchar * filetype_no_conversion_cmd() { return NULL; } - -void filetype_log_error(GError **error, gchar *msg) { - g_set_error (error, - GTKPOD_GENERAL_ERROR, /* error domain */ - GTKPOD_GENERAL_ERROR_FAILED, /* error code */ - msg); -} diff --git a/libgtkpod/filetype_iface.h b/libgtkpod/filetype_iface.h index 271fdf9..1ee4116 100644 --- a/libgtkpod/filetype_iface.h +++ b/libgtkpod/filetype_iface.h @@ -146,6 +146,4 @@ gchar *filetype_no_gain_cmd(); gboolean filetype_no_convert(); gchar *filetype_no_conversion_cmd(); -void filetype_log_error(GError **error, gchar *msg); - #endif /* FILE_TYPE_IFACE_H_ */ diff --git a/libgtkpod/gp_private.c b/libgtkpod/gp_private.c index 05e90ef..959b9a5 100644 --- a/libgtkpod/gp_private.c +++ b/libgtkpod/gp_private.c @@ -120,3 +120,10 @@ GQuark gtkpod_general_error_quark (void) { return g_quark_from_static_string ("gtkpod-general-error-quark"); } + +void gtkpod_log_error(GError **error, gchar *msg) { + g_set_error (error, + GTKPOD_GENERAL_ERROR, /* error domain */ + GTKPOD_GENERAL_ERROR_FAILED, /* error code */ + msg); +} diff --git a/libgtkpod/gp_private.h b/libgtkpod/gp_private.h index f96dd19..05a0250 100644 --- a/libgtkpod/gp_private.h +++ b/libgtkpod/gp_private.h @@ -102,4 +102,6 @@ typedef enum { GQuark gtkpod_general_error_quark (void); +void gtkpod_log_error(GError **error, gchar *msg); + #endif /* GP_DEFINITIONS_H_ */ diff --git a/libgtkpod/misc.c b/libgtkpod/misc.c index 6da8a0d..19e2208 100644 --- a/libgtkpod/misc.c +++ b/libgtkpod/misc.c @@ -1035,11 +1035,8 @@ gchar *get_string_from_full_template(Track *track, const gchar *full_template, g if (!template) { gchar *fn = get_file_name_from_source(track, SOURCE_PREFER_LOCAL); - g_set_error (error, - GTKPOD_GENERAL_ERROR, /* error domain */ - GTKPOD_GENERAL_ERROR_FAILED, /* error code */ - _("Template ('%s') does not match file type '%s'\n"), - full_template, fn ? fn : ""); + gtkpod_log_error(error, g_strdup_printf(_("Template ('%s') does not match file type '%s'\n"), + full_template, fn ? fn : "")); g_free(fn); return NULL; } diff --git a/plugins/filetype_flac/flacfile.c b/plugins/filetype_flac/flacfile.c index b455f4e..fc72411 100644 --- a/plugins/filetype_flac/flacfile.c +++ b/plugins/filetype_flac/flacfile.c @@ -33,6 +33,7 @@ #include "libgtkpod/charset.h" #include "libgtkpod/gp_itdb.h" #include "libgtkpod/prefs.h" +#include "libgtkpod/gp_private.h" #include "plugin.h" #include "flacfile.h" @@ -54,7 +55,7 @@ Track *flac_get_file_info(const gchar *flacFileName, GError **error) { gchar *filename = NULL; filename = charset_to_utf8(flacFileName); - filetype_log_error(error, g_strdup_printf(_("'%s' does not appear to be an FLAC audio file.\n"), filename)); + gtkpod_log_error(error, g_strdup_printf(_("'%s' does not appear to be an FLAC audio file.\n"), filename)); g_free(filename); } else { @@ -67,7 +68,7 @@ Track *flac_get_file_info(const gchar *flacFileName, GError **error) { if (!FLAC__metadata_get_tags(flacFileName, &tags)) { gchar *filename = NULL; filename = charset_to_utf8(flacFileName); - filetype_log_error(error, g_strdup_printf(_("Error retrieving tags for '%s'.\n"), filename)); + gtkpod_log_error(error, g_strdup_printf(_("Error retrieving tags for '%s'.\n"), filename)); g_free(filename); } else { diff --git a/plugins/filetype_mp3/mp3file.c b/plugins/filetype_mp3/mp3file.c index f946ce0..955474c 100644 --- a/plugins/filetype_mp3/mp3file.c +++ b/plugins/filetype_mp3/mp3file.c @@ -1571,7 +1571,7 @@ gboolean mp3_write_file_info(const gchar *filename, Track *track, GError **error id3file = id3_file_open(filename, ID3_FILE_MODE_READWRITE); if (!id3file) { gchar *fbuf = charset_to_utf8(filename); - filetype_log_error(error, + gtkpod_log_error(error, g_strdup_printf(_("ERROR while opening file: '%s' (%s).\n"), fbuf, g_strerror(errno))); g_free(fbuf); return FALSE; @@ -1646,7 +1646,7 @@ gboolean mp3_write_file_info(const gchar *filename, Track *track, GError **error if (id3_file_update(id3file) != 0) { gchar *fbuf = charset_to_utf8(filename); - filetype_log_error(error, + gtkpod_log_error(error, g_strdup_printf(_("ERROR while writing tag to file: '%s' (%s).\n"), fbuf, g_strerror(errno))); g_free(fbuf); return FALSE; @@ -2779,7 +2779,7 @@ Track *mp3_get_file_info(const gchar *name, GError **error) { } else { gchar *fbuf = charset_to_utf8(name); - filetype_log_error(error, + gtkpod_log_error(error, g_strdup_printf(_("ERROR while opening file: '%s' (%s).\n"), fbuf, g_strerror(errno))); g_free(fbuf); return NULL; @@ -2812,7 +2812,7 @@ Track *mp3_get_file_info(const gchar *name, GError **error) { if (track->tracklen == 0) { /* Tracks with zero play length are ignored by iPod... */ - filetype_log_error(error, + gtkpod_log_error(error, g_strdup_printf(_("File \"%s\" has zero play length. Ignoring.\n"), name)); gp_track_free(track); track = NULL; @@ -2844,7 +2844,7 @@ gboolean id3_lyrics_read(const gchar *filename, gchar **lyrics, GError **error) if (!(id3file = id3_file_open(filename, ID3_FILE_MODE_READONLY))) { gchar *fbuf = charset_to_utf8(filename); - filetype_log_error(error, + gtkpod_log_error(error, g_strdup_printf(_("ERROR while opening file: '%s' (%s).\n"), fbuf, g_strerror(errno))); g_free(fbuf); return FALSE; diff --git a/plugins/filetype_mp4/mp4file.c b/plugins/filetype_mp4/mp4file.c index b8e91ef..7e41f4b 100644 --- a/plugins/filetype_mp4/mp4file.c +++ b/plugins/filetype_mp4/mp4file.c @@ -43,6 +43,7 @@ #include "libgtkpod/charset.h" #include "libgtkpod/misc.h" #include "libgtkpod/prefs.h" +#include "libgtkpod/gp_private.h" #include "mp4file.h" /* ------------------------------------------------------------ @@ -547,7 +548,7 @@ static gboolean mp4_scan_soundcheck(MP4FileHandle mp4File, Track *track) { gboolean mp4_read_soundcheck(const gchar *mp4FileName, Track *track, GError **error) { if (!mp4v2_handle) { - filetype_log_error(error, + gtkpod_log_error(error, g_strdup_printf(_("m4a/m4p/m4b/mp4 soundcheck update for '%s' failed: m4a/m4p/m4b/mp4 not supported without the mp4v2 library. You must install the mp4v2 library.\n"), mp4FileName)); return FALSE; } @@ -582,7 +583,7 @@ gboolean mp4_read_soundcheck(const gchar *mp4FileName, Track *track, GError **er } if (!audio_or_video_found) { gchar *filename = charset_to_utf8(mp4FileName); - filetype_log_error(error, + gtkpod_log_error(error, g_strdup_printf(_("'%s' does not appear to be a m4a/m4b/m4v/mp4 audio or video file.\n"), filename)); g_free(filename); } @@ -590,7 +591,7 @@ gboolean mp4_read_soundcheck(const gchar *mp4FileName, Track *track, GError **er } else { gchar *filename = charset_to_utf8(mp4FileName); - filetype_log_error(error, + gtkpod_log_error(error, g_strdup_printf(_("Could not open '%s' for reading, or file is not an m4a/m4b/m4v/mp4 file.\n"), filename)); g_free(filename); } @@ -600,7 +601,7 @@ gboolean mp4_read_soundcheck(const gchar *mp4FileName, Track *track, GError **er Track *mp4_get_file_info(const gchar *mp4FileName, GError **error) { if (!mp4v2_handle) { - filetype_log_error(error, g_strdup_printf(_("Import of '%s' failed: file type not supported without the mp4v2 library. You must install the mp4v2 library.\n"), mp4FileName)); + gtkpod_log_error(error, g_strdup_printf(_("Import of '%s' failed: file type not supported without the mp4v2 library. You must install the mp4v2 library.\n"), mp4FileName)); return NULL; } @@ -848,7 +849,7 @@ Track *mp4_get_file_info(const gchar *mp4FileName, GError **error) { } if (!audio_or_video_found) { gchar *filename = charset_to_utf8(mp4FileName); - filetype_log_error(error, + gtkpod_log_error(error, g_strdup_printf(_("'%s' does not appear to be a m4a/m4p/m4b/mp4 audio or video file.\n"), filename)); g_free(filename); } @@ -856,7 +857,7 @@ Track *mp4_get_file_info(const gchar *mp4FileName, GError **error) { } else { gchar *filename = charset_to_utf8(mp4FileName); - filetype_log_error(error, + gtkpod_log_error(error, g_strdup_printf(_("Could not open '%s' for reading, or file is not an mp4 file.\n"), filename)); g_free(filename); } @@ -866,7 +867,7 @@ Track *mp4_get_file_info(const gchar *mp4FileName, GError **error) { gboolean mp4_write_file_info(const gchar *mp4FileName, Track *track, GError **error) { if (!mp4v2_handle) { - filetype_log_error(error, + gtkpod_log_error(error, g_strdup_printf(_("m4a/m4p/m4b/mp4 metadata update for '%s' failed: m4a/m4p/m4b/mp4 not supported without the mp4v2 library. You must install the mp4v2 library.\n"), mp4FileName)); return FALSE; } @@ -989,7 +990,7 @@ gboolean mp4_write_file_info(const gchar *mp4FileName, Track *track, GError **er } else { gchar *filename = charset_to_utf8(mp4FileName); - filetype_log_error(error, + gtkpod_log_error(error, g_strdup_printf(_("'%s' does not appear to be a m4a/m4b/m4v/mp4 audio file.\n"), filename)); g_free(filename); result = FALSE; @@ -998,7 +999,7 @@ gboolean mp4_write_file_info(const gchar *mp4FileName, Track *track, GError **er } else { gchar *filename = charset_to_utf8(mp4FileName); - filetype_log_error(error, + gtkpod_log_error(error, g_strdup_printf(_("Could not open '%s' for writing, or file is not an m4a/m4b/m4v/mp4 file.\n"), filename)); g_free(filename); result = FALSE; diff --git a/plugins/filetype_ogg/oggfile.c b/plugins/filetype_ogg/oggfile.c index b653040..6f5a07b 100644 --- a/plugins/filetype_ogg/oggfile.c +++ b/plugins/filetype_ogg/oggfile.c @@ -34,6 +34,7 @@ #include "libgtkpod/charset.h" #include "libgtkpod/gp_itdb.h" #include "libgtkpod/prefs.h" +#include "libgtkpod/gp_private.h" #include "plugin.h" #include "oggfile.h" @@ -63,7 +64,7 @@ Track *ogg_get_file_info(const gchar *oggFileName, GError **error) { if (file == NULL) { gchar *filename = charset_to_utf8(oggFileName); - filetype_log_error(error, g_strdup_printf(_("Could not open '%s' for reading.\n"), filename)); + gtkpod_log_error(error, g_strdup_printf(_("Could not open '%s' for reading.\n"), filename)); g_free(filename); } else { @@ -71,7 +72,7 @@ Track *ogg_get_file_info(const gchar *oggFileName, GError **error) { if (ov_open(file, &oggFile, NULL, 0) != 0) { gchar *filename = NULL; filename = charset_to_utf8(oggFileName); - filetype_log_error(error, g_strdup_printf(_("'%s' does not appear to be an Ogg audio file.\n"), filename)); + gtkpod_log_error(error, g_strdup_printf(_("'%s' does not appear to be an Ogg audio file.\n"), filename)); g_free(filename); fclose(file); } diff --git a/plugins/filetype_wav/wavfile.c b/plugins/filetype_wav/wavfile.c index 168ec4e..376133f 100644 --- a/plugins/filetype_wav/wavfile.c +++ b/plugins/filetype_wav/wavfile.c @@ -35,6 +35,7 @@ #include "libgtkpod/charset.h" #include "libgtkpod/gp_itdb.h" #include "libgtkpod/prefs.h" +#include "libgtkpod/gp_private.h" #include "plugin.h" #include "wavfile.h" @@ -95,7 +96,7 @@ Track *wav_get_file_info(const gchar *filename, GError **error) { memset(wav_file, 0, sizeof(WaveFile)); if (!(wav_file->file = fopen(filename, "rb"))) { gchar *fn = charset_to_utf8(filename); - filetype_log_error(error, g_strdup_printf(_("Could not open '%s' for reading.\n"), fn)); + gtkpod_log_error(error, g_strdup_printf(_("Could not open '%s' for reading.\n"), fn)); g_free(fn); g_free(wav_file); wav_file = NULL; @@ -172,7 +173,7 @@ Track *wav_get_file_info(const gchar *filename, GError **error) { g_free(wav_file); wav_file = NULL; fn = charset_to_utf8(filename); - filetype_log_error(error, g_strdup_printf(_("%s does not appear to be a supported wav file.\n"), fn)); + gtkpod_log_error(error, g_strdup_printf(_("%s does not appear to be a supported wav file.\n"), fn)); g_free(fn); return NULL; } ------------------------------------------------------------------------------ Fulfilling the Lean Software Promise Lean software platforms are now widely adopted and the benefits have been demonstrated beyond question. Learn why your peers are replacing JEE containers with lightweight application servers - and what you can gain from the move. http://p.sf.net/sfu/vmware-sfemails _______________________________________________ gtkpod-cvs2 mailing list gtkpod-cvs2@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2