[easytag/wip/application-window: 18/29] Use GSettings for most application settings
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag/wip/application-window: 18/29] Use GSettings for most application settings
- Date: Fri, 9 May 2014 20:32:02 +0000 (UTC)
commit 094ebe3a5122c6597c6f783bc753ee28ecf712c4
Author: David King <amigadave amigadave com>
Date: Wed May 7 23:22:12 2014 +0100
Use GSettings for most application settings
src/application_window.c | 33 +++--
src/bar.c | 102 ++++---------
src/browser.c | 28 ++--
src/cddb_dialog.c | 237 ++++++++++++++++++++---------
src/easytag.c | 68 +++++----
src/et_core.c | 48 ++++---
src/flac_tag.c | 38 ++++--
src/id3_tag.c | 47 ++++--
src/id3v24_tag.c | 118 +++++++++------
src/load_files_dialog.c | 33 +---
src/load_files_dialog.h | 1 -
src/log.c | 10 +-
src/misc.c | 19 ++-
src/ogg_tag.c | 54 ++++---
src/playlist_dialog.c | 67 ++++-----
src/preferences_dialog.c | 298 +++++++++++++++++++++----------------
src/scan_dialog.c | 121 +++++++++-------
src/search_dialog.c | 31 +++--
src/setting.c | 374 ++-------------------------------------------
src/setting.h | 119 +--------------
20 files changed, 789 insertions(+), 1057 deletions(-)
---
diff --git a/src/application_window.c b/src/application_window.c
index 07a9e13..99d8509 100644
--- a/src/application_window.c
+++ b/src/application_window.c
@@ -2516,13 +2516,13 @@ et_application_window_tag_area_display_controls (EtApplicationWindow *self,
gtk_widget_show (GTK_WIDGET (priv->comment_label));
gtk_widget_show(GTK_WIDGET(CommentEntry));
- // Special controls to display or not!
+ /* Special controls to display or not! */
switch (ETFile->ETFileDescription->TagType)
{
case ID3_TAG:
- if (!FILE_WRITING_ID3V2_WRITE_TAG)
+ if (!g_settings_get_boolean (MainSettings, "id3v2-enabled"))
{
- // ID3v1 : Hide specifics ID3v2 fields if not activated!
+ /* ID3v1 : Hide specifics ID3v2 fields if not activated! */
gtk_widget_hide (GTK_WIDGET (priv->disc_number_label));
gtk_widget_hide(GTK_WIDGET(DiscNumberEntry));
gtk_widget_hide (GTK_WIDGET (priv->composer_label));
@@ -2982,8 +2982,10 @@ et_application_window_select_first_file (GtkAction *action, gpointer user_data)
Update_Command_Buttons_Sensivity();
et_scan_dialog_update_previews (ET_SCAN_DIALOG (et_application_window_get_scan_dialog (self)));
- if (SET_FOCUS_TO_FIRST_TAG_FIELD)
- gtk_widget_grab_focus(GTK_WIDGET(TitleEntry));
+ if (g_settings_get_boolean (MainSettings, "tag-preserve-focus"))
+ {
+ gtk_widget_grab_focus (GTK_WIDGET (TitleEntry));
+ }
}
@@ -3025,8 +3027,10 @@ et_application_window_select_prev_file (GtkAction *action, gpointer user_data)
Update_Command_Buttons_Sensivity();
et_scan_dialog_update_previews (ET_SCAN_DIALOG (et_application_window_get_scan_dialog (self)));
- if (SET_FOCUS_TO_FIRST_TAG_FIELD)
- gtk_widget_grab_focus(GTK_WIDGET(TitleEntry));
+ if (g_settings_get_boolean (MainSettings, "tag-preserve-focus"))
+ {
+ gtk_widget_grab_focus (GTK_WIDGET (TitleEntry));
+ }
}
@@ -3068,8 +3072,10 @@ et_application_window_select_next_file (GtkAction *acton, gpointer user_data)
Update_Command_Buttons_Sensivity();
et_scan_dialog_update_previews (ET_SCAN_DIALOG (et_application_window_get_scan_dialog (self)));
- if (SET_FOCUS_TO_FIRST_TAG_FIELD)
- gtk_widget_grab_focus(GTK_WIDGET(TitleEntry));
+ if (g_settings_get_boolean (MainSettings, "tag-preserve-focus"))
+ {
+ gtk_widget_grab_focus (GTK_WIDGET (TitleEntry));
+ }
}
@@ -3108,8 +3114,10 @@ et_application_window_select_last_file (GtkAction *action, gpointer user_data)
Update_Command_Buttons_Sensivity();
et_scan_dialog_update_previews (ET_SCAN_DIALOG (et_application_window_get_scan_dialog (self)));
- if (SET_FOCUS_TO_FIRST_TAG_FIELD)
- gtk_widget_grab_focus(GTK_WIDGET(TitleEntry));
+ if (g_settings_get_boolean (MainSettings, "tag-preserve-focus"))
+ {
+ gtk_widget_grab_focus (GTK_WIDGET (TitleEntry));
+ }
}
/*
@@ -3243,7 +3251,8 @@ delete_file (ET_File *ETFile, gboolean multiple_files, GError **error)
/*
* Remove the file
*/
- if (CONFIRM_DELETE_FILE && !SF_HideMsgbox_Delete_File)
+ if (g_settings_get_boolean (MainSettings, "confirm-delete-file")
+ && !SF_HideMsgbox_Delete_File)
{
if (multiple_files)
{
diff --git a/src/bar.c b/src/bar.c
index cca013e..aae600d 100644
--- a/src/bar.c
+++ b/src/bar.c
@@ -1,21 +1,20 @@
-/* bar.c - 2000/05/05 */
-/*
- * EasyTAG - Tag editor for MP3 and Ogg Vorbis files
- * Copyright (C) 2000-2003 Jerome Couderc <easytag gmail com>
+/* EasyTAG - Tag editor for audio files
+ * Copyright (C) 2014 David King <amigadave amigadave com>
+ * Copyright (C) 2000-2003 Jerome Couderc <easytag gmail com>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <config.h>
@@ -52,8 +51,6 @@ static GList *ActionPairsList = NULL;
* Prototypes *
**************/
-static void Check_Menu_Item_Toggled_Browse_Hidden_Dir (GtkWidget *checkmenuitem);
-static void Check_Menu_Item_Toggled_Browse_Subdir (GtkWidget *checkmenuitem);
static void Init_Menu_Bar (void);
static void Statusbar_Remove_Timer (void);
@@ -374,17 +371,21 @@ Create_UI (GtkWindow *window, GtkWidget **ppmenubar, GtkWidget **pptoolbar)
GtkToggleActionEntry ToggleActionEntries[] =
{
- //{ AM_BROWSE_SUBDIR, GTK_STOCK_INDEX, _("Browse _Subdirectories"),
NULL, _("Browse _Sub-directories"), NULL, FALSE
},
- { AM_BROWSE_SUBDIR, NULL, _("Browse _Subdirectories"),
NULL, _("Browse subdirectories"), NULL,
BROWSE_SUBDIR },
+ { AM_BROWSE_SUBDIR, NULL, _("Browse _Subdirectories"), NULL,
+ _("Browse subdirectories"), NULL,
+ g_settings_get_boolean (MainSettings, "browse-subdir") },
#ifndef G_OS_WIN32 /* No sense here for Win32, "hidden" means : starts with a
* '.'
*/
- { AM_BROWSER_HIDDEN_DIR, NULL, _("Show Hidden Directories"),
NULL, _("Show hidden directories"),
G_CALLBACK(et_application_window_browser_reload), BROWSE_HIDDEN_DIR },
+ { AM_BROWSER_HIDDEN_DIR, NULL, _("Show Hidden Directories"), NULL,
+ _("Show hidden directories"),
+ G_CALLBACK (et_application_window_browser_reload),
+ g_settings_get_boolean (MainSettings, "browse-show-hidden") },
#endif /* !G_OS_WIN32 */
{ AM_SCANNER_SHOW, "document-properties", _("_Show Scanner"), NULL,
_("Show scanner"),
G_CALLBACK (et_application_window_show_scan_dialog),
- OPEN_SCANNER_WINDOW_ON_STARTUP },
+ g_settings_get_boolean (MainSettings, "scan-startup") },
};
GtkRadioActionEntry view_mode_entries[] =
@@ -494,67 +495,20 @@ Init_Menu_Bar (void)
CheckMenuItemBrowseSubdirMainMenu = gtk_ui_manager_get_widget(UIManager,
"/MenuBar/BrowserMenu/BrowseSubdir");
if (CheckMenuItemBrowseSubdirMainMenu)
{
- // Link to update BROWSE_SUBDIR when changed
- g_signal_connect(G_OBJECT(CheckMenuItemBrowseSubdirMainMenu),"toggled",
- G_CALLBACK(Check_Menu_Item_Toggled_Browse_Subdir),NULL);
+ g_settings_bind (MainSettings, "browse-subdir",
+ CheckMenuItemBrowseSubdirMainMenu, "active",
+ G_SETTINGS_BIND_DEFAULT);
}
CheckMenuItemBrowseHiddenDirMainMenu = gtk_ui_manager_get_widget (UIManager,
"/MenuBar/ViewMenu/BrowseHiddenDir");
if (CheckMenuItemBrowseHiddenDirMainMenu)
{
- // Link to update BROWSE_HIDDEN_DIR when changed
- g_signal_connect(G_OBJECT(CheckMenuItemBrowseHiddenDirMainMenu),"toggled",
- G_CALLBACK(Check_Menu_Item_Toggled_Browse_Hidden_Dir),NULL);
+ g_settings_bind (MainSettings, "browse-show-hidden",
+ CheckMenuItemBrowseHiddenDirMainMenu, "active",
+ G_SETTINGS_BIND_DEFAULT);
}
-
- /* If entry not implemented */
- //{GtkWidget *widget = gtk_item_factory_get_widget_by_action(ItemFactory,FILENAME_FROM_TXT);
- //if (widget) gtk_widget_set_sensitive(widget,FALSE);}
-}
-
-/*
- * Callback to update state of check button to browse subdir into menu
- */
-static void
-Check_Menu_Item_Toggled_Browse_Subdir (GtkWidget *checkmenuitem)
-{
- BROWSE_SUBDIR = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(checkmenuitem));
- Check_Menu_Item_Update_Browse_Subdir();
}
-void Check_Menu_Item_Update_Browse_Subdir (void)
-{
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(CheckMenuItemBrowseSubdirMainMenu),BROWSE_SUBDIR);
-}
-
-/*
- * Callback to update state of check button to show hiddendirectories into menu
- */
-static void
-Check_Menu_Item_Toggled_Browse_Hidden_Dir (GtkWidget *checkmenuitem)
-{
- BROWSE_HIDDEN_DIR = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(checkmenuitem));
- Check_Menu_Item_Update_Browse_Hidden_Dir();
-
- // Reload directory, in case we have changed BROWSE_HIDDEN_DIR
- //et_application_window_browser_reload(NULL); // Commented, as already done in GtkToggleActionEntry for
AM_BROWSER_HIDDEN_DIR
-}
-
-void
-Check_Menu_Item_Update_Browse_Hidden_Dir (void)
-{
-#ifndef G_OS_WIN32
-
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(CheckMenuItemBrowseHiddenDirMainMenu),BROWSE_HIDDEN_DIR);
-#endif /* !G_OS_WIN32 */
-}
-
-
-
-
-
-
-
-
/*
* Status bar functions
diff --git a/src/browser.c b/src/browser.c
index 72ee29b..d964a3c 100644
--- a/src/browser.c
+++ b/src/browser.c
@@ -879,7 +879,7 @@ Browser_Tree_Node_Selected (EtBrowser *self, GtkTreeSelection *selection)
selectedPath = gtk_tree_model_get_path(GTK_TREE_MODEL(priv->directory_model), &selectedIter);
/* Open the node */
- if (OPEN_SELECTED_BROWSER_NODE)
+ if (g_settings_get_boolean (MainSettings, "browse-expand-children"))
{
gtk_tree_view_expand_row(GTK_TREE_VIEW(priv->tree), selectedPath, FALSE);
}
@@ -900,7 +900,8 @@ Browser_Tree_Node_Selected (EtBrowser *self, GtkTreeSelection *selection)
Update_Command_Buttons_Sensivity(); // Not clean to put this here...
/* Check if all files have been saved before changing the directory */
- if (CONFIRM_WHEN_UNSAVED_FILES && ET_Check_If_All_Files_Are_Saved() != TRUE)
+ if (g_settings_get_boolean (MainSettings, "confirm-when-unsaved-files")
+ && ET_Check_If_All_Files_Are_Saved () != TRUE)
{
GtkWidget *msgdialog;
gint response;
@@ -947,7 +948,7 @@ Browser_Tree_Node_Selected (EtBrowser *self, GtkTreeSelection *selection)
/* Start to read the directory */
/* The first time, 'counter' is equal to zero. And if we don't want to load
* directory on startup, we skip the 'reading', but newt we must read it each time */
- if (LOAD_ON_STARTUP || counter)
+ if (g_settings_get_boolean (MainSettings, "load-on-startup") || counter)
{
gboolean dir_loaded;
GtkTreeIter parentIter;
@@ -975,7 +976,8 @@ Browser_Tree_Node_Selected (EtBrowser *self, GtkTreeSelection *selection)
{
gtk_tree_view_collapse_row (GTK_TREE_VIEW (priv->tree),
selectedPath);
- if (OPEN_SELECTED_BROWSER_NODE)
+ if (g_settings_get_boolean (MainSettings,
+ "browse-expand-children"))
{
gtk_tree_view_expand_row (GTK_TREE_VIEW (priv->tree),
selectedPath, FALSE);
@@ -1691,7 +1693,7 @@ Browser_List_Set_Row_Appearance (EtBrowser *self, GtkTreeIter *iter)
// Set text to bold/red if 'filename' or 'tag' changed
if ( ET_Check_If_File_Is_Saved(rowETFile) == FALSE )
{
- if (CHANGED_FILES_DISPLAYED_TO_BOLD)
+ if (g_settings_get_boolean (MainSettings, "file-changed-bold"))
{
gtk_list_store_set(priv->file_model, iter,
LIST_FONT_WEIGHT, PANGO_WEIGHT_BOLD,
@@ -2434,7 +2436,7 @@ Browser_Artist_List_Set_Row_Appearance (EtBrowser *self, GtkTreeIter *iter)
{
if (ET_Check_If_File_Is_Saved ((ET_File *)m->data) == FALSE)
{
- if (CHANGED_FILES_DISPLAYED_TO_BOLD)
+ if (g_settings_get_boolean (MainSettings, "file-changed-bold"))
{
// Set the font-style to "bold"
gtk_list_store_set(priv->artist_model, iter,
@@ -2622,7 +2624,7 @@ Browser_Album_List_Set_Row_Appearance (EtBrowser *self, GtkTreeIter *iter)
{
if (ET_Check_If_File_Is_Saved ((ET_File *)l->data) == FALSE)
{
- if (CHANGED_FILES_DISPLAYED_TO_BOLD)
+ if (g_settings_get_boolean (MainSettings, "file-changed-bold"))
{
// Set the font-style to "bold"
gtk_list_store_set(priv->album_model, iter,
@@ -3137,7 +3139,8 @@ check_for_subdir (const gchar *path)
{
if ((g_file_info_get_file_type (childinfo) ==
G_FILE_TYPE_DIRECTORY) &&
- (BROWSE_HIDDEN_DIR || !g_file_info_get_is_hidden (childinfo)))
+ (g_settings_get_boolean (MainSettings, "browse-show-hidden")
+ || !g_file_info_get_is_hidden (childinfo)))
{
g_object_unref (childinfo);
g_file_enumerator_close (enumerator, NULL, NULL);
@@ -3326,7 +3329,8 @@ expand_cb (EtBrowser *self, GtkTreeIter *iter, GtkTreePath *gtreePath, GtkTreeVi
isdir = g_file_info_get_file_type (childinfo) == G_FILE_TYPE_DIRECTORY;
if (isdir &&
- (BROWSE_HIDDEN_DIR || !g_file_info_get_is_hidden (childinfo)))
+ (g_settings_get_boolean (MainSettings, "browse-show-hidden")
+ || !g_file_info_get_is_hidden (childinfo)))
{
const gchar *dirname_utf8;
dirname_utf8 = g_file_info_get_display_name (childinfo);
@@ -4112,7 +4116,9 @@ et_browser_show_rename_directory_dialog (EtBrowser *self)
priv->rename_directory_mask_toggle = gtk_check_button_new_with_label(_("Use mask:"));
gtk_box_pack_start(GTK_BOX(HBox),priv->rename_directory_mask_toggle,FALSE,FALSE,0);
-
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->rename_directory_mask_toggle),RENAME_DIRECTORY_WITH_MASK);
+ g_settings_bind (MainSettings, "rename-directory-with-mask",
+ priv->rename_directory_mask_toggle, "active",
+ G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(priv->rename_directory_mask_toggle,_("If activated, it will use masks to
rename directory."));
g_signal_connect_swapped (priv->rename_directory_mask_toggle, "toggled",
G_CALLBACK (Rename_Directory_With_Mask_Toggled),
@@ -4200,8 +4206,6 @@ Destroy_Rename_Directory_Window (EtBrowser *self)
Add_String_To_Combo_List(priv->rename_directory_mask_model, RENAME_DIRECTORY_DEFAULT_MASK);
Save_Rename_Directory_Masks_List(priv->rename_directory_mask_model, MASK_EDITOR_TEXT);
- RENAME_DIRECTORY_WITH_MASK =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->rename_directory_mask_toggle));
-
gtk_list_store_clear(priv->rename_directory_mask_model);
gtk_widget_destroy(priv->rename_directory_dialog);
diff --git a/src/cddb_dialog.c b/src/cddb_dialog.c
index d0c3e1b..6e76cfc 100644
--- a/src/cddb_dialog.c
+++ b/src/cddb_dialog.c
@@ -601,7 +601,7 @@ Cddb_Track_List_Row_Selected (EtCDDBDialog *self, GtkTreeSelection *selection)
priv = et_cddb_dialog_get_instance_private (self);
// Exit if we don't have to select files in the main list
- if (!CDDB_FOLLOW_FILE)
+ if (!g_settings_get_boolean (MainSettings, "cddb-follow-file"))
return;
selectedRows = gtk_tree_selection_get_selected_rows(selection, NULL);
@@ -624,7 +624,7 @@ Cddb_Track_List_Row_Selected (EtCDDBDialog *self, GtkTreeSelection *selection)
if (found)
{
- if (CDDB_USE_DLM)
+ if (g_settings_get_boolean (MainSettings, "cddb-dlm-enabled"))
{
gtk_tree_model_get(GTK_TREE_MODEL(priv->track_list_model), ¤tFile,
CDDB_TRACK_LIST_NAME, &text_path,
@@ -705,7 +705,7 @@ Cddb_Album_List_Set_Row_Appearance (EtCDDBDialog *self, GtkTreeIter *row)
if (cddbalbum->track_list != NULL)
{
- if (CHANGED_FILES_DISPLAYED_TO_BOLD)
+ if (g_settings_get_boolean (MainSettings, "file-changed-bold"))
{
gtk_list_store_set(priv->album_list_model, row,
CDDB_ALBUM_LIST_FONT_STYLE, PANGO_STYLE_NORMAL,
@@ -727,11 +727,12 @@ Cddb_Album_List_Set_Row_Appearance (EtCDDBDialog *self, GtkTreeIter *row)
CDDB_ALBUM_LIST_FOREGROUND_COLOR, &RED, -1);
}
}
- } else
+ }
+ else
{
if (cddbalbum->other_version == TRUE)
{
- if (CHANGED_FILES_DISPLAYED_TO_BOLD)
+ if (g_settings_get_boolean (MainSettings, "file-changed-bold"))
{
gtk_list_store_set(priv->album_list_model, row,
CDDB_ALBUM_LIST_FONT_STYLE, PANGO_STYLE_ITALIC,
@@ -1246,6 +1247,9 @@ Cddb_Search_Album_List_From_String_Freedb (EtCDDBDialog *self)
gchar *cddb_server_name;
gint cddb_server_port;
gchar *cddb_server_cgi_path;
+ gboolean proxy_enabled;
+ gchar *proxy_hostname;
+ guint proxy_port;
gchar *ptr_cat, *cat_str, *id_str, *art_alb_str;
gchar *art_alb_tmp = NULL;
@@ -1284,18 +1288,31 @@ Cddb_Search_Album_List_From_String_Freedb (EtCDDBDialog *self)
while ( (tmp=strchr(string,' '))!=NULL )
*tmp = '+';
- cddb_server_name = g_strdup(CDDB_SERVER_NAME_MANUAL_SEARCH); //"www.freedb.org");
- cddb_server_port = CDDB_SERVER_PORT_MANUAL_SEARCH; //80;
- cddb_server_cgi_path = g_strdup(CDDB_SERVER_CGI_PATH_MANUAL_SEARCH);//"/~cddb/cddb.cgi");
+ cddb_server_name = g_settings_get_string (MainSettings,
+ "cddb-manual-search-hostname");
+ cddb_server_port = g_settings_get_uint (MainSettings,
+ "cddb-manual-search-port");
+ cddb_server_cgi_path = g_settings_get_string (MainSettings,
+ "cddb-manual-search-path");
/* Connection to the server */
+ proxy_enabled = g_settings_get_boolean (MainSettings,
+ "cddb-proxy-enabled");
+ proxy_hostname = g_settings_get_string (MainSettings,
+ "cddb-proxy-hostname");
+ proxy_port = g_settings_get_uint (MainSettings, "cddb-proxy-port");
if ((socket_id = Cddb_Open_Connection (self,
- CDDB_USE_PROXY ? CDDB_PROXY_NAME : cddb_server_name,
- CDDB_USE_PROXY ? CDDB_PROXY_PORT : cddb_server_port)) <= 0)
+ proxy_enabled
+ ? proxy_hostname
+ : cddb_server_name,
+ proxy_enabled
+ ? proxy_port
+ : cddb_server_port)) <= 0)
{
g_free (string);
g_free (cddb_server_name);
g_free (cddb_server_cgi_path);
+ g_free (proxy_hostname);
return FALSE;
}
@@ -1311,7 +1328,8 @@ Cddb_Search_Album_List_From_String_Freedb (EtCDDBDialog *self)
"%s"
"Connection: close\r\n"
"\r\n",
- CDDB_USE_PROXY?"http://":"", CDDB_USE_PROXY?cddb_server_name:"", // Needed
when using proxy
+ proxy_enabled ? "http://" : "",
+ proxy_enabled ? cddb_server_name : "",
string,
(tmp = Cddb_Generate_Request_String_With_Fields_And_Categories_Options (self)),
cddb_server_name,cddb_server_port,
@@ -1335,6 +1353,7 @@ Cddb_Search_Album_List_From_String_Freedb (EtCDDBDialog *self)
g_free(string);
g_free(cddb_server_name);
g_free(cddb_server_cgi_path);
+ g_free (proxy_hostname);
return FALSE;
}
g_free(cddb_in);
@@ -1383,6 +1402,7 @@ Cddb_Search_Album_List_From_String_Freedb (EtCDDBDialog *self)
g_free(cddb_out);
g_free(cddb_server_name);
g_free(cddb_server_cgi_path);
+ g_free (proxy_hostname);
gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_search_button),FALSE);
gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_auto_search_button),FALSE);
if (file)
@@ -1508,6 +1528,7 @@ Cddb_Search_Album_List_From_String_Freedb (EtCDDBDialog *self)
g_free(cat_str); g_free(id_str); g_free(art_alb_str); g_free(end_str); g_free(html_end_str);
g_free(cddb_server_name);
g_free(cddb_server_cgi_path);
+ g_free (proxy_hostname);
// Close file opened for reading lines
if (file)
@@ -1558,6 +1579,9 @@ Cddb_Search_Album_List_From_String_Gnudb (EtCDDBDialog *self)
gchar *cddb_server_name;
gint cddb_server_port;
gchar *cddb_server_cgi_path;
+ gboolean proxy_enabled;
+ gchar *proxy_hostname;
+ guint proxy_port;
gchar *ptr_cat, *cat_str, *art_alb_str;
gchar *end_str;
@@ -1615,18 +1639,29 @@ Cddb_Search_Album_List_From_String_Gnudb (EtCDDBDialog *self)
// Do a loop to load all the pages of results
do
{
- cddb_server_name = g_strdup(CDDB_SERVER_NAME_MANUAL_SEARCH); //"www.gnudb.org");
- cddb_server_port = CDDB_SERVER_PORT_MANUAL_SEARCH; //80;
- cddb_server_cgi_path = g_strdup(CDDB_SERVER_CGI_PATH_MANUAL_SEARCH);//"/~cddb/cddb.cgi");
+ cddb_server_name = g_settings_get_string (MainSettings,
+ "cddb-manual-search-hostname");
+ cddb_server_port = g_settings_get_uint (MainSettings,
+ "cddb-manual-search-port");
+ cddb_server_cgi_path = g_settings_get_string (MainSettings,
+ "cddb-manual-search-path");
/* Connection to the server */
+ proxy_enabled = g_settings_get_boolean (MainSettings,
+ "cddb-proxy-enabled");
+ proxy_hostname = g_settings_get_string (MainSettings,
+ "cddb-proxy-hostname");
+ proxy_port = g_settings_get_uint (MainSettings, "cddb-proxy-port");
if ((socket_id = Cddb_Open_Connection (self,
- CDDB_USE_PROXY ? CDDB_PROXY_NAME : cddb_server_name,
- CDDB_USE_PROXY ? CDDB_PROXY_PORT : cddb_server_port)) <= 0)
+ proxy_enabled ? proxy_hostname
+ : cddb_server_name,
+ proxy_enabled ? proxy_port
+ : cddb_server_port)) <= 0)
{
g_free(string);
g_free(cddb_server_name);
g_free(cddb_server_cgi_path);
+ g_free (proxy_hostname);
gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_search_button),FALSE);
gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_auto_search_button),FALSE);
return FALSE;
@@ -1643,7 +1678,8 @@ Cddb_Search_Album_List_From_String_Gnudb (EtCDDBDialog *self)
"%s"
"Connection: close\r\n"
"\r\n",
- CDDB_USE_PROXY?"http://":"", CDDB_USE_PROXY?cddb_server_name:"", //
Needed when using proxy
+ proxy_enabled ? "http://" : "",
+ proxy_enabled ? cddb_server_name : "",
string,
next_page_cpt,
cddb_server_name,cddb_server_port,
@@ -1665,6 +1701,7 @@ Cddb_Search_Album_List_From_String_Gnudb (EtCDDBDialog *self)
g_free (string);
g_free (cddb_server_name);
g_free (cddb_server_cgi_path);
+ g_free (proxy_hostname);
gtk_widget_set_sensitive (GTK_WIDGET (priv->stop_search_button),
FALSE);
gtk_widget_set_sensitive (GTK_WIDGET (priv->stop_auto_search_button),
@@ -1697,6 +1734,7 @@ Cddb_Search_Album_List_From_String_Gnudb (EtCDDBDialog *self)
g_free(string);
g_free(cddb_server_name);
g_free(cddb_server_cgi_path);
+ g_free (proxy_hostname);
gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_search_button),FALSE);
gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_auto_search_button),FALSE);
return FALSE;
@@ -1714,6 +1752,7 @@ Cddb_Search_Album_List_From_String_Gnudb (EtCDDBDialog *self)
g_free(string);
g_free(cddb_server_name);
g_free(cddb_server_cgi_path);
+ g_free (proxy_hostname);
gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_search_button),FALSE);
gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_auto_search_button),FALSE);
if (file)
@@ -1859,6 +1898,7 @@ Cddb_Search_Album_List_From_String_Gnudb (EtCDDBDialog *self)
g_free(sraf_str);g_free(sraf_end_str);
g_free(cddb_server_name);
g_free(cddb_server_cgi_path);
+ g_free (proxy_hostname);
// Close file opened for reading lines
if (file)
@@ -1898,12 +1938,21 @@ Cddb_Search_Album_List_From_String_Gnudb (EtCDDBDialog *self)
static gboolean
Cddb_Search_Album_List_From_String (EtCDDBDialog *self)
{
- if (strstr (CDDB_SERVER_NAME_MANUAL_SEARCH, "gnudb") != NULL)
+ gchar *hostname = g_settings_get_string (MainSettings,
+ "cddb-manual-search-hostname");
+
+ if (strstr (hostname, "gnudb") != NULL)
+ {
/* Use gnudb. */
+ g_free (hostname);
return Cddb_Search_Album_List_From_String_Gnudb (self);
+ }
else
+ {
/* Use freedb. */
+ g_free (hostname);
return Cddb_Search_Album_List_From_String_Freedb (self);
+ }
}
/*
@@ -1969,6 +2018,9 @@ Cddb_Get_Album_Tracks_List (EtCDDBDialog *self, GtkTreeSelection* selection)
gchar *cddb_server_name;
gint cddb_server_port;
gchar *cddb_server_cgi_path;
+ gboolean proxy_enabled;
+ gchar *proxy_hostname;
+ guint proxy_port;
gint bytes_written;
gulong bytes_read_total = 0;
FILE *file = NULL;
@@ -2009,12 +2061,23 @@ Cddb_Get_Album_Tracks_List (EtCDDBDialog *self, GtkTreeSelection* selection)
}else
{
- /* Remote access. */
/* Connection to the server. */
+ proxy_enabled = g_settings_get_boolean (MainSettings,
+ "cddb-proxy-enabled");
+ proxy_hostname = g_settings_get_string (MainSettings,
+ "cddb-proxy-hostname");
+ proxy_port = g_settings_get_uint (MainSettings, "cddb-proxy-port");
if ((socket_id = Cddb_Open_Connection (self,
- CDDB_USE_PROXY ? CDDB_PROXY_NAME : cddb_server_name,
- CDDB_USE_PROXY ? CDDB_PROXY_PORT : cddb_server_port)) <= 0)
+ proxy_enabled
+ ? proxy_hostname
+ : cddb_server_name,
+ proxy_enabled
+ ? proxy_port
+ : cddb_server_port)) <= 0)
+ {
+ g_free (proxy_hostname);
return FALSE;
+ }
if ( strstr(cddb_server_name,"gnudb") != NULL )
{
@@ -2028,7 +2091,8 @@ Cddb_Get_Album_Tracks_List (EtCDDBDialog *self, GtkTreeSelection* selection)
"%s"
"Connection: close\r\n"
"\r\n",
- CDDB_USE_PROXY?"http://":"",
CDDB_USE_PROXY?cddb_server_name:"", // Needed when using proxy
+ proxy_enabled ? "http://" : "",
+ proxy_enabled ? cddb_server_name : "",
cddbalbum->category,cddbalbum->id,
cddb_server_name,cddb_server_port,
PACKAGE_NAME, PACKAGE_VERSION,
@@ -2046,7 +2110,9 @@ Cddb_Get_Album_Tracks_List (EtCDDBDialog *self, GtkTreeSelection* selection)
"Host: %s:%d\r\n"
"%s"
"Connection: close\r\n\r\n",
- CDDB_USE_PROXY?"http://":"",CDDB_USE_PROXY?cddb_server_name:"",
cddb_server_cgi_path,
+ proxy_enabled ? "http://" : "",
+ proxy_enabled ? cddb_server_name : "",
+ cddb_server_cgi_path,
cddbalbum->category,cddbalbum->id,
PACKAGE_NAME, PACKAGE_VERSION,
cddb_server_name,cddb_server_port,
@@ -2066,9 +2132,11 @@ Cddb_Get_Album_Tracks_List (EtCDDBDialog *self, GtkTreeSelection* selection)
Log_Print(LOG_ERROR,_("Cannot send the request (%s)"),g_strerror(errno));
Cddb_Close_Connection (self, socket_id);
g_free(cddb_in);
+ g_free (proxy_hostname);
return FALSE;
}
g_free(cddb_in);
+ g_free (proxy_hostname);
// Read the answer
@@ -2518,8 +2586,8 @@ Cddb_Set_Track_Infos_To_File_List (EtCDDBDialog *self)
g_warning ("Iter not found matching path in CDDB track list model");
}
- // Set values in the ETFile
- if (CDDB_USE_DLM)
+ /* Set values in the ETFile. */
+ if (g_settings_get_boolean (MainSettings, "cddb-dlm-enabled"))
{
// RQ : this part is ~ equal to code for '!CDDB_USE_DLM', but uses '*etfile' instead of 'etfile'
ET_File **etfile = NULL;
@@ -2862,16 +2930,6 @@ Cddb_Set_To_All_Fields_Check_Button_Toggled (EtCDDBDialog *self)
}
static void
-Cddb_Use_Dlm_2_Check_Button_Toggled (EtCDDBDialog *self)
-{
- EtCDDBDialogPrivate *priv;
-
- priv = et_cddb_dialog_get_instance_private (self);
-
- CDDB_USE_DLM = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->use_dlm2_toggle));
-}
-
-static void
create_cddb_dialog (EtCDDBDialog *self)
{
EtCDDBDialogPrivate *priv;
@@ -2954,7 +3012,8 @@ create_cddb_dialog (EtCDDBDialog *self)
// Check box to run the scanner
priv->use_local_access_toggle = gtk_check_button_new_with_label(_("Use local CDDB"));
gtk_box_pack_start(GTK_BOX(hbox),priv->use_local_access_toggle,FALSE,FALSE,0);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->use_local_access_toggle),CDDB_USE_LOCAL_ACCESS);
+ g_settings_bind (MainSettings, "cddb-local", priv->use_local_access_toggle,
+ "active", G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(priv->use_local_access_toggle,_("When activating this option, after loading
the "
"fields, the current selected scanner will be ran (the scanner window must be opened)."));
@@ -3072,7 +3131,9 @@ create_cddb_dialog (EtCDDBDialog *self)
gtk_grid_attach (GTK_GRID (Table), priv->search_title_toggle, 3, 0, 1, 1);
gtk_grid_attach (GTK_GRID (Table), priv->search_track_toggle, 4, 0, 1, 1);
gtk_grid_attach (GTK_GRID (Table), priv->search_other_toggle, 5, 0, 1, 1);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->search_all_toggle), CDDB_SEARCH_IN_ALL_FIELDS);
+ g_settings_bind (MainSettings, "cddb-search-all-fields",
+ priv->search_all_toggle, "active",
+ G_SETTINGS_BIND_DEFAULT);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->search_artist_toggle), CDDB_SEARCH_IN_ARTIST_FIELD);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->search_title_toggle), CDDB_SEARCH_IN_TITLE_FIELD);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->search_track_toggle),
CDDB_SEARCH_IN_TRACK_NAME_FIELD);
@@ -3149,7 +3210,9 @@ create_cddb_dialog (EtCDDBDialog *self)
gtk_grid_attach (GTK_GRID (Table), priv->categories_soundtrack_toggle, 6, 3, 1,
1);
gtk_label_set_line_wrap(GTK_LABEL(gtk_bin_get_child(GTK_BIN(priv->categories_all_toggle))),TRUE); //
Wrap label of the check button.
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->categories_all_toggle),
CDDB_SEARCH_IN_ALL_CATEGORIES);
+ g_settings_bind (MainSettings, "cddb-search-all-categories",
+ priv->categories_all_toggle, "active",
+ G_SETTINGS_BIND_DEFAULT);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->categories_blues_toggle),
CDDB_SEARCH_IN_BLUES_CATEGORY);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->categories_classical_toggle),
CDDB_SEARCH_IN_CLASSICAL_CATEGORY);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->categories_country_toggle),
CDDB_SEARCH_IN_COUNTRY_CATEGORY);
@@ -3193,8 +3256,9 @@ create_cddb_dialog (EtCDDBDialog *self)
priv->show_categories_toggle = gtk_toggle_button_new_with_label (_("Categories"));
gtk_grid_attach (GTK_GRID (Table), priv->show_categories_toggle, 6, 0, 1,
1);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->show_categories_toggle),
- CDDB_SHOW_CATEGORIES);
+ g_settings_bind (MainSettings, "cddb-search-show-categories",
+ priv->show_categories_toggle, "active",
+ G_SETTINGS_BIND_DEFAULT);
g_signal_connect_swapped (priv->show_categories_toggle, "toggled",
G_CALLBACK (on_show_categories_toggle_toggled),
self);
@@ -3489,25 +3553,23 @@ create_cddb_dialog (EtCDDBDialog *self)
// Check box to run the scanner
priv->run_scanner_toggle = gtk_check_button_new_with_label(_("Run the current scanner for each file"));
gtk_box_pack_start(GTK_BOX(hbox),priv->run_scanner_toggle,FALSE,TRUE,0);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->run_scanner_toggle),CDDB_RUN_SCANNER);
+ g_settings_bind (MainSettings, "cddb-run-scanner",
+ priv->run_scanner_toggle, "active",
+ G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(priv->run_scanner_toggle,_("When activating this option, after loading the "
"fields, the current selected scanner will be ran (the scanner window must be opened)."));
// Check box to use DLM (also used in the preferences window)
priv->use_dlm2_toggle = gtk_check_button_new_with_label(_("Match lines with the Levenshtein algorithm"));
gtk_box_pack_start(GTK_BOX(hbox),priv->use_dlm2_toggle,FALSE,FALSE,0);
- // Doesn't activate it by default because if the new user don't pay attention to it,
- // it will not understand why the cddb results aren't loaded correctly...
- //gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->use_dlm2_toggle),CDDB_USE_DLM);
+ g_settings_bind (MainSettings, "cddb-dlm-enabled", priv->use_dlm2_toggle,
+ "active", G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(priv->use_dlm2_toggle,_("When activating this option, the "
"Levenshtein algorithm (DLM: Damerau-Levenshtein Metric) will be used "
"to match the CDDB title against every filename in the current folder, "
"and to select the best match. This will be used when selecting the "
"corresponding audio file, or applying CDDB results, instead of using "
"directly the position order."));
- g_signal_connect_swapped (priv->use_dlm2_toggle, "toggled",
- G_CALLBACK (Cddb_Use_Dlm_2_Check_Button_Toggled),
- self);
/* Button to apply. */
priv->apply_button = gtk_button_new_from_stock(GTK_STOCK_APPLY);
@@ -3554,14 +3616,11 @@ et_cddb_dialog_apply_changes (EtCDDBDialog *self)
priv = et_cddb_dialog_get_instance_private (self);
- CDDB_SEARCH_IN_ALL_FIELDS =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->search_all_toggle));
CDDB_SEARCH_IN_ARTIST_FIELD =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->search_artist_toggle));
CDDB_SEARCH_IN_TITLE_FIELD =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->search_title_toggle));
CDDB_SEARCH_IN_TRACK_NAME_FIELD =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->search_track_toggle));
CDDB_SEARCH_IN_OTHER_FIELD =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->search_other_toggle));
- CDDB_SHOW_CATEGORIES =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->show_categories_toggle));
- CDDB_SEARCH_IN_ALL_CATEGORIES =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_all_toggle));
CDDB_SEARCH_IN_BLUES_CATEGORY =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_blues_toggle));
CDDB_SEARCH_IN_CLASSICAL_CATEGORY =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_classical_toggle));
CDDB_SEARCH_IN_COUNTRY_CATEGORY =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_country_toggle));
@@ -3583,10 +3642,6 @@ et_cddb_dialog_apply_changes (EtCDDBDialog *self)
CDDB_SET_TO_GENRE = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->set_genre_toggle));
CDDB_SET_TO_FILE_NAME = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->set_filename_toggle));
- CDDB_RUN_SCANNER = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->run_scanner_toggle));
- CDDB_USE_DLM = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->use_dlm2_toggle));
- CDDB_USE_LOCAL_ACCESS = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->use_local_access_toggle));
-
/* Save combobox history lists before exit. */
Save_Cddb_Search_String_List(priv->search_string_model, MISC_COMBO_TEXT);
Save_Cddb_Search_String_In_Result_List(priv->search_string_in_result_model, MISC_COMBO_TEXT);
@@ -3826,6 +3881,9 @@ et_cddb_dialog_search_from_selection (EtCDDBDialog *self)
gchar *cddb_server_name;
gint cddb_server_port;
gchar *cddb_server_cgi_path;
+ gboolean proxy_enabled;
+ gchar *proxy_hostname;
+ guint proxy_port;
gint server_try = 0;
gchar *tmp, *valid;
gchar *query_string;
@@ -3957,8 +4015,7 @@ et_cddb_dialog_search_from_selection (EtCDDBDialog *self)
gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_auto_search_button),TRUE);
- CDDB_USE_LOCAL_ACCESS = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->use_local_access_toggle));
- if (CDDB_USE_LOCAL_ACCESS) // Remote or Local acces?
+ if (g_settings_get_boolean (MainSettings, "cddb-local"))
{
/*
* Local cddb acces
@@ -4086,16 +4143,24 @@ et_cddb_dialog_search_from_selection (EtCDDBDialog *self)
server_try++;
if (server_try == 1)
{
- // 1rst try
- cddb_server_name = g_strdup(CDDB_SERVER_NAME_AUTOMATIC_SEARCH);
- cddb_server_port = CDDB_SERVER_PORT_AUTOMATIC_SEARCH;
- cddb_server_cgi_path = g_strdup(CDDB_SERVER_CGI_PATH_AUTOMATIC_SEARCH);
- }else
+ /* 1st try. */
+ cddb_server_name = g_settings_get_string (MainSettings,
+ "cddb-automatic-search-hostname");
+ cddb_server_port = g_settings_get_uint (MainSettings,
+ "cddb-automatic-search-port");
+ cddb_server_cgi_path = g_settings_get_string (MainSettings,
+ "cddb-automatic-search-path");
+
+ }
+ else
{
- // 2sd try
- cddb_server_name = g_strdup(CDDB_SERVER_NAME_AUTOMATIC_SEARCH2);
- cddb_server_port = CDDB_SERVER_PORT_AUTOMATIC_SEARCH2;
- cddb_server_cgi_path = g_strdup(CDDB_SERVER_CGI_PATH_AUTOMATIC_SEARCH2);
+ /* 2nd try. */
+ cddb_server_name = g_settings_get_string (MainSettings,
+ "cddb-automatic-search-hostname2");
+ cddb_server_port = g_settings_get_uint (MainSettings,
+ "cddb-automatic-search-port");
+ cddb_server_cgi_path = g_settings_get_string (MainSettings,
+ "cddb-automatic-search-path2");
}
// Check values
@@ -4103,13 +4168,24 @@ et_cddb_dialog_search_from_selection (EtCDDBDialog *self)
continue;
/* Connection to the server. */
+ proxy_enabled = g_settings_get_boolean (MainSettings,
+ "cddb-proxy-enabled");
+ proxy_hostname = g_settings_get_string (MainSettings,
+ "cddb-proxy-hostname");
+ proxy_port = g_settings_get_uint (MainSettings, "cddb-proxy-port");
+
if ((socket_id = Cddb_Open_Connection (self,
- CDDB_USE_PROXY ? CDDB_PROXY_NAME : cddb_server_name,
- CDDB_USE_PROXY ? CDDB_PROXY_PORT : cddb_server_port)) <=
0)
+ proxy_enabled
+ ? proxy_hostname
+ : cddb_server_name,
+ proxy_enabled
+ ? proxy_port
+ : cddb_server_port)) <= 0)
{
g_free(cddb_in);
g_free(cddb_server_name);
g_free(cddb_server_cgi_path);
+ g_free (proxy_hostname);
return FALSE;
}
@@ -4126,7 +4202,9 @@ et_cddb_dialog_search_from_selection (EtCDDBDialog *self)
"Host: %s:%d\r\n"
"%s"
"Connection: close\r\n\r\n",
- CDDB_USE_PROXY?"http://":"",CDDB_USE_PROXY?cddb_server_name:"",
cddb_server_cgi_path,
+ proxy_enabled ? "http://" : "",
+ proxy_enabled ? cddb_server_name : "",
+ cddb_server_cgi_path,
cddb_discid,
num_tracks, query_string,
disc_length,
@@ -4152,6 +4230,7 @@ et_cddb_dialog_search_from_selection (EtCDDBDialog *self)
g_free (cddb_in);
g_free (cddb_server_name);
g_free (cddb_server_cgi_path);
+ g_free (proxy_hostname);
return FALSE;
}
g_free(cddb_in);
@@ -4174,6 +4253,7 @@ et_cddb_dialog_search_from_selection (EtCDDBDialog *self)
g_free(msg);
g_free(cddb_server_name);
g_free(cddb_server_cgi_path);
+ g_free (proxy_hostname);
gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_search_button),FALSE);
gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_auto_search_button),FALSE);
return FALSE;
@@ -4190,6 +4270,7 @@ et_cddb_dialog_search_from_selection (EtCDDBDialog *self)
g_free(cddb_out);
g_free(cddb_server_name);
g_free(cddb_server_cgi_path);
+ g_free (proxy_hostname);
gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_search_button),FALSE);
gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_auto_search_button),FALSE);
if (file)
@@ -4280,6 +4361,7 @@ et_cddb_dialog_search_from_selection (EtCDDBDialog *self)
g_free(cddb_end_str);
g_free(cddb_server_name);
g_free(cddb_server_cgi_path);
+ g_free (proxy_hostname);
/* Close file opened for reading lines. */
if (file)
@@ -4359,22 +4441,33 @@ Cddb_Get_Pixbuf_From_Server_Name (const gchar *server_name)
static gchar *
Cddb_Format_Proxy_Authentification (void)
{
+ gchar *username;
+ gchar *password;
gchar *ret;
- if (CDDB_USE_PROXY && CDDB_PROXY_USER_NAME != NULL && *CDDB_PROXY_USER_NAME != '\0')
+ username = g_settings_get_string (MainSettings, "cddb-proxy-username");
+ password = g_settings_get_string (MainSettings, "cddb-proxy-password");
+
+ if (g_settings_get_boolean (MainSettings, "cddb-proxy-enabled")
+ && username && *username )
{
const gchar *tempstr;
gchar *str_encoded;
- tempstr = g_strconcat(CDDB_PROXY_USER_NAME, ":", CDDB_PROXY_USER_PASSWORD, NULL);
+ tempstr = g_strconcat (username, ":", password, NULL);
str_encoded = g_base64_encode((const guchar *)tempstr, strlen(tempstr));
ret = g_strdup_printf("Proxy-authorization: Basic %s\r\n", str_encoded);
g_free (str_encoded);
- }else
+ }
+ else
{
- ret = g_strdup("");
+ ret = g_strdup ("");
}
+
+ g_free (username);
+ g_free (password);
+
return ret;
}
diff --git a/src/easytag.c b/src/easytag.c
index f6bf494..5df2538 100644
--- a/src/easytag.c
+++ b/src/easytag.c
@@ -1,20 +1,20 @@
-/*
- * EasyTAG - Tag editor for MP3 and Ogg Vorbis files
- * Copyright (C) 2000-2003 Jerome Couderc <easytag gmail com>
+/* EasyTAG - Tag editor for audio files
+ * Copyright (C) 2014 David King <amigadave amigadave com>
+ * Copyright (C) 2000-2003 Jerome Couderc <easytag gmail com>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
@@ -179,7 +179,7 @@ common_init (GApplication *application)
* @arg: the path to check
*
* Recursively check for a hidden path in the directory tree given by @arg. If
- * a hidden path is found, set BROWSE_HIDDEN to 1.
+ * a hidden path is found, set browse-show-hidden to TRUE.
*/
static void
check_for_hidden_path_in_tree (GFile *arg)
@@ -214,9 +214,8 @@ check_for_hidden_path_in_tree (GFile *arg)
{
if (g_file_info_get_is_hidden (info))
{
- /* If the user saves the configuration for this session,
- * this value will be saved. */
- BROWSE_HIDDEN_DIR = 1;
+ g_settings_set_boolean (MainSettings, "browse-show-hidden",
+ TRUE);
}
}
@@ -871,7 +870,8 @@ Save_File (ET_File *ETFile, gboolean multiple_files,
GtkWidget *msgdialog_check_button = NULL;
gint response;
- if (CONFIRM_WRITE_TAG && !SF_HideMsgbox_Write_Tag)
+ if (g_settings_get_boolean (MainSettings, "confirm-rename-file")
+ && !SF_HideMsgbox_Write_Tag)
{
// ET_Display_File_Data_To_UI(ETFile);
@@ -954,7 +954,8 @@ Save_File (ET_File *ETFile, gboolean multiple_files,
GtkWidget *msgdialog_check_button = NULL;
gint response;
- if (CONFIRM_RENAME_FILE && !SF_HideMsgbox_Rename_File)
+ if (g_settings_get_boolean (MainSettings, "confirm-rename-file")
+ && !SF_HideMsgbox_Rename_File)
{
gchar *msgdialog_title = NULL;
gchar *msg = NULL;
@@ -1321,17 +1322,18 @@ gboolean Read_Directory (gchar *path_real)
/* Open the window to quit recursion (since 27/04/2007 : not only into recursion mode) */
Set_Busy_Cursor();
uiaction = gtk_ui_manager_get_action(UIManager, "/ToolBar/Stop");
- g_object_set(uiaction, "sensitive", BROWSE_SUBDIR, NULL);
- //if (BROWSE_SUBDIR)
- Open_Quit_Recursion_Function_Window();
+ g_settings_bind (MainSettings, "browse-subdir", uiaction, "sensitive",
+ G_SETTINGS_BIND_DEFAULT);
+ Open_Quit_Recursion_Function_Window();
/* Read the directory recursively */
msg = g_strdup_printf(_("Search in progress…"));
Statusbar_Message(msg,FALSE);
g_free(msg);
- // Search the supported files
+ /* Search the supported files. */
FileList = read_directory_recursively (FileList, dir_enumerator,
- BROWSE_SUBDIR);
+ g_settings_get_boolean (MainSettings,
+ "browse-subdir"));
g_file_enumerator_close (dir_enumerator, NULL, &error);
g_object_unref (dir_enumerator);
g_object_unref (dir);
@@ -1397,7 +1399,7 @@ gboolean Read_Directory (gchar *path_real)
//}
/* Prepare message for the status bar */
- if (BROWSE_SUBDIR)
+ if (g_settings_get_boolean (MainSettings, "browse-subdir"))
{
msg = g_strdup_printf (ngettext ("Found one file in this directory and subdirectories",
"Found %d files in this directory and subdirectories",
@@ -1428,7 +1430,7 @@ gboolean Read_Directory (gchar *path_real)
_("No files")); /* See in ET_Display_Filename_To_UI */
/* Prepare message for the status bar */
- if (BROWSE_SUBDIR)
+ if (g_settings_get_boolean (MainSettings, "browse-subdir"))
msg = g_strdup(_("No file found in this directory and subdirectories"));
else
msg = g_strdup(_("No file found in this directory"));
@@ -1479,7 +1481,9 @@ read_directory_recursively (GList *file_list, GFileEnumerator *dir_enumerator,
type = g_file_info_get_file_type (info);
/* Hidden directory like '.mydir' will also be browsed if allowed. */
- if (!is_hidden || (BROWSE_HIDDEN_DIR && is_hidden))
+ if (!is_hidden || (g_settings_get_boolean (MainSettings,
+ "browse-show-hidden")
+ && is_hidden))
{
if (type == G_FILE_TYPE_DIRECTORY)
{
@@ -1931,7 +1935,7 @@ Init_Load_Default_Dir (void)
/* FIXME: Open the scanner window. */
/*
- if (OPEN_SCANNER_WINDOW_ON_STARTUP)
+ if (g_settings_get_boolean (MainSettings, "scan-startup"))
{
et_application_window_show_scan_dialog (ET_APPLICATION_WINDOW (MainWindow));
}
@@ -1999,7 +2003,8 @@ void Quit_MainWindow (void)
ET_Save_File_Data_From_UI(ETCore->ETFileDisplayed); // To detect change before exiting
/* Check if all files have been saved before exit */
- if (CONFIRM_WHEN_UNSAVED_FILES && ET_Check_If_All_Files_Are_Saved() != TRUE)
+ if (g_settings_get_boolean (MainSettings, "confirm-when-unsaved-files")
+ && ET_Check_If_All_Files_Are_Saved () != TRUE)
{
/* Some files haven't been saved */
msgbox = gtk_message_dialog_new(GTK_WINDOW(MainWindow),
@@ -2032,7 +2037,8 @@ void Quit_MainWindow (void)
break;
}
- } else if (CONFIRM_BEFORE_EXIT)
+ }
+ else if (g_settings_get_boolean (MainSettings, "confirm-quit"))
{
msgbox = gtk_message_dialog_new(GTK_WINDOW(MainWindow),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
diff --git a/src/et_core.c b/src/et_core.c
index 4839412..8b12d97 100644
--- a/src/et_core.c
+++ b/src/et_core.c
@@ -1,21 +1,20 @@
-/* et_core.c - 2001/10/21 */
-/*
- * EasyTAG - Tag editor for MP3 and Ogg Vorbis files
- * Copyright (C) 2000-2003 Jerome Couderc <easytag gmail com>
+/* EasyTAG - Tag editor for audio files
+ * Copyright (C) 2000-2003 David King <amigadave amigadave com>
+ * Copyright (C) 2000-2003 Jerome Couderc <easytag gmail com>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <config.h>
@@ -4079,7 +4078,8 @@ gboolean ET_Save_File_Tag_To_HD (ET_File *ETFile)
/* Update properties for the file. */
if (fileinfo)
{
- if (PRESERVE_MODIFICATION_TIME)
+ if (g_settings_get_boolean (MainSettings,
+ "file-preserve-modification-time"))
{
g_file_set_attributes_from_info (file, fileinfo,
G_FILE_QUERY_INFO_NONE,
@@ -4107,10 +4107,13 @@ gboolean ET_Save_File_Tag_To_HD (ET_File *ETFile)
if (state==TRUE)
{
- // Update date and time of the parent directory of the file after changing the tag
- // value (ex: needed for Amarok for refreshing). Note that when renaming a file the
- // parent directory is automatically updated.
- if (UPDATE_PARENT_DIRECTORY_MODIFICATION_TIME)
+ /* Update date and time of the parent directory of the file after
+ * changing the tag value (ex: needed for Amarok for refreshing). Note
+ * that when renaming a file the parent directory is automatically
+ * updated.
+ */
+ if (g_settings_get_boolean (MainSettings,
+ "file-update-parent-modification-time"))
{
gchar *path = g_path_get_dirname (cur_filename);
utime (path, NULL);
@@ -4995,8 +4998,9 @@ gboolean ET_File_Name_Convert_Character (gchar *filename_utf8)
*character = '-';
#endif /* G_OS_WIN32 */
- // Convert other illegal characters on FAT32/16 filesystems and ISO9660 and Joliet (CD-ROM filesystems)
- if (REPLACE_ILLEGAL_CHARACTERS_IN_FILENAME)
+ /* Convert other illegal characters on FAT32/16 filesystems and ISO9660 and
+ * Joliet (CD-ROM filesystems). */
+ if (g_settings_get_boolean (MainSettings, "rename-replace-illegal-chars"))
{
// Commented as we display unicode values as "\351" for "Ă©"
//while ( (character=g_utf8_strchr(filename_utf8, -1, '\\'))!=NULL )
diff --git a/src/flac_tag.c b/src/flac_tag.c
index 2bbfa4c..e6c0b57 100644
--- a/src/flac_tag.c
+++ b/src/flac_tag.c
@@ -931,22 +931,30 @@ gboolean Flac_Tag_Write_File_Tag (ET_File *ETFile)
/*********
* Title *
*********/
- Flac_Set_Tag(vc_block,"TITLE=",FileTag->title, VORBIS_SPLIT_FIELD_TITLE);
+ Flac_Set_Tag (vc_block, "TITLE=", FileTag->title,
+ g_settings_get_boolean (MainSettings,
+ "ogg-split-title"));
/**********
* Artist *
**********/
- Flac_Set_Tag(vc_block,"ARTIST=",FileTag->artist,VORBIS_SPLIT_FIELD_ARTIST);
+ Flac_Set_Tag (vc_block, "ARTIST=", FileTag->artist,
+ g_settings_get_boolean (MainSettings,
+ "ogg-split-artist"));
/****************
* Album Artist *
****************/
- Flac_Set_Tag(vc_block,"ALBUMARTIST=",FileTag->album_artist,VORBIS_SPLIT_FIELD_ARTIST);
+ Flac_Set_Tag (vc_block, "ALBUMARTIST=", FileTag->album_artist,
+ g_settings_get_boolean (MainSettings,
+ "ogg-split-artist"));
/*********
* Album *
*********/
- Flac_Set_Tag(vc_block,"ALBUM=",FileTag->album,VORBIS_SPLIT_FIELD_ALBUM);
+ Flac_Set_Tag (vc_block, "ALBUM=", FileTag->album,
+ g_settings_get_boolean (MainSettings,
+ "ogg-split-album"));
/******************************
* Disc Number and Disc Total *
@@ -968,22 +976,30 @@ gboolean Flac_Tag_Write_File_Tag (ET_File *ETFile)
/*********
* Genre *
*********/
- Flac_Set_Tag(vc_block,"GENRE=",FileTag->genre,VORBIS_SPLIT_FIELD_GENRE);
+ Flac_Set_Tag (vc_block, "GENRE=", FileTag->genre,
+ g_settings_get_boolean (MainSettings,
+ "ogg-split-genre"));
/***********
* Comment *
***********/
- Flac_Set_Tag(vc_block,"DESCRIPTION=",FileTag->comment,VORBIS_SPLIT_FIELD_COMMENT);
+ Flac_Set_Tag (vc_block, "DESCRIPTION=", FileTag->comment,
+ g_settings_get_boolean (MainSettings,
+ "ogg-split-comment"));
/************
* Composer *
************/
- Flac_Set_Tag(vc_block,"COMPOSER=",FileTag->composer,VORBIS_SPLIT_FIELD_COMPOSER);
+ Flac_Set_Tag (vc_block, "COMPOSER=", FileTag->composer,
+ g_settings_get_boolean (MainSettings,
+ "ogg-split-comment"));
/*******************
* Original artist *
*******************/
- Flac_Set_Tag(vc_block,"PERFORMER=",FileTag->orig_artist,VORBIS_SPLIT_FIELD_ORIG_ARTIST);
+ Flac_Set_Tag (vc_block, "PERFORMER=", FileTag->orig_artist,
+ g_settings_get_boolean (MainSettings,
+ "ogg-split-original-artist"));
/*************
* Copyright *
@@ -1082,8 +1098,10 @@ gboolean Flac_Tag_Write_File_Tag (ET_File *ETFile)
// Move all PADDING blocks to the end on the metadata, and merge them into a single block.
FLAC__metadata_chain_sort_padding(chain);
- // Write tag
- if ( !FLAC__metadata_chain_write(chain, /*padding*/TRUE, PRESERVE_MODIFICATION_TIME) )
+ /* Write tag. */
+ if (!FLAC__metadata_chain_write (chain, /*padding*/TRUE,
+ g_settings_get_boolean (MainSettings,
+ "file-preserve-modification-time")))
{
// Error with "FLAC__metadata_chain_write"
FLAC__Metadata_ChainStatus status = FLAC__metadata_chain_status(chain);
diff --git a/src/id3_tag.c b/src/id3_tag.c
index 44536ca..5d1a122 100644
--- a/src/id3_tag.c
+++ b/src/id3_tag.c
@@ -180,10 +180,10 @@ Id3tag_Write_File_v23Tag (ET_File *ETFile)
// When writing the first MP3 file, we check if the version of id3lib of the
// system doesn't contain a bug when writting Unicode tags
if (flag_first_check
- && (FILE_WRITING_ID3V2_USE_UNICODE_CHARACTER_SET) )
+ && g_settings_get_boolean (MainSettings, "id3v2-enable-unicode"))
{
flag_first_check = FALSE;
- flag_id3lib_bugged = Id3tag_Check_If_Id3lib_Is_Bugged();
+ flag_id3lib_bugged = Id3tag_Check_If_Id3lib_Is_Bugged ();
}
FileTag = (File_Tag *)ETFile->FileTag->data;
@@ -366,10 +366,15 @@ Id3tag_Write_File_v23Tag (ET_File *ETFile)
genre_value = Id3tag_String_To_Genre(FileTag->genre);
// If genre not defined don't write genre value between brackets! (priority problem noted with some
tools)
- if ((genre_value == ID3_INVALID_GENRE)||(FILE_WRITING_ID3V2_TEXT_ONLY_GENRE))
+ if ((genre_value == ID3_INVALID_GENRE)
+ || g_settings_get_boolean (MainSettings, "id3v2-text-only-genre"))
+ {
genre_string_tmp = g_strdup_printf("%s",FileTag->genre);
+ }
else
+ {
genre_string_tmp = g_strdup_printf("(%d)",genre_value);
+ }
Id3tag_Set_Field(id3_frame, ID3FN_TEXT, genre_string_tmp);
g_free(genre_string_tmp);
@@ -576,10 +581,10 @@ Id3tag_Write_File_v23Tag (ET_File *ETFile)
* equal to 0, id3lib-3.7.12 doesn't update the tag */
number_of_frames = ID3Tag_NumFrames(id3_tag);
- /* If all fields (managed in the UI) are empty and option STRIP_TAG_WHEN_EMPTY_FIELDS
- * is set to 1, we strip the ID3v1.x and ID3v2 tags. Else, write ID3v2 and/or ID3v1
- */
- if ( STRIP_TAG_WHEN_EMPTY_FIELDS
+ /* If all fields (managed in the UI) are empty and option id3-strip-empty
+ * is set to TRUE, we strip the ID3v1.x and ID3v2 tags. Else, write ID3v2
+ * and/or ID3v1. */
+ if (g_settings_get_boolean (MainSettings, "id3-strip-empty")
&& !has_title && !has_artist && !has_album_artist && !has_album && !has_year &&
!has_track
&& !has_genre && !has_composer && !has_orig_artist && !has_copyright && !has_url
&& !has_encoded_by && !has_picture && !has_comment && !has_disc_number)//&& !has_song_len )
@@ -609,7 +614,8 @@ Id3tag_Write_File_v23Tag (ET_File *ETFile)
/*
* ID3v2 tag
*/
- if (FILE_WRITING_ID3V2_WRITE_TAG && number_of_frames!=0)
+ if (g_settings_get_boolean (MainSettings, "id3v2-enabled")
+ && number_of_frames != 0)
{
error_update_id3v2 = ID3Tag_UpdateByTagType(id3_tag,ID3TT_ID3V2);
if (error_update_id3v2 != ID3E_NoError)
@@ -627,7 +633,8 @@ Id3tag_Write_File_v23Tag (ET_File *ETFile)
* by Id3tag_Check_If_Id3lib_Is_Bugged) we didn't make the following
* test => OK */
if (flag_id3lib_bugged
- && ( FILE_WRITING_ID3V2_USE_UNICODE_CHARACTER_SET ))
+ && g_settings_get_boolean (MainSettings,
+ "id3v2-enable-unicode"))
{
File_Tag *FileTag_tmp = ET_File_Tag_Item_New();
if (Id3tag_Read_File_Tag(filename,FileTag_tmp) == TRUE
@@ -675,7 +682,8 @@ Id3tag_Write_File_v23Tag (ET_File *ETFile)
* Must be set after ID3v2 or ID3Tag_UpdateByTagType cause damage to unicode strings
*/
// id3lib writes incorrectly the ID3v2 tag if unicode used when writing ID3v1 tag
- if (FILE_WRITING_ID3V1_WRITE_TAG && number_of_frames!=0)
+ if (g_settings_get_boolean (MainSettings, "id3v1-enabled")
+ && number_of_frames != 0)
{
// By default id3lib converts id3tag to ISO-8859-1 (single byte character set)
// Note : converting UTF-16 string (two bytes character set) to ISO-8859-1
@@ -922,7 +930,9 @@ gchar *Id3tag_Get_Field (const ID3Frame *id3_frame, ID3_FieldID id3_fieldid)
if (enc != ID3TE_UTF16 && enc != ID3TE_UTF8) // Encoding is ISO-8859-1?
{
- if (USE_NON_STANDARD_ID3_READING_CHARACTER_SET) // Override with another character set?
+ /* Override with another character set? */
+ if (g_settings_get_boolean (MainSettings,
+ "id3-override-read-encoding"))
{
// Encoding set by user to ???.
if ( strcmp(FILE_READING_ID3V1V2_CHARACTER_SET,"ISO-8859-1") == 0 )
@@ -1055,7 +1065,7 @@ Id3tag_Set_Field (const ID3Frame *id3_frame,
* We prioritize the rule selected in options. If the encoding of the
* field is ISO-8859-1, we can write it to another single byte encoding.
*/
- if (FILE_WRITING_ID3V2_USE_UNICODE_CHARACTER_SET)
+ if (g_settings_get_boolean (MainSettings, "id3v2-enable-unicode"))
{
// Check if we can write the tag using ISO-8859-1 instead of UTF-16...
if ( (string_converted = g_convert(string, strlen(string), "ISO-8859-1",
@@ -1396,9 +1406,12 @@ gboolean Id3tag_Check_If_Id3lib_Is_Bugged (void)
g_output_stream_close (G_OUTPUT_STREAM (ostream), NULL, NULL);
g_object_unref (ostream);
- // Save state of switches as we must force to Unicode before writting
- use_unicode = FILE_WRITING_ID3V2_USE_UNICODE_CHARACTER_SET;
- FILE_WRITING_ID3V2_USE_UNICODE_CHARACTER_SET = TRUE;
+ /* Save state of switches as we must force to Unicode before writing.
+ * FIXME! */
+ g_settings_delay (MainSettings);
+ use_unicode = g_settings_get_boolean (MainSettings,
+ "id3v2-enable-unicode");
+ g_settings_set_boolean (MainSettings, "id3v2-enable-unicode", TRUE);
id3_tag = ID3Tag_New();
path = g_file_get_path (file);
@@ -1415,8 +1428,8 @@ gboolean Id3tag_Check_If_Id3lib_Is_Bugged (void)
ID3Tag_UpdateByTagType(id3_tag,ID3TT_ID3V2);
ID3Tag_Delete(id3_tag);
- FILE_WRITING_ID3V2_USE_UNICODE_CHARACTER_SET = use_unicode;
-
+ g_settings_set_boolean (MainSettings, "id3v2-enable-unicode", use_unicode);
+ g_settings_revert (MainSettings);
id3_tag = ID3Tag_New();
ID3Tag_Link_1 (id3_tag, path);
diff --git a/src/id3v24_tag.c b/src/id3v24_tag.c
index a25167c..11e84ad 100644
--- a/src/id3v24_tag.c
+++ b/src/id3v24_tag.c
@@ -1,22 +1,21 @@
-/* id3v24_tag.c - 2007/05/25 */
-/*
- * EasyTAG - Tag editor for MP3 and Ogg Vorbis files
- * Copyright (C) 2001-2003 Jerome Couderc <easytag gmail com>
- * Copyright (C) 2006-2007 Alexey Illarionov <littlesavage rambler ru>
+/* EasyTAG - Tag editor for audio files
+ * Copyright (C) 2014 David King <amigadave amigadave com>
+ * Copyright (C) 2001-2003 Jerome Couderc <easytag gmail com>
+ * Copyright (C) 2006-2007 Alexey Illarionov <littlesavage rambler ru>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <config.h>
@@ -134,19 +133,19 @@ gboolean Id3tag_Read_File_Tag (const gchar *filename, File_Tag *FileTag)
if ((tagsize = id3_tag_query((id3_byte_t const *)string1, ID3_TAG_QUERYSIZE)) <= ID3_TAG_QUERYSIZE)
{
- // ID3v2 tag not found!
- update = FILE_WRITING_ID3V2_WRITE_TAG;
+ /* ID3v2 tag not found! */
+ update = !g_settings_get_boolean (MainSettings, "id3v2-enabled");
}else
{
/* ID3v2 tag found */
- if (FILE_WRITING_ID3V2_WRITE_TAG == 0)
+ if (!g_settings_get_boolean (MainSettings, "id3v2-enabled"))
{
- // To delete the tag
+ /* To delete the tag. */
update = 1;
}else
{
/* Determine version if user want to upgrade old tags */
- if (CONVERT_OLD_ID3V2_TAG_VERSION
+ if (g_settings_get_boolean (MainSettings, "id3v2-convert-old")
&& (string1 = g_realloc (string1, tagsize))
&& (read(tmpfile, &string1[ID3_TAG_QUERYSIZE], tagsize - ID3_TAG_QUERYSIZE) == tagsize -
ID3_TAG_QUERYSIZE)
&& (tag = id3_tag_parse((id3_byte_t const *)string1, tagsize))
@@ -180,13 +179,13 @@ gboolean Id3tag_Read_File_Tag (const gchar *filename, File_Tag *FileTag)
&& (string1[2] == 'G')
)
{
- // ID3v1 tag found!
- if (!FILE_WRITING_ID3V1_WRITE_TAG)
+ /* ID3v1 tag found! */
+ if (g_settings_get_boolean (MainSettings, "id3v1-enabled"))
update = 1;
}else
{
- // ID3v1 tag not found!
- if (FILE_WRITING_ID3V1_WRITE_TAG)
+ /* ID3v1 tag not found! */
+ if (!g_settings_get_boolean (MainSettings, "id3v1-enabled"))
update = 1;
}
@@ -547,7 +546,7 @@ etag_guess_byteorder(const id3_ucs4_t *ustr, gchar **ret) /* XXX */
unsigned i, len;
gunichar *gstr;
gchar *tmp, *str, *str2;
- const gchar *charset;
+ gchar *charset;
if (!ustr || !*ustr)
{
@@ -556,11 +555,20 @@ etag_guess_byteorder(const id3_ucs4_t *ustr, gchar **ret) /* XXX */
return 0;
}
- if (USE_NON_STANDARD_ID3_READING_CHARACTER_SET)
+ if (g_settings_get_boolean (MainSettings, "id3-override-read-encoding"))
+ {
charset = FILE_READING_ID3V1V2_CHARACTER_SET;
- else if (!FILE_WRITING_ID3V2_USE_UNICODE_CHARACTER_SET) /* XXX */
- charset = FILE_WRITING_ID3V2_NO_UNICODE_CHARACTER_SET;
- else g_get_charset(&charset);
+ }
+ else if (!g_settings_get_boolean (MainSettings, "id3v2-enable-unicode"))
+ {
+ charset = FILE_WRITING_ID3V2_NO_UNICODE_CHARACTER_SET; /* XXX */
+ }
+ else
+ {
+ const gchar *tmp;
+ g_get_charset (&tmp);
+ charset = g_strdup (tmp);
+ }
if (!charset)
charset = "ISO-8859-1";
@@ -574,6 +582,7 @@ etag_guess_byteorder(const id3_ucs4_t *ustr, gchar **ret) /* XXX */
*ret = tmp;
else
free (tmp);
+ g_free (charset);
return 0; /* byteorder not changed */
}
@@ -586,6 +595,7 @@ etag_guess_byteorder(const id3_ucs4_t *ustr, gchar **ret) /* XXX */
*ret = tmp;
else
free(tmp);
+ g_free (charset);
return 0;
}
@@ -600,6 +610,7 @@ etag_guess_byteorder(const id3_ucs4_t *ustr, gchar **ret) /* XXX */
*ret = tmp;
else
free(tmp);
+ g_free (charset);
return 0;
}
@@ -613,6 +624,7 @@ etag_guess_byteorder(const id3_ucs4_t *ustr, gchar **ret) /* XXX */
*ret = str;
else
free(str);
+ g_free (charset);
return 1;
}
@@ -623,6 +635,7 @@ etag_guess_byteorder(const id3_ucs4_t *ustr, gchar **ret) /* XXX */
else
free(tmp);
+ g_free (charset);
return 0;
}
@@ -647,7 +660,8 @@ etag_ucs42gchar(const id3_ucs4_t *usrc, unsigned is_latin,
retval = 0, retstr = NULL;
- if (is_latin && USE_NON_STANDARD_ID3_READING_CHARACTER_SET)
+ if (is_latin && g_settings_get_boolean (MainSettings,
+ "id3-override-read-encoding"))
{
if ((latinstr = (gchar *)id3_ucs4_latin1duplicate(usrc)))
{
@@ -726,7 +740,8 @@ libid3tag_Get_Frame_Str (const struct id3_frame *frame,
latinstr = g_strdup (field_type == ID3_FIELD_TYPE_LATIN1 ? (gchar *)id3_field_getlatin1
(field)
: (gchar *)id3_field_getfulllatin1
(field));
- if (USE_NON_STANDARD_ID3_READING_CHARACTER_SET)
+ if (g_settings_get_boolean (MainSettings,
+ "id3-override-read-encoding"))
{
tmpstr = convert_string (latinstr,
FILE_READING_ID3V1V2_CHARACTER_SET,
@@ -859,8 +874,8 @@ gboolean Id3tag_Write_File_v24Tag (ET_File *ETFile)
v1tag = v2tag = NULL;
- // Write ID3v2 tag
- if (FILE_WRITING_ID3V2_WRITE_TAG)
+ /* Write ID3v2 tag. */
+ if (g_settings_get_boolean (MainSettings, "id3v2-enabled"))
{
struct id3_file *file;
struct id3_tag *tmptag;
@@ -919,14 +934,18 @@ gboolean Id3tag_Write_File_v24Tag (ET_File *ETFile)
//ID3_TAG_OPTION_UNSYNCHRONISATION); // Taglib doesn't support frames with
unsynchronisation (patch from Alexey Illarionov) http://bugs.kde.org/show_bug.cgi?id=138829
0);
- if (FILE_WRITING_ID3V2_USE_CRC32)
- id3_tag_options(v2tag, ID3_TAG_OPTION_CRC, ~0);
- if (FILE_WRITING_ID3V2_USE_COMPRESSION)
- id3_tag_options(v2tag, ID3_TAG_OPTION_COMPRESSION, ~0);
+ if (g_settings_get_boolean (MainSettings, "id3v2-crc32"))
+ {
+ id3_tag_options (v2tag, ID3_TAG_OPTION_CRC, ~0);
+ }
+ if (g_settings_get_boolean (MainSettings, "id3v2-compression"))
+ {
+ id3_tag_options (v2tag, ID3_TAG_OPTION_COMPRESSION, ~0);
+ }
}
- // Write ID3v1 tag
- if (FILE_WRITING_ID3V1_WRITE_TAG)
+ /* Write ID3v1 tag. */
+ if (g_settings_get_boolean (MainSettings, "id3v1-enabled"))
{
v1tag = id3_tag_new();
if (!v1tag)
@@ -996,10 +1015,15 @@ gboolean Id3tag_Write_File_v24Tag (ET_File *ETFile)
if (FileTag->genre)
genre_value = Id3tag_String_To_Genre(FileTag->genre);
- if ((genre_value == ID3_INVALID_GENRE)||(FILE_WRITING_ID3V2_TEXT_ONLY_GENRE))
- string1 = g_strdup(FileTag->genre);
+ if ((genre_value == ID3_INVALID_GENRE)
+ || g_settings_get_boolean (MainSettings, "id3v2-text-only-genre"))
+ {
+ string1 = g_strdup (FileTag->genre);
+ }
else
- string1 = g_strdup_printf("(%d)",genre_value);
+ {
+ string1 = g_strdup_printf ("(%d)",genre_value);
+ }
etag_set_tags(string1, ID3_FRAME_GENRE, ID3_FIELD_TYPE_STRINGLIST, v1tag, v2tag, &strip_tags);
g_free(string1);
@@ -1208,10 +1232,10 @@ id3taglib_set_field(struct id3_frame *frame,
if (str)
{
/* Prepare str for writing according to easytag charset coversion settings */
- if ((FILE_WRITING_ID3V2_USE_UNICODE_CHARACTER_SET == 0)
- || (type == ID3_FIELD_TYPE_LATIN1)
- || (type == ID3_FIELD_TYPE_LATIN1FULL)
- || id3v1)
+ if ((g_settings_get_boolean (MainSettings, "id3v2-enable-unicode"))
+ || (type == ID3_FIELD_TYPE_LATIN1)
+ || (type == ID3_FIELD_TYPE_LATIN1FULL)
+ || id3v1)
{
encname = NULL;
/* id3v1 fields converted using its own character set and iconv options */
diff --git a/src/load_files_dialog.c b/src/load_files_dialog.c
index f51f058..4c0b745 100644
--- a/src/load_files_dialog.c
+++ b/src/load_files_dialog.c
@@ -63,7 +63,6 @@ struct _EtLoadFilesDialogPrivate
GtkListStore *load_file_content_model;
GtkWidget *load_file_name_view;
GtkListStore *load_file_name_model;
- GtkWidget *load_file_run_scanner;
GtkWidget *selected_line_entry;
};
@@ -138,7 +137,8 @@ Load_Filename_Set_Filenames (EtLoadFilesDialog *self)
g_free(filename_new_utf8);
/* Then run current scanner if requested. */
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->load_file_run_scanner)))
+ if (g_settings_get_boolean (MainSettings,
+ "load-filenames-run-scanner"))
{
EtScanDialog *dialog;
@@ -176,11 +176,9 @@ on_response (GtkDialog *dialog, gint response_id, gpointer user_data)
Load_Filename_Set_Filenames (ET_LOAD_FILES_DIALOG (dialog));
break;
case GTK_RESPONSE_CANCEL:
- et_load_files_dialog_apply_changes (ET_LOAD_FILES_DIALOG (dialog));
gtk_widget_hide (GTK_WIDGET (dialog));
break;
case GTK_RESPONSE_DELETE_EVENT:
- et_load_files_dialog_apply_changes (ET_LOAD_FILES_DIALOG (dialog));
break;
default:
g_assert_not_reached ();
@@ -825,6 +823,7 @@ create_load_files_dialog (EtLoadFilesDialog *self)
GtkWidget *loadedvbox;
GtkWidget *filelistvbox;
GtkWidget *vboxpaned;
+ GtkWidget *load_file_run_scanner;
const gchar *path;
GtkCellRenderer* renderer;
GtkTreeViewColumn* column;
@@ -1102,32 +1101,18 @@ create_load_files_dialog (EtLoadFilesDialog *self)
Separator = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL);
gtk_box_pack_start(GTK_BOX(content_area),Separator,FALSE,FALSE,0);
- priv->load_file_run_scanner = gtk_check_button_new_with_label(_("Run the current scanner for each
file"));
- gtk_box_pack_start(GTK_BOX(content_area),priv->load_file_run_scanner,FALSE,TRUE,0);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->load_file_run_scanner),LOAD_FILE_RUN_SCANNER);
- gtk_widget_set_tooltip_text(priv->load_file_run_scanner,_("When activating this option, after loading
the "
+ load_file_run_scanner = gtk_check_button_new_with_label (_("Run the current scanner for each file"));
+ gtk_box_pack_start (GTK_BOX (content_area), load_file_run_scanner, FALSE,
+ TRUE, 0);
+ g_settings_bind (MainSettings, "load-filenames-run-scanner",
+ load_file_run_scanner, "active", G_SETTINGS_BIND_DEFAULT);
+ gtk_widget_set_tooltip_text (load_file_run_scanner, _("When activating this option, after loading the "
"filenames, the current selected scanner will be ran (the scanner window must be opened)."));
// To initialize 'ButtonLoad' sensivity
g_signal_emit_by_name(G_OBJECT(gtk_bin_get_child(GTK_BIN(priv->file_to_load_combo))),"changed");
}
-/*
- * For the configuration file...
- */
-void
-et_load_files_dialog_apply_changes (EtLoadFilesDialog *self)
-{
- EtLoadFilesDialogPrivate *priv;
-
- g_return_if_fail (ET_LOAD_FILES_DIALOG (self));
-
- priv = et_load_files_dialog_get_instance_private (self);
-
- LOAD_FILE_RUN_SCANNER = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->load_file_run_scanner));
-}
-
-
static void
et_load_files_dialog_finalize (GObject *object)
{
diff --git a/src/load_files_dialog.h b/src/load_files_dialog.h
index 5db17e4..ff6c50c 100644
--- a/src/load_files_dialog.h
+++ b/src/load_files_dialog.h
@@ -47,7 +47,6 @@ struct _EtLoadFilesDialogClass
GType et_load_files_dialog_get_type (void);
EtLoadFilesDialog *et_load_files_dialog_new (void);
-void et_load_files_dialog_apply_changes (EtLoadFilesDialog *self);
G_END_DECLS
diff --git a/src/log.c b/src/log.c
index 956b7fa..8e881ed 100644
--- a/src/log.c
+++ b/src/log.c
@@ -168,10 +168,10 @@ et_log_area_init (EtLogArea *self)
/* Load pending messages in the Log list. */
Log_Print_Tmp_List (self);
- if (SHOW_LOG_VIEW)
- {
- gtk_widget_show_all (GTK_WIDGET (self));
- }
+ gtk_widget_show_all (GTK_WIDGET (self));
+
+ g_settings_bind (MainSettings, "log-show", self, "visible",
+ G_SETTINGS_BIND_DEFAULT);
}
@@ -296,7 +296,7 @@ Log_Print (EtLogAreaKind error_type, const gchar * const format, ...)
n_items = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (priv->log_model),
NULL);
- if (n_items > LOG_MAX_LINES - 1
+ if (n_items > g_settings_get_uint (MainSettings, "log-lines") - 1
&& gtk_tree_model_get_iter_first (GTK_TREE_MODEL (priv->log_model),
&iter))
{
diff --git a/src/misc.c b/src/misc.c
index ac0f7e2..e514df4 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -292,7 +292,10 @@ gboolean Parse_Date (void)
GDateTime *dt;
/* Early return. */
- if (!DATE_AUTO_COMPLETION) return FALSE;
+ if (!g_settings_get_boolean (MainSettings, "tag-date-autocomplete"))
+ {
+ return FALSE;
+ }
/* Get the info entered by user */
year = gtk_entry_get_text(GTK_ENTRY(YearEntry));
@@ -898,10 +901,16 @@ et_disc_number_to_string (const guint disc_number)
gchar *
et_track_number_to_string (const guint track_number)
{
- return NUMBER_TRACK_FORMATED ? g_strdup_printf ("%.*d",
- NUMBER_TRACK_FORMATED_SPIN_BUTTON,
- track_number)
- : g_strdup_printf ("%d", track_number);
+ if (g_settings_get_boolean (MainSettings, "tag-number-padded"))
+ {
+ return g_strdup_printf ("%.*d", g_settings_get_uint (MainSettings,
+ "tag-number-length"),
+ track_number);
+ }
+ else
+ {
+ return g_strdup_printf ("%d", track_number);
+ }
}
void
diff --git a/src/ogg_tag.c b/src/ogg_tag.c
index c373584..15f19b9 100644
--- a/src/ogg_tag.c
+++ b/src/ogg_tag.c
@@ -1,21 +1,20 @@
-/* ogg_tag.c - 2001/11/08 */
-/*
- * EasyTAG - Tag editor for MP3 and Ogg Vorbis files
- * Copyright (C) 2001-2003 Jerome Couderc <easytag gmail com>
+/* EasyTAG - Tag editor for audio files
+ * Copyright (C) 2014 David King <amigadave amigadave com>
+ * Copyright (C) 2001-2003 Jerome Couderc <easytag gmail com>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "config.h" // For definition of ENABLE_OGG
@@ -928,22 +927,26 @@ ogg_tag_write_file_tag (ET_File *ETFile, GError **error)
/*********
* Title *
*********/
- Ogg_Set_Tag(vc,"TITLE=",FileTag->title,VORBIS_SPLIT_FIELD_TITLE);
+ Ogg_Set_Tag (vc, "TITLE=", FileTag->title,
+ g_settings_get_boolean (MainSettings, "ogg-split-title"));
/**********
* Artist *
**********/
- Ogg_Set_Tag(vc,"ARTIST=",FileTag->artist, VORBIS_SPLIT_FIELD_ARTIST);
+ Ogg_Set_Tag (vc, "ARTIST=", FileTag->artist,
+ g_settings_get_boolean (MainSettings, "ogg-split-artist"));
/****************
* Album Artist *
****************/
- Ogg_Set_Tag(vc,"ALBUMARTIST=",FileTag->album_artist, VORBIS_SPLIT_FIELD_ARTIST);
+ Ogg_Set_Tag (vc, "ALBUMARTIST=", FileTag->album_artist,
+ g_settings_get_boolean (MainSettings, "ogg-split-artist"));
/*********
* Album *
*********/
- Ogg_Set_Tag(vc,"ALBUM=",FileTag->album, VORBIS_SPLIT_FIELD_ALBUM);
+ Ogg_Set_Tag (vc, "ALBUM=", FileTag->album,
+ g_settings_get_boolean (MainSettings, "ogg-split-album"));
/***************
* Disc Number *
@@ -966,23 +969,28 @@ ogg_tag_write_file_tag (ET_File *ETFile, GError **error)
/*********
* Genre *
*********/
- Ogg_Set_Tag(vc,"GENRE=",FileTag->genre,VORBIS_SPLIT_FIELD_GENRE);
+ Ogg_Set_Tag (vc, "GENRE=", FileTag->genre,
+ g_settings_get_boolean (MainSettings, "ogg-split-genre"));
/***********
* Comment *
***********/
/* Format of new specification. */
- Ogg_Set_Tag(vc,"DESCRIPTION=",FileTag->comment,VORBIS_SPLIT_FIELD_COMMENT);
+ Ogg_Set_Tag (vc, "DESCRIPTION=", FileTag->comment,
+ g_settings_get_boolean (MainSettings, "ogg-split-comment"));
/************
* Composer *
************/
- Ogg_Set_Tag(vc,"COMPOSER=",FileTag->composer,VORBIS_SPLIT_FIELD_COMPOSER);
+ Ogg_Set_Tag (vc ,"COMPOSER=", FileTag->composer,
+ g_settings_get_boolean (MainSettings, "ogg-split-composer"));
/*******************
* Original artist *
*******************/
- Ogg_Set_Tag(vc,"PERFORMER=",FileTag->orig_artist,VORBIS_SPLIT_FIELD_ORIG_ARTIST);
+ Ogg_Set_Tag (vc, "PERFORMER=", FileTag->orig_artist,
+ g_settings_get_boolean (MainSettings,
+ "ogg-split-original-artist"));
/*************
* Copyright *
diff --git a/src/playlist_dialog.c b/src/playlist_dialog.c
index dfb5b99..09bca6b 100644
--- a/src/playlist_dialog.c
+++ b/src/playlist_dialog.c
@@ -124,7 +124,7 @@ write_playlist (EtPlaylistDialog *self, GFile *file, GError **error)
g_string_free (to_write, TRUE);
}
- if (PLAYLIST_ONLY_SELECTED_FILES)
+ if (g_settings_get_boolean (MainSettings, "playlist-selected-only"))
{
GList *selfilelist = NULL;
GtkTreeSelection *selection = et_application_window_browser_get_selection (ET_APPLICATION_WINDOW
(MainWindow));
@@ -152,7 +152,7 @@ write_playlist (EtPlaylistDialog *self, GFile *file, GError **error)
filename = ((File_Name *)etfile->FileNameCur->data)->value;
duration = ((ET_File_Info *)etfile->ETFileInfo)->duration;
- if (PLAYLIST_RELATIVE_PATH)
+ if (g_settings_get_boolean (MainSettings, "playlist-relative"))
{
// Keep only files in this directory and sub-dirs
if ( strncmp(filename,basedir,strlen(basedir))==0 )
@@ -221,8 +221,9 @@ write_playlist (EtPlaylistDialog *self, GFile *file, GError **error)
g_free(filename_generated_utf8);
}
- // 3) Write the file path
- if (PLAYLIST_USE_DOS_SEPARATOR)
+ /* 3) Write the file path. */
+ if (g_settings_get_boolean (MainSettings,
+ "playlist-dos-separator"))
{
gchar *filename_conv = g_strdup(filename+strlen(basedir)+1);
convert_forwardslash_to_backslash (filename_conv);
@@ -270,7 +271,8 @@ write_playlist (EtPlaylistDialog *self, GFile *file, GError **error)
g_string_free (to_write, TRUE);
}
}
- }else // PLAYLIST_FULL_PATH
+ }
+ else /* !ETSettings:playlist-relative */
{
gsize bytes_written;
@@ -330,8 +332,9 @@ write_playlist (EtPlaylistDialog *self, GFile *file, GError **error)
g_free(filename_generated_utf8);
}
- // 3) Write the file path
- if (PLAYLIST_USE_DOS_SEPARATOR)
+ /* 3) Write the file path. */
+ if (g_settings_get_boolean (MainSettings,
+ "playlist-dos-separator"))
{
gchar *filename_conv = g_strdup(filename);
convert_forwardslash_to_backslash(filename_conv);
@@ -377,8 +380,10 @@ write_playlist (EtPlaylistDialog *self, GFile *file, GError **error)
}
}
- if (PLAYLIST_ONLY_SELECTED_FILES)
- g_list_free(etfilelist);
+ if (g_settings_get_boolean (MainSettings, "playlist-selected-only"))
+ {
+ g_list_free (etfilelist);
+ }
g_assert (error == NULL || *error == NULL);
g_object_unref (ostream);
@@ -406,15 +411,6 @@ write_button_clicked (EtPlaylistDialog *self)
/* List of variables also set in the function 'Write_Playlist_Window_Apply_Changes' */
/***if (PLAYLIST_NAME) g_free(PLAYLIST_NAME);
- PLAYLIST_NAME = g_strdup(gtk_entry_get_text(GTK_ENTRY(GTK_BIN(name_mask_combo)->child)));
- PLAYLIST_USE_MASK_NAME = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(playlist_use_mask_name));
- PLAYLIST_USE_DIR_NAME = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(playlist_use_dir_name));
-
- PLAYLIST_ONLY_SELECTED_FILES =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(playlist_only_selected_files));
- PLAYLIST_FULL_PATH = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(playlist_full_path));
- PLAYLIST_RELATIVE_PATH = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(playlist_relative_path));
- PLAYLIST_CREATE_IN_PARENT_DIR =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(playlist_create_in_parent_dir));
- PLAYLIST_USE_DOS_SEPARATOR =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(playlist_use_dos_separator));
PLAYLIST_CONTENT_NONE = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(playlist_content_none));
PLAYLIST_CONTENT_FILENAME =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(playlist_content_filename));
@@ -427,7 +423,7 @@ write_button_clicked (EtPlaylistDialog *self)
playlist_path_utf8 = filename_to_display (et_application_window_get_current_path (ET_APPLICATION_WINDOW
(MainWindow)));
/* Build the playlist filename. */
- if (PLAYLIST_USE_MASK_NAME)
+ if (g_settings_get_boolean (MainSettings, "playlist-use-mask"))
{
if (!ETCore->ETFileList)
@@ -476,8 +472,9 @@ write_button_clicked (EtPlaylistDialog *self)
}
- // Must be placed after "Build the playlist filename", as we can truncate the path!
- if (PLAYLIST_CREATE_IN_PARENT_DIR)
+ /* Must be placed after "Build the playlist filename", as we can truncate
+ * the path! */
+ if (g_settings_get_boolean (MainSettings, "playlist-parent-directory"))
{
if ( (strcmp(playlist_path_utf8,G_DIR_SEPARATOR_S) != 0) )
{
@@ -683,8 +680,8 @@ create_playlist_dialog (EtPlaylistDialog *self)
gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->name_mask_combo))),
PLAYLIST_NAME);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(playlist_use_mask_name),PLAYLIST_USE_MASK_NAME);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(playlist_use_dir_name),PLAYLIST_USE_DIR_NAME);
+ g_settings_bind (MainSettings, "playlist-use-mask", playlist_use_mask_name,
+ "active", G_SETTINGS_BIND_DEFAULT);
// Mask status icon
// Signal connection to check if mask is correct into the mask entry
@@ -701,7 +698,9 @@ create_playlist_dialog (EtPlaylistDialog *self)
playlist_only_selected_files = gtk_check_button_new_with_label(_("Include only the selected files"));
gtk_box_pack_start(GTK_BOX(vbox),playlist_only_selected_files,FALSE,FALSE,0);
-
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(playlist_only_selected_files),PLAYLIST_ONLY_SELECTED_FILES);
+ g_settings_bind (MainSettings, "playlist-selected-only",
+ playlist_only_selected_files, "active",
+ G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(playlist_only_selected_files,_("If activated, only the selected files will
be "
"written in the playlist file. Else, all the files will be written."));
@@ -710,13 +709,15 @@ create_playlist_dialog (EtPlaylistDialog *self)
playlist_relative_path =
gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(playlist_full_path),
_("Use relative path for files in playlist"));
gtk_box_pack_start(GTK_BOX(vbox),playlist_relative_path,FALSE,FALSE,0);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(playlist_full_path),PLAYLIST_FULL_PATH);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(playlist_relative_path),PLAYLIST_RELATIVE_PATH);
+ g_settings_bind (MainSettings, "playlist-relative", playlist_relative_path,
+ "active", G_SETTINGS_BIND_DEFAULT);
// Create playlist in parent directory
playlist_create_in_parent_dir = gtk_check_button_new_with_label(_("Create playlist in the parent
directory"));
gtk_box_pack_start(GTK_BOX(vbox),playlist_create_in_parent_dir,FALSE,FALSE,0);
-
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(playlist_create_in_parent_dir),PLAYLIST_CREATE_IN_PARENT_DIR);
+ g_settings_bind (MainSettings, "playlist-parent-directory",
+ playlist_create_in_parent_dir, "active",
+ G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(playlist_create_in_parent_dir,_("If activated, the playlist will be created "
"in the parent directory."));
@@ -726,7 +727,9 @@ create_playlist_dialog (EtPlaylistDialog *self)
/* This makes no sense under Win32, so we do not display it. */
gtk_box_pack_start(GTK_BOX(vbox),playlist_use_dos_separator,FALSE,FALSE,0);
#endif /* !G_OS_WIN32 */
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(playlist_use_dos_separator),PLAYLIST_USE_DOS_SEPARATOR);
+ g_settings_bind (MainSettings, "playlist-dos-separator",
+ playlist_use_dos_separator, "active",
+ G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(playlist_use_dos_separator,_("This option replaces the UNIX directory "
"separator '/' into DOS separator '\\'."));
@@ -798,14 +801,6 @@ et_playlist_dialog_apply_changes (EtPlaylistDialog *self)
/* List of variables also set in the function 'Playlist_Write_Button_Pressed' */
if (PLAYLIST_NAME) g_free(PLAYLIST_NAME);
PLAYLIST_NAME = g_strdup (gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN
(priv->name_mask_combo)))));
- PLAYLIST_USE_MASK_NAME = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (playlist_use_mask_name));
- PLAYLIST_USE_DIR_NAME = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (playlist_use_dir_name));
-
- PLAYLIST_ONLY_SELECTED_FILES =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(playlist_only_selected_files));
- PLAYLIST_FULL_PATH = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(playlist_full_path));
- PLAYLIST_RELATIVE_PATH = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(playlist_relative_path));
- PLAYLIST_CREATE_IN_PARENT_DIR =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(playlist_create_in_parent_dir));
- PLAYLIST_USE_DOS_SEPARATOR =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(playlist_use_dos_separator));
PLAYLIST_CONTENT_NONE = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(playlist_content_none));
PLAYLIST_CONTENT_FILENAME =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(playlist_content_filename));
diff --git a/src/preferences_dialog.c b/src/preferences_dialog.c
index 77cad95..0225c9f 100644
--- a/src/preferences_dialog.c
+++ b/src/preferences_dialog.c
@@ -1,7 +1,6 @@
-/*
- * EasyTAG - Tag editor for audio files
+/* EasyTAG - Tag editor for audio files
+ * Copyright (C) 2013-2014 David King <amigadave amigadave com>
* Copyright (C) 2000-2003 Jerome Couderc <easytag gmail com>
- * Copyright (C) 2013 David King <amigadave amigadave com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -31,6 +30,7 @@
#include <sys/stat.h>
#include <unistd.h>
+#include "application_window.h"
#include "gtk2_compat.h"
#include "setting.h"
#include "bar.h"
@@ -64,7 +64,6 @@ struct _EtPreferencesDialogPrivate
* Prototypes *
**************/
/* Options window */
-static void Set_Default_Comment_Check_Button_Toggled (void);
static void Number_Track_Formatted_Toggled (void);
static void Number_Track_Formatted_Spin_Button_Changed (GtkWidget *Label,
GtkWidget *SpinButton);
@@ -116,6 +115,7 @@ create_preferences_dialog (EtPreferencesDialog *self)
GtkWidget *Separator;
gchar *path_utf8;
gchar *program_path;
+ gchar *default_comment;
priv = et_preferences_dialog_get_instance_private (self);
@@ -198,7 +198,8 @@ create_preferences_dialog (EtPreferencesDialog *self)
/* Load directory on startup */
LoadOnStartup = gtk_check_button_new_with_label(_("Load on startup the default directory or the
directory passed as argument"));
gtk_box_pack_start(GTK_BOX(vbox),LoadOnStartup,FALSE,FALSE,0);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(LoadOnStartup),LOAD_ON_STARTUP);
+ g_settings_bind (MainSettings, "load-on-startup", LoadOnStartup, "active",
+ G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(LoadOnStartup,_("Automatically search files, when EasyTAG starts, "
"into the default directory. Note that this path may be overridden by the parameter "
"passed to easytag (easytag /path_to/mp3_files)."));
@@ -206,7 +207,8 @@ create_preferences_dialog (EtPreferencesDialog *self)
/* Browse subdirectories */
BrowseSubdir = gtk_check_button_new_with_label(_("Search subdirectories"));
gtk_box_pack_start(GTK_BOX(vbox),BrowseSubdir,FALSE,FALSE,0);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(BrowseSubdir),BROWSE_SUBDIR);
+ g_settings_bind (MainSettings, "browse-subdir", BrowseSubdir, "active",
+ G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(BrowseSubdir,_("Search subdirectories for files when reading "
"a directory into the tree."));
@@ -214,7 +216,9 @@ create_preferences_dialog (EtPreferencesDialog *self)
OpenSelectedBrowserNode = gtk_check_button_new_with_label(_("Show subdirectories when selecting "
"a directory"));
gtk_box_pack_start(GTK_BOX(vbox),OpenSelectedBrowserNode,FALSE,FALSE,0);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(OpenSelectedBrowserNode),OPEN_SELECTED_BROWSER_NODE);
+ g_settings_bind (MainSettings, "browse-expand-children",
+ OpenSelectedBrowserNode, "active",
+ G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(OpenSelectedBrowserNode,_("This expands the selected node into the file "
"browser to display the sub-directories."));
@@ -223,7 +227,8 @@ create_preferences_dialog (EtPreferencesDialog *self)
#ifndef G_OS_WIN32 /* Always true and not user modifiable on win32 */
gtk_box_pack_start(GTK_BOX(vbox),BrowseHiddendir,FALSE,FALSE,0);
#endif /* !G_OS_WIN32 */
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(BrowseHiddendir),BROWSE_HIDDEN_DIR);
+ g_settings_bind (MainSettings, "browse-show-hidden", BrowseHiddendir,
+ "active", G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(BrowseHiddendir,_("Search hidden directories for files "
"(directories starting by a '.')."));
@@ -247,7 +252,8 @@ create_preferences_dialog (EtPreferencesDialog *self)
// Show header infos
ShowHeaderInfos = gtk_check_button_new_with_label(_("Show header information of file"));
gtk_box_pack_start(GTK_BOX(vbox),ShowHeaderInfos,FALSE,FALSE,0);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ShowHeaderInfos),SHOW_HEADER_INFO);
+ g_settings_bind (MainSettings, "file-show-header", ShowHeaderInfos, "active",
+ G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(ShowHeaderInfos,_("If activated, information about the file as "
"the bitrate, the time, the size, will be displayed under the filename entry."));
@@ -259,14 +265,17 @@ create_preferences_dialog (EtPreferencesDialog *self)
ChangedFilesDisplayedToRed = gtk_radio_button_new_with_label(NULL,_("Red color"));
gtk_box_pack_start(GTK_BOX(hbox),ChangedFilesDisplayedToRed,FALSE,FALSE,4);
-
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ChangedFilesDisplayedToRed),CHANGED_FILES_DISPLAYED_TO_RED);
// Set "new" Gtk+-2.0ish black/bold style for changed items
ChangedFilesDisplayedToBold = gtk_radio_button_new_with_label(
gtk_radio_button_get_group(GTK_RADIO_BUTTON(ChangedFilesDisplayedToRed)),_("Bold style"));
gtk_box_pack_start(GTK_BOX(hbox),ChangedFilesDisplayedToBold,FALSE,FALSE,2);
-
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ChangedFilesDisplayedToBold),CHANGED_FILES_DISPLAYED_TO_BOLD);
-
+ g_settings_bind (MainSettings, "file-changed-bold",
+ ChangedFilesDisplayedToBold, "active",
+ G_SETTINGS_BIND_DEFAULT);
+ g_signal_connect_swapped (ChangedFilesDisplayedToBold, "notify::active",
+ G_CALLBACK (et_application_window_browser_refresh_list),
+ MainWindow);
/* Sorting List Options */
Frame = gtk_frame_new (_("Sorting List Options"));
@@ -402,7 +411,8 @@ create_preferences_dialog (EtPreferencesDialog *self)
// Show / hide log view
ShowLogView = gtk_check_button_new_with_label(_("Show log view in main window"));
gtk_box_pack_start(GTK_BOX(vbox),ShowLogView,FALSE,FALSE,0);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ShowLogView),SHOW_LOG_VIEW);
+ g_settings_bind (MainSettings, "log-show", ShowLogView, "active",
+ G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(ShowLogView,_("If activated, the log view would be "
"visible in the main window."));
@@ -414,7 +424,8 @@ create_preferences_dialog (EtPreferencesDialog *self)
LogMaxLinesSpinButton = gtk_spin_button_new_with_range(10.0,1500.0,10.0);
gtk_box_pack_start(GTK_BOX(hbox),LogMaxLinesSpinButton,FALSE,FALSE,0);
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(LogMaxLinesSpinButton),(gfloat)LOG_MAX_LINES);
+ g_settings_bind (MainSettings, "log-lines", LogMaxLinesSpinButton,
+ "value", G_SETTINGS_BIND_DEFAULT);
/*
g_signal_connect(G_OBJECT(NumberTrackFormated),"toggled",G_CALLBACK(Number_Track_Formatted_Toggled),NULL);
* g_signal_emit_by_name(G_OBJECT(NumberTrackFormated),"toggled");
gtk_tooltips_set_tip(Tips,GTK_BIN(FilePlayerCombo)->child,_("Enter the program used to "
@@ -441,7 +452,9 @@ create_preferences_dialog (EtPreferencesDialog *self)
ReplaceIllegalCharactersInFilename = gtk_check_button_new_with_label(_("Replace illegal characters in
filename (for Windows and CD-Rom)"));
gtk_box_pack_start(GTK_BOX(vbox),ReplaceIllegalCharactersInFilename,FALSE,FALSE,0);
-
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ReplaceIllegalCharactersInFilename),REPLACE_ILLEGAL_CHARACTERS_IN_FILENAME);
+ g_settings_bind (MainSettings, "rename-replace-illegal-chars",
+ ReplaceIllegalCharactersInFilename, "active",
+ G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(ReplaceIllegalCharactersInFilename,_("Convert illegal characters for "
"FAT32/16 and ISO9660 + Joliet filesystems ('\\', ':', ';', '*', '?', '\"', '<', '>', '|') "
"of the filename to avoid problem when renaming the file. This is useful when renaming the "
@@ -473,7 +486,9 @@ create_preferences_dialog (EtPreferencesDialog *self)
/* Preserve modification time */
PreserveModificationTime = gtk_check_button_new_with_label(_("Preserve modification time of the file"));
gtk_box_pack_start(GTK_BOX(vbox),PreserveModificationTime,FALSE,FALSE,0);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(PreserveModificationTime),PRESERVE_MODIFICATION_TIME);
+ g_settings_bind (MainSettings, "file-preserve-modification-time",
+ PreserveModificationTime, "active",
+ G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(PreserveModificationTime,_("Preserve the modification time "
"(in file properties) when saving the file."));
@@ -481,7 +496,9 @@ create_preferences_dialog (EtPreferencesDialog *self)
UpdateParentDirectoryModificationTime = gtk_check_button_new_with_label(_("Update modification time "
"of the parent directory of the file (recommended when using Amarok)"));
gtk_box_pack_start(GTK_BOX(vbox),UpdateParentDirectoryModificationTime,FALSE,FALSE,0);
-
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(UpdateParentDirectoryModificationTime),UPDATE_PARENT_DIRECTORY_MODIFICATION_TIME);
+ g_settings_bind (MainSettings, "file-update-parent-modification-time",
+ UpdateParentDirectoryModificationTime, "active",
+ G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(UpdateParentDirectoryModificationTime,_("The modification time "
"of the parent directory of the file will be updated when saving tag the file. At the "
"present time it is automatically done only when renaming a file.\nThis feature is "
@@ -556,7 +573,8 @@ create_preferences_dialog (EtPreferencesDialog *self)
DateAutoCompletion = gtk_check_button_new_with_label(_("Auto completion of date if not complete"));
gtk_box_pack_start(GTK_BOX(vbox),DateAutoCompletion,FALSE,FALSE,0);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(DateAutoCompletion),DATE_AUTO_COMPLETION);
+ g_settings_bind (MainSettings, "tag-date-autocomplete", DateAutoCompletion,
+ "active", G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(DateAutoCompletion,_("Try to complete the year field if you enter "
"only the last numerals of the date (for instance, if the current year is 2005: "
"5 => 2005, 4 => 2004, 6 => 1996, 95 => 1995…)."));
@@ -567,14 +585,17 @@ create_preferences_dialog (EtPreferencesDialog *self)
NumberTrackFormated = gtk_check_button_new_with_label(_("Write the track field with the following number
of digits:"));
gtk_box_pack_start(GTK_BOX(hbox),NumberTrackFormated,FALSE,FALSE,0);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(NumberTrackFormated),NUMBER_TRACK_FORMATED);
+ g_settings_bind (MainSettings, "tag-number-padded", NumberTrackFormated,
+ "active", G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(NumberTrackFormated,_("If activated, the track field is written using "
"the number '0' as padding to obtain a number with 'n' digits (for example, with two digits: '05', "
"'09', '10'…). Else it keeps the 'raw' track value."));
NumberTrackFormatedSpinButton = gtk_spin_button_new_with_range(2.0,6.0,1.0);
gtk_box_pack_start(GTK_BOX(hbox),NumberTrackFormatedSpinButton,FALSE,FALSE,0);
-
gtk_spin_button_set_value(GTK_SPIN_BUTTON(NumberTrackFormatedSpinButton),(gfloat)NUMBER_TRACK_FORMATED_SPIN_BUTTON);
+ g_settings_bind (MainSettings, "tag-number-length",
+ NumberTrackFormatedSpinButton, "value",
+ G_SETTINGS_BIND_DEFAULT);
g_signal_connect(G_OBJECT(NumberTrackFormated),"toggled",G_CALLBACK(Number_Track_Formatted_Toggled),NULL);
g_signal_emit_by_name(G_OBJECT(NumberTrackFormated),"toggled");
@@ -617,27 +638,12 @@ create_preferences_dialog (EtPreferencesDialog *self)
gtk_box_pack_start(GTK_BOX(vbox),Separator,FALSE,FALSE,0);
/* Tag field focus */
- Table = et_grid_new (2, 3);
- gtk_box_pack_start(GTK_BOX(vbox),Table,FALSE,FALSE,0);
- /*gtk_grid_set_row_spacing (GTK_GRID (Table), 2);*/
- gtk_grid_set_column_spacing (GTK_GRID (Table), 2 * BOX_SPACING);
+ SetFocusToSameTagField = gtk_check_button_new_with_label (_("Keep focus on the same tag field when
switching files"));
+ gtk_box_pack_start (GTK_BOX (vbox), SetFocusToSameTagField, FALSE, FALSE,
+ 0);
+ g_settings_bind (MainSettings, "tag-preserve-focus", SetFocusToSameTagField,
+ "active", G_SETTINGS_BIND_DEFAULT);
- Label = gtk_label_new(_("Tag field focus when switching files in list with "
- "shortcuts Page Up/Page Down:"));
- gtk_grid_attach (GTK_GRID (Table), Label, 0, 0, 2, 1);
- gtk_misc_set_alignment(GTK_MISC(Label),0,0.5);
-
- SetFocusToSameTagField = gtk_radio_button_new_with_label(NULL,
- _("Keep focus to the same tag field"));
- gtk_grid_attach (GTK_GRID (Table), SetFocusToSameTagField, 1, 1, 1, 1);
- //gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(SetFocusToSameTagField),SET_FOCUS_TO_SAME_TAG_FIELD);
-
- SetFocusToFirstTagField = gtk_radio_button_new_with_label(
- gtk_radio_button_get_group(GTK_RADIO_BUTTON(SetFocusToSameTagField)),
- _("Return focus to the first tag field (i.e. 'Title' field)"));
- gtk_grid_attach (GTK_GRID (Table), SetFocusToFirstTagField, 1, 2, 1, 1);
- //gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(SetFocusToFirstTagField),SET_FOCUS_TO_FIRST_TAG_FIELD);
-
/* Tag Splitting */
Frame = gtk_frame_new (_("Tag Splitting"));
gtk_box_pack_start(GTK_BOX(VBox),Frame,FALSE,FALSE,0);
@@ -668,13 +674,22 @@ create_preferences_dialog (EtPreferencesDialog *self)
gtk_grid_attach (GTK_GRID (Table), VorbisSplitFieldComposer, 1, 2, 1, 1);
gtk_grid_attach (GTK_GRID (Table), VorbisSplitFieldOrigArtist, 1, 3, 1, 1);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(VorbisSplitFieldTitle), VORBIS_SPLIT_FIELD_TITLE);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(VorbisSplitFieldArtist), VORBIS_SPLIT_FIELD_ARTIST);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(VorbisSplitFieldAlbum), VORBIS_SPLIT_FIELD_ALBUM);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(VorbisSplitFieldGenre), VORBIS_SPLIT_FIELD_GENRE);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(VorbisSplitFieldComment), VORBIS_SPLIT_FIELD_COMMENT);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(VorbisSplitFieldComposer), VORBIS_SPLIT_FIELD_COMPOSER);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(VorbisSplitFieldOrigArtist),
VORBIS_SPLIT_FIELD_ORIG_ARTIST);
+ g_settings_bind (MainSettings, "ogg-split-title", VorbisSplitFieldTitle,
+ "active", G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (MainSettings, "ogg-split-artist", VorbisSplitFieldArtist,
+ "active", G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (MainSettings, "ogg-split-album", VorbisSplitFieldAlbum,
+ "active", G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (MainSettings, "ogg-split-genre", VorbisSplitFieldGenre,
+ "active", G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (MainSettings, "ogg-split-comment", VorbisSplitFieldComment,
+ "active", G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (MainSettings, "ogg-split-composer",
+ VorbisSplitFieldComposer, "active",
+ G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (MainSettings, "ogg-split-original-artist",
+ VorbisSplitFieldOrigArtist, "active",
+ G_SETTINGS_BIND_DEFAULT);
/*
* ID3 Tag Settings
@@ -702,7 +717,8 @@ create_preferences_dialog (EtPreferencesDialog *self)
/* Strip tag when fields (managed by EasyTAG) are empty */
StripTagWhenEmptyFields = gtk_check_button_new_with_label(_("Strip tags if all fields are set to
blank"));
gtk_grid_attach (GTK_GRID (Table), StripTagWhenEmptyFields, 0, 0, 1, 1);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(StripTagWhenEmptyFields),STRIP_TAG_WHEN_EMPTY_FIELDS);
+ g_settings_bind (MainSettings, "id3-strip-empty", StripTagWhenEmptyFields,
+ "active", G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(StripTagWhenEmptyFields,_("As ID3v2 tags may contain other data than "
"Title, Artist, Album, Year, Track, Genre or Comment (as an attached image, lyrics…), "
"this option allows you to strip the whole tag when these seven standard data fields have "
@@ -711,28 +727,35 @@ create_preferences_dialog (EtPreferencesDialog *self)
/* Convert old ID3v2 tag version */
ConvertOldId3v2TagVersion = gtk_check_button_new_with_label(_("Automatically convert old ID3v2 tag
versions"));
gtk_grid_attach (GTK_GRID (Table), ConvertOldId3v2TagVersion, 0, 1, 1, 1);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ConvertOldId3v2TagVersion),CONVERT_OLD_ID3V2_TAG_VERSION);
+ g_settings_bind (MainSettings, "id3v2-convert-old",
+ ConvertOldId3v2TagVersion, "active",
+ G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(ConvertOldId3v2TagVersion,_("If activated, an old ID3v2 tag version (as "
"ID3v2.2) will be updated to the ID3v2.3 version."));
/* Use CRC32 */
FileWritingId3v2UseCrc32 = gtk_check_button_new_with_label(_("Use CRC32"));
gtk_grid_attach (GTK_GRID (Table), FileWritingId3v2UseCrc32, 1, 0, 1, 1);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(FileWritingId3v2UseCrc32),FILE_WRITING_ID3V2_USE_CRC32);
+ g_settings_bind (MainSettings, "id3v2-crc32", FileWritingId3v2UseCrc32,
+ "active", G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(FileWritingId3v2UseCrc32,_("Set CRC32 in the ID3v2 tags"));
/* Use Compression */
FileWritingId3v2UseCompression = gtk_check_button_new_with_label(_("Use Compression"));
gtk_grid_attach (GTK_GRID (Table), FileWritingId3v2UseCompression, 1, 1, 1,
1);
-
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(FileWritingId3v2UseCompression),FILE_WRITING_ID3V2_USE_COMPRESSION);
+ g_settings_bind (MainSettings, "id3v2-compression",
+ FileWritingId3v2UseCompression, "active",
+ G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(FileWritingId3v2UseCompression,_("Set Compression in the ID3v2 tags"));
/* Write Genre in text */
FileWritingId3v2TextOnlyGenre = gtk_check_button_new_with_label(_("Write Genre in text only"));
gtk_grid_attach (GTK_GRID (Table), FileWritingId3v2TextOnlyGenre, 0, 2, 1,
1);
-
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(FileWritingId3v2TextOnlyGenre),FILE_WRITING_ID3V2_TEXT_ONLY_GENRE);
+ g_settings_bind (MainSettings, "id3v2-text-only-genre",
+ FileWritingId3v2TextOnlyGenre, "active",
+ G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(FileWritingId3v2TextOnlyGenre,_("Don't use ID3v1 number references in genre
tag. Enable this if you see numbers as genre in your music player."));
/* Character Set for writing ID3 tag */
@@ -758,7 +781,8 @@ create_preferences_dialog (EtPreferencesDialog *self)
/* Write ID3v2 tag */
FileWritingId3v2WriteTag = gtk_check_button_new_with_label(_("Write ID3v2 tag"));
gtk_grid_attach (GTK_GRID (Table), FileWritingId3v2WriteTag, 0, 0, 5, 1);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(FileWritingId3v2WriteTag),FILE_WRITING_ID3V2_WRITE_TAG);
+ g_settings_bind (MainSettings, "id3v2-enabled", FileWritingId3v2WriteTag,
+ "active", G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(FileWritingId3v2WriteTag,_("If activated, an ID3v2.4 tag will be added or "
"updated at the beginning of the MP3 files. Else it will be stripped."));
g_signal_connect_after(G_OBJECT(FileWritingId3v2WriteTag),"toggled",
@@ -791,10 +815,11 @@ create_preferences_dialog (EtPreferencesDialog *self)
gtk_grid_attach (GTK_GRID (Table), LabelId3v2Charset, 0, 2, 5, 1);
gtk_misc_set_alignment(GTK_MISC(LabelId3v2Charset),0,0.5);
- // Unicode
+ /* Unicode. */
FileWritingId3v2UseUnicodeCharacterSet = gtk_radio_button_new_with_label(NULL, _("Unicode "));
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(FileWritingId3v2UseUnicodeCharacterSet),
- FILE_WRITING_ID3V2_USE_UNICODE_CHARACTER_SET);
+ g_settings_bind (MainSettings, "id3v2-enable-unicode",
+ FileWritingId3v2UseUnicodeCharacterSet, "active",
+ G_SETTINGS_BIND_DEFAULT);
gtk_grid_attach (GTK_GRID (Table), FileWritingId3v2UseUnicodeCharacterSet,
1, 3, 1, 1);
@@ -813,14 +838,12 @@ create_preferences_dialog (EtPreferencesDialog *self)
g_signal_connect_after(G_OBJECT(FileWritingId3v2UseUnicodeCharacterSet),"toggled",
G_CALLBACK(Change_Id3_Settings_Toggled),NULL);
- // Non-unicode
+ /* Non-Unicode. */
FileWritingId3v2UseNoUnicodeCharacterSet = gtk_radio_button_new_with_label(
gtk_radio_button_get_group(GTK_RADIO_BUTTON(FileWritingId3v2UseUnicodeCharacterSet)),
_("Other"));
gtk_grid_attach (GTK_GRID (Table),
FileWritingId3v2UseNoUnicodeCharacterSet, 1, 4, 1, 1);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(FileWritingId3v2UseNoUnicodeCharacterSet),
- !FILE_WRITING_ID3V2_USE_UNICODE_CHARACTER_SET);
FileWritingId3v2NoUnicodeCharacterSetCombo = gtk_combo_box_text_new();
gtk_widget_set_tooltip_text (FileWritingId3v2NoUnicodeCharacterSetCombo,
@@ -884,7 +907,8 @@ create_preferences_dialog (EtPreferencesDialog *self)
/* Write ID3v1 tag */
FileWritingId3v1WriteTag = gtk_check_button_new_with_label(_("Write ID3v1.x tag"));
gtk_grid_attach (GTK_GRID (Table), FileWritingId3v1WriteTag, 0, 0, 4, 1);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(FileWritingId3v1WriteTag),FILE_WRITING_ID3V1_WRITE_TAG);
+ g_settings_bind (MainSettings, "id3v1-enabled", FileWritingId3v1WriteTag,
+ "active", G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(FileWritingId3v1WriteTag,_("If activated, an ID3v1 tag will be added or "
"updated at the end of the MP3 files. Else it will be stripped."));
g_signal_connect_after(G_OBJECT(FileWritingId3v1WriteTag),"toggled",
@@ -952,8 +976,9 @@ create_preferences_dialog (EtPreferencesDialog *self)
// "File Reading Charset" Check Button + Combo
UseNonStandardId3ReadingCharacterSet = gtk_check_button_new_with_label(_(
"Non-standard:"));
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(UseNonStandardId3ReadingCharacterSet),
- USE_NON_STANDARD_ID3_READING_CHARACTER_SET);
+ g_settings_bind (MainSettings, "id3-override-read-encoding",
+ UseNonStandardId3ReadingCharacterSet, "active",
+ G_SETTINGS_BIND_DEFAULT);
gtk_grid_attach (GTK_GRID (Table), UseNonStandardId3ReadingCharacterSet, 0,
0, 1, 1);
gtk_widget_set_tooltip_text(UseNonStandardId3ReadingCharacterSet,
@@ -1055,11 +1080,13 @@ create_preferences_dialog (EtPreferencesDialog *self)
gtk_container_add(GTK_CONTAINER(Frame),vbox);
gtk_container_set_border_width (GTK_CONTAINER (vbox), BOX_SPACING);
- // Don't convert some words like to, feat. first letter uppercase.
+ /* Don't convert some words like to, feat. first letter uppercase. */
PFSDontUpperSomeWords = gtk_check_button_new_with_label(_("Don't uppercase "
"first letter of words for some prepositions and articles."));
gtk_box_pack_start(GTK_BOX(vbox),PFSDontUpperSomeWords, FALSE, FALSE, 0);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(PFSDontUpperSomeWords), PFS_DONT_UPPER_SOME_WORDS);
+ g_settings_bind (MainSettings, "process-uppercase-prepositions",
+ PFSDontUpperSomeWords, "active",
+ G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_INVERT_BOOLEAN);
gtk_widget_set_tooltip_text(PFSDontUpperSomeWords, _("Don't convert first "
"letter of words like prepositions, articles and words like feat., "
"when using the scanner 'First letter uppercase of each word' (for "
@@ -1074,7 +1101,8 @@ create_preferences_dialog (EtPreferencesDialog *self)
OpenScannerWindowOnStartup = gtk_check_button_new_with_label(_("Open the Scanner Window on startup"));
gtk_box_pack_start(GTK_BOX(vbox),OpenScannerWindowOnStartup,FALSE,FALSE,0);
-
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(OpenScannerWindowOnStartup),OPEN_SCANNER_WINDOW_ON_STARTUP);
+ g_settings_bind (MainSettings, "scan-startup", OpenScannerWindowOnStartup,
+ "active", G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(OpenScannerWindowOnStartup,_("Activate this option to open automatically "
"the scanner window when EasyTAG starts."));
@@ -1089,7 +1117,8 @@ create_preferences_dialog (EtPreferencesDialog *self)
// Overwrite text into tag fields
OverwriteTagField = gtk_check_button_new_with_label(_("Overwrite fields when scanning tags"));
gtk_box_pack_start(GTK_BOX(vbox),OverwriteTagField,FALSE,FALSE,0);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(OverwriteTagField),OVERWRITE_TAG_FIELD);
+ g_settings_bind (MainSettings, "fill-overwrite-tag-fields",
+ OverwriteTagField, "active", G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(OverwriteTagField,_("If activated, the scanner will replace existing text "
"in fields by the new one. If deactivated, only blank fields of the tag will be filled."));
@@ -1101,7 +1130,8 @@ create_preferences_dialog (EtPreferencesDialog *self)
gtk_box_pack_start(GTK_BOX(vbox),hbox,FALSE,FALSE,0);
SetDefaultComment = gtk_check_button_new_with_label(_("Set this text as default comment:"));
gtk_box_pack_start(GTK_BOX(hbox),SetDefaultComment,FALSE,FALSE,0);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(SetDefaultComment),SET_DEFAULT_COMMENT);
+ g_settings_bind (MainSettings, "fill-set-default-comment",
+ SetDefaultComment, "active", G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(SetDefaultComment,_("Activate this option if you want to put the "
"following string into the comment field when using the 'Fill Tag' scanner."));
DefaultComment = gtk_combo_box_new_with_model_and_entry(GTK_TREE_MODEL(priv->default_comment_model));
@@ -1109,22 +1139,25 @@ create_preferences_dialog (EtPreferencesDialog *self)
gtk_combo_box_set_entry_text_column(GTK_COMBO_BOX(DefaultComment),MISC_COMBO_TEXT);
gtk_box_pack_start(GTK_BOX(hbox),DefaultComment,FALSE,FALSE,0);
gtk_widget_set_size_request(GTK_WIDGET(DefaultComment), 250, -1);
- g_signal_connect(G_OBJECT(SetDefaultComment),"toggled",
- G_CALLBACK(Set_Default_Comment_Check_Button_Toggled),NULL);
- if (DEFAULT_COMMENT==NULL)
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(SetDefaultComment),FALSE);
- Set_Default_Comment_Check_Button_Toggled();
+ g_settings_bind (MainSettings, "fill-set-default-comment", DefaultComment,
+ "sensitive", G_SETTINGS_BIND_GET);
+
/* History list */
Load_Default_Tag_Comment_Text_List(priv->default_comment_model, MISC_COMBO_TEXT);
- Add_String_To_Combo_List(priv->default_comment_model, DEFAULT_COMMENT);
- if (DEFAULT_COMMENT)
- gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(DefaultComment))), DEFAULT_COMMENT);
-
- // CRC32 comment
+ default_comment = g_settings_get_string (MainSettings,
+ "fill-default-comment");
+ Add_String_To_Combo_List (priv->default_comment_model, default_comment);
+ g_free (default_comment);
+ g_settings_bind (MainSettings, "fill-default-comment",
+ gtk_bin_get_child (GTK_BIN (DefaultComment)), "text",
+ G_SETTINGS_BIND_DEFAULT);
+
+ /* CRC32 comment. */
Crc32Comment = gtk_check_button_new_with_label(_("Use CRC32 as the default "
"comment (for files with ID3 tags only)."));
gtk_box_pack_start(GTK_BOX(vbox),Crc32Comment,FALSE,FALSE,0);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Crc32Comment),SET_CRC32_COMMENT);
+ g_settings_bind (MainSettings, "fill-crc32-comment", Crc32Comment, "active",
+ G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(Crc32Comment,_("Calculates the CRC-32 value of the file "
"and writes it into the comment field when using the 'Fill Tag' scanner."));
g_signal_connect_swapped(G_OBJECT(SetDefaultComment), "toggled",
@@ -1160,32 +1193,33 @@ create_preferences_dialog (EtPreferencesDialog *self)
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(CddbServerNameAutomaticSearch), "at.freedb.org");
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(CddbServerNameAutomaticSearch), "au.freedb.org");
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(CddbServerNameAutomaticSearch), "ca.freedb.org");
- //gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(CddbServerNameAutomaticSearch), "ca2.freedb.org");
- //gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(CddbServerNameAutomaticSearch), "de.freedb.org");
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(CddbServerNameAutomaticSearch), "es.freedb.org");
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(CddbServerNameAutomaticSearch), "fi.freedb.org");
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(CddbServerNameAutomaticSearch), "ru.freedb.org");
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(CddbServerNameAutomaticSearch), "uk.freedb.org");
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(CddbServerNameAutomaticSearch), "us.freedb.org");
- if (CDDB_SERVER_NAME_AUTOMATIC_SEARCH)
-
gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(CddbServerNameAutomaticSearch))),CDDB_SERVER_NAME_AUTOMATIC_SEARCH);
+ g_settings_bind (MainSettings, "cddb-automatic-search-hostname",
+ gtk_bin_get_child (GTK_BIN (CddbServerNameAutomaticSearch)),
+ "text", G_SETTINGS_BIND_DEFAULT);
Label = gtk_label_new (_("Port:"));
gtk_box_pack_start(GTK_BOX(hbox),Label,FALSE,FALSE,2);
CddbServerPortAutomaticSearch = gtk_spin_button_new_with_range (0.0,
65535.0,
1.0);
+ g_settings_bind (MainSettings, "cddb-automatic-search-port",
+ CddbServerPortAutomaticSearch, "value",
+ G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_size_request(GTK_WIDGET(CddbServerPortAutomaticSearch), 45, -1);
gtk_box_pack_start(GTK_BOX(hbox),CddbServerPortAutomaticSearch,FALSE,FALSE,0);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (CddbServerPortAutomaticSearch),
- CDDB_SERVER_PORT_AUTOMATIC_SEARCH);
Label = gtk_label_new (_("CGI Path:"));
gtk_box_pack_start(GTK_BOX(hbox),Label,FALSE,FALSE,2);
CddbServerCgiPathAutomaticSearch = gtk_entry_new();
gtk_box_pack_start(GTK_BOX(hbox),CddbServerCgiPathAutomaticSearch,FALSE,FALSE,0);
- if (CDDB_SERVER_CGI_PATH_AUTOMATIC_SEARCH)
-
gtk_entry_set_text(GTK_ENTRY(CddbServerCgiPathAutomaticSearch),CDDB_SERVER_CGI_PATH_AUTOMATIC_SEARCH);
+ g_settings_bind (MainSettings, "cddb-automatic-search-path",
+ CddbServerCgiPathAutomaticSearch, "text",
+ G_SETTINGS_BIND_DEFAULT);
// 2sd automatic search server
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, BOX_SPACING);
@@ -1195,25 +1229,28 @@ create_preferences_dialog (EtPreferencesDialog *self)
CddbServerNameAutomaticSearch2 = gtk_combo_box_text_new_with_entry();
gtk_box_pack_start(GTK_BOX(hbox),CddbServerNameAutomaticSearch2,FALSE,FALSE,0);
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(CddbServerNameAutomaticSearch2),
"freedb.musicbrainz.org");
- if (CDDB_SERVER_NAME_AUTOMATIC_SEARCH2)
-
gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(CddbServerNameAutomaticSearch2))),CDDB_SERVER_NAME_AUTOMATIC_SEARCH2);
+ g_settings_bind (MainSettings, "cddb-automatic-search-hostname2",
+ gtk_bin_get_child (GTK_BIN (CddbServerNameAutomaticSearch2)),
+ "text", G_SETTINGS_BIND_DEFAULT);
Label = gtk_label_new (_("Port:"));
gtk_box_pack_start(GTK_BOX(hbox),Label,FALSE,FALSE,2);
CddbServerPortAutomaticSearch2 = gtk_spin_button_new_with_range (0.0,
65535.0,
1.0);
+ g_settings_bind (MainSettings, "cddb-automatic-search-port2",
+ CddbServerPortAutomaticSearch2, "value",
+ G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_size_request(GTK_WIDGET(CddbServerPortAutomaticSearch2), 45, -1);
gtk_box_pack_start(GTK_BOX(hbox),CddbServerPortAutomaticSearch2,FALSE,FALSE,0);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (CddbServerPortAutomaticSearch2),
- CDDB_SERVER_PORT_AUTOMATIC_SEARCH2);
Label = gtk_label_new (_("CGI Path:"));
gtk_box_pack_start(GTK_BOX(hbox),Label,FALSE,FALSE,2);
CddbServerCgiPathAutomaticSearch2 = gtk_entry_new();
gtk_box_pack_start(GTK_BOX(hbox),CddbServerCgiPathAutomaticSearch2,FALSE,FALSE,0);
- if (CDDB_SERVER_CGI_PATH_AUTOMATIC_SEARCH2)
- gtk_entry_set_text(GTK_ENTRY(CddbServerCgiPathAutomaticSearch2)
,CDDB_SERVER_CGI_PATH_AUTOMATIC_SEARCH2);
+ g_settings_bind (MainSettings, "cddb-automatic-search-path2",
+ CddbServerCgiPathAutomaticSearch2, "text",
+ G_SETTINGS_BIND_DEFAULT);
// CDDB Server Settings (Manual Search)
Frame = gtk_frame_new (_("Server Settings for Manual Search"));
@@ -1230,8 +1267,9 @@ create_preferences_dialog (EtPreferencesDialog *self)
gtk_box_pack_start(GTK_BOX(hbox),CddbServerNameManualSearch,FALSE,FALSE,0);
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(CddbServerNameManualSearch), "www.freedb.org");
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(CddbServerNameManualSearch), "www.gnudb.org");
- if (CDDB_SERVER_NAME_MANUAL_SEARCH)
-
gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(CddbServerNameManualSearch))),CDDB_SERVER_NAME_MANUAL_SEARCH);
+ g_settings_bind (MainSettings, "cddb-manual-search-hostname",
+ gtk_bin_get_child (GTK_BIN (CddbServerNameManualSearch)),
+ "text", G_SETTINGS_BIND_DEFAULT);
Label = gtk_label_new (_("Port:"));
gtk_box_pack_start(GTK_BOX(hbox),Label,FALSE,FALSE,2);
@@ -1239,15 +1277,17 @@ create_preferences_dialog (EtPreferencesDialog *self)
1.0);
gtk_widget_set_size_request(GTK_WIDGET(CddbServerPortManualSearch), 45, -1);
gtk_box_pack_start(GTK_BOX(hbox),CddbServerPortManualSearch,FALSE,FALSE,0);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (CddbServerPortManualSearch),
- CDDB_SERVER_PORT_MANUAL_SEARCH);
+ g_settings_bind (MainSettings, "cddb-manual-search-port",
+ CddbServerPortManualSearch, "value",
+ G_SETTINGS_BIND_DEFAULT);
Label = gtk_label_new (_("CGI Path:"));
gtk_box_pack_start(GTK_BOX(hbox),Label,FALSE,FALSE,2);
CddbServerCgiPathManualSearch = gtk_entry_new();
gtk_box_pack_start(GTK_BOX(hbox),CddbServerCgiPathManualSearch,FALSE,FALSE,0);
- if (CDDB_SERVER_CGI_PATH_MANUAL_SEARCH)
- gtk_entry_set_text(GTK_ENTRY(CddbServerCgiPathManualSearch) ,CDDB_SERVER_CGI_PATH_MANUAL_SEARCH);
+ g_settings_bind (MainSettings, "cddb-manual-search-path",
+ CddbServerCgiPathManualSearch, "text",
+ G_SETTINGS_BIND_DEFAULT);
/* Local access for CDDB (Automatic Search). */
Frame = gtk_frame_new (_("Local CDDB"));
@@ -1306,7 +1346,8 @@ create_preferences_dialog (EtPreferencesDialog *self)
CddbUseProxy = gtk_check_button_new_with_label(_("Use a proxy"));
gtk_grid_attach (GTK_GRID (Table), CddbUseProxy, 0, 0, 5, 1);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(CddbUseProxy),CDDB_USE_PROXY);
+ g_settings_bind (MainSettings, "cddb-proxy-enabled", CddbUseProxy, "active",
+ G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(CddbUseProxy,_("Set active the settings of the proxy server."));
Label = gtk_label_new(_("Host Name:"));
@@ -1314,36 +1355,36 @@ create_preferences_dialog (EtPreferencesDialog *self)
gtk_misc_set_alignment(GTK_MISC(Label),1,0.5);
CddbProxyName = gtk_entry_new();
gtk_grid_attach (GTK_GRID (Table), CddbProxyName, 2, 1, 1, 1);
- if (CDDB_PROXY_NAME)
- gtk_entry_set_text(GTK_ENTRY(CddbProxyName),CDDB_PROXY_NAME);
+ g_settings_bind (MainSettings, "cddb-manual-search-path",
+ CddbServerCgiPathManualSearch, "text",
+ G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(CddbProxyName,_("Name of the proxy server."));
Label = gtk_label_new (_("Port:"));
gtk_grid_attach (GTK_GRID (Table), Label, 3, 1, 1, 1);
gtk_misc_set_alignment(GTK_MISC(Label),1,0.5);
- CddbProxyPort = gtk_entry_new();
CddbProxyPort = gtk_spin_button_new_with_range (0.0, 65535.0, 1.0);
+ g_settings_bind (MainSettings, "cddb-proxy-port", CddbProxyPort, "value",
+ G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_size_request(GTK_WIDGET(CddbProxyPort), 45, -1);
gtk_grid_attach (GTK_GRID (Table), CddbProxyPort, 4, 1, 1, 1);
gtk_widget_set_tooltip_text(CddbProxyPort,_("Port of the proxy server."));
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (CddbProxyPort),
- CDDB_PROXY_PORT);
g_signal_connect(G_OBJECT(CddbUseProxy),"toggled",G_CALLBACK(Cddb_Use_Proxy_Toggled),NULL);
Label = gtk_label_new(_("User Name:"));
gtk_grid_attach (GTK_GRID (Table), Label, 1, 2, 1, 1);
gtk_misc_set_alignment(GTK_MISC(Label),1,0.5);
CddbProxyUserName = gtk_entry_new();
- if (CDDB_PROXY_USER_NAME)
- gtk_entry_set_text(GTK_ENTRY(CddbProxyUserName),CDDB_PROXY_USER_NAME);
+ g_settings_bind (MainSettings, "cddb-proxy-username", CddbProxyUserName,
+ "text", G_SETTINGS_BIND_DEFAULT);
gtk_grid_attach (GTK_GRID (Table), CddbProxyUserName, 2, 2, 1, 1);
gtk_widget_set_tooltip_text(CddbProxyUserName,_("Name of user for the the proxy server."));
Label = gtk_label_new(_("User Password:"));
gtk_grid_attach (GTK_GRID (Table), Label, 3, 2, 1, 1);
gtk_misc_set_alignment(GTK_MISC(Label),1,0.5);
CddbProxyUserPassword = gtk_entry_new();
- if (CDDB_PROXY_USER_PASSWORD)
- gtk_entry_set_text(GTK_ENTRY(CddbProxyUserPassword),CDDB_PROXY_USER_PASSWORD);
+ gtk_entry_set_visibility (GTK_ENTRY (CddbProxyUserPassword), FALSE);
+ g_settings_bind (MainSettings, "cddb-proxy-password", CddbProxyUserPassword,
+ "text", G_SETTINGS_BIND_DEFAULT);
gtk_grid_attach (GTK_GRID (Table), CddbProxyUserPassword, 4, 2, 1, 1);
- gtk_entry_set_visibility(GTK_ENTRY(CddbProxyUserPassword),FALSE);
gtk_widget_set_tooltip_text (CddbProxyUserPassword,
_("Password of user for the proxy server."));
Cddb_Use_Proxy_Toggled();
@@ -1360,7 +1401,8 @@ create_preferences_dialog (EtPreferencesDialog *self)
CddbFollowFile = gtk_check_button_new_with_label(_("Select corresponding audio "
"file (according position or DLM if activated below)"));
gtk_box_pack_start(GTK_BOX(vbox),CddbFollowFile,FALSE,FALSE,0);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(CddbFollowFile),CDDB_FOLLOW_FILE);
+ g_settings_bind (MainSettings, "cddb-dlm-enabled", CddbUseDLM, "active",
+ G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(CddbFollowFile,_("If activated, when selecting a "
"line in the list of tracks name, the corresponding audio file in the "
"main list will be also selected."));
@@ -1369,7 +1411,8 @@ create_preferences_dialog (EtPreferencesDialog *self)
CddbUseDLM = gtk_check_button_new_with_label(_("Use the Levenshtein algorithm "
"(DLM) to match lines (using title) with audio files (using filename)"));
gtk_box_pack_start(GTK_BOX(vbox),CddbUseDLM,FALSE,FALSE,0);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(CddbUseDLM),CDDB_USE_DLM);
+ g_settings_bind (MainSettings, "cddb-dlm-enabled", CddbUseDLM, "active",
+ G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(CddbUseDLM,_("When activating this option, the "
"Levenshtein algorithm (DLM: Damerau-Levenshtein Metric) will be used "
"to match the CDDB title against every filename in the current folder, "
@@ -1388,39 +1431,39 @@ create_preferences_dialog (EtPreferencesDialog *self)
ConfirmBeforeExit = gtk_check_button_new_with_label(_("Confirm exit from program"));
gtk_box_pack_start(GTK_BOX(VBox),ConfirmBeforeExit,FALSE,FALSE,0);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ConfirmBeforeExit),CONFIRM_BEFORE_EXIT);
+ g_settings_bind (MainSettings, "confirm-quit", ConfirmBeforeExit, "active",
+ G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(ConfirmBeforeExit,_("If activated, opens a dialog box to ask "
"confirmation before exiting the program."));
ConfirmWriteTag = gtk_check_button_new_with_label(_("Confirm writing of file tag"));
gtk_box_pack_start(GTK_BOX(VBox),ConfirmWriteTag,FALSE,FALSE,0);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ConfirmWriteTag),CONFIRM_WRITE_TAG);
+ g_settings_bind (MainSettings, "confirm-write-tags", ConfirmWriteTag,
+ "active", G_SETTINGS_BIND_DEFAULT);
ConfirmRenameFile = gtk_check_button_new_with_label(_("Confirm renaming of file"));
gtk_box_pack_start(GTK_BOX(VBox),ConfirmRenameFile,FALSE,FALSE,0);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ConfirmRenameFile),CONFIRM_RENAME_FILE);
+ g_settings_bind (MainSettings, "confirm-rename-file", ConfirmRenameFile,
+ "active", G_SETTINGS_BIND_DEFAULT);
ConfirmDeleteFile = gtk_check_button_new_with_label(_("Confirm deleting of file"));
- gtk_box_pack_start(GTK_BOX(VBox),ConfirmDeleteFile,FALSE,FALSE,0);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ConfirmDeleteFile),CONFIRM_DELETE_FILE);
+ g_settings_bind (MainSettings, "confirm-delete-file", ConfirmDeleteFile,
+ "active", G_SETTINGS_BIND_DEFAULT);
ConfirmWritePlayList = gtk_check_button_new_with_label(_("Confirm writing of playlist"));
gtk_box_pack_start(GTK_BOX(VBox),ConfirmWritePlayList,FALSE,FALSE,0);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ConfirmWritePlayList),CONFIRM_WRITE_PLAYLIST);
+ g_settings_bind (MainSettings, "confirm-write-playlist",
+ ConfirmWritePlayList, "active", G_SETTINGS_BIND_DEFAULT);
ConfirmWhenUnsavedFiles = gtk_check_button_new_with_label(_("Confirm changing directory when there are
unsaved changes"));
gtk_box_pack_start(GTK_BOX(VBox),ConfirmWhenUnsavedFiles,FALSE,FALSE,0);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ConfirmWhenUnsavedFiles),CONFIRM_WHEN_UNSAVED_FILES);
-
+ g_settings_bind (MainSettings, "confirm-when-unsaved-files",
+ ConfirmWhenUnsavedFiles, "active",
+ G_SETTINGS_BIND_DEFAULT);
/* Load the default page */
- gtk_notebook_set_current_page(GTK_NOTEBOOK(priv->options_notebook), OPTIONS_NOTEBOOK_PAGE);
-}
-
-
-static void Set_Default_Comment_Check_Button_Toggled (void)
-{
-
gtk_widget_set_sensitive(DefaultComment,gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(SetDefaultComment)));
+ g_settings_bind (MainSettings, "preferences-page", priv->options_notebook,
+ "page", G_SETTINGS_BIND_DEFAULT);
}
void Number_Track_Formatted_Toggled (void)
@@ -1849,9 +1892,6 @@ et_preferences_dialog_apply_changes (EtPreferencesDialog *self)
priv = et_preferences_dialog_get_instance_private (self);
- /* Get the last visible notebook page */
- OPTIONS_NOTEBOOK_PAGE = gtk_notebook_get_current_page (GTK_NOTEBOOK (priv->options_notebook));
-
/* Save combobox history lists before exit */
Save_Default_Path_To_MP3_List (priv->default_path_model, MISC_COMBO_TEXT);
Save_Default_Tag_Comment_Text_List (priv->default_comment_model,
diff --git a/src/scan_dialog.c b/src/scan_dialog.c
index 3f26e40..c77e488 100644
--- a/src/scan_dialog.c
+++ b/src/scan_dialog.c
@@ -271,20 +271,34 @@ Scan_Tag_With_Mask (EtScanDialog *self, ET_File *ETFile)
// Get the target entry for this code
dest = Scan_Return_File_Tag_Field_From_Mask_Code(FileTag,mask_item->code);
- // We display the text affected to the code
- if ( dest && ( OVERWRITE_TAG_FIELD || *dest==NULL || strlen(*dest)==0 ) )
- ET_Set_Field_File_Tag_Item(dest,mask_item->string);
+ /* We display the text affected to the code. */
+ if (dest && (g_settings_get_boolean (MainSettings,
+ "fill-overwrite-tag-fields")
+ || *dest == NULL || strlen (*dest) == 0))
+ {
+ ET_Set_Field_File_Tag_Item (dest, mask_item->string);
+ }
}
Scan_Free_File_Fill_Tag_List(fill_tag_list);
- // Set the default text to comment
- if (SET_DEFAULT_COMMENT && (OVERWRITE_TAG_FIELD || FileTag->comment==NULL || strlen(FileTag->comment)==0
) )
- ET_Set_Field_File_Tag_Item((void *)&FileTag->comment,DEFAULT_COMMENT);
+ /* Set the default text to comment. */
+ if (g_settings_get_boolean (MainSettings, "fill-set-default-comment")
+ && (g_settings_get_boolean (MainSettings, "fill-overwrite-tag-fields")
+ || FileTag->comment == NULL || strlen (FileTag->comment) == 0))
+ {
+ gchar *default_comment = g_settings_get_string (MainSettings,
+ "fill-default-comment");
+ ET_Set_Field_File_Tag_Item ((void *)&FileTag->comment,
+ default_comment);
+ g_free (default_comment);
+ }
- // Set CRC-32 value as default comment (for files with ID3 tag only ;-)
- if (SET_CRC32_COMMENT && (OVERWRITE_TAG_FIELD || FileTag->comment==NULL || strlen(FileTag->comment)==0 )
)
+ /* Set CRC-32 value as default comment (for files with ID3 tag only). */
+ if (g_settings_get_boolean (MainSettings, "fill-crc32-comment")
+ && (g_settings_get_boolean (MainSettings, "fill-overwrite-tag-fields")
+ || FileTag->comment == NULL || strlen (FileTag->comment) == 0))
{
GError *error = NULL;
guint32 crc32_value;
@@ -1544,11 +1558,6 @@ Scan_Process_Fields_First_Letters_Uppercase (EtScanDialog *self, gchar **str)
NULL
};
- if (!PFS_DONT_UPPER_SOME_WORDS)
- {
- exempt[0] = NULL;
- }
-
temp = Scan_Process_Fields_All_Downcase (string);
g_free (*str);
*str = string = temp;
@@ -1615,7 +1624,14 @@ Scan_Process_Fields_First_Letters_Uppercase (EtScanDialog *self, gchar **str)
c = g_utf8_get_char(word);
strncpy(word, utf8_character, g_unichar_to_utf8(g_unichar_toupper(c), utf8_character));
- // Set lowercase the first character of this word if found in the exempt words list
+ if (g_settings_get_boolean (MainSettings,
+ "process-uppercase-prepositions"))
+ {
+ break;
+ }
+
+ /* Lowercase the first character of this word if found in the
+ * exempt words list. */
for (i=0; exempt[i]!=NULL; i++)
{
if (g_ascii_strncasecmp(exempt[i], word, strlen(exempt[i])) == 0)
@@ -2579,7 +2595,9 @@ create_scan_dialog (EtScanDialog *self)
gtk_box_pack_start(GTK_BOX(HBox1),priv->mask_editor_toggle,FALSE,FALSE,0);
gtk_button_set_relief(GTK_BUTTON(priv->mask_editor_toggle),GTK_RELIEF_NONE);
gtk_widget_set_tooltip_text(priv->mask_editor_toggle,_("Show / Hide Masks Editor"));
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->mask_editor_toggle),SCAN_MASK_EDITOR_BUTTON);
+ g_settings_bind (MainSettings, "scan-mask-editor-show",
+ priv->mask_editor_toggle, "active",
+ G_SETTINGS_BIND_DEFAULT);
g_signal_connect_swapped (priv->mask_editor_toggle, "toggled",
G_CALLBACK (Scan_Toggle_Mask_Editor_Button),
self);
@@ -2591,7 +2609,8 @@ create_scan_dialog (EtScanDialog *self)
gtk_box_pack_start(GTK_BOX(HBox1),priv->legend_toggle,FALSE,FALSE,0);
gtk_button_set_relief(GTK_BUTTON(priv->legend_toggle),GTK_RELIEF_NONE);
gtk_widget_set_tooltip_text(priv->legend_toggle,_("Show / Hide Legend"));
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->legend_toggle),SCAN_LEGEND_BUTTON);
+ g_settings_bind (MainSettings, "scan-legend-show", priv->legend_toggle,
+ "active", G_SETTINGS_BIND_DEFAULT);
g_signal_connect_swapped (priv->legend_toggle, "toggled",
G_CALLBACK (Scan_Toggle_Legend_Button),
self);
@@ -2872,10 +2891,7 @@ create_scan_dialog (EtScanDialog *self)
gtk_box_pack_start(GTK_BOX(hbox),priv->process_convert_to_entry, FALSE,FALSE,0);
gtk_box_pack_start (GTK_BOX (group), process_fields_convert_none, FALSE,
FALSE, 0);
- if (PROCESS_FIELDS_CONVERT_FROM)
- gtk_entry_set_text(GTK_ENTRY(priv->process_convert_from_entry),PROCESS_FIELDS_CONVERT_FROM);
- if (PROCESS_FIELDS_CONVERT_TO)
- gtk_entry_set_text(GTK_ENTRY(priv->process_convert_to_entry),PROCESS_FIELDS_CONVERT_TO);
+
/* Toggled signals */
g_signal_connect_swapped (priv->process_convert_toggle, "toggled",
G_CALLBACK (Process_Fields_Convert_Check_Button_Toggled),
@@ -2883,7 +2899,16 @@ create_scan_dialog (EtScanDialog *self)
/* Set check buttons to init value */
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_convert_to_space_toggle),PF_CONVERT_INTO_SPACE);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_convert_to_underscores_toggle),PF_CONVERT_SPACE);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_convert_toggle),PF_CONVERT);
+ g_settings_bind (MainSettings, "process-convert-characters",
+ priv->process_convert_toggle, "active",
+ G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (MainSettings, "process-convert-characters-from",
+ priv->process_convert_from_entry, "text",
+ G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (MainSettings, "process-convert-characters-to",
+ priv->process_convert_to_entry, "text",
+ G_SETTINGS_BIND_DEFAULT);
+
/* Tooltips */
gtk_widget_set_tooltip_text(priv->process_convert_to_space_toggle,
_("The underscore character or the string '%20' are replaced by one space. "
@@ -2926,11 +2951,18 @@ create_scan_dialog (EtScanDialog *self)
G_CALLBACK (Process_Fields_First_Letters_Check_Button_Toggled),
self);
/* Set check buttons to init value */
-
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_all_uppercase_toggle),PF_CONVERT_ALL_UPPERCASE);
-
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_all_lowercase_toggle),PF_CONVERT_ALL_DOWNCASE);
-
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_first_uppercase_toggle),PF_CONVERT_FIRST_LETTER_UPPERCASE);
-
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_first_style_uppercase_toggle),PF_CONVERT_FIRST_LETTERS_UPPERCASE);
-
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_roman_numerals_check),PF_DETECT_ROMAN_NUMERALS);
+ g_settings_bind (MainSettings, "process-uppercase-all",
+ priv->process_all_uppercase_toggle, "active",
+ G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (MainSettings, "process-lowercase-all",
+ priv->process_all_lowercase_toggle, "active",
+ G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (MainSettings, "process-uppercase-first-letters",
+ priv->process_first_uppercase_toggle, "active",
+ G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (MainSettings, "process-detect-roman-numerals",
+ priv->process_roman_numerals_check, "active",
+ G_SETTINGS_BIND_DEFAULT);
/* Tooltips */
gtk_widget_set_tooltip_text(priv->process_all_uppercase_toggle,
_("Convert all words in all fields to upper case. "
@@ -2962,13 +2994,19 @@ create_scan_dialog (EtScanDialog *self)
FALSE, 0);
gtk_box_pack_start (GTK_BOX (group), priv->process_insert_space_toggle, FALSE,
FALSE, 0);
- gtk_box_pack_start (GTK_BOX (group), priv->process_insert_one_space_toggle, FALSE,
- FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (group), priv->process_insert_one_space_toggle,
+ FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (group), radio_space_none, FALSE, FALSE, 0);
/* Set check buttons to init value */
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_remove_space_toggle),PF_REMOVE_SPACE);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_insert_space_toggle),PF_INSERT_SPACE);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_insert_one_space_toggle),PF_ONLY_ONE_SPACE);
+ g_settings_bind (MainSettings, "process-remove-spaces",
+ priv->process_remove_space_toggle, "active",
+ G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (MainSettings, "process-insert-capital-spaces",
+ priv->process_insert_space_toggle, "active",
+ G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (MainSettings, "process-remove-duplicate-spaces",
+ priv->process_insert_one_space_toggle, "active",
+ G_SETTINGS_BIND_DEFAULT);
/* Tooltips */
gtk_widget_set_tooltip_text(priv->process_remove_space_toggle,
_("All spaces between words are removed. "
@@ -3226,9 +3264,6 @@ et_scan_dialog_apply_changes (EtScanDialog *self)
/* The selected scanner type. */
SCANNER_TYPE = gtk_combo_box_get_active(GTK_COMBO_BOX(priv->type_combo));
- SCAN_MASK_EDITOR_BUTTON = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->mask_editor_toggle));
- SCAN_LEGEND_BUTTON = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->legend_toggle));
-
/* Group: select entries to process */
PROCESS_FILENAME_FIELD =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_filename_toggle));
PROCESS_TITLE_FIELD = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_title_toggle));
@@ -3243,27 +3278,9 @@ et_scan_dialog_apply_changes (EtScanDialog *self)
PROCESS_URL_FIELD = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_url_toggle));
PROCESS_ENCODED_BY_FIELD =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_encoded_by_toggle));
- if (PROCESS_FIELDS_CONVERT_FROM) g_free(PROCESS_FIELDS_CONVERT_FROM);
- PROCESS_FIELDS_CONVERT_FROM = g_strdup(gtk_entry_get_text(GTK_ENTRY(priv->process_convert_from_entry)));
- if (PROCESS_FIELDS_CONVERT_TO) g_free(PROCESS_FIELDS_CONVERT_TO);
- PROCESS_FIELDS_CONVERT_TO = g_strdup(gtk_entry_get_text(GTK_ENTRY(priv->process_convert_to_entry)));
-
/* Group: convert one character */
PF_CONVERT_INTO_SPACE =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_convert_to_space_toggle));
PF_CONVERT_SPACE =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_convert_to_underscores_toggle));
- PF_CONVERT =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_convert_toggle));
-
- /* Group: capitalize */
- PF_CONVERT_ALL_UPPERCASE =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_all_uppercase_toggle));
- PF_CONVERT_ALL_DOWNCASE =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_all_lowercase_toggle));
- PF_CONVERT_FIRST_LETTER_UPPERCASE =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_first_uppercase_toggle));
- PF_CONVERT_FIRST_LETTERS_UPPERCASE =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_first_style_uppercase_toggle));
- PF_DETECT_ROMAN_NUMERALS =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_roman_numerals_check));
-
- /* Group: remove/insert space */
- PF_REMOVE_SPACE = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_remove_space_toggle));
- PF_INSERT_SPACE = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_insert_space_toggle));
- PF_ONLY_ONE_SPACE =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_insert_one_space_toggle));
/* Save default masks. */
if (SCAN_TAG_DEFAULT_MASK) g_free(SCAN_TAG_DEFAULT_MASK);
diff --git a/src/search_dialog.c b/src/search_dialog.c
index c881d51..c75de8c 100644
--- a/src/search_dialog.c
+++ b/src/search_dialog.c
@@ -1,5 +1,5 @@
/* EasyTAG - tag editor for audio files
- * Copyright (C) 2013 David King <amigadave amigadave com>
+ * Copyright (C) 2013-2014 David King <amigadave amigadave com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -257,10 +257,14 @@ Add_Row_To_Search_Result_List (EtSearchDialog *self,
{
if ( SearchResultList_Text[column] && strlen(string_to_search) &&
strstr(SearchResultList_Text[column],string_to_search) )
{
- if (CHANGED_FILES_DISPLAYED_TO_BOLD)
+ if (g_settings_get_boolean (MainSettings, "file-changed-bold"))
+ {
SearchResultList_Weight[column] = PANGO_WEIGHT_BOLD;
+ }
else
+ {
SearchResultList_Color[column] = &RED;
+ }
}
} else
@@ -279,10 +283,14 @@ Add_Row_To_Search_Result_List (EtSearchDialog *self,
if ( list_text && strlen(string_to_search2) && strstr(list_text,string_to_search2) )
{
- if (CHANGED_FILES_DISPLAYED_TO_BOLD)
+ if (g_settings_get_boolean (MainSettings, "file-changed-bold"))
+ {
SearchResultList_Weight[column] = PANGO_WEIGHT_BOLD;
+ }
else
+ {
SearchResultList_Color[column] = &RED;
+ }
}
g_free(list_text);
@@ -651,10 +659,10 @@ create_search_dialog (EtSearchDialog *self)
priv->search_in_tag = gtk_check_button_new_with_label (_("the Tag"));
gtk_grid_attach (GTK_GRID (Table), priv->search_in_filename, 1, 1, 1, 1);
gtk_grid_attach (GTK_GRID (Table), priv->search_in_tag, 2, 1, 1, 1);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->search_in_filename),
- SEARCH_IN_FILENAME);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->search_in_tag),
- SEARCH_IN_TAG);
+ g_settings_bind (MainSettings, "search-filename", priv->search_in_filename,
+ "active", G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (MainSettings, "search-tag", priv->search_in_tag,
+ "active", G_SETTINGS_BIND_DEFAULT);
Separator = gtk_separator_new(GTK_ORIENTATION_VERTICAL);
et_grid_attach_full (GTK_GRID (Table), Separator, 3, 1, 1, 1, FALSE, FALSE,
@@ -664,8 +672,9 @@ create_search_dialog (EtSearchDialog *self)
priv->search_case_sensitive = gtk_check_button_new_with_label (_("Case sensitive"));
et_grid_attach_full (GTK_GRID (Table), priv->search_case_sensitive, 4, 1,
1, 1, TRUE, FALSE, 0, 0);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->search_case_sensitive),
- SEARCH_CASE_SENSITIVE);
+ g_settings_bind (MainSettings, "search-case-sensitive",
+ priv->search_case_sensitive, "active",
+ G_SETTINGS_BIND_DEFAULT);
// Results list
ScrollWindow = gtk_scrolled_window_new(NULL,NULL);
@@ -909,10 +918,6 @@ et_search_dialog_apply_changes (EtSearchDialog *self)
priv = et_search_dialog_get_instance_private (self);
Save_Search_File_List (priv->search_string_model, MISC_COMBO_TEXT);
-
- SEARCH_IN_FILENAME = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->search_in_filename));
- SEARCH_IN_TAG = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->search_in_tag));
- SEARCH_CASE_SENSITIVE = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->search_case_sensitive));
}
static void
diff --git a/src/setting.c b/src/setting.c
index 261f78a..5415d7a 100644
--- a/src/setting.c
+++ b/src/setting.c
@@ -1,20 +1,20 @@
-/*
- * EasyTAG - Tag editor for MP3 and Ogg Vorbis files
- * Copyright (C) 2000-2003 Jerome Couderc <easytag gmail com>
+/* EasyTAG - Tag editor for audio files
+ * Copyright (C) 2014 David King <amigadave amigadave com>
+ * Copyright (C) 2000-2003 Jerome Couderc <easytag gmail com>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "config.h"
@@ -115,92 +115,40 @@ static void set_sorting_indicator_for_column_id (EtApplicationWindow *self,
********************/
static const tConfigVariable Config_Variables[] =
{
- {"load_on_startup", CV_TYPE_BOOL, &LOAD_ON_STARTUP },
{"default_path_to_mp3", CV_TYPE_STRING, &DEFAULT_PATH_TO_MP3 },
- {"browser_line_style", CV_TYPE_BOOL, &BROWSER_LINE_STYLE },
- {"browser_expander_style", CV_TYPE_BOOL, &BROWSER_EXPANDER_STYLE },
- {"browse_subdir", CV_TYPE_BOOL, &BROWSE_SUBDIR },
- {"browse_hidden_dir", CV_TYPE_BOOL, &BROWSE_HIDDEN_DIR },
- {"open_selected_browser_node", CV_TYPE_BOOL, &OPEN_SELECTED_BROWSER_NODE },
-
- {"show_header_infos", CV_TYPE_BOOL, &SHOW_HEADER_INFO },
- {"changed_files_displayed_to_red", CV_TYPE_BOOL, &CHANGED_FILES_DISPLAYED_TO_RED },
- {"changed_files_displayed_to_bold", CV_TYPE_BOOL, &CHANGED_FILES_DISPLAYED_TO_BOLD },
-
- {"date_auto_completion", CV_TYPE_BOOL, &DATE_AUTO_COMPLETION },
- {"number_track_formated", CV_TYPE_BOOL, &NUMBER_TRACK_FORMATED },
- {"number_track_formated_spin_button", CV_TYPE_INT, &NUMBER_TRACK_FORMATED_SPIN_BUTTON },
+
{"pad_disc_number", CV_TYPE_BOOL, &PAD_DISC_NUMBER },
{"pad_disc_number_digits", CV_TYPE_INT, &PAD_DISC_NUMBER_DIGITS },
- {"set_focus_to_same_tag_field", CV_TYPE_BOOL, &SET_FOCUS_TO_SAME_TAG_FIELD },
- {"set_focus_to_first_tag_field", CV_TYPE_BOOL, &SET_FOCUS_TO_FIRST_TAG_FIELD },
{"sorting_file_mode", CV_TYPE_INT, &SORTING_FILE_MODE },
{"sorting_file_case_sensitive", CV_TYPE_BOOL, &SORTING_FILE_CASE_SENSITIVE },
- {"log_max_lines", CV_TYPE_INT, &LOG_MAX_LINES },
- {"sho_log_view", CV_TYPE_BOOL, &SHOW_LOG_VIEW },
- {"replace_illegal_character_in_filename", CV_TYPE_BOOL,
&REPLACE_ILLEGAL_CHARACTERS_IN_FILENAME },
{"filename_extension_lower_case", CV_TYPE_BOOL, &FILENAME_EXTENSION_LOWER_CASE
},
{"filename_extension_upper_case", CV_TYPE_BOOL, &FILENAME_EXTENSION_UPPER_CASE
},
{"filename_extension_no_change", CV_TYPE_BOOL, &FILENAME_EXTENSION_NO_CHANGE
},
- {"preserve_modification_time", CV_TYPE_BOOL, &PRESERVE_MODIFICATION_TIME
},
- {"update_parent_directory_modification_time", CV_TYPE_BOOL,
&UPDATE_PARENT_DIRECTORY_MODIFICATION_TIME},
{"filename_character_set_other", CV_TYPE_BOOL, &FILENAME_CHARACTER_SET_OTHER
},
{"filename_character_set_approximate", CV_TYPE_BOOL, &FILENAME_CHARACTER_SET_APPROXIMATE
},
{"filename_character_set_discard", CV_TYPE_BOOL, &FILENAME_CHARACTER_SET_DISCARD
},
- {"strip_tag_when_empty_fields", CV_TYPE_BOOL, &STRIP_TAG_WHEN_EMPTY_FIELDS
},
- {"convert_old_id3v2_tag_version", CV_TYPE_BOOL, &CONVERT_OLD_ID3V2_TAG_VERSION
},
- {"use_non_standard_id3_reading_character_set", CV_TYPE_BOOL,
&USE_NON_STANDARD_ID3_READING_CHARACTER_SET},
{"file_reading_id3v1v2_character_set", CV_TYPE_STRING,&FILE_READING_ID3V1V2_CHARACTER_SET},
- {"file_writing_id3v2_write_tag", CV_TYPE_BOOL, &FILE_WRITING_ID3V2_WRITE_TAG },
{"file_writing_id3v2_version_4", CV_TYPE_BOOL, &FILE_WRITING_ID3V2_VERSION_4 },
- {"file_writing_id3v2_use_crc32", CV_TYPE_BOOL, &FILE_WRITING_ID3V2_USE_CRC32 },
- {"file_writing_id3v2_use_compression", CV_TYPE_BOOL, &FILE_WRITING_ID3V2_USE_COMPRESSION
},
- {"file_writing_id3v2_use_unicode_character_set", CV_TYPE_BOOL,
&FILE_WRITING_ID3V2_USE_UNICODE_CHARACTER_SET},
{"file_writing_id3v2_unicode_character_set",
CV_TYPE_STRING,&FILE_WRITING_ID3V2_UNICODE_CHARACTER_SET},
{"file_writing_id3v2_no_unicode_character_set",
CV_TYPE_STRING,&FILE_WRITING_ID3V2_NO_UNICODE_CHARACTER_SET},
{"file_writing_id3v2_iconv_options_no", CV_TYPE_BOOL, &FILE_WRITING_ID3V2_ICONV_OPTIONS_NO},
{"file_writing_id3v2_iconv_options_translit", CV_TYPE_BOOL,
&FILE_WRITING_ID3V2_ICONV_OPTIONS_TRANSLIT},
{"file_writing_id3v2_iconv_options_ignore", CV_TYPE_BOOL,
&FILE_WRITING_ID3V2_ICONV_OPTIONS_IGNORE},
- {"file_writing_id3v2_text_only_genre", CV_TYPE_BOOL, &FILE_WRITING_ID3V2_TEXT_ONLY_GENRE},
- {"file_writing_id3v1_write_tag", CV_TYPE_BOOL, &FILE_WRITING_ID3V1_WRITE_TAG },
{"file_writing_id3v1_character_set", CV_TYPE_STRING,&FILE_WRITING_ID3V1_CHARACTER_SET},
{"file_writing_id3v1_iconv_options_no", CV_TYPE_BOOL, &FILE_WRITING_ID3V1_ICONV_OPTIONS_NO},
{"file_writing_id3v1_iconv_options_translit", CV_TYPE_BOOL,
&FILE_WRITING_ID3V1_ICONV_OPTIONS_TRANSLIT},
{"file_writing_id3v1_iconv_options_ignore", CV_TYPE_BOOL,
&FILE_WRITING_ID3V1_ICONV_OPTIONS_IGNORE},
- {"vorbis_split_field_title", CV_TYPE_BOOL, &VORBIS_SPLIT_FIELD_TITLE},
- {"vorbis_split_field_artist", CV_TYPE_BOOL, &VORBIS_SPLIT_FIELD_ARTIST},
- {"vorbis_split_field_album", CV_TYPE_BOOL, &VORBIS_SPLIT_FIELD_ALBUM},
- {"vorbis_split_field_genre", CV_TYPE_BOOL, &VORBIS_SPLIT_FIELD_GENRE},
- {"vorbis_split_field_comment", CV_TYPE_BOOL, &VORBIS_SPLIT_FIELD_COMMENT},
- {"vorbis_split_field_composer", CV_TYPE_BOOL, &VORBIS_SPLIT_FIELD_COMPOSER},
- {"vorbis_split_field_orig_artist", CV_TYPE_BOOL, &VORBIS_SPLIT_FIELD_ORIG_ARTIST},
{"audio_file_player", CV_TYPE_STRING,&AUDIO_FILE_PLAYER },
{"scanner_type", CV_TYPE_INT, &SCANNER_TYPE },
- {"scan_mask_editor_button", CV_TYPE_BOOL,&SCAN_MASK_EDITOR_BUTTON },
- {"scan_legend_button", CV_TYPE_BOOL,&SCAN_LEGEND_BUTTON },
{"fts_convert_underscore_and_p20_into_space",CV_TYPE_BOOL,&FTS_CONVERT_UNDERSCORE_AND_P20_INTO_SPACE },
{"fts_convert_space_into_underscore", CV_TYPE_BOOL,&FTS_CONVERT_SPACE_INTO_UNDERSCORE },
{"rfs_convert_underscore_and_p20_into_space",CV_TYPE_BOOL,&RFS_CONVERT_UNDERSCORE_AND_P20_INTO_SPACE },
{"rfs_convert_space_into_underscore", CV_TYPE_BOOL,&RFS_CONVERT_SPACE_INTO_UNDERSCORE },
{"rfs_remove_spaces", CV_TYPE_BOOL,&RFS_REMOVE_SPACES },
- {"pfs_dont_upper_some_words", CV_TYPE_BOOL,&PFS_DONT_UPPER_SOME_WORDS },
- {"overwrite_tag_field", CV_TYPE_BOOL, &OVERWRITE_TAG_FIELD },
- {"set_default_comment", CV_TYPE_BOOL, &SET_DEFAULT_COMMENT },
- {"default_comment", CV_TYPE_STRING, &DEFAULT_COMMENT },
- {"crc32_comment", CV_TYPE_BOOL, &SET_CRC32_COMMENT },
- {"open_scanner_window_on_startup", CV_TYPE_BOOL, &OPEN_SCANNER_WINDOW_ON_STARTUP },
-
- {"confirm_before_exit", CV_TYPE_BOOL, &CONFIRM_BEFORE_EXIT },
- {"confirm_write_tag", CV_TYPE_BOOL, &CONFIRM_WRITE_TAG },
- {"confirm_rename_file", CV_TYPE_BOOL, &CONFIRM_RENAME_FILE },
- {"confirm_write_playlist", CV_TYPE_BOOL, &CONFIRM_WRITE_PLAYLIST },
- {"confirm_delete_file", CV_TYPE_BOOL, &CONFIRM_DELETE_FILE },
- {"confirm_when_unsaved_files", CV_TYPE_BOOL, &CONFIRM_WHEN_UNSAVED_FILES },
-
{"process_filename_field", CV_TYPE_BOOL, &PROCESS_FILENAME_FIELD },
{"process_title_field", CV_TYPE_BOOL, &PROCESS_TITLE_FIELD },
{"process_artist_field", CV_TYPE_BOOL, &PROCESS_ARTIST_FIELD },
@@ -213,64 +161,23 @@ static const tConfigVariable Config_Variables[] =
{"process_copyright_field", CV_TYPE_BOOL, &PROCESS_COPYRIGHT_FIELD },
{"process_url_field", CV_TYPE_BOOL, &PROCESS_URL_FIELD },
{"process_encoded_by_field", CV_TYPE_BOOL, &PROCESS_ENCODED_BY_FIELD },
- {"process_fields_convert_from", CV_TYPE_STRING, &PROCESS_FIELDS_CONVERT_FROM },
- {"process_fields_convert_to", CV_TYPE_STRING, &PROCESS_FIELDS_CONVERT_TO },
{"pf_convert_into_space", CV_TYPE_BOOL, &PF_CONVERT_INTO_SPACE },
{"pf_convert_space", CV_TYPE_BOOL, &PF_CONVERT_SPACE },
- {"pf_convert", CV_TYPE_BOOL, &PF_CONVERT },
- {"pf_convert_all_uppercase", CV_TYPE_BOOL, &PF_CONVERT_ALL_UPPERCASE },
- {"pf_convert_all_downcase", CV_TYPE_BOOL, &PF_CONVERT_ALL_DOWNCASE },
- {"pf_convert_first_letter_uppercase", CV_TYPE_BOOL, &PF_CONVERT_FIRST_LETTER_UPPERCASE },
- {"pf_convert_first_letters_uppercase", CV_TYPE_BOOL, &PF_CONVERT_FIRST_LETTERS_UPPERCASE },
- {"pf_detect_roman_numerals", CV_TYPE_BOOL, &PF_DETECT_ROMAN_NUMERALS },
- {"pf_remove_space", CV_TYPE_BOOL, &PF_REMOVE_SPACE },
- {"pf_insert_space", CV_TYPE_BOOL, &PF_INSERT_SPACE },
- {"pf_only_one_space", CV_TYPE_BOOL, &PF_ONLY_ONE_SPACE },
{"playlist_name", CV_TYPE_STRING, &PLAYLIST_NAME },
- {"playlist_use_mask_name", CV_TYPE_BOOL, &PLAYLIST_USE_MASK_NAME },
- {"playlist_use_dir_name", CV_TYPE_BOOL, &PLAYLIST_USE_DIR_NAME },
- {"playlist_only_selected_files", CV_TYPE_BOOL, &PLAYLIST_ONLY_SELECTED_FILES },
- {"playlist_full_path", CV_TYPE_BOOL, &PLAYLIST_FULL_PATH },
- {"playlist_relative_path", CV_TYPE_BOOL, &PLAYLIST_RELATIVE_PATH },
- {"playlist_create_in_parent_dir", CV_TYPE_BOOL, &PLAYLIST_CREATE_IN_PARENT_DIR },
- {"playlist_use_dos_separator", CV_TYPE_BOOL, &PLAYLIST_USE_DOS_SEPARATOR },
{"playlist_content_none", CV_TYPE_BOOL, &PLAYLIST_CONTENT_NONE },
{"playlist_content_filename", CV_TYPE_BOOL, &PLAYLIST_CONTENT_FILENAME },
{"playlist_content_mask", CV_TYPE_BOOL, &PLAYLIST_CONTENT_MASK },
{"playlist_content_mask_value", CV_TYPE_STRING, &PLAYLIST_CONTENT_MASK_VALUE },
- {"load_file_run_scanner", CV_TYPE_BOOL, &LOAD_FILE_RUN_SCANNER },
-
- {"cddb_server_name_automatic_search", CV_TYPE_STRING, &CDDB_SERVER_NAME_AUTOMATIC_SEARCH },
- {"cddb_server_port_automatic_search", CV_TYPE_INT, &CDDB_SERVER_PORT_AUTOMATIC_SEARCH },
- {"cddb_server_cgi_path_automatic_search", CV_TYPE_STRING, &CDDB_SERVER_CGI_PATH_AUTOMATIC_SEARCH },
- {"cddb_server_name_automatic_search2", CV_TYPE_STRING, &CDDB_SERVER_NAME_AUTOMATIC_SEARCH2 },
- {"cddb_server_port_automatic_search2", CV_TYPE_INT, &CDDB_SERVER_PORT_AUTOMATIC_SEARCH2 },
- {"cddb_server_cgi_path_automatic_search2", CV_TYPE_STRING, &CDDB_SERVER_CGI_PATH_AUTOMATIC_SEARCH2 },
- {"cddb_server_name_manual_search", CV_TYPE_STRING, &CDDB_SERVER_NAME_MANUAL_SEARCH },
- {"cddb_server_port_manual_search", CV_TYPE_INT, &CDDB_SERVER_PORT_MANUAL_SEARCH },
- {"cddb_server_cgi_path_manual_search", CV_TYPE_STRING, &CDDB_SERVER_CGI_PATH_MANUAL_SEARCH },
{"cddb_local_path", CV_TYPE_STRING, &CDDB_LOCAL_PATH },
- {"cddb_use_proxy", CV_TYPE_INT, &CDDB_USE_PROXY },
- {"cddb_proxy_name", CV_TYPE_STRING, &CDDB_PROXY_NAME },
- {"cddb_proxy_port", CV_TYPE_INT, &CDDB_PROXY_PORT },
- {"cddb_proxy_user_name", CV_TYPE_STRING, &CDDB_PROXY_USER_NAME },
- {"cddb_proxy_user_password", CV_TYPE_STRING, &CDDB_PROXY_USER_PASSWORD },
-
- {"cddb_follow_file", CV_TYPE_BOOL, &CDDB_FOLLOW_FILE },
- {"cddb_use_dlm", CV_TYPE_BOOL, &CDDB_USE_DLM },
- {"cddb_use_local_access", CV_TYPE_BOOL, &CDDB_USE_LOCAL_ACCESS },
- {"cddb_search_in_all_fields", CV_TYPE_BOOL, &CDDB_SEARCH_IN_ALL_FIELDS },
{"cddb_search_in_artist_field", CV_TYPE_BOOL, &CDDB_SEARCH_IN_ARTIST_FIELD },
{"cddb_search_in_title_field", CV_TYPE_BOOL, &CDDB_SEARCH_IN_TITLE_FIELD },
{"cddb_search_in_track_name_field", CV_TYPE_BOOL, &CDDB_SEARCH_IN_TRACK_NAME_FIELD },
{"cddb_search_in_other_field", CV_TYPE_BOOL, &CDDB_SEARCH_IN_OTHER_FIELD },
- {"cddb_show_categories", CV_TYPE_BOOL, &CDDB_SHOW_CATEGORIES },
- {"cddb_search_in_all_categories", CV_TYPE_BOOL, &CDDB_SEARCH_IN_ALL_CATEGORIES },
{"cddb_search_in_blues_categories", CV_TYPE_BOOL, &CDDB_SEARCH_IN_BLUES_CATEGORY },
{"cddb_search_in_classical_categories", CV_TYPE_BOOL, &CDDB_SEARCH_IN_CLASSICAL_CATEGORY },
{"cddb_search_in_country_categories", CV_TYPE_BOOL, &CDDB_SEARCH_IN_COUNTRY_CATEGORY },
@@ -292,18 +199,9 @@ static const tConfigVariable Config_Variables[] =
{"cddb_set_to_genre", CV_TYPE_BOOL, &CDDB_SET_TO_GENRE },
{"cddb_set_to_file_name", CV_TYPE_BOOL, &CDDB_SET_TO_FILE_NAME },
- {"cddb_run_scanner", CV_TYPE_BOOL, &CDDB_RUN_SCANNER },
-
- {"search_in_filename", CV_TYPE_BOOL, &SEARCH_IN_FILENAME },
- {"search_in_tag", CV_TYPE_BOOL, &SEARCH_IN_TAG },
- {"search_case_sensitive", CV_TYPE_BOOL, &SEARCH_CASE_SENSITIVE },
-
{"scan_tag_default_mask", CV_TYPE_STRING, &SCAN_TAG_DEFAULT_MASK },
{"rename_file_default_mask", CV_TYPE_STRING, &RENAME_FILE_DEFAULT_MASK },
{"rename_directory_default_mask", CV_TYPE_STRING, &RENAME_DIRECTORY_DEFAULT_MASK },
- {"rename_directory_with_mask", CV_TYPE_BOOL, &RENAME_DIRECTORY_WITH_MASK },
-
- { "options_notebook_page", CV_TYPE_INT, &OPTIONS_NOTEBOOK_PAGE }
};
@@ -320,18 +218,11 @@ void Init_Config_Variables (void)
{
const gchar *music_dir;
+ MainSettings = g_settings_new ("org.gnome.EasyTAG");
+
/*
* Common
*/
- LOAD_ON_STARTUP = 0;
- BROWSE_SUBDIR = 1;
-#ifdef G_OS_WIN32
- BROWSE_HIDDEN_DIR = 1;
-#else /* !G_OS_WIN32 */
- BROWSE_HIDDEN_DIR = 0;
-#endif /* !G_OS_WIN32 */
- OPEN_SELECTED_BROWSER_NODE = 1;
-
music_dir = g_get_user_special_dir (G_USER_DIRECTORY_MUSIC);
DEFAULT_PATH_TO_MP3 = music_dir ? g_strdup (music_dir)
: g_strdup (g_get_home_dir ());
@@ -339,25 +230,14 @@ void Init_Config_Variables (void)
/*
* Misc
*/
- SHOW_HEADER_INFO = 1;
- CHANGED_FILES_DISPLAYED_TO_RED = 0;
- CHANGED_FILES_DISPLAYED_TO_BOLD = 1;
-
- DATE_AUTO_COMPLETION = 1;
- NUMBER_TRACK_FORMATED = 1;
- NUMBER_TRACK_FORMATED_SPIN_BUTTON = 2;
PAD_DISC_NUMBER = 1;
PAD_DISC_NUMBER_DIGITS = 1;
- SET_FOCUS_TO_SAME_TAG_FIELD = 1;
- SET_FOCUS_TO_FIRST_TAG_FIELD = 0;
SORTING_FILE_MODE = SORTING_BY_ASCENDING_FILENAME;
#ifdef G_OS_WIN32
SORTING_FILE_CASE_SENSITIVE = 1;
#else /* !G_OS_WIN32 */
SORTING_FILE_CASE_SENSITIVE = 0;
#endif /* !G_OS_WIN32 */
- LOG_MAX_LINES = 50;
- SHOW_LOG_VIEW = 1;
#ifdef G_OS_WIN32
AUDIO_FILE_PLAYER = ET_Win32_Get_Audio_File_Player();
@@ -368,12 +248,9 @@ void Init_Config_Variables (void)
/*
* File Settings
*/
- REPLACE_ILLEGAL_CHARACTERS_IN_FILENAME = 1;
FILENAME_EXTENSION_LOWER_CASE = 1;
FILENAME_EXTENSION_UPPER_CASE = 0;
FILENAME_EXTENSION_NO_CHANGE = 0;
- PRESERVE_MODIFICATION_TIME = 0;
- UPDATE_PARENT_DIRECTORY_MODIFICATION_TIME = 1;
FILENAME_CHARACTER_SET_OTHER = 1;
FILENAME_CHARACTER_SET_APPROXIMATE = 0;
@@ -382,19 +259,12 @@ void Init_Config_Variables (void)
/*
* Tag Settings
*/
- STRIP_TAG_WHEN_EMPTY_FIELDS = 1;
- CONVERT_OLD_ID3V2_TAG_VERSION = 1;
- USE_NON_STANDARD_ID3_READING_CHARACTER_SET = 0;
FILE_READING_ID3V1V2_CHARACTER_SET = g_strdup("UTF-8");
- FILE_WRITING_ID3V2_WRITE_TAG = 1;
#ifdef G_OS_WIN32
FILE_WRITING_ID3V2_VERSION_4 = 0;
#else /* !G_OS_WIN32 */
FILE_WRITING_ID3V2_VERSION_4 = 1;
#endif /* !G_OS_WIN32 */
- FILE_WRITING_ID3V2_USE_CRC32 = 0;
- FILE_WRITING_ID3V2_USE_COMPRESSION = 0;
- FILE_WRITING_ID3V2_USE_UNICODE_CHARACTER_SET = 1;
#ifdef G_OS_WIN32
FILE_WRITING_ID3V2_UNICODE_CHARACTER_SET = g_strdup("UTF-16");
#else /* !G_OS_WIN32 */
@@ -404,44 +274,18 @@ void Init_Config_Variables (void)
FILE_WRITING_ID3V2_ICONV_OPTIONS_NO = 1;
FILE_WRITING_ID3V2_ICONV_OPTIONS_TRANSLIT = 0;
FILE_WRITING_ID3V2_ICONV_OPTIONS_IGNORE = 0;
- FILE_WRITING_ID3V1_WRITE_TAG = 1;
FILE_WRITING_ID3V1_CHARACTER_SET = g_strdup("ISO-8859-1");
FILE_WRITING_ID3V1_ICONV_OPTIONS_NO = 0;
FILE_WRITING_ID3V1_ICONV_OPTIONS_TRANSLIT = 1;
FILE_WRITING_ID3V1_ICONV_OPTIONS_IGNORE = 0;
- VORBIS_SPLIT_FIELD_TITLE = 0;
- VORBIS_SPLIT_FIELD_ARTIST = 0;
- VORBIS_SPLIT_FIELD_ALBUM = 0;
- VORBIS_SPLIT_FIELD_GENRE = 0;
- VORBIS_SPLIT_FIELD_COMMENT = 0;
- VORBIS_SPLIT_FIELD_COMPOSER = 0;
- VORBIS_SPLIT_FIELD_ORIG_ARTIST = 0;
/*
* Scanner
*/
SCANNER_TYPE = ET_SCAN_TYPE_FILL_TAG;
- SCAN_MASK_EDITOR_BUTTON = 0;
- SCAN_LEGEND_BUTTON = 0;
FTS_CONVERT_UNDERSCORE_AND_P20_INTO_SPACE = 1;
FTS_CONVERT_SPACE_INTO_UNDERSCORE = 0;
RFS_CONVERT_UNDERSCORE_AND_P20_INTO_SPACE = 1;
- RFS_CONVERT_SPACE_INTO_UNDERSCORE = 0;
- PFS_DONT_UPPER_SOME_WORDS = 0;
- OVERWRITE_TAG_FIELD = 1;
- SET_DEFAULT_COMMENT = 0;
- DEFAULT_COMMENT = g_strdup("Tagged with EasyTAG");
- SET_CRC32_COMMENT = 0;
- OPEN_SCANNER_WINDOW_ON_STARTUP = 0;
-
- /*
- * Confirmation
- */
- CONFIRM_BEFORE_EXIT = 1;
- CONFIRM_WRITE_TAG = 1;
- CONFIRM_RENAME_FILE = 1;
- CONFIRM_DELETE_FILE = 1;
- CONFIRM_WRITE_PLAYLIST = 1;
/*
* Scanner window
@@ -459,73 +303,28 @@ void Init_Config_Variables (void)
PROCESS_URL_FIELD = 1;
PROCESS_ENCODED_BY_FIELD = 1;
- PROCESS_FIELDS_CONVERT_FROM = NULL;
- PROCESS_FIELDS_CONVERT_TO = NULL;
-
PF_CONVERT_INTO_SPACE = 1;
PF_CONVERT_SPACE = 0;
- PF_CONVERT = 0;
- PF_CONVERT_ALL_UPPERCASE = 0;
- PF_CONVERT_ALL_DOWNCASE = 0;
- PF_CONVERT_FIRST_LETTER_UPPERCASE = 0;
- PF_CONVERT_FIRST_LETTERS_UPPERCASE = 1;
- PF_DETECT_ROMAN_NUMERALS = 1;
- PF_REMOVE_SPACE = 0;
- PF_INSERT_SPACE = 0;
- PF_ONLY_ONE_SPACE = 1;
/*
* Playlist window
*/
PLAYLIST_NAME = g_strdup("playlist_%a_-_%b");
- PLAYLIST_USE_MASK_NAME = 0;
- PLAYLIST_USE_DIR_NAME = 1;
- PLAYLIST_ONLY_SELECTED_FILES = 1;
- PLAYLIST_FULL_PATH = 0;
- PLAYLIST_RELATIVE_PATH = 1;
- PLAYLIST_CREATE_IN_PARENT_DIR = 0;
- PLAYLIST_USE_DOS_SEPARATOR = 0;
PLAYLIST_CONTENT_NONE = 0;
PLAYLIST_CONTENT_FILENAME = 1;
PLAYLIST_CONTENT_MASK = 0;
PLAYLIST_CONTENT_MASK_VALUE = g_strdup("%n/%l - %a - %b - %t");
/*
- * Load File window
- */
- LOAD_FILE_RUN_SCANNER = 0;
-
- /*
* CDDB window
*/
- CDDB_SERVER_NAME_AUTOMATIC_SEARCH = g_strdup("freedb.freedb.org");
- CDDB_SERVER_PORT_AUTOMATIC_SEARCH = 80;
- CDDB_SERVER_CGI_PATH_AUTOMATIC_SEARCH = g_strdup("/~cddb/cddb.cgi");
- CDDB_SERVER_NAME_AUTOMATIC_SEARCH2 = g_strdup("freedb.musicbrainz.org");
- CDDB_SERVER_PORT_AUTOMATIC_SEARCH2 = 80;
- CDDB_SERVER_CGI_PATH_AUTOMATIC_SEARCH2 = g_strdup("/~cddb/cddb.cgi");
- CDDB_SERVER_NAME_MANUAL_SEARCH = g_strdup("www.gnudb.org");
- CDDB_SERVER_PORT_MANUAL_SEARCH = 80;
- CDDB_SERVER_CGI_PATH_MANUAL_SEARCH = g_strdup("/~cddb/cddb.cgi");
CDDB_LOCAL_PATH = NULL;
- CDDB_USE_PROXY = 0;
- CDDB_PROXY_NAME = g_strdup("localhost");
- CDDB_PROXY_PORT = 8080;
- CDDB_PROXY_USER_NAME = NULL;
- CDDB_PROXY_USER_PASSWORD = NULL;
- CDDB_FOLLOW_FILE = 1;
- CDDB_USE_DLM = 0;
- CDDB_USE_LOCAL_ACCESS = 0;
-
- CDDB_SEARCH_IN_ALL_FIELDS = 0;
CDDB_SEARCH_IN_ARTIST_FIELD = 1;
CDDB_SEARCH_IN_TITLE_FIELD = 1;
CDDB_SEARCH_IN_TRACK_NAME_FIELD = 0;
CDDB_SEARCH_IN_OTHER_FIELD = 0;
- CDDB_SHOW_CATEGORIES = 0;
- CDDB_SEARCH_IN_ALL_CATEGORIES = 1;
CDDB_SEARCH_IN_BLUES_CATEGORY = 0;
CDDB_SEARCH_IN_CLASSICAL_CATEGORY = 0;
CDDB_SEARCH_IN_COUNTRY_CATEGORY = 0;
@@ -547,27 +346,12 @@ void Init_Config_Variables (void)
CDDB_SET_TO_GENRE = 0;
CDDB_SET_TO_FILE_NAME = 1;
- CDDB_RUN_SCANNER = 0;
-
- /*
- * Search window
- */
- SEARCH_IN_FILENAME = 1;
- SEARCH_IN_TAG = 1;
- SEARCH_CASE_SENSITIVE = 0;
-
/*
* Masks
*/
SCAN_TAG_DEFAULT_MASK = NULL;
RENAME_FILE_DEFAULT_MASK = NULL;
RENAME_DIRECTORY_DEFAULT_MASK = NULL;
- RENAME_DIRECTORY_WITH_MASK = 0;
-
- /*
- * Other parameters
- */
- OPTIONS_NOTEBOOK_PAGE = 0;
}
@@ -594,7 +378,6 @@ Apply_Changes_Of_Preferences_Window (void)
if (dialog)
{
/* Common */
- LOAD_ON_STARTUP = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(LoadOnStartup));
if (DEFAULT_PATH_TO_MP3) g_free(DEFAULT_PATH_TO_MP3);
DEFAULT_PATH_TO_MP3 =
g_strdup(gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(DefaultPathToMp3))))); // Saved in UTF-8
#if 0
@@ -602,31 +385,10 @@ Apply_Changes_Of_Preferences_Window (void)
ET_Win32_Path_Replace_Backslashes(DEFAULT_PATH_TO_MP3);
#endif /* G_OS_WIN32 */
#endif
- BROWSE_SUBDIR = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(BrowseSubdir));
- BROWSE_HIDDEN_DIR = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(BrowseHiddendir));
- OPEN_SELECTED_BROWSER_NODE =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(OpenSelectedBrowserNode));
-
- /* User interface */
- SHOW_HEADER_INFO = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ShowHeaderInfos));
- // We reload the list if the selected style have changed
- if (CHANGED_FILES_DISPLAYED_TO_RED !=
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ChangedFilesDisplayedToRed)))
- {
- CHANGED_FILES_DISPLAYED_TO_RED =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ChangedFilesDisplayedToRed));
- CHANGED_FILES_DISPLAYED_TO_BOLD =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ChangedFilesDisplayedToBold));
- et_application_window_browser_refresh_list (ET_APPLICATION_WINDOW (MainWindow));
- }
-
/* Misc */
- DATE_AUTO_COMPLETION =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(DateAutoCompletion));
- NUMBER_TRACK_FORMATED =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(NumberTrackFormated));
- NUMBER_TRACK_FORMATED_SPIN_BUTTON =
gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(NumberTrackFormatedSpinButton));
PAD_DISC_NUMBER = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (pad_disc_number));
PAD_DISC_NUMBER_DIGITS = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON
(pad_disc_number_spinbutton));
SORTING_FILE_CASE_SENSITIVE =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(SortingFileCaseSensitive));
- SET_FOCUS_TO_SAME_TAG_FIELD =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(SetFocusToSameTagField));
- SET_FOCUS_TO_FIRST_TAG_FIELD =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(SetFocusToFirstTagField));
- LOG_MAX_LINES =
gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(LogMaxLinesSpinButton));
- SHOW_LOG_VIEW =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ShowLogView));
temp_sort = gtk_combo_box_get_active (GTK_COMBO_BOX (SortingFileCombo));
column_id = temp_sort / 2;
@@ -648,22 +410,15 @@ Apply_Changes_Of_Preferences_Window (void)
AUDIO_FILE_PLAYER =
g_strdup(gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(FilePlayerCombo)))));
/* File Settings */
- REPLACE_ILLEGAL_CHARACTERS_IN_FILENAME =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ReplaceIllegalCharactersInFilename));
FILENAME_EXTENSION_LOWER_CASE =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(FilenameExtensionLowerCase));
FILENAME_EXTENSION_UPPER_CASE =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(FilenameExtensionUpperCase));
FILENAME_EXTENSION_NO_CHANGE =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(FilenameExtensionNoChange));
- PRESERVE_MODIFICATION_TIME =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(PreserveModificationTime));
- UPDATE_PARENT_DIRECTORY_MODIFICATION_TIME =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(UpdateParentDirectoryModificationTime));
FILENAME_CHARACTER_SET_OTHER =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(FilenameCharacterSetOther));
FILENAME_CHARACTER_SET_APPROXIMATE =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(FilenameCharacterSetApproximate));
FILENAME_CHARACTER_SET_DISCARD =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(FilenameCharacterSetDiscard));
/* Tag Settings */
- STRIP_TAG_WHEN_EMPTY_FIELDS =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(StripTagWhenEmptyFields));
- CONVERT_OLD_ID3V2_TAG_VERSION =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ConvertOldId3v2TagVersion));
- USE_NON_STANDARD_ID3_READING_CHARACTER_SET =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(UseNonStandardId3ReadingCharacterSet));
-
#ifdef ENABLE_ID3LIB
active = gtk_combo_box_get_active(GTK_COMBO_BOX(FileWritingId3v2VersionCombo));
FILE_WRITING_ID3V2_VERSION_4 = !active;
@@ -674,12 +429,6 @@ Apply_Changes_Of_Preferences_Window (void)
FILE_READING_ID3V1V2_CHARACTER_SET = Charset_Get_Name_From_Title(temp);
g_free(temp);
- FILE_WRITING_ID3V2_WRITE_TAG =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(FileWritingId3v2WriteTag));
- FILE_WRITING_ID3V2_USE_CRC32 =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(FileWritingId3v2UseCrc32));
- FILE_WRITING_ID3V2_USE_COMPRESSION =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(FileWritingId3v2UseCompression));
- FILE_WRITING_ID3V2_TEXT_ONLY_GENRE =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(FileWritingId3v2TextOnlyGenre));
- FILE_WRITING_ID3V2_USE_UNICODE_CHARACTER_SET =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(FileWritingId3v2UseUnicodeCharacterSet));
-
active = gtk_combo_box_get_active(GTK_COMBO_BOX(FileWritingId3v2UnicodeCharacterSetCombo));
FILE_WRITING_ID3V2_UNICODE_CHARACTER_SET = (active == 1) ? "UTF-16" : "UTF-8";
@@ -691,7 +440,6 @@ Apply_Changes_Of_Preferences_Window (void)
FILE_WRITING_ID3V2_ICONV_OPTIONS_TRANSLIT =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(FileWritingId3v2IconvOptionsTranslit));
FILE_WRITING_ID3V2_ICONV_OPTIONS_IGNORE =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(FileWritingId3v2IconvOptionsIgnore));
- FILE_WRITING_ID3V1_WRITE_TAG =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(FileWritingId3v1WriteTag));
temp = Get_Active_Combo_Box_Item(GTK_COMBO_BOX(FileWritingId3v1CharacterSetCombo));
FILE_WRITING_ID3V1_CHARACTER_SET = Charset_Get_Name_From_Title(temp);
g_free(temp);
@@ -700,14 +448,6 @@ Apply_Changes_Of_Preferences_Window (void)
FILE_WRITING_ID3V1_ICONV_OPTIONS_TRANSLIT =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(FileWritingId3v1IconvOptionsTranslit));
FILE_WRITING_ID3V1_ICONV_OPTIONS_IGNORE =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(FileWritingId3v1IconvOptionsIgnore));
- VORBIS_SPLIT_FIELD_TITLE =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(VorbisSplitFieldTitle));
- VORBIS_SPLIT_FIELD_ARTIST =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(VorbisSplitFieldArtist));
- VORBIS_SPLIT_FIELD_ALBUM =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(VorbisSplitFieldAlbum));
- VORBIS_SPLIT_FIELD_GENRE =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(VorbisSplitFieldGenre));
- VORBIS_SPLIT_FIELD_COMMENT =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(VorbisSplitFieldComment));
- VORBIS_SPLIT_FIELD_COMPOSER =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(VorbisSplitFieldComposer));
- VORBIS_SPLIT_FIELD_ORIG_ARTIST =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(VorbisSplitFieldOrigArtist));
-
/* Scanner */
// Fill Tag Scanner
FTS_CONVERT_UNDERSCORE_AND_P20_INTO_SPACE =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(FTSConvertUnderscoreAndP20IntoSpace));
@@ -716,59 +456,11 @@ Apply_Changes_Of_Preferences_Window (void)
RFS_CONVERT_UNDERSCORE_AND_P20_INTO_SPACE =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(RFSConvertUnderscoreAndP20IntoSpace));
RFS_CONVERT_SPACE_INTO_UNDERSCORE =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(RFSConvertSpaceIntoUnderscore));
RFS_REMOVE_SPACES =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(RFSRemoveSpaces));
- // Process File Scanner
- PFS_DONT_UPPER_SOME_WORDS =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(PFSDontUpperSomeWords));
-
- OVERWRITE_TAG_FIELD = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(OverwriteTagField));
- SET_DEFAULT_COMMENT = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(SetDefaultComment));
- if (DEFAULT_COMMENT) g_free(DEFAULT_COMMENT);
- DEFAULT_COMMENT =
g_strdup(gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(DefaultComment)))));
- SET_CRC32_COMMENT = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(Crc32Comment));
-
- OPEN_SCANNER_WINDOW_ON_STARTUP =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(OpenScannerWindowOnStartup));
/* CDDB */
- if (CDDB_SERVER_NAME_AUTOMATIC_SEARCH) g_free(CDDB_SERVER_NAME_AUTOMATIC_SEARCH);
- CDDB_SERVER_NAME_AUTOMATIC_SEARCH =
g_strdup(gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(CddbServerNameAutomaticSearch)))));
- CDDB_SERVER_PORT_AUTOMATIC_SEARCH =
atoi(gtk_entry_get_text(GTK_ENTRY(CddbServerPortAutomaticSearch)));
- if (CDDB_SERVER_CGI_PATH_AUTOMATIC_SEARCH) g_free(CDDB_SERVER_CGI_PATH_AUTOMATIC_SEARCH);
- CDDB_SERVER_CGI_PATH_AUTOMATIC_SEARCH =
g_strdup(gtk_entry_get_text(GTK_ENTRY(CddbServerCgiPathAutomaticSearch)));
-
- if (CDDB_SERVER_NAME_AUTOMATIC_SEARCH2) g_free(CDDB_SERVER_NAME_AUTOMATIC_SEARCH2);
- CDDB_SERVER_NAME_AUTOMATIC_SEARCH2 =
g_strdup(gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(CddbServerNameAutomaticSearch2)))));
- CDDB_SERVER_PORT_AUTOMATIC_SEARCH2 =
atoi(gtk_entry_get_text(GTK_ENTRY(CddbServerPortAutomaticSearch2)));
- if (CDDB_SERVER_CGI_PATH_AUTOMATIC_SEARCH2) g_free(CDDB_SERVER_CGI_PATH_AUTOMATIC_SEARCH2);
- CDDB_SERVER_CGI_PATH_AUTOMATIC_SEARCH2 =
g_strdup(gtk_entry_get_text(GTK_ENTRY(CddbServerCgiPathAutomaticSearch2)));
-
- if (CDDB_SERVER_NAME_MANUAL_SEARCH) g_free(CDDB_SERVER_NAME_MANUAL_SEARCH);
- CDDB_SERVER_NAME_MANUAL_SEARCH =
g_strdup(gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(CddbServerNameManualSearch)))));
- CDDB_SERVER_PORT_MANUAL_SEARCH = atoi(gtk_entry_get_text(GTK_ENTRY(CddbServerPortManualSearch)));
- if (CDDB_SERVER_CGI_PATH_MANUAL_SEARCH) g_free(CDDB_SERVER_CGI_PATH_MANUAL_SEARCH);
- CDDB_SERVER_CGI_PATH_MANUAL_SEARCH =
g_strdup(gtk_entry_get_text(GTK_ENTRY(CddbServerCgiPathManualSearch)));
-
if (CDDB_LOCAL_PATH) g_free(CDDB_LOCAL_PATH);
CDDB_LOCAL_PATH = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(CddbLocalPath)))));
- CDDB_USE_PROXY = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbUseProxy));
- if (CDDB_PROXY_NAME) g_free(CDDB_PROXY_NAME);
- CDDB_PROXY_NAME = g_strdup(gtk_entry_get_text(GTK_ENTRY(CddbProxyName)));
- CDDB_PROXY_PORT = atoi(gtk_entry_get_text(GTK_ENTRY(CddbProxyPort)));
- if (CDDB_PROXY_USER_NAME) g_free(CDDB_PROXY_USER_NAME);
- CDDB_PROXY_USER_NAME = g_strdup(gtk_entry_get_text(GTK_ENTRY(CddbProxyUserName)));
- if (CDDB_PROXY_USER_PASSWORD) g_free(CDDB_PROXY_USER_PASSWORD);
- CDDB_PROXY_USER_PASSWORD = g_strdup(gtk_entry_get_text(GTK_ENTRY(CddbProxyUserPassword)));
-
- CDDB_FOLLOW_FILE = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbFollowFile));
- CDDB_USE_DLM = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbUseDLM));
-
- /* Confirmation */
- CONFIRM_BEFORE_EXIT = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ConfirmBeforeExit));
- CONFIRM_WRITE_TAG = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ConfirmWriteTag));
- CONFIRM_RENAME_FILE = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ConfirmRenameFile));
- CONFIRM_DELETE_FILE = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ConfirmDeleteFile));
- CONFIRM_WRITE_PLAYLIST = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ConfirmWritePlayList));
- CONFIRM_WHEN_UNSAVED_FILES =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ConfirmWhenUnsavedFiles));
-
/* Parameters and variables of Scanner Window are in "scan.c" file */
/* Parameters and variables of Cddb Window are in "cddb.c" file */
}
@@ -776,33 +468,6 @@ Apply_Changes_Of_Preferences_Window (void)
/*
* Changes to apply to :
*/
- if (MainWindow)
- {
- if (SHOW_HEADER_INFO) gtk_widget_show_all(HeaderInfosTable);
- else gtk_widget_hide(HeaderInfosTable);
-
- if (SHOW_LOG_VIEW)
- {
- et_application_window_show_log_area (ET_APPLICATION_WINDOW (MainWindow));
- }
- else
- {
- et_application_window_hide_log_area (ET_APPLICATION_WINDOW (MainWindow));
- }
-
- /* Update state of check-menu-item into main/popup menu to browse subdirs */
- Check_Menu_Item_Update_Browse_Subdir();
-
- /* Update state of check-menu-item into main/popup menu to show hidden directories */
- Check_Menu_Item_Update_Browse_Hidden_Dir();
-
- /* Reload if number of character changed for track list */
- //Load_Track_List_To_UI();
-
- /* Reload directory, in case we have changed BROWSE_HIDDEN_DIR */
- // FIX ME : commented as it reloads files...
- //Browser_Tree_Rebuild(NULL);
- }
}
/*
@@ -836,11 +501,6 @@ Apply_Changes_Of_UI (void)
/* Configuration of the search_file window (see search_dialog.c).
* Function also called when destroying the window. */
et_search_dialog_apply_changes (ET_SEARCH_DIALOG (et_application_window_get_search_dialog
(ET_APPLICATION_WINDOW (MainWindow))));
-
- /* Configuration of the load_filename window (see load_files_dialog.c).
- * Function also called when destroying the window. */
- et_load_files_dialog_apply_changes (ET_LOAD_FILES_DIALOG (et_application_window_get_load_files_dialog
(ET_APPLICATION_WINDOW (MainWindow))));
-
}
void Save_Changes_Of_UI (void)
diff --git a/src/setting.h b/src/setting.h
index 7d0e1f3..eeba9ea 100644
--- a/src/setting.h
+++ b/src/setting.h
@@ -46,107 +46,54 @@ struct _tConfigVariable
/*
- * Config varariables
+ * Config variables
*/
+
+GSettings *MainSettings;
+
/* Common */
-gint LOAD_ON_STARTUP;
gchar *DEFAULT_PATH_TO_MP3;
-gint BROWSER_LINE_STYLE;
-gint BROWSER_EXPANDER_STYLE;
-gint BROWSE_SUBDIR;
-gint BROWSE_HIDDEN_DIR;
-gint OPEN_SELECTED_BROWSER_NODE;
/* Misc */
-gint SHOW_HEADER_INFO;
-
-gint CHANGED_FILES_DISPLAYED_TO_RED;
-gint CHANGED_FILES_DISPLAYED_TO_BOLD;
-
gint SORTING_FILE_MODE;
gint SORTING_FILE_CASE_SENSITIVE;
gchar *AUDIO_FILE_PLAYER;
/* File Settings */
-gint REPLACE_ILLEGAL_CHARACTERS_IN_FILENAME;
gint FILENAME_EXTENSION_LOWER_CASE;
gint FILENAME_EXTENSION_UPPER_CASE;
gint FILENAME_EXTENSION_NO_CHANGE;
-gint PRESERVE_MODIFICATION_TIME;
-gint UPDATE_PARENT_DIRECTORY_MODIFICATION_TIME;
gint FILENAME_CHARACTER_SET_OTHER;
gint FILENAME_CHARACTER_SET_APPROXIMATE;
gint FILENAME_CHARACTER_SET_DISCARD;
/* Tag Settings */
-gint STRIP_TAG_WHEN_EMPTY_FIELDS;
-gint CONVERT_OLD_ID3V2_TAG_VERSION;
-
gint FILE_WRITING_ID3V2_VERSION_4;
-gint USE_NON_STANDARD_ID3_READING_CHARACTER_SET;
gchar *FILE_READING_ID3V1V2_CHARACTER_SET;
-gint FILE_WRITING_ID3V2_WRITE_TAG;
-gint FILE_WRITING_ID3V2_USE_CRC32;
-gint FILE_WRITING_ID3V2_USE_COMPRESSION;
-gint FILE_WRITING_ID3V2_TEXT_ONLY_GENRE;
-gint FILE_WRITING_ID3V2_USE_UNICODE_CHARACTER_SET;
gchar *FILE_WRITING_ID3V2_UNICODE_CHARACTER_SET;
gchar *FILE_WRITING_ID3V2_NO_UNICODE_CHARACTER_SET;
gint FILE_WRITING_ID3V2_ICONV_OPTIONS_NO;
gint FILE_WRITING_ID3V2_ICONV_OPTIONS_TRANSLIT;
gint FILE_WRITING_ID3V2_ICONV_OPTIONS_IGNORE;
-gint FILE_WRITING_ID3V1_WRITE_TAG;
gchar *FILE_WRITING_ID3V1_CHARACTER_SET;
gint FILE_WRITING_ID3V1_ICONV_OPTIONS_NO;
gint FILE_WRITING_ID3V1_ICONV_OPTIONS_TRANSLIT;
gint FILE_WRITING_ID3V1_ICONV_OPTIONS_IGNORE;
-gint VORBIS_SPLIT_FIELD_TITLE;
-gint VORBIS_SPLIT_FIELD_ARTIST;
-gint VORBIS_SPLIT_FIELD_ALBUM;
-gint VORBIS_SPLIT_FIELD_GENRE;
-gint VORBIS_SPLIT_FIELD_COMMENT;
-gint VORBIS_SPLIT_FIELD_COMPOSER;
-gint VORBIS_SPLIT_FIELD_ORIG_ARTIST;
-
-gint DATE_AUTO_COMPLETION;
-gint NUMBER_TRACK_FORMATED;
-gint NUMBER_TRACK_FORMATED_SPIN_BUTTON;
gint PAD_DISC_NUMBER;
gint PAD_DISC_NUMBER_DIGITS;
-gint SET_FOCUS_TO_SAME_TAG_FIELD;
-gint SET_FOCUS_TO_FIRST_TAG_FIELD;
-gint LOG_MAX_LINES;
-gint SHOW_LOG_VIEW;
-
/* Scanner */
gint SCANNER_TYPE;
-gint SCAN_MASK_EDITOR_BUTTON;
-gint SCAN_LEGEND_BUTTON;
gint FTS_CONVERT_UNDERSCORE_AND_P20_INTO_SPACE;
gint FTS_CONVERT_SPACE_INTO_UNDERSCORE;
gint RFS_CONVERT_UNDERSCORE_AND_P20_INTO_SPACE;
gint RFS_CONVERT_SPACE_INTO_UNDERSCORE;
gint RFS_REMOVE_SPACES;
-gint PFS_DONT_UPPER_SOME_WORDS;
-gint OVERWRITE_TAG_FIELD;
-gint SET_DEFAULT_COMMENT;
-gchar *DEFAULT_COMMENT;
-gint SET_CRC32_COMMENT;
-gint OPEN_SCANNER_WINDOW_ON_STARTUP;
-
-/* Confirmation */
-gint CONFIRM_BEFORE_EXIT;
-gint CONFIRM_WRITE_TAG;
-gint CONFIRM_RENAME_FILE;
-gint CONFIRM_WRITE_PLAYLIST;
-gint CONFIRM_DELETE_FILE;
-gint CONFIRM_WHEN_UNSAVED_FILES;
/* Scanner window */
gint PROCESS_FILENAME_FIELD;
@@ -161,68 +108,24 @@ gint PROCESS_ORIG_ARTIST_FIELD;
gint PROCESS_COPYRIGHT_FIELD;
gint PROCESS_URL_FIELD;
gint PROCESS_ENCODED_BY_FIELD;
-gchar *PROCESS_FIELDS_CONVERT_FROM;
-gchar *PROCESS_FIELDS_CONVERT_TO;
gint PF_CONVERT_INTO_SPACE;
gint PF_CONVERT_SPACE;
-gint PF_CONVERT;
-gint PF_CONVERT_ALL_UPPERCASE;
-gint PF_CONVERT_ALL_DOWNCASE;
-gint PF_CONVERT_FIRST_LETTER_UPPERCASE;
-gint PF_CONVERT_FIRST_LETTERS_UPPERCASE;
-gint PF_DETECT_ROMAN_NUMERALS;
-gint PF_REMOVE_SPACE;
-gint PF_INSERT_SPACE;
-gint PF_ONLY_ONE_SPACE;
/* Playlist window */
gchar *PLAYLIST_NAME;
-gint PLAYLIST_USE_MASK_NAME;
-gint PLAYLIST_USE_DIR_NAME;
-gint PLAYLIST_ONLY_SELECTED_FILES;
-gint PLAYLIST_FULL_PATH;
-gint PLAYLIST_RELATIVE_PATH;
-gint PLAYLIST_CREATE_IN_PARENT_DIR;
-gint PLAYLIST_USE_DOS_SEPARATOR;
gint PLAYLIST_CONTENT_NONE;
gint PLAYLIST_CONTENT_FILENAME;
gint PLAYLIST_CONTENT_MASK;
gchar *PLAYLIST_CONTENT_MASK_VALUE;
-/* "Load filenames from txt" window */
-gint LOAD_FILE_RUN_SCANNER;
-
-/* CDDB in preferences window */
-gchar *CDDB_SERVER_NAME_AUTOMATIC_SEARCH;
-gint CDDB_SERVER_PORT_AUTOMATIC_SEARCH;
-gchar *CDDB_SERVER_CGI_PATH_AUTOMATIC_SEARCH;
-gchar *CDDB_SERVER_NAME_AUTOMATIC_SEARCH2;
-gint CDDB_SERVER_PORT_AUTOMATIC_SEARCH2;
-gchar *CDDB_SERVER_CGI_PATH_AUTOMATIC_SEARCH2;
-gchar *CDDB_SERVER_NAME_MANUAL_SEARCH;
-gint CDDB_SERVER_PORT_MANUAL_SEARCH;
-gchar *CDDB_SERVER_CGI_PATH_MANUAL_SEARCH;
gchar *CDDB_LOCAL_PATH;
-gint CDDB_USE_PROXY;
-gchar *CDDB_PROXY_NAME;
-gint CDDB_PROXY_PORT;
-gchar *CDDB_PROXY_USER_NAME;
-gchar *CDDB_PROXY_USER_PASSWORD;
-
-gint CDDB_FOLLOW_FILE;
-gint CDDB_USE_DLM;
-gint CDDB_USE_LOCAL_ACCESS;
/* CDDB window */
-gint CDDB_SEARCH_IN_ALL_FIELDS;
gint CDDB_SEARCH_IN_ARTIST_FIELD;
gint CDDB_SEARCH_IN_TITLE_FIELD;
gint CDDB_SEARCH_IN_TRACK_NAME_FIELD;
gint CDDB_SEARCH_IN_OTHER_FIELD;
-gint CDDB_SHOW_CATEGORIES;
-
-gint CDDB_SEARCH_IN_ALL_CATEGORIES;
gint CDDB_SEARCH_IN_BLUES_CATEGORY;
gint CDDB_SEARCH_IN_CLASSICAL_CATEGORY;
gint CDDB_SEARCH_IN_COUNTRY_CATEGORY;
@@ -244,24 +147,10 @@ gint CDDB_SET_TO_TRACK_TOTAL;
gint CDDB_SET_TO_GENRE;
gint CDDB_SET_TO_FILE_NAME;
-gint CDDB_RUN_SCANNER;
-
-/* Search Window */
-gint SEARCH_IN_FILENAME;
-gint SEARCH_IN_TAG;
-gint SEARCH_CASE_SENSITIVE;
-
/* Default mask */
gchar *SCAN_TAG_DEFAULT_MASK;
gchar *RENAME_FILE_DEFAULT_MASK;
gchar *RENAME_DIRECTORY_DEFAULT_MASK;
-gint RENAME_DIRECTORY_WITH_MASK;
-
-
-/* Other parameters */
-gint OPTIONS_NOTEBOOK_PAGE;
-
-
/**************
* Prototypes *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]