[easytag/wip/core-refactoring] WIP avoid using filename_to_display()
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag/wip/core-refactoring] WIP avoid using filename_to_display()
- Date: Sat, 10 Jan 2015 01:15:07 +0000 (UTC)
commit 7edb40e2ec0cb76b9bb43ccf33028f066aa69828
Author: David King <amigadave amigadave com>
Date: Sat Jan 10 00:27:46 2015 +0000
WIP avoid using filename_to_display()
Use the GLib functions for converting filenames from the GLib file
encoding to UTF-8 for display. Avoid trying to guess the encoding, and
only pay attention to the G_FILENAME_ENCODING environment variable as an
override.
src/application.c | 19 ++++++++-------
src/browser.c | 24 +++++++++----------
src/charset.c | 58 -----------------------------------------------
src/charset.h | 1 -
src/easytag.c | 12 +++++-----
src/file.c | 6 ++--
src/file_list.c | 36 ++++++++++++++++-------------
src/load_files_dialog.c | 10 ++++----
src/playlist_dialog.c | 2 +-
src/scan_dialog.c | 2 +-
src/tags/id3_tag.c | 14 +++--------
src/tags/mp4_tag.cc | 4 ---
src/tags/ogg_tag.c | 9 -------
13 files changed, 61 insertions(+), 136 deletions(-)
---
diff --git a/src/application.c b/src/application.c
index a970cc4..0048cf3 100644
--- a/src/application.c
+++ b/src/application.c
@@ -408,7 +408,7 @@ et_application_open (GApplication *self,
GError *err = NULL;
GFileType type;
gchar *path;
- gchar *path_utf8;
+ gchar *display_path;
priv = et_application_get_instance_private (ET_APPLICATION (self));
@@ -421,7 +421,8 @@ et_application_open (GApplication *self,
check_for_hidden_path_in_tree (arg);
path = g_file_get_path (arg);
- path_utf8 = filename_to_display (path);
+ /* TODO: Use g_filename_display_basename? */
+ display_path = g_filename_display_name (path);
info = g_file_query_info (arg, G_FILE_ATTRIBUTE_STANDARD_TYPE,
G_FILE_QUERY_INFO_NONE, NULL, &err);
@@ -430,17 +431,17 @@ et_application_open (GApplication *self,
if (activated)
{
Log_Print (LOG_ERROR, _("Error while querying information for file ‘%s’: %s"),
- path_utf8, err->message);
+ display_path, err->message);
}
else
{
g_warning ("Error while querying information for file: '%s' (%s)",
- path_utf8, err->message);
+ display_path, err->message);
}
g_free (path);
- g_free (path_utf8);
+ g_free (display_path);
g_error_free (err);
return;
}
@@ -460,7 +461,7 @@ et_application_open (GApplication *self,
priv->init_directory = path;
}
- g_free (path_utf8);
+ g_free (display_path);
g_object_unref (info);
break;
case G_FILE_TYPE_REGULAR:
@@ -469,7 +470,7 @@ et_application_open (GApplication *self,
if (parent)
{
- g_free (path_utf8);
+ g_free (display_path);
g_free (path);
if (activated)
@@ -493,9 +494,9 @@ et_application_open (GApplication *self,
}
/* Fall through on error. */
default:
- Log_Print (LOG_WARNING, _("Cannot open path ‘%s’"), path_utf8);
+ Log_Print (LOG_WARNING, _("Cannot open path ‘%s’"), display_path);
g_free (path);
- g_free (path_utf8);
+ g_free (display_path);
return;
break;
}
diff --git a/src/browser.c b/src/browser.c
index 7ae6593..c0228c2 100644
--- a/src/browser.c
+++ b/src/browser.c
@@ -896,7 +896,7 @@ Browser_Tree_Node_Selected (EtBrowser *self, GtkTreeSelection *selection)
et_browser_set_current_path (self, pathName);
/* Display the selected path into the BrowserEntry */
- pathName_utf8 = filename_to_display(pathName);
+ pathName_utf8 = g_filename_display_name (pathName);
gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(priv->entry_combo))), pathName_utf8);
/* Start to read the directory */
@@ -3200,7 +3200,6 @@ Browser_Tree_Rename_Directory (EtBrowser *self,
GtkTreeIter iter;
GtkTreePath *childpath;
GtkTreePath *parentpath;
- gchar *new_basename;
gchar *new_basename_utf8;
gchar *path;
@@ -3240,7 +3239,7 @@ Browser_Tree_Rename_Directory (EtBrowser *self,
if (childpath == NULL)
{
// ERROR! Could not find it!
- gchar *text_utf8 = filename_to_display(textsplit[i]);
+ gchar *text_utf8 = g_filename_display_name (textsplit[i]);
g_critical ("Error: Searching for %s, could not find node %s in tree.",
last_path, text_utf8);
g_strfreev(textsplit);
@@ -3255,8 +3254,7 @@ Browser_Tree_Rename_Directory (EtBrowser *self,
gtk_tree_path_free(parentpath);
/* Rename the on-screen node */
- new_basename = g_path_get_basename(new_path);
- new_basename_utf8 = filename_to_display(new_basename);
+ new_basename_utf8 = g_filename_display_basename (new_path);
gtk_tree_store_set(priv->directory_model, &iter,
TREE_COLUMN_DIR_NAME, new_basename_utf8,
TREE_COLUMN_FULL_PATH, new_path,
@@ -3271,7 +3269,6 @@ Browser_Tree_Rename_Directory (EtBrowser *self,
g_free(path);
g_strfreev(textsplit);
- g_free(new_basename);
g_free(new_basename_utf8);
}
@@ -3802,7 +3799,7 @@ open_file_selection_dialog (GtkWidget *entry,
if (response == GTK_RESPONSE_ACCEPT)
{
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
- filename_utf8 = filename_to_display (filename);
+ filename_utf8 = g_filename_display_name (filename);
gtk_entry_set_text (GTK_ENTRY (entry), filename_utf8);
g_free (filename);
g_free (filename_utf8);
@@ -4179,7 +4176,8 @@ et_browser_show_rename_directory_dialog (EtBrowser *self)
return;
}
- directory_name_utf8 = filename_to_display(directory_name);
+ /* FIXME: Use g_filename_display_basename()? */
+ directory_name_utf8 = g_filename_display_name (directory_name);
builder = gtk_builder_new ();
gtk_builder_add_from_resource (builder,
@@ -4391,9 +4389,9 @@ Rename_Directory (EtBrowser *self)
/* Build the current and new absolute paths */
last_path = g_strconcat(directory_parent, directory_last_name, NULL);
- last_path_utf8 = filename_to_display(last_path);
+ last_path_utf8 = g_filename_display_name (last_path);
new_path = g_strconcat(directory_parent, directory_new_name_file, NULL);
- new_path_utf8 = filename_to_display(new_path);
+ new_path_utf8 = g_filename_display_name (new_path);
/* TODO: Replace with g_open_dir() (or more likely g_file_move()). */
/* Check if the new directory name doesn't already exists, and detect if
@@ -4460,7 +4458,7 @@ Rename_Directory (EtBrowser *self)
/* Temporary path (useful when changing only string case) */
tmp_path = g_strdup_printf("%s.XXXXXX",last_path);
- tmp_path_utf8 = filename_to_display(tmp_path);
+ tmp_path_utf8 = g_filename_display_name (tmp_path);
if ( (fd_tmp = mkstemp(tmp_path)) >= 0 )
{
@@ -4536,9 +4534,9 @@ Rename_Directory (EtBrowser *self)
ET_Display_File_Data_To_UI(ETCore->ETFileDisplayed);
}else
{
- gchar *tmp = filename_to_display (et_browser_get_current_path (self));
+ gchar *tmp = g_filename_display_name (et_browser_get_current_path (self));
et_browser_entry_set_text (self, tmp);
- g_free(tmp);
+ g_free (tmp);
}
Destroy_Rename_Directory_Window (self);
diff --git a/src/charset.c b/src/charset.c
index cf51138..c3709fd 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -465,64 +465,6 @@ gchar *convert_to_utf8 (const gchar *string)
}
/*
- * Convert a string from the filename system encoding to UTF-8.
- * - conversion OK : returns the UTF-8 string (new allocated)
- * - conversion KO : tries others encodings else returns an 'escaped' string
- */
-gchar *
-filename_to_display (const gchar *string)
-{
- gchar *ret = NULL;
- GError *error = NULL;
-
- g_return_val_if_fail (string != NULL, NULL);
-
- if (g_utf8_validate(string, -1, NULL))
- {
- // String already in UTF-8
- ret = g_strdup(string);
- }else
- {
- const gchar *char_encoding;
-
- // Get encoding associated to the locale without using UTF-8 (ex , if LANG=fr_FR.UTF-8 it will
return ISO-8859-1)
- char_encoding = get_encoding_from_locale(get_locale());
- if (char_encoding)
- {
- //g_print("> char_encoding: %s\n",char_encoding);
- error = NULL;
- ret = g_convert(string, -1, "UTF-8", char_encoding, NULL, NULL, &error);
- }
-
- if (!ret)
- {
- // Failing that, try ISO-8859-1
- error = NULL;
- ret = g_convert(string, -1, "UTF-8", "ISO-8859-1", NULL, NULL, &error);
- }
-
- if (!ret)
- {
- gchar *escaped_str = g_strescape(string, NULL);
- Log_Print (LOG_ERROR,
- _("The filename ‘%s’ could not be converted into UTF-8: %s"),
- escaped_str,
- error && error->message ? error->message : _("Invalid UTF-8"));
- g_clear_error(&error);
-
- ret = escaped_str;
- }
- }
-
-#ifdef G_OS_WIN32
- ET_Win32_Path_Remove_Trailing_Slash (ret);
- ET_Win32_Path_Replace_Slashes (ret);
-#endif /* G_OS_WIN32 */
-
- return ret;
-}
-
-/*
* Convert a string from UTF-8 to the filename system encoding.
* - conversion OK : returns the string in filename system encoding (new allocated)
* - conversion KO : display error message + returns nothing!
diff --git a/src/charset.h b/src/charset.h
index edede76..d59938d 100644
--- a/src/charset.h
+++ b/src/charset.h
@@ -33,7 +33,6 @@ gchar *convert_string_1 (const gchar *string, gssize length, const gchar *from_c
/* Used for Ogg Vorbis and FLAC tags */
gchar *convert_to_utf8 (const gchar *string);
-gchar *filename_to_display (const gchar *string);
gchar *filename_from_display (const gchar *string);
gchar *Try_To_Validate_Utf8_String (const gchar *string);
diff --git a/src/easytag.c b/src/easytag.c
index e8d3db5..c80bfd9 100644
--- a/src/easytag.c
+++ b/src/easytag.c
@@ -953,21 +953,21 @@ Read_Directory (const gchar *path_real)
{
// Message if the directory doesn't exist...
GtkWidget *msgdialog;
- gchar *path_utf8 = filename_to_display(path_real);
+ gchar *display_path = g_filename_display_name (path_real);
msgdialog = gtk_message_dialog_new(GTK_WINDOW(MainWindow),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
_("Cannot read directory ‘%s’"),
- path_utf8);
+ display_path);
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (msgdialog),
"%s", error->message);
gtk_window_set_title(GTK_WINDOW(msgdialog),_("Directory Read Error"));
gtk_dialog_run(GTK_DIALOG(msgdialog));
gtk_widget_destroy(msgdialog);
- g_free(path_utf8);
+ g_free (display_path);
ReadingDirectory = FALSE; //Allow a new reading
et_application_window_browser_set_sensitive (window, TRUE);
@@ -1006,12 +1006,12 @@ Read_Directory (const gchar *path_real)
l = g_list_next (l))
{
gchar *filename_real = l->data; /* Contains real filenames. */
- gchar *filename_utf8 = filename_to_display(filename_real);
+ gchar *display_path = g_filename_display_name (filename_real);
- msg = g_strdup_printf (_("File: ‘%s’"), filename_utf8);
+ msg = g_strdup_printf (_("File: ‘%s’"), display_path);
et_application_window_status_bar_message (window, msg, FALSE);
g_free(msg);
- g_free(filename_utf8);
+ g_free (display_path);
/* Warning: Do not free filename_real because ET_Add_File.. uses it for
* internal structures. */
diff --git a/src/file.c b/src/file.c
index 28c8459..a584349 100644
--- a/src/file.c
+++ b/src/file.c
@@ -1164,7 +1164,7 @@ ET_Set_Filename_File_Name_Item (File_Name *FileName,
FileName->value_ck = g_utf8_collate_key_for_filename(FileName->value_utf8, -1);
}else if (filename)
{
- FileName->value_utf8 = filename_to_display(filename);;
+ FileName->value_utf8 = g_filename_display_name (filename);;
FileName->value = g_strdup(filename);
FileName->value_ck = g_utf8_collate_key_for_filename(FileName->value_utf8, -1);
}else
@@ -1545,7 +1545,7 @@ ET_Save_File_Name_From_UI (const ET_File *ETFile, File_Name *FileName)
/* Set the new filename (in file system encoding). */
FileName->value = g_strconcat(dirname,G_DIR_SEPARATOR_S,filename_new,NULL);
/* Set the new filename (in UTF-8 encoding). */
- FileName->value_utf8 = filename_to_display(FileName->value);
+ FileName->value_utf8 = g_filename_display_name (FileName->value);
// Calculates collate key
FileName->value_ck = g_utf8_collate_key_for_filename(FileName->value_utf8, -1);
@@ -1601,7 +1601,7 @@ ET_Save_File_Name_Internal (const ET_File *ETFile,
/* Set the new filename (in file system encoding). */
FileName->value = g_strconcat(dirname,G_DIR_SEPARATOR_S,filename_new,NULL);
/* Set the new filename (in UTF-8 encoding). */
- FileName->value_utf8 = filename_to_display(FileName->value);
+ FileName->value_utf8 = g_filename_display_name (FileName->value);
// Calculate collate key
FileName->value_ck = g_utf8_collate_key_for_filename(FileName->value_utf8, -1);
diff --git a/src/file_list.c b/src/file_list.c
index 3252a4a..cd7d567 100644
--- a/src/file_list.c
+++ b/src/file_list.c
@@ -205,7 +205,7 @@ et_file_list_add (GList *file_list,
guint undo_key;
GFile *file;
GFileInfo *fileinfo;
- gchar *filename_utf8 = filename_to_display(filename);
+ gchar *display_path = g_filename_display_name (filename);
const gchar *locale_lc_ctype = getenv("LC_CTYPE");
GError *error = NULL;
gboolean success;
@@ -227,8 +227,8 @@ et_file_list_add (GList *file_list,
FileName = ET_File_Name_Item_New();
FileName->saved = TRUE; /* The file hasn't been changed, so it's saved */
FileName->value = filename;
- FileName->value_utf8 = filename_utf8;
- FileName->value_ck = g_utf8_collate_key_for_filename(filename_utf8, -1);
+ FileName->value_utf8 = display_path;
+ FileName->value_ck = g_utf8_collate_key_for_filename (display_path, -1);
/* Fill the File_Tag structure for FileTagList */
FileTag = et_file_tag_new ();
@@ -248,7 +248,7 @@ et_file_list_add (GList *file_list,
{
Log_Print (LOG_ERROR,
"Error reading ID3 tag from file ‘%s’: %s",
- filename_utf8, error->message);
+ display_path, error->message);
g_clear_error (&error);
}
break;
@@ -259,7 +259,7 @@ et_file_list_add (GList *file_list,
{
Log_Print (LOG_ERROR,
_("Error reading tag from Ogg file ‘%s’: %s"),
- filename_utf8, error->message);
+ display_path, error->message);
g_clear_error (&error);
}
break;
@@ -270,7 +270,7 @@ et_file_list_add (GList *file_list,
{
Log_Print (LOG_ERROR,
_("Error reading tag from FLAC file ‘%s’: %s"),
- filename_utf8, error->message);
+ display_path, error->message);
g_clear_error (&error);
}
break;
@@ -280,7 +280,7 @@ et_file_list_add (GList *file_list,
{
Log_Print (LOG_ERROR,
_("Error reading APE tag from file ‘%s’: %s"),
- filename_utf8, error->message);
+ display_path, error->message);
g_clear_error (&error);
}
break;
@@ -290,7 +290,7 @@ et_file_list_add (GList *file_list,
{
Log_Print (LOG_ERROR,
_("Error reading tag from MP4 file ‘%s’: %s"),
- filename_utf8, error->message);
+ display_path, error->message);
g_clear_error (&error);
}
break;
@@ -301,7 +301,7 @@ et_file_list_add (GList *file_list,
{
Log_Print (LOG_ERROR,
_("Error reading tag from WavPack file ‘%s’: %s"),
- filename_utf8, error->message);
+ display_path, error->message);
g_clear_error (&error);
}
break;
@@ -312,7 +312,7 @@ et_file_list_add (GList *file_list,
{
Log_Print (LOG_ERROR,
_("Error reading tag from Opus file ‘%s’: %s"),
- filename_utf8, error->message);
+ display_path, error->message);
g_clear_error (&error);
}
break;
@@ -320,7 +320,9 @@ et_file_list_add (GList *file_list,
case UNKNOWN_TAG:
default:
/* FIXME: Translatable string. */
- Log_Print(LOG_ERROR,"FileTag: Undefined tag type (%d) for file
%s",ETFileDescription->TagType,filename_utf8);
+ Log_Print (LOG_ERROR,
+ "FileTag: Undefined tag type (%d) for file %s",
+ ETFileDescription->TagType, display_path);
break;
}
@@ -328,7 +330,7 @@ et_file_list_add (GList *file_list,
{
Log_Print (LOG_WARNING,
_("The year value ‘%s’ seems to be invalid in file ‘%s’. The information will be lost
when saving"),
- FileTag->year, filename_utf8);
+ FileTag->year, display_path);
}
/* Fill the ET_File_Info structure */
@@ -383,7 +385,9 @@ et_file_list_add (GList *file_list,
case UNKNOWN_FILE:
default:
/* FIXME: Translatable string. */
- Log_Print(LOG_ERROR,"ETFileInfo: Undefined file type (%d) for file
%s",ETFileDescription->FileType,filename_utf8);
+ Log_Print (LOG_ERROR,
+ "ETFileInfo: Undefined file type (%d) for file %s",
+ ETFileDescription->FileType, display_path);
/* To get at least the file size. */
success = et_core_read_file_info (file, ETFileInfo, &error);
break;
@@ -393,7 +397,7 @@ et_file_list_add (GList *file_list,
{
Log_Print (LOG_ERROR,
_("Error while querying information for file ‘%s’: %s"),
- filename_utf8, error->message);
+ display_path, error->message);
g_error_free (error);
}
@@ -463,7 +467,7 @@ et_file_list_add (GList *file_list,
if ( (FileName && FileName->saved==FALSE) || (FileTag && FileTag->saved==FALSE) )
{
Log_Print (LOG_INFO, _("Automatic corrections applied for file ‘%s’"),
- filename_utf8);
+ display_path);
}
/* Add the item to the ArtistAlbum list (placed here to take advantage of previous changes) */
@@ -1219,7 +1223,7 @@ et_file_list_update_directory_name (GList *file_list,
FileName->value = filename_tmp;
/* Replace the filename (in file system encoding). */
g_free (FileName->value_utf8);
- FileName->value_utf8 = filename_to_display (FileName->value);
+ FileName->value_utf8 = g_filename_display_name (FileName->value);
/* Recalculate the collate key. */
g_free (FileName->value_ck);
FileName->value_ck = g_utf8_collate_key_for_filename (FileName->value_utf8, -1);
diff --git a/src/load_files_dialog.c b/src/load_files_dialog.c
index 0c3a2d6..42ab920 100644
--- a/src/load_files_dialog.c
+++ b/src/load_files_dialog.c
@@ -241,7 +241,7 @@ Load_File_Content (G_GNUC_UNUSED GtkButton *button, gpointer user_data)
GError *error = NULL;
gsize size_read;
gchar *path;
- gchar *filename_utf8;
+ gchar *display_path;
gchar *line;
gchar *valid;
@@ -250,7 +250,7 @@ Load_File_Content (G_GNUC_UNUSED GtkButton *button, gpointer user_data)
/* The file to read. */
path = g_file_get_path (file);
- filename_utf8 = filename_to_display (path);
+ display_path = g_filename_display_name (path);
g_free (path);
istream = g_file_read (file, NULL, &error);
@@ -258,15 +258,15 @@ Load_File_Content (G_GNUC_UNUSED GtkButton *button, gpointer user_data)
if (!istream)
{
- Log_Print (LOG_ERROR, _("Cannot open file ‘%s’: %s"), filename_utf8,
+ Log_Print (LOG_ERROR, _("Cannot open file ‘%s’: %s"), display_path,
error->message);
g_error_free (error);
g_object_unref (file);
- g_free (filename_utf8);
+ g_free (display_path);
return;
}
- g_free (filename_utf8);
+ g_free (display_path);
data = g_data_input_stream_new (G_INPUT_STREAM (istream));
/* TODO: Find a safer alternative to _ANY. */
g_data_input_stream_set_newline_type (data,
diff --git a/src/playlist_dialog.c b/src/playlist_dialog.c
index f0c6447..9a1bdcf 100644
--- a/src/playlist_dialog.c
+++ b/src/playlist_dialog.c
@@ -428,7 +428,7 @@ write_button_clicked (EtPlaylistDialog *self)
}
// Path of the playlist file (may be truncated later if PLAYLIST_CREATE_IN_PARENT_DIR is TRUE)
- playlist_path_utf8 = filename_to_display (et_application_window_get_current_path (ET_APPLICATION_WINDOW
(MainWindow)));
+ playlist_path_utf8 = g_filename_display_name (et_application_window_get_current_path
(ET_APPLICATION_WINDOW (MainWindow)));
/* Build the playlist filename. */
if (g_settings_get_boolean (MainSettings, "playlist-use-mask"))
diff --git a/src/scan_dialog.c b/src/scan_dialog.c
index dd3cb61..db1f235 100644
--- a/src/scan_dialog.c
+++ b/src/scan_dialog.c
@@ -522,7 +522,7 @@ Scan_Generate_New_Tag_From_Mask (ET_File *ETFile, gchar *mask)
{
gchar *mask_seq = mask_splitted[mask_splitted_index];
gchar *file_seq = file_splitted[file_splitted_index];
- gchar *file_seq_utf8 = filename_to_display(file_seq);
+ gchar *file_seq_utf8 = g_filename_display_name (file_seq);
//g_print(">%d> seq '%s' '%s'\n",loop,mask_seq,file_seq);
while ( mask_seq && strlen(mask_seq)>0 )
diff --git a/src/tags/id3_tag.c b/src/tags/id3_tag.c
index 49f50e9..68f2fdd 100644
--- a/src/tags/id3_tag.c
+++ b/src/tags/id3_tag.c
@@ -199,24 +199,17 @@ id3tag_write_file_v23tag (const ET_File *ETFile,
if (et_id3tag_check_if_file_is_corrupted (file, error))
{
GtkWidget *msgdialog;
- gchar *basename;
- gchar *basename_utf8;
-
- basename = g_file_get_basename (file);
- basename_utf8 = filename_to_display (basename);
msgdialog = gtk_message_dialog_new (GTK_WINDOW (MainWindow),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
_("As the following corrupted file ‘%s’ will cause an error in
id3lib, it will not be processed"),
- basename_utf8);
+ filename_utf8);
gtk_window_set_title (GTK_WINDOW (msgdialog), _("Corrupted file"));
gtk_dialog_run (GTK_DIALOG (msgdialog));
gtk_widget_destroy (msgdialog);
- g_free (basename);
- g_free (basename_utf8);
g_object_unref (file);
return FALSE;
}
@@ -1047,14 +1040,15 @@ gchar *Id3tag_Get_Field (const ID3Frame *id3_frame, ID3_FieldID id3_fieldid)
//g_print(">>ID:%d >'%s' (string1:'%s')
(num_chars:%d)\n",ID3Field_GetINT(id3_field_encoding),string,string1,num_chars);
out:
- // In case the conversion fails, try 'filename_to_display' character fix...
+ /* In case the conversion fails, try character fix. */
if (num_chars && !string1)
{
gchar *escaped_str = g_strescape(string, NULL);
g_debug ("Id3tag_Get_Field: Trying to fix string '%s'…", escaped_str);
g_free(escaped_str);
- string1 = filename_to_display(string);
+ /* FIXME: Use g_filename_from_utf8()? */
+ string1 = g_filename_display_name (string);
/* TODO: Set a GError instead. */
if (!string1)
diff --git a/src/tags/mp4_tag.cc b/src/tags/mp4_tag.cc
index 32eaf20..8479e17 100644
--- a/src/tags/mp4_tag.cc
+++ b/src/tags/mp4_tag.cc
@@ -253,12 +253,10 @@ mp4tag_write_file_tag (const ET_File *ETFile,
if (!stream.isOpen ())
{
- gchar *filename_utf8 = filename_to_display (filename);
const GError *tmp_error = stream.getError ();
g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
_("Error while opening file ‘%s’: %s"), filename_utf8,
tmp_error->message);
- g_free (filename_utf8);
return FALSE;
}
@@ -289,10 +287,8 @@ mp4tag_write_file_tag (const ET_File *ETFile,
if (!(tag = mp4file.tag ()))
{
- gchar *filename_utf8 = filename_to_display (filename);
g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
_("Error reading tags from file ‘%s’"), filename_utf8);
- g_free (filename_utf8);
return FALSE;
}
diff --git a/src/tags/ogg_tag.c b/src/tags/ogg_tag.c
index 291b7d6..33d43ea 100644
--- a/src/tags/ogg_tag.c
+++ b/src/tags/ogg_tag.c
@@ -709,8 +709,6 @@ ogg_tag_read_file_tag (GFile *file,
{
GFileInputStream *istream;
EtOggState *state;
- gchar *filename;
- gchar *filename_utf8;
g_return_val_if_fail (file != NULL && FileTag != NULL, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
@@ -723,10 +721,6 @@ ogg_tag_read_file_tag (GFile *file,
return FALSE;
}
- filename = g_file_get_path (file);
- filename_utf8 = filename_to_display (filename);
- g_free (filename);
-
{
/* Check for an unsupported ID3v2 tag. */
guchar tmp_id3[4];
@@ -779,7 +773,6 @@ ogg_tag_read_file_tag (GFile *file,
{
g_assert (error == NULL || *error != NULL);
vcedit_clear(state);
- g_free (filename_utf8);
return FALSE;
}
@@ -794,14 +787,12 @@ ogg_tag_read_file_tag (GFile *file,
et_add_file_tags_from_vorbis_comments (vcedit_comments(state), FileTag);
vcedit_clear(state);
- g_free (filename_utf8);
return TRUE;
err:
g_assert (error == NULL || *error != NULL);
g_object_unref (istream);
- g_free (filename_utf8);
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]