[easytag] Move ET_Display_File_Data_To_UI() to main window
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag] Move ET_Display_File_Data_To_UI() to main window
- Date: Thu, 19 Feb 2015 23:30:39 +0000 (UTC)
commit 95dc22cef21b1ed78ccdba4021e4f472bab384b5
Author: David King <amigadave amigadave com>
Date: Thu Feb 19 20:32:05 2015 +0000
Move ET_Display_File_Data_To_UI() to main window
Rename ET_Display_File_Data_To_UI() to
et_application_window_display_et_file() and move it to
EtApplicationWindow.
src/application_window.c | 253 +++++++++++++++++++++++++++++++++++++++++++--
src/application_window.h | 1 +
src/browser.c | 3 +-
src/cddb_dialog.c | 3 +-
src/easytag.c | 3 +-
src/file.c | 232 +-----------------------------------------
src/file.h | 1 -
src/load_files_dialog.c | 3 +-
src/scan_dialog.c | 2 +-
src/tag_area.c | 8 +-
10 files changed, 260 insertions(+), 249 deletions(-)
---
diff --git a/src/application_window.c b/src/application_window.c
index c393674..df763c8 100644
--- a/src/application_window.c
+++ b/src/application_window.c
@@ -27,9 +27,24 @@
#include "easytag.h"
#include "file_area.h"
#include "file_list.h"
+#ifdef ENABLE_FLAC
+#include "flac_header.h"
+#endif
#include "load_files_dialog.h"
#include "log.h"
#include "misc.h"
+#ifdef ENABLE_MP4
+#include "mp4_header.h"
+#endif
+#include "mpeg_header.h"
+#include "monkeyaudio_header.h"
+#include "musepack_header.h"
+#ifdef ENABLE_OGG
+#include "ogg_header.h"
+#endif
+#ifdef ENABLE_OPUS
+#include "opus_header.h"
+#endif
#include "picture.h"
#include "playlist_dialog.h"
#include "preferences_dialog.h"
@@ -40,6 +55,9 @@
#include "setting.h"
#include "status_bar.h"
#include "tag_area.h"
+#ifdef ENABLE_WAVPACK
+#include "wavpack_header.h"
+#endif
/* TODO: Use G_DEFINE_TYPE_WITH_PRIVATE. */
G_DEFINE_TYPE (EtApplicationWindow, et_application_window, GTK_TYPE_APPLICATION_WINDOW)
@@ -503,7 +521,7 @@ on_delete (GSimpleAction *action,
path);
gtk_tree_path_free (path);
- ET_Display_File_Data_To_UI(ETFile);
+ et_application_window_display_et_file (self, ETFile);
et_application_window_browser_select_file_by_et_file (self, ETFile,
FALSE);
fraction = (++progress_bar_index) / (double) nb_files_to_delete;
@@ -566,7 +584,9 @@ on_delete (GSimpleAction *action,
/* It's important to displayed the new item, as it'll check the changes in
et_browser_toggle_display_mode. */
if (ETCore->ETFileDisplayed)
- ET_Display_File_Data_To_UI(ETCore->ETFileDisplayed);
+ {
+ et_application_window_display_et_file (self, ETCore->ETFileDisplayed);
+ }
/*else if (ET_Displayed_File_List_Current())
ET_Display_File_Data_To_UI((ET_File *)ET_Displayed_File_List_Current()->data);*/
@@ -626,7 +646,7 @@ on_undo_file_changes (GSimpleAction *action,
et_application_window_browser_refresh_list (self);
/* Display the current file */
- ET_Display_File_Data_To_UI(ETCore->ETFileDisplayed);
+ et_application_window_display_et_file (self, ETCore->ETFileDisplayed);
et_application_window_update_actions (self);
//ET_Debug_Print_File_List(ETCore->ETFileList,__FILE__,__LINE__,__FUNCTION__);
@@ -668,7 +688,7 @@ on_redo_file_changes (GSimpleAction *action,
et_application_window_browser_refresh_list (ET_APPLICATION_WINDOW (user_data));
/* Display the current file */
- ET_Display_File_Data_To_UI(ETCore->ETFileDisplayed);
+ et_application_window_display_et_file (self, ETCore->ETFileDisplayed);
et_application_window_update_actions (self);
}
@@ -795,7 +815,7 @@ on_undo_last_changes (GSimpleAction *action,
if (ETFile)
{
- ET_Display_File_Data_To_UI (ETFile);
+ et_application_window_display_et_file (self, ETFile);
et_application_window_browser_select_file_by_et_file (self, ETFile,
TRUE);
et_application_window_browser_refresh_file_in_list (self, ETFile);
@@ -822,7 +842,7 @@ on_redo_last_changes (GSimpleAction *action,
if (ETFile)
{
- ET_Display_File_Data_To_UI (ETFile);
+ et_application_window_display_et_file (self, ETFile);
et_application_window_browser_select_file_by_et_file (self, ETFile,
TRUE);
et_application_window_browser_refresh_file_in_list (self, ETFile);
@@ -884,7 +904,7 @@ on_remove_tags (GSimpleAction *action,
et_application_window_browser_refresh_list (self);
/* Display the current file */
- ET_Display_File_Data_To_UI (ETCore->ETFileDisplayed);
+ et_application_window_display_et_file (self, ETCore->ETFileDisplayed);
et_application_window_update_actions (self);
et_application_window_progress_set_fraction (self, 0.0);
@@ -1277,7 +1297,8 @@ on_go_first (GSimpleAction *action,
et_application_window_browser_select_file_by_et_file (self,
(ET_File *)etfilelist->data,
TRUE);
- ET_Display_File_Data_To_UI ((ET_File *)etfilelist->data);
+ et_application_window_display_et_file (self,
+ (ET_File *)etfilelist->data);
}
et_application_window_update_actions (self);
@@ -1315,7 +1336,8 @@ on_go_previous (GSimpleAction *action,
et_application_window_browser_select_file_by_et_file (self,
(ET_File *)etfilelist->data,
TRUE);
- ET_Display_File_Data_To_UI((ET_File *)etfilelist->data);
+ et_application_window_display_et_file (self,
+ (ET_File *)etfilelist->data);
}
et_application_window_update_actions (self);
@@ -1353,7 +1375,8 @@ on_go_next (GSimpleAction *action,
et_application_window_browser_select_file_by_et_file (self,
(ET_File *)etfilelist->data,
TRUE);
- ET_Display_File_Data_To_UI((ET_File *)etfilelist->data);
+ et_application_window_display_et_file (self,
+ (ET_File *)etfilelist->data);
}
et_application_window_update_actions (self);
@@ -1391,7 +1414,8 @@ on_go_last (GSimpleAction *action,
et_application_window_browser_select_file_by_et_file (self,
(ET_File *)etfilelist->data,
TRUE);
- ET_Display_File_Data_To_UI ((ET_File *)etfilelist->data);
+ et_application_window_display_et_file (self,
+ (ET_File *)etfilelist->data);
}
et_application_window_update_actions (self);
@@ -1989,7 +2013,7 @@ et_application_window_select_file_by_et_file (EtApplicationWindow *self,
et_application_window_browser_select_file_by_et_file (self, ETFile, TRUE);
/* Just to update 'ETFileDisplayedList'. */
ET_Displayed_File_List_By_Etfile (ETFile);
- ET_Display_File_Data_To_UI (ETFile);
+ et_application_window_display_et_file (self, ETFile);
et_application_window_update_actions (self);
et_application_window_scan_dialog_update_previews (self);
@@ -2006,6 +2030,211 @@ et_application_window_update_et_file_from_ui (EtApplicationWindow *self)
}
+static void
+et_file_header_fields_free (EtFileHeaderFields *fields)
+{
+ g_free (fields->version);
+ g_free (fields->bitrate);
+ g_free (fields->samplerate);
+ g_free (fields->mode);
+ g_free (fields->size);
+ g_free (fields->duration);
+ g_slice_free (EtFileHeaderFields, fields);
+}
+
+static void
+et_application_window_display_file_name (EtApplicationWindow *self,
+ const ET_File *ETFile)
+{
+ const gchar *new_filename_utf8;
+ gchar *dirname_utf8;
+ gchar *text;
+
+ g_return_if_fail (ETFile != NULL);
+
+ new_filename_utf8 = ((File_Name *)((GList *)ETFile->FileNameNew)->data)->value_utf8;
+
+ /*
+ * Set the path to the file into BrowserEntry (dirbrowser)
+ */
+ dirname_utf8 = g_path_get_dirname (new_filename_utf8);
+ et_application_window_browser_entry_set_text (self, dirname_utf8);
+
+ // And refresh the number of files in this directory
+ text = g_strdup_printf (ngettext ("One file", "%u files",
+ et_file_list_get_n_files_in_path (ETCore->ETFileList,
+ dirname_utf8)),
+ et_file_list_get_n_files_in_path (ETCore->ETFileList,
+ dirname_utf8));
+ et_application_window_browser_label_set_text (self, text);
+ g_free(dirname_utf8);
+ g_free(text);
+}
+
+/*
+ * "Default" way to display File Info to the user interface.
+ */
+static EtFileHeaderFields *
+et_header_fields_new_from_unknown (const ET_File *ETFile)
+{
+ EtFileHeaderFields *fields;
+ ET_File_Info *info;
+ gchar *time = NULL;
+ gchar *time1 = NULL;
+ gchar *size = NULL;
+ gchar *size1 = NULL;
+
+ info = ETFile->ETFileInfo;
+ fields = g_slice_new (EtFileHeaderFields);
+
+ fields->description = _("File");
+
+ /* MPEG, Layer versions */
+ fields->version = g_strdup_printf ("%d, Layer %" G_GSIZE_FORMAT,
+ info->version, info->layer);
+
+ /* Bitrate */
+ fields->bitrate = g_strdup_printf (_("%d kb/s"), info->bitrate);
+
+ /* Samplerate */
+ fields->samplerate = g_strdup_printf (_("%d Hz"), info->samplerate);
+
+ /* Mode */
+ fields->mode = g_strdup_printf ("%d", info->mode);
+
+ /* Size */
+ size = g_format_size (info->size);
+ size1 = g_format_size (ETCore->ETFileDisplayedList_TotalSize);
+ fields->size = g_strdup_printf ("%s (%s)", size, size1);
+ g_free (size);
+ g_free (size1);
+
+ /* Duration */
+ time = Convert_Duration (info->duration);
+ time1 = Convert_Duration (ETCore->ETFileDisplayedList_TotalDuration);
+ fields->duration = g_strdup_printf ("%s (%s)", time, time1);
+ g_free (time);
+ g_free (time1);
+
+ return fields;
+}
+
+/*
+ * Display information of the file (Position + Header + Tag) to the user interface.
+ * Before doing it, it saves data of the file currently displayed
+ */
+void
+et_application_window_display_et_file (EtApplicationWindow *self,
+ ET_File *ETFile)
+{
+ const ET_File_Description *description;
+ const gchar *cur_filename_utf8;
+ gchar *msg;
+ EtFileHeaderFields *fields;
+
+ g_return_if_fail (ETFile != NULL &&
+ ((GList *)ETFile->FileNameCur)->data != NULL);
+ /* For the case where ETFile is an "empty" structure. */
+
+ cur_filename_utf8 = ((File_Name *)((GList *)ETFile->FileNameCur)->data)->value_utf8;
+ description = ETFile->ETFileDescription;
+
+ /* Save the current displayed file */
+ ETCore->ETFileDisplayed = ETFile;
+
+ /* Display position in list + show/hide icon if file writable/read_only (cur_filename) */
+ et_application_window_file_area_set_file_fields (self, ETFile);
+
+ /* Display filename (and his path) (value in FileNameNew) */
+ et_application_window_display_file_name (self, ETFile);
+
+ /* Display tag data */
+ et_application_window_tag_area_display_et_file (self, ETFile);
+
+ /* Display controls in tag area */
+ et_application_window_tag_area_display_controls (self, ETFile);
+
+ /* Display file data, header data and file type */
+ switch (description->FileType)
+ {
+#if defined ENABLE_MP3 && defined ENABLE_ID3LIB
+ case MP3_FILE:
+ case MP2_FILE:
+ fields = et_mpeg_header_display_file_info_to_ui (ETFile);
+ et_application_window_file_area_set_header_fields (self, fields);
+ et_mpeg_file_header_fields_free (fields);
+ break;
+#endif
+#ifdef ENABLE_OGG
+ case OGG_FILE:
+ fields = et_ogg_header_display_file_info_to_ui (ETFile);
+ et_application_window_file_area_set_header_fields (self, fields);
+ et_ogg_file_header_fields_free (fields);
+ break;
+#endif
+#ifdef ENABLE_SPEEX
+ case SPEEX_FILE:
+ fields = et_ogg_header_display_file_info_to_ui (ETFile);
+ et_application_window_file_area_set_header_fields (self, fields);
+ et_ogg_file_header_fields_free (fields);
+ break;
+#endif
+#ifdef ENABLE_FLAC
+ case FLAC_FILE:
+ fields = et_flac_header_display_file_info_to_ui (ETFile);
+ et_application_window_file_area_set_header_fields (self, fields);
+ et_flac_file_header_fields_free (fields);
+ break;
+#endif
+ case MPC_FILE:
+ fields = et_mpc_header_display_file_info_to_ui (ETFile);
+ et_application_window_file_area_set_header_fields (self, fields);
+ et_mpc_file_header_fields_free (fields);
+ break;
+ case MAC_FILE:
+ fields = et_mac_header_display_file_info_to_ui (ETFile);
+ et_application_window_file_area_set_header_fields (self, fields);
+ et_mac_file_header_fields_free (fields);
+ break;
+#ifdef ENABLE_MP4
+ case MP4_FILE:
+ fields = et_mp4_header_display_file_info_to_ui (ETFile);
+ et_application_window_file_area_set_header_fields (self, fields);
+ et_mp4_file_header_fields_free (fields);
+ break;
+#endif
+#ifdef ENABLE_WAVPACK
+ case WAVPACK_FILE:
+ fields = et_wavpack_header_display_file_info_to_ui (ETFile);
+ et_application_window_file_area_set_header_fields (self, fields);
+ et_wavpack_file_header_fields_free (fields);
+ break;
+#endif
+#ifdef ENABLE_OPUS
+ case OPUS_FILE:
+ fields = et_opus_header_display_file_info_to_ui (ETFile);
+ et_application_window_file_area_set_header_fields (self, fields);
+ et_opus_file_header_fields_free (fields);
+ break;
+#endif
+ case OFR_FILE:
+ case UNKNOWN_FILE:
+ default:
+ /* Default displaying. */
+ fields = et_header_fields_new_from_unknown (ETFile);
+ et_application_window_file_area_set_header_fields (self, fields);
+ et_file_header_fields_free (fields);
+ Log_Print (LOG_ERROR,
+ "ETFileInfo: Undefined file type %d for file %s.",
+ (gint)description->FileType, cur_filename_utf8);
+ break;
+ }
+
+ msg = g_strdup_printf (_("File: ā%sā"), cur_filename_utf8);
+ et_application_window_status_bar_message (self, msg, FALSE);
+ g_free (msg);
+}
+
const gchar *
et_application_window_get_current_path (EtApplicationWindow *self)
{
diff --git a/src/application_window.h b/src/application_window.h
index 14173da..8bd8153 100644
--- a/src/application_window.h
+++ b/src/application_window.h
@@ -82,6 +82,7 @@ GtkTreeViewColumn *et_application_window_browser_get_column_for_column_id (EtApp
GtkSortType et_application_window_browser_get_sort_order_for_column_id (EtApplicationWindow *self, gint
column_id);
void et_application_window_browser_select_file_by_iter_string (EtApplicationWindow *self, const gchar
*iter_string, gboolean select);
void et_application_window_update_et_file_from_ui (EtApplicationWindow *self);
+void et_application_window_display_et_file (EtApplicationWindow *self, ET_File *ETFile);
void et_application_window_browser_select_file_by_et_file (EtApplicationWindow *self, const ET_File *file,
gboolean select);
GtkTreePath * et_application_window_browser_select_file_by_et_file2 (EtApplicationWindow *self, const
ET_File *file, gboolean select, GtkTreePath *start_path);
ET_File * et_application_window_browser_select_file_by_dlm (EtApplicationWindow *self, const gchar *string,
gboolean select);
diff --git a/src/browser.c b/src/browser.c
index 2e226b1..eefff15 100644
--- a/src/browser.c
+++ b/src/browser.c
@@ -4539,7 +4539,8 @@ Rename_Directory (EtBrowser *self)
// To update file path in the browser entry
if (ETCore->ETFileDisplayedList)
{
- ET_Display_File_Data_To_UI(ETCore->ETFileDisplayed);
+ et_application_window_display_et_file (ET_APPLICATION_WINDOW (MainWindow),
+ ETCore->ETFileDisplayed);
}else
{
gchar *tmp = filename_to_display (et_browser_get_current_path (self));
diff --git a/src/cddb_dialog.c b/src/cddb_dialog.c
index 6ddbccd..e0db256 100644
--- a/src/cddb_dialog.c
+++ b/src/cddb_dialog.c
@@ -2623,7 +2623,8 @@ Cddb_Set_Track_Infos_To_File_List (EtCDDBDialog *self)
(GDestroyNotify)gtk_tree_path_free);
et_application_window_browser_refresh_list (ET_APPLICATION_WINDOW (MainWindow));
- ET_Display_File_Data_To_UI(ETCore->ETFileDisplayed);
+ et_application_window_display_et_file (ET_APPLICATION_WINDOW (MainWindow),
+ ETCore->ETFileDisplayed);
return TRUE;
}
diff --git a/src/easytag.c b/src/easytag.c
index 40bba1d..d7b0d33 100644
--- a/src/easytag.c
+++ b/src/easytag.c
@@ -347,7 +347,8 @@ Save_List_Of_Files (GList *etfilelist, gboolean force_saving_files)
g_simple_action_set_enabled (G_SIMPLE_ACTION (action), FALSE);
/* Return to the saved position in the list */
- ET_Display_File_Data_To_UI(etfile_save_position);
+ et_application_window_display_et_file (ET_APPLICATION_WINDOW (MainWindow),
+ etfile_save_position);
et_application_window_browser_select_file_by_et_file (ET_APPLICATION_WINDOW (MainWindow),
etfile_save_position,
TRUE);
diff --git a/src/file.c b/src/file.c
index 2b5b13c..739423d 100644
--- a/src/file.c
+++ b/src/file.c
@@ -32,33 +32,25 @@
#include "easytag.h"
#include "file_tag.h"
#include "file_list.h"
-#include "mpeg_header.h"
-#include "monkeyaudio_header.h"
-#include "musepack_header.h"
#ifdef ENABLE_MP3
# include "id3_tag.h"
#endif
#include "picture.h"
#include "ape_tag.h"
#ifdef ENABLE_OGG
-# include "ogg_header.h"
-# include "ogg_tag.h"
+#include "ogg_tag.h"
#endif
#ifdef ENABLE_FLAC
-# include "flac_header.h"
-# include "flac_tag.h"
+#include "flac_tag.h"
#endif
#ifdef ENABLE_MP4
-# include "mp4_header.h"
-# include "mp4_tag.h"
+#include "mp4_tag.h"
#endif
#ifdef ENABLE_WAVPACK
-# include "wavpack_header.h"
-# include "wavpack_tag.h"
+#include "wavpack_tag.h"
#endif
#ifdef ENABLE_OPUS
#include "opus_tag.h"
-#include "opus_header.h"
#endif
#include "browser.h"
#include "log.h"
@@ -71,9 +63,6 @@
static gboolean ET_Free_File_Name_List (GList *FileNameList);
static gboolean ET_Free_File_Tag_List (GList *FileTagList);
-static void ET_Display_Filename_To_UI (const ET_File *ETFile);
-static EtFileHeaderFields * ET_Display_File_Info_To_UI (const ET_File *ETFile);
-
static gboolean ET_Save_File_Name_From_UI (const ET_File *ETFile,
File_Name *FileName);
@@ -1063,219 +1052,6 @@ ET_Free_File_Tag_List (GList *FileTagList)
* Copying functions *
*********************/
-/************************
- * Displaying functions *
- ************************/
-
-static void
-et_file_header_fields_free (EtFileHeaderFields *fields)
-{
- g_free (fields->version);
- g_free (fields->bitrate);
- g_free (fields->samplerate);
- g_free (fields->mode);
- g_free (fields->size);
- g_free (fields->duration);
- g_slice_free (EtFileHeaderFields, fields);
-}
-
-/*
- * Display information of the file (Position + Header + Tag) to the user interface.
- * Before doing it, it saves data of the file currently displayed
- */
-void
-ET_Display_File_Data_To_UI (ET_File *ETFile)
-{
- EtApplicationWindow *window;
- const ET_File_Description *description;
- const gchar *cur_filename_utf8;
- gchar *msg;
- EtFileHeaderFields *fields;
-
- g_return_if_fail (ETFile != NULL &&
- ((GList *)ETFile->FileNameCur)->data != NULL);
- /* For the case where ETFile is an "empty" structure. */
-
- cur_filename_utf8 = ((File_Name *)((GList *)ETFile->FileNameCur)->data)->value_utf8;
- description = ETFile->ETFileDescription;
-
- /* Save the current displayed file */
- ETCore->ETFileDisplayed = ETFile;
-
- window = ET_APPLICATION_WINDOW (MainWindow);
-
- /* Display position in list + show/hide icon if file writable/read_only (cur_filename) */
- et_application_window_file_area_set_file_fields (window, ETFile);
-
- /* Display filename (and his path) (value in FileNameNew) */
- ET_Display_Filename_To_UI(ETFile);
-
- /* Display tag data */
- et_application_window_tag_area_display_et_file (window, ETFile);
-
- /* Display controls in tag area */
- et_application_window_tag_area_display_controls (window, ETFile);
-
- /* Display file data, header data and file type */
- switch (description->FileType)
- {
-#if defined ENABLE_MP3 && defined ENABLE_ID3LIB
- case MP3_FILE:
- case MP2_FILE:
- fields = et_mpeg_header_display_file_info_to_ui (ETFile);
- et_application_window_file_area_set_header_fields (window, fields);
- et_mpeg_file_header_fields_free (fields);
- break;
-#endif
-#ifdef ENABLE_OGG
- case OGG_FILE:
- fields = et_ogg_header_display_file_info_to_ui (ETFile);
- et_application_window_file_area_set_header_fields (window, fields);
- et_ogg_file_header_fields_free (fields);
- break;
-#endif
-#ifdef ENABLE_SPEEX
- case SPEEX_FILE:
- fields = et_ogg_header_display_file_info_to_ui (ETFile);
- et_application_window_file_area_set_header_fields (window, fields);
- et_ogg_file_header_fields_free (fields);
- break;
-#endif
-#ifdef ENABLE_FLAC
- case FLAC_FILE:
- fields = et_flac_header_display_file_info_to_ui (ETFile);
- et_application_window_file_area_set_header_fields (window, fields);
- et_flac_file_header_fields_free (fields);
- break;
-#endif
- case MPC_FILE:
- fields = et_mpc_header_display_file_info_to_ui (ETFile);
- et_application_window_file_area_set_header_fields (window, fields);
- et_mpc_file_header_fields_free (fields);
- break;
- case MAC_FILE:
- fields = et_mac_header_display_file_info_to_ui (ETFile);
- et_application_window_file_area_set_header_fields (window, fields);
- et_mac_file_header_fields_free (fields);
- break;
-#ifdef ENABLE_MP4
- case MP4_FILE:
- fields = et_mp4_header_display_file_info_to_ui (ETFile);
- et_application_window_file_area_set_header_fields (window, fields);
- et_mp4_file_header_fields_free (fields);
- break;
-#endif
-#ifdef ENABLE_WAVPACK
- case WAVPACK_FILE:
- fields = et_wavpack_header_display_file_info_to_ui (ETFile);
- et_application_window_file_area_set_header_fields (window, fields);
- et_wavpack_file_header_fields_free (fields);
- break;
-#endif
-#ifdef ENABLE_OPUS
- case OPUS_FILE:
- fields = et_opus_header_display_file_info_to_ui (ETFile);
- et_application_window_file_area_set_header_fields (window, fields);
- et_opus_file_header_fields_free (fields);
- break;
-#endif
- case OFR_FILE:
- case UNKNOWN_FILE:
- default:
- /* Default displaying. */
- fields = ET_Display_File_Info_To_UI (ETFile);
- et_application_window_file_area_set_header_fields (window, fields);
- et_file_header_fields_free (fields);
- Log_Print (LOG_ERROR,
- "ETFileInfo: Undefined file type %d for file %s.",
- (gint)description->FileType, cur_filename_utf8);
- break;
- }
-
- msg = g_strdup_printf (_("File: ā%sā"), cur_filename_utf8);
- et_application_window_status_bar_message (window, msg, FALSE);
- g_free (msg);
-}
-
-static void
-ET_Display_Filename_To_UI (const ET_File *ETFile)
-{
- const gchar *new_filename_utf8;
- gchar *dirname_utf8;
- gchar *text;
-
- g_return_if_fail (ETFile != NULL);
-
- new_filename_utf8 = ((File_Name *)((GList *)ETFile->FileNameNew)->data)->value_utf8;
-
- /*
- * Set the path to the file into BrowserEntry (dirbrowser)
- */
- dirname_utf8 = g_path_get_dirname(new_filename_utf8);
- et_application_window_browser_entry_set_text (ET_APPLICATION_WINDOW (MainWindow),
- dirname_utf8);
-
- // And refresh the number of files in this directory
- text = g_strdup_printf (ngettext ("One file", "%u files",
- et_file_list_get_n_files_in_path (ETCore->ETFileList,
- dirname_utf8)),
- et_file_list_get_n_files_in_path (ETCore->ETFileList,
- dirname_utf8));
- et_application_window_browser_label_set_text (ET_APPLICATION_WINDOW (MainWindow),
- text);
- g_free(dirname_utf8);
- g_free(text);
-}
-
-
-/*
- * "Default" way to display File Info to the user interface.
- */
-static EtFileHeaderFields *
-ET_Display_File_Info_To_UI (const ET_File *ETFile)
-{
- EtFileHeaderFields *fields;
- ET_File_Info *info;
- gchar *time = NULL;
- gchar *time1 = NULL;
- gchar *size = NULL;
- gchar *size1 = NULL;
-
- info = ETFile->ETFileInfo;
- fields = g_slice_new (EtFileHeaderFields);
-
- fields->description = _("File");
-
- /* MPEG, Layer versions */
- fields->version = g_strdup_printf ("%d, Layer %" G_GSIZE_FORMAT,
- info->version, info->layer);
-
- /* Bitrate */
- fields->bitrate = g_strdup_printf (_("%d kb/s"), info->bitrate);
-
- /* Samplerate */
- fields->samplerate = g_strdup_printf (_("%d Hz"), info->samplerate);
-
- /* Mode */
- fields->mode = g_strdup_printf ("%d", info->mode);
-
- /* Size */
- size = g_format_size (info->size);
- size1 = g_format_size (ETCore->ETFileDisplayedList_TotalSize);
- fields->size = g_strdup_printf ("%s (%s)", size, size1);
- g_free (size);
- g_free (size1);
-
- /* Duration */
- time = Convert_Duration (info->duration);
- time1 = Convert_Duration (ETCore->ETFileDisplayedList_TotalDuration);
- fields->duration = g_strdup_printf ("%s (%s)", time, time1);
- g_free (time);
- g_free (time1);
-
- return fields;
-}
-
/********************
* Saving functions *
********************/
diff --git a/src/file.h b/src/file.h
index 496a4a7..e2b3b93 100644
--- a/src/file.h
+++ b/src/file.h
@@ -67,7 +67,6 @@ gboolean ET_Check_If_File_Is_Saved (const ET_File *ETFile);
ET_File * ET_File_Item_New (void);
void ET_Free_File_List_Item (ET_File *ETFile);
-void ET_Display_File_Data_To_UI (ET_File *ETFile);
void ET_Save_File_Data_From_UI (ET_File *ETFile);
gboolean ET_Save_File_Name_Internal (const ET_File *ETFile, File_Name *FileName);
gboolean ET_Save_File_Tag_To_HD (ET_File *ETFile, GError **error);
diff --git a/src/load_files_dialog.c b/src/load_files_dialog.c
index ed34cf8..0225674 100644
--- a/src/load_files_dialog.c
+++ b/src/load_files_dialog.c
@@ -156,7 +156,8 @@ Load_Filename_Set_Filenames (EtLoadFilesDialog *self)
gtk_tree_path_free(currentPath);
et_application_window_browser_refresh_list (ET_APPLICATION_WINDOW (MainWindow));
- ET_Display_File_Data_To_UI(ETCore->ETFileDisplayed);
+ et_application_window_display_et_file (ET_APPLICATION_WINDOW (MainWindow),
+ ETCore->ETFileDisplayed);
}
/*
diff --git a/src/scan_dialog.c b/src/scan_dialog.c
index 7543bf7..a5427df 100644
--- a/src/scan_dialog.c
+++ b/src/scan_dialog.c
@@ -2945,7 +2945,7 @@ et_scan_dialog_scan_selected_files (EtScanDialog *self)
et_application_window_browser_refresh_list (window);
/* Display the current file */
- ET_Display_File_Data_To_UI(ETCore->ETFileDisplayed);
+ et_application_window_display_et_file (window, ETCore->ETFileDisplayed);
/* To update state of command buttons */
et_application_window_update_actions (window);
diff --git a/src/tag_area.c b/src/tag_area.c
index bc1ad96..9ae4ca8 100644
--- a/src/tag_area.c
+++ b/src/tag_area.c
@@ -662,7 +662,7 @@ on_apply_to_selection (GObject *object,
et_application_window_browser_refresh_list (window);
/* Display the current file (Needed when sequencing tracks) */
- ET_Display_File_Data_To_UI(ETCore->ETFileDisplayed);
+ et_application_window_display_et_file (window, ETCore->ETFileDisplayed);
if (msg)
{
@@ -1558,7 +1558,8 @@ on_picture_add_button_clicked (GObject *object,
if (ETCore->ETFileDisplayed)
{
- ET_Display_File_Data_To_UI (ETCore->ETFileDisplayed);
+ et_application_window_display_et_file (ET_APPLICATION_WINDOW (MainWindow),
+ ETCore->ETFileDisplayed);
}
gtk_widget_destroy(FileSelectionWindow);
@@ -2058,7 +2059,8 @@ on_picture_clear_button_clicked (GObject *object,
if (ETCore->ETFileDisplayed)
{
- ET_Display_File_Data_To_UI (ETCore->ETFileDisplayed);
+ et_application_window_display_et_file (ET_APPLICATION_WINDOW (MainWindow),
+ ETCore->ETFileDisplayed);
}
g_list_free (refs);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]