[easytag] Use const in more places
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag] Use const in more places
- Date: Sat, 25 Oct 2014 22:10:11 +0000 (UTC)
commit 73526459d5c794c2c5c11addb8486cf14a90489d
Author: David King <amigadave amigadave com>
Date: Sat Oct 25 22:20:04 2014 +0100
Use const in more places
src/application_window.c | 6 +++---
src/application_window.h | 6 +++---
src/browser.c | 21 ++++++++++++---------
src/browser.h | 10 +++++-----
src/easytag.c | 3 ++-
src/easytag.h | 2 +-
src/picture.c | 5 +++--
src/picture.h | 4 ++--
src/playlist_dialog.c | 10 +++++-----
src/scan_dialog.c | 24 +++++++++++++++++++-----
src/scan_dialog.h | 14 ++++----------
11 files changed, 59 insertions(+), 46 deletions(-)
---
diff --git a/src/application_window.c b/src/application_window.c
index 700bff4..ea553e2 100644
--- a/src/application_window.c
+++ b/src/application_window.c
@@ -2474,7 +2474,7 @@ et_application_window_browser_select_file_by_iter_string (EtApplicationWindow *s
void
et_application_window_browser_select_file_by_et_file (EtApplicationWindow *self,
- ET_File *file,
+ const ET_File *file,
gboolean select)
{
EtApplicationWindowPrivate *priv;
@@ -2487,7 +2487,7 @@ et_application_window_browser_select_file_by_et_file (EtApplicationWindow *self,
GtkTreePath *
et_application_window_browser_select_file_by_et_file2 (EtApplicationWindow *self,
- ET_File *file,
+ const ET_File *file,
gboolean select,
GtkTreePath *start_path)
{
@@ -2540,7 +2540,7 @@ et_application_window_browser_refresh_list (EtApplicationWindow *self)
void
et_application_window_browser_refresh_file_in_list (EtApplicationWindow *self,
- ET_File *file)
+ const ET_File *file)
{
EtApplicationWindowPrivate *priv;
diff --git a/src/application_window.h b/src/application_window.h
index 41005b3..f586402 100644
--- a/src/application_window.h
+++ b/src/application_window.h
@@ -78,12 +78,12 @@ GtkTreeSelection * et_application_window_browser_get_selection (EtApplicationWin
GtkTreeViewColumn *et_application_window_browser_get_column_for_column_id (EtApplicationWindow *self, gint
column_id);
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_browser_select_file_by_et_file (EtApplicationWindow *self, ET_File *file,
gboolean select);
-GtkTreePath * et_application_window_browser_select_file_by_et_file2 (EtApplicationWindow *self, ET_File
*file, gboolean select, GtkTreePath *start_path);
+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);
void et_application_window_browser_unselect_all (EtApplicationWindow *self);
void et_application_window_browser_refresh_list (EtApplicationWindow *self);
-void et_application_window_browser_refresh_file_in_list (EtApplicationWindow *self, ET_File *file);
+void et_application_window_browser_refresh_file_in_list (EtApplicationWindow *self, const ET_File *file);
void et_application_window_browser_refresh_sort (EtApplicationWindow *self);
void et_application_window_hide_log_area (EtApplicationWindow *self);
void et_application_window_show_log_area (EtApplicationWindow *self);
diff --git a/src/browser.c b/src/browser.c
index 99de0b1..a5bbf0d 100644
--- a/src/browser.c
+++ b/src/browser.c
@@ -1220,7 +1220,7 @@ et_browser_clear_file_model (EtBrowser *self)
void
et_browser_load_file_list (EtBrowser *self,
GList *etfilelist,
- ET_File *etfile_to_select)
+ const ET_File *etfile_to_select)
{
EtBrowserPrivate *priv;
GList *l;
@@ -1432,7 +1432,8 @@ et_browser_refresh_list (EtBrowser *self)
* - Change color is something change on the file
*/
void
-et_browser_refresh_file_in_list (EtBrowser *self, ET_File *ETFile)
+et_browser_refresh_file_in_list (EtBrowser *self,
+ const ET_File *ETFile)
{
EtBrowserPrivate *priv;
GList *selectedRow = NULL;
@@ -1714,7 +1715,8 @@ Browser_List_Set_Row_Appearance (EtBrowser *self, GtkTreeIter *iter)
* Remove a file from the list, by ETFile
*/
void
-et_browser_remove_file (EtBrowser *self, ET_File *searchETFile)
+et_browser_remove_file (EtBrowser *self,
+ const ET_File *searchETFile)
{
EtBrowserPrivate *priv;
gint row;
@@ -1803,7 +1805,7 @@ et_browser_get_et_file_from_iter (EtBrowser *self, GtkTreeIter *iter)
*/
void
et_browser_select_file_by_et_file (EtBrowser *self,
- ET_File *file,
+ const ET_File *file,
gboolean select_it)
{
GtkTreePath *currentPath = NULL;
@@ -1823,7 +1825,7 @@ et_browser_select_file_by_et_file (EtBrowser *self,
*/
GtkTreePath *
et_browser_select_file_by_et_file2 (EtBrowser *self,
- ET_File *searchETFile,
+ const ET_File *searchETFile,
gboolean select_it,
GtkTreePath *startPath)
{
@@ -4048,7 +4050,8 @@ rename_directory_generate_preview (EtBrowser *self)
if (!mask)
return;
- preview_text = Scan_Generate_New_Filename_From_Mask(ETCore->ETFileDisplayed,mask,FALSE);
+ preview_text = et_scan_generate_new_filename_from_mask (ETCore->ETFileDisplayed,
+ mask, FALSE);
if (GTK_IS_LABEL(priv->rename_directory_preview_label))
{
@@ -4269,9 +4272,9 @@ Rename_Directory (EtBrowser *self)
mask = g_settings_get_string (MainSettings,
"rename-directory-default-mask");
- directory_new_name = Scan_Generate_New_Directory_Name_From_Mask (ETCore->ETFileDisplayed,
- mask,
- FALSE);
+ directory_new_name = et_scan_generate_new_directory_name_from_mask (ETCore->ETFileDisplayed,
+ mask,
+ FALSE);
g_free (mask);
}
diff --git a/src/browser.h b/src/browser.h
index b149f8f..f9fa977 100644
--- a/src/browser.h
+++ b/src/browser.h
@@ -76,19 +76,19 @@ void et_browser_reload (EtBrowser *self);
void et_browser_collapse (EtBrowser *self);
void et_browser_set_sensitive (EtBrowser *self, gboolean sensitive);
-void et_browser_load_file_list (EtBrowser *self, GList *etfilelist, ET_File *etfile_to_select);
+void et_browser_load_file_list (EtBrowser *self, GList *etfilelist, const ET_File *etfile_to_select);
void et_browser_refresh_list (EtBrowser *self);
-void et_browser_refresh_file_in_list (EtBrowser *self, ET_File *ETFile);
+void et_browser_refresh_file_in_list (EtBrowser *self, const ET_File *ETFile);
void et_browser_clear (EtBrowser *self);
-void et_browser_select_file_by_et_file (EtBrowser *self, ET_File *ETFile, gboolean select_it);
-GtkTreePath * et_browser_select_file_by_et_file2 (EtBrowser *self, ET_File *searchETFile, gboolean
select_it, GtkTreePath *startPath);
+void et_browser_select_file_by_et_file (EtBrowser *self, const ET_File *ETFile, gboolean select_it);
+GtkTreePath * et_browser_select_file_by_et_file2 (EtBrowser *self, const ET_File *searchETFile, gboolean
select_it, GtkTreePath *startPath);
void et_browser_select_file_by_iter_string (EtBrowser *self, const gchar* stringiter, gboolean select_it);
ET_File *et_browser_select_file_by_dlm (EtBrowser *self, const gchar* string, gboolean select_it);
void et_browser_refresh_sort (EtBrowser *self);
void et_browser_select_all (EtBrowser *self);
void et_browser_unselect_all (EtBrowser *self);
void et_browser_invert_selection (EtBrowser *self);
-void et_browser_remove_file (EtBrowser *self, ET_File *ETFile);
+void et_browser_remove_file (EtBrowser *self, const ET_File *ETFile);
ET_File * et_browser_get_et_file_from_path (EtBrowser *self, GtkTreePath *path);
ET_File * et_browser_get_et_file_from_iter (EtBrowser *self, GtkTreeIter *iter);
diff --git a/src/easytag.c b/src/easytag.c
index 35212a8..e609bf8 100644
--- a/src/easytag.c
+++ b/src/easytag.c
@@ -933,7 +933,8 @@ Write_File_Tag (ET_File *ETFile, gboolean hide_msgbox)
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
-gboolean Read_Directory (gchar *path_real)
+gboolean
+Read_Directory (const gchar *path_real)
{
GFile *dir;
GFileEnumerator *dir_enumerator;
diff --git a/src/easytag.h b/src/easytag.h
index 124558d..43fce9e 100644
--- a/src/easytag.h
+++ b/src/easytag.h
@@ -60,6 +60,6 @@ gint Save_All_Files_With_Answer (gboolean force_saving_files);
void Action_Main_Stop_Button_Pressed (void);
-gboolean Read_Directory (gchar *path);
+gboolean Read_Directory (const gchar *path);
#endif /* __EASYTAG_H__ */
diff --git a/src/picture.c b/src/picture.c
index 0c3d040..88fe08e 100644
--- a/src/picture.c
+++ b/src/picture.c
@@ -114,7 +114,8 @@ et_picture_type_from_filename (const gchar *filename_utf8)
}
/* FIXME: Possibly use gnome_vfs_get_mime_type_for_buffer. */
-Picture_Format Picture_Format_From_Data (Picture *pic)
+Picture_Format
+Picture_Format_From_Data (const Picture *pic)
{
// JPEG : "\xff\xd8"
if (pic->data && pic->size > 2
@@ -247,7 +248,7 @@ Picture_Type_String (EtPictureType type)
}
gchar *
-Picture_Info (Picture *pic)
+Picture_Info (const Picture *pic)
{
const gchar *format, *desc, *type;
gchar *r, *size_str;
diff --git a/src/picture.h b/src/picture.h
index c7b3533..a3d8904 100644
--- a/src/picture.h
+++ b/src/picture.h
@@ -86,10 +86,10 @@ Picture *Picture_Allocate (void);
Picture *Picture_Copy_One (const Picture *pic);
Picture *Picture_Copy (const Picture *pic);
void Picture_Free (Picture *pic);
-Picture_Format Picture_Format_From_Data (Picture *pic);
+Picture_Format Picture_Format_From_Data (const Picture *pic);
const gchar *Picture_Mime_Type_String (Picture_Format format);
const gchar * Picture_Type_String (EtPictureType type);
-gchar * Picture_Info (Picture *pic);
+gchar * Picture_Info (const Picture *pic);
Picture *et_picture_load_file_data (GFile *file, GError **error);
gboolean et_picture_save_file_data (const Picture *pic, GFile *file, GError **error);
diff --git a/src/playlist_dialog.c b/src/playlist_dialog.c
index 0bfd973..7eb6293 100644
--- a/src/playlist_dialog.c
+++ b/src/playlist_dialog.c
@@ -197,7 +197,7 @@ write_playlist (EtPlaylistDialog *self, GFile *file, GError **error)
/* Special case: do not replace illegal characters and
* do not check if there is a directory separator in
* the mask. */
- gchar *filename_generated_utf8 = Scan_Generate_New_Filename_From_Mask (etfile, mask,
TRUE);
+ gchar *filename_generated_utf8 = et_scan_generate_new_filename_from_mask (etfile,
mask, TRUE);
gchar *filename_generated = filename_from_display (filename_generated_utf8);
to_write = g_string_new ("#EXTINF:");
@@ -316,7 +316,7 @@ write_playlist (EtPlaylistDialog *self, GFile *file, GError **error)
/* Special case: do not replace illegal characters and
* do not check if there is a directory separator in
* the mask. */
- gchar *filename_generated_utf8 = Scan_Generate_New_Filename_From_Mask (etfile, mask,
TRUE);
+ gchar *filename_generated_utf8 = et_scan_generate_new_filename_from_mask (etfile, mask,
TRUE);
gchar *filename_generated = filename_from_display (filename_generated_utf8);
to_write = g_string_new ("#EXTINF:");
@@ -442,9 +442,9 @@ write_button_clicked (EtPlaylistDialog *self)
/* Generate filename from tag of the current selected file (FIXME). */
temp = filename_from_display (playlist_name);
g_free (playlist_name);
- playlist_basename_utf8 = Scan_Generate_New_Filename_From_Mask (ETCore->ETFileDisplayed,
- temp,
- FALSE);
+ playlist_basename_utf8 = et_scan_generate_new_filename_from_mask (ETCore->ETFileDisplayed,
+ temp,
+ FALSE);
g_free (temp);
/* Replace Characters (with scanner). */
diff --git a/src/scan_dialog.c b/src/scan_dialog.c
index c29d7fe..450d3d9 100644
--- a/src/scan_dialog.c
+++ b/src/scan_dialog.c
@@ -170,6 +170,10 @@ typedef enum
} Mask_Item_Type;
+enum {
+ MASK_EDITOR_TEXT,
+ MASK_EDITOR_COUNT
+};
/*
* Used into Rename File Scanner
@@ -604,7 +608,8 @@ Scan_Rename_File_Generate_Preview (EtScanDialog *self)
if (!mask)
return;
- preview_text = Scan_Generate_New_Filename_From_Mask(ETCore->ETFileDisplayed,mask,FALSE);
+ preview_text = et_scan_generate_new_filename_from_mask (ETCore->ETFileDisplayed,
+ mask, FALSE);
if (GTK_IS_LABEL(priv->rename_file_preview_label))
{
@@ -687,7 +692,9 @@ Scan_Rename_File_With_Mask (EtScanDialog *self, ET_File *ETFile)
// Note : if the first character is '/', we have a path with the filename,
// else we have only the filename. The both are in UTF-8.
- filename_generated_utf8 = Scan_Generate_New_Filename_From_Mask(ETFile,mask,FALSE);
+ filename_generated_utf8 = et_scan_generate_new_filename_from_mask (ETFile,
+ mask,
+ FALSE);
g_free(mask);
if (!filename_generated_utf8)
@@ -753,7 +760,10 @@ Scan_Rename_File_With_Mask (EtScanDialog *self, ET_File *ETFile)
* function "Write_Playlist" for the content of the playlist.
* Returns filename in UTF-8
*/
-gchar *Scan_Generate_New_Filename_From_Mask (ET_File *ETFile, gchar *mask, gboolean
no_dir_check_or_conversion)
+gchar *
+et_scan_generate_new_filename_from_mask (const ET_File *ETFile,
+ const gchar *mask,
+ gboolean no_dir_check_or_conversion)
{
gchar *tmp;
gchar **source = NULL;
@@ -1041,9 +1051,13 @@ Scan_Rename_File_Prefix_Path (EtScanDialog *self)
}
-gchar *Scan_Generate_New_Directory_Name_From_Mask (ET_File *ETFile, gchar *mask, gboolean
no_dir_check_or_conversion)
+gchar *
+et_scan_generate_new_directory_name_from_mask (const ET_File *ETFile,
+ const gchar *mask,
+ gboolean no_dir_check_or_conversion)
{
- return Scan_Generate_New_Filename_From_Mask(ETFile,mask,no_dir_check_or_conversion);
+ return et_scan_generate_new_filename_from_mask (ETFile, mask,
+ no_dir_check_or_conversion);
}
diff --git a/src/scan_dialog.h b/src/scan_dialog.h
index f54dfb1..4784ced 100644
--- a/src/scan_dialog.h
+++ b/src/scan_dialog.h
@@ -54,18 +54,12 @@ void et_scan_dialog_open (EtScanDialog *self, EtScanMode scanner_type);
void et_scan_dialog_scan_selected_files (EtScanDialog *self);
void et_scan_dialog_update_previews (EtScanDialog *self);
-G_END_DECLS
-
-
-enum {
- MASK_EDITOR_TEXT,
- MASK_EDITOR_COUNT
-};
-
void Scan_Select_Mode_And_Run_Scanner (EtScanDialog *self, ET_File *ETFile);
-gchar *Scan_Generate_New_Filename_From_Mask (ET_File *ETFile, gchar *mask, gboolean
no_dir_check_or_conversion);
-gchar *Scan_Generate_New_Directory_Name_From_Mask (ET_File *ETFile, gchar *mask, gboolean
no_dir_check_or_conversion);
+gchar * et_scan_generate_new_filename_from_mask (const ET_File *ETFile, const gchar *mask, gboolean
no_dir_check_or_conversion);
+gchar * et_scan_generate_new_directory_name_from_mask (const ET_File *ETFile, const gchar *mask, gboolean
no_dir_check_or_conversion);
void entry_check_rename_file_mask (GtkEntry *entry, gpointer user_data);
+G_END_DECLS
+
#endif /* ET_SCAN_DIALOG_H_ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]