[easytag/wip/gsettings: 3/3] Use GSettings instead of custom settings parsing
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag/wip/gsettings: 3/3] Use GSettings instead of custom settings parsing
- Date: Mon, 18 Feb 2013 20:36:26 +0000 (UTC)
commit 28adb38bd3d900c9a3bab7f646f7652ce943ccb0
Author: David King <amigadave amigadave com>
Date: Sun Feb 17 16:07:20 2013 +0000
Use GSettings instead of custom settings parsing
src/ape_tag.c | 11 ++-
src/bar.c | 70 +++--------------
src/browser.c | 14 ++--
src/cddb.c | 227 +++++++++++++++++++++++++++++++++++++++++++-----------
src/easytag.c | 82 ++++++++++++--------
src/et_core.c | 46 ++++++++----
src/flac_tag.c | 20 +++--
src/id3_tag.c | 23 ++++--
src/id3v24_tag.c | 51 +++++++-----
src/log.c | 12 ++--
src/misc.c | 16 +++-
src/mp4_tag.c | 7 ++-
src/ogg_tag.c | 21 ++++--
src/prefs.c | 224 ++++++++++++++++++++++++++++++-----------------------
src/scan.c | 18 +++--
src/setting.c | 188 +--------------------------------------------
src/setting.h | 56 +-------------
17 files changed, 527 insertions(+), 559 deletions(-)
---
diff --git a/src/ape_tag.c b/src/ape_tag.c
index bfcc023..568caac 100644
--- a/src/ape_tag.c
+++ b/src/ape_tag.c
@@ -111,14 +111,19 @@ gboolean Ape_Tag_Read_File_Tag (gchar *filename, File_Tag *FileTag)
string = Try_To_Validate_Utf8_String(string);
string1 = g_utf8_strchr(string, -1, '/'); // strchr don't like NULL string
- if (NUMBER_TRACK_FORMATED)
+ if (g_settings_get_boolean (ETSettings, "tag-number-padded"))
{
if (string1)
{
- FileTag->track_total = g_strdup_printf("%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,
atoi(string1 + 1));
+ FileTag->track_total = g_strdup_printf ("%.*d",
+ g_settings_get_uint (ETSettings,
"tag-number-length"),
+ atoi (string1 + 1));
*string1 = '\0';
}
- FileTag->track = g_strdup_printf("%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON, atoi(string));
+ FileTag->track = g_strdup_printf ("%.*d",
+ g_settings_get_uint (ETSettings,
+ "tag-number-length"),
+ atoi(string));
} else
{
if (string1)
diff --git a/src/bar.c b/src/bar.c
index 2930459..b7efbcc 100644
--- a/src/bar.c
+++ b/src/bar.c
@@ -47,8 +47,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);
@@ -267,12 +265,15 @@ void Create_UI (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 (ETSettings, "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(Browser_Tree_Rebuild),
BROWSE_HIDDEN_DIR },
+ { AM_BROWSER_HIDDEN_DIR, NULL, _("Show Hidden Directories"), NULL,
+ _("Show hidden directories"), G_CALLBACK(Browser_Tree_Rebuild),
+ g_settings_get_boolean (ETSettings, "browse-show-hidden") },
#endif /* !G_OS_WIN32 */
{ AM_VIEWMODE_TOGGLE, "easytag-artist-album", _("Show Tree Browser / Display by Artist and
Album"), NULL, _("Show tree browser / display by artist and Album"), G_CALLBACK(Action_Select_Browser_Style),
FALSE },
};
@@ -340,66 +341,19 @@ 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 (ETSettings, "browse-subdir",
+ CheckMenuItemBrowseSubdirMainMenu, "active",
+ G_SETTINGS_BIND_DEFAULT);
}
CheckMenuItemBrowseHiddenDirMainMenu = gtk_ui_manager_get_widget(UIManager,
"/MenuBar/BrowserMenu/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 (ETSettings, "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
- //Browser_Tree_Rebuild(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 8aa7152..950155d 100644
--- a/src/browser.c
+++ b/src/browser.c
@@ -736,7 +736,7 @@ Browser_Tree_Node_Selected (GtkTreeSelection *selection, gpointer user_data)
selectedPath = gtk_tree_model_get_path(GTK_TREE_MODEL(directoryTreeModel), &selectedIter);
/* Open the node */
- if (OPEN_SELECTED_BROWSER_NODE)
+ if (g_settings_get_boolean (ETSettings, "browse-expand-children"))
{
gtk_tree_view_expand_row(GTK_TREE_VIEW(BrowserTree), selectedPath, FALSE);
}
@@ -757,7 +757,8 @@ Browser_Tree_Node_Selected (GtkTreeSelection *selection, gpointer user_data)
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 (ETSettings, "confirm-when-unsaved-files")
+ && ET_Check_If_All_Files_Are_Saved() != TRUE)
{
GtkWidget *msgdialog;
gint response;
@@ -798,7 +799,7 @@ Browser_Tree_Node_Selected (GtkTreeSelection *selection, gpointer user_data)
/* 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 (ETSettings, "load-on-startup") || counter)
{
gboolean dir_loaded;
GtkTreeIter parentIter;
@@ -816,7 +817,8 @@ Browser_Tree_Node_Selected (GtkTreeSelection *selection, gpointer user_data)
gtk_tree_selection_select_iter(selection,&parentIter);
selectedPath = gtk_tree_model_get_path(GTK_TREE_MODEL(directoryTreeModel), &parentIter);
gtk_tree_view_collapse_row(GTK_TREE_VIEW(BrowserTree),selectedPath);
- if (OPEN_SELECTED_BROWSER_NODE)
+ if (g_settings_get_boolean (ETSettings,
+ "browse-expand-children"))
{
gtk_tree_view_expand_row(GTK_TREE_VIEW(BrowserTree),selectedPath,FALSE);
}
@@ -2696,7 +2698,7 @@ static gboolean check_for_subdir (gchar *path)
if ((g_ascii_strcasecmp(dirent->d_name,".") != 0)
&& (g_ascii_strcasecmp(dirent->d_name,"..") != 0)
// Display hidden directories is needed, or keep only the not hidden directories
- && (BROWSE_HIDDEN_DIR
+ && (g_settings_get_boolean (ETSettings, "browse-show-hidden")
|| !( (g_ascii_strncasecmp(dirent->d_name,".", 1) == 0)
&& (strlen(dirent->d_name) > 1)
&& (g_ascii_strncasecmp(dirent->d_name+1,".", 1) != 0) ))
@@ -2850,7 +2852,7 @@ static void expand_cb (GtkWidget *tree, GtkTreeIter *iter, GtkTreePath *gtreePat
&& (g_ascii_strcasecmp(dirent->d_name,".") != 0)
&& (g_ascii_strcasecmp(dirent->d_name,"..") != 0)
// Display hidden directories is needed, or keep only the not hidden directories
- && (BROWSE_HIDDEN_DIR
+ && (g_settings_get_boolean (ETSettings, "browse-show-hidden")
|| !( (g_ascii_strncasecmp(dirent->d_name,".", 1) == 0)
&& (strlen(dirent->d_name) > 1)
&& (g_ascii_strncasecmp(dirent->d_name+1,".", 1) != 0) ))
diff --git a/src/cddb.c b/src/cddb.c
index 2f936fa..76bd29f 100644
--- a/src/cddb.c
+++ b/src/cddb.c
@@ -2137,12 +2137,19 @@ Cddb_Generate_Request_String_With_Fields_And_Categories_Options (void)
static gboolean
Cddb_Search_Album_List_From_String (void)
{
- if ( strstr(CDDB_SERVER_NAME_MANUAL_SEARCH,"gnudb") != NULL )
- // Use of gnudb
- return Cddb_Search_Album_List_From_String_Gnudb();
+ gchar *hostname = g_settings_get_string (ETSettings,
+ "cddb-manual-search-hostname");
+
+ if (strstr (hostname, "gnudb") != NULL)
+ {
+ g_free (hostname);
+ return Cddb_Search_Album_List_From_String_Gnudb ();
+ }
else
- // Use of freedb
- return Cddb_Search_Album_List_From_String_Freedb();
+ {
+ g_free (hostname);
+ return Cddb_Search_Album_List_From_String_Freedb ();
+ }
}
@@ -2165,6 +2172,9 @@ Cddb_Search_Album_List_From_String_Freedb (void)
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;
@@ -2201,17 +2211,28 @@ Cddb_Search_Album_List_From_String_Freedb (void)
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 (ETSettings,
+ "cddb-manual-search-hostname");
+ cddb_server_port = g_settings_get_uint (ETSettings,
+ "cddb-manual-search-port");
+ cddb_server_cgi_path = g_settings_get_string (ETSettings,
+ "cddb-manual-search-path");
/* Connection to the server */
- if ( (socket_id=Cddb_Open_Connection(CDDB_USE_PROXY?CDDB_PROXY_NAME:cddb_server_name,
- CDDB_USE_PROXY?CDDB_PROXY_PORT:cddb_server_port)) <= 0 )
+ proxy_enabled = g_settings_get_boolean (ETSettings, "cddb-proxy-enabled");
+ proxy_hostname = g_settings_get_string (ETSettings, "cddb-proxy-hostname");
+ proxy_port = g_settings_get_uint (ETSettings, "cddb-proxy-port");
+ if ((socket_id = Cddb_Open_Connection (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 (cddb_server_cgi_path);
+ g_free (proxy_hostname);
return FALSE;
}
@@ -2227,7 +2248,8 @@ Cddb_Search_Album_List_From_String_Freedb (void)
"%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()),
cddb_server_name,cddb_server_port,
@@ -2251,6 +2273,7 @@ Cddb_Search_Album_List_From_String_Freedb (void)
g_free(string);
g_free(cddb_server_name);
g_free(cddb_server_cgi_path);
+ g_free (proxy_hostname);
return FALSE;
}
g_free(cddb_in);
@@ -2299,6 +2322,7 @@ Cddb_Search_Album_List_From_String_Freedb (void)
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(CddbStopSearchButton),FALSE);
gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchAutoButton),FALSE);
if (file)
@@ -2424,6 +2448,7 @@ Cddb_Search_Album_List_From_String_Freedb (void)
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)
@@ -2474,6 +2499,9 @@ Cddb_Search_Album_List_From_String_Gnudb (void)
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;
@@ -2531,17 +2559,30 @@ Cddb_Search_Album_List_From_String_Gnudb (void)
// 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 (ETSettings,
+ "cddb-manual-search-hostname");
+ cddb_server_port = g_settings_get_uint (ETSettings,
+ "cddb-manual-search-port");
+ cddb_server_cgi_path = g_settings_get_string (ETSettings,
+ "cddb-manual-search-path");
/* Connection to the server */
- if ( (socket_id=Cddb_Open_Connection(CDDB_USE_PROXY?CDDB_PROXY_NAME:cddb_server_name,
- CDDB_USE_PROXY?CDDB_PROXY_PORT:cddb_server_port)) <= 0 )
+ proxy_enabled = g_settings_get_boolean (ETSettings,
+ "cddb-proxy-enabled");
+ proxy_hostname = g_settings_get_string (ETSettings,
+ "cddb-proxy-hostname");
+ proxy_port = g_settings_get_uint (ETSettings, "cddb-proxy-port");
+ if ((socket_id = Cddb_Open_Connection (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(CddbStopSearchButton),FALSE);
gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchAutoButton),FALSE);
return FALSE;
@@ -2558,7 +2599,8 @@ Cddb_Search_Album_List_From_String_Gnudb (void)
"%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,
@@ -2580,6 +2622,7 @@ Cddb_Search_Album_List_From_String_Gnudb (void)
g_free(string);
g_free(cddb_server_name);
g_free(cddb_server_cgi_path);
+ g_free (proxy_hostname);
gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchButton),FALSE);
gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchAutoButton),FALSE);
return FALSE;
@@ -2610,6 +2653,7 @@ Cddb_Search_Album_List_From_String_Gnudb (void)
g_free(string);
g_free(cddb_server_name);
g_free(cddb_server_cgi_path);
+ g_free (proxy_hostname);
gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchButton),FALSE);
gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchAutoButton),FALSE);
return FALSE;
@@ -2627,6 +2671,7 @@ Cddb_Search_Album_List_From_String_Gnudb (void)
g_free(string);
g_free(cddb_server_name);
g_free(cddb_server_cgi_path);
+ g_free (proxy_hostname);
gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchButton),FALSE);
gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchAutoButton),FALSE);
if (file)
@@ -2772,6 +2817,7 @@ Cddb_Search_Album_List_From_String_Gnudb (void)
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)
@@ -2824,6 +2870,9 @@ Cddb_Search_Album_From_Selected_Files (void)
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;
@@ -3083,29 +3132,45 @@ Cddb_Search_Album_From_Selected_Files (void)
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);
+ /* 1st try. */
+ cddb_server_name = g_settings_get_string (ETSettings,
+ "cddb-automatic-search-hostname");
+ cddb_server_port = g_settings_get_uint (ETSettings,
+ "cddb-automatic-search-port");
+ cddb_server_cgi_path = g_settings_get_string (ETSettings,
+ "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 (ETSettings,
+ "cddb-automatic-search-hostname2");
+ cddb_server_port = g_settings_get_uint (ETSettings,
+ "cddb-automatic-search-port");
+ cddb_server_cgi_path = g_settings_get_string (ETSettings,
+ "cddb-automatic-search-path2");
}
// Check values
if (!cddb_server_name || strcmp(cddb_server_name,"")==0)
continue;
- // Connection to the server
- if ( (socket_id=Cddb_Open_Connection(CDDB_USE_PROXY?CDDB_PROXY_NAME:cddb_server_name,
- CDDB_USE_PROXY?CDDB_PROXY_PORT:cddb_server_port)) <= 0 )
+ /* Connection to the server. */
+ proxy_enabled = g_settings_get_boolean (ETSettings,
+ "cddb-proxy-enabled");
+ proxy_hostname = g_settings_get_string (ETSettings,
+ "cddb-proxy-hostname");
+ proxy_port = g_settings_get_uint (ETSettings, "cddb-proxy-port");
+ if ((socket_id = Cddb_Open_Connection (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;
}
@@ -3122,7 +3187,9 @@ Cddb_Search_Album_From_Selected_Files (void)
"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,
@@ -3148,6 +3215,7 @@ Cddb_Search_Album_From_Selected_Files (void)
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);
@@ -3169,6 +3237,7 @@ Cddb_Search_Album_From_Selected_Files (void)
g_free(msg);
g_free(cddb_server_name);
g_free(cddb_server_cgi_path);
+ g_free (proxy_hostname);
gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchButton),FALSE);
gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchAutoButton),FALSE);
return FALSE;
@@ -3185,6 +3254,7 @@ Cddb_Search_Album_From_Selected_Files (void)
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(CddbStopSearchButton),FALSE);
gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchAutoButton),FALSE);
if (file)
@@ -3275,6 +3345,7 @@ Cddb_Search_Album_From_Selected_Files (void)
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)
@@ -3352,6 +3423,9 @@ Cddb_Get_Album_Tracks_List (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;
@@ -3395,10 +3469,22 @@ Cddb_Get_Album_Tracks_List (GtkTreeSelection* selection)
{
// Remote access
- // Connection to the server
- if ( (socket_id=Cddb_Open_Connection(CDDB_USE_PROXY?CDDB_PROXY_NAME:cddb_server_name,
- CDDB_USE_PROXY?CDDB_PROXY_PORT:cddb_server_port)) <= 0 )
+ /* Connection to the server. */
+ proxy_enabled = g_settings_get_boolean (ETSettings,
+ "cddb-proxy-enabled");
+ proxy_hostname = g_settings_get_string (ETSettings,
+ "cddb-proxy-hostname");
+ proxy_port = g_settings_get_uint (ETSettings, "cddb-proxy-port");
+ if ((socket_id = Cddb_Open_Connection (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 )
{
@@ -3412,7 +3498,8 @@ Cddb_Get_Album_Tracks_List (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,
@@ -3430,7 +3517,9 @@ Cddb_Get_Album_Tracks_List (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,
@@ -3450,6 +3539,7 @@ Cddb_Get_Album_Tracks_List (GtkTreeSelection* selection)
Log_Print(LOG_ERROR,_("Cannot send the request (%s)"),g_strerror(errno));
Cddb_Close_Connection(socket_id);
g_free(cddb_in);
+ g_free (proxy_hostname);
return FALSE;
}
g_free(cddb_in);
@@ -3469,6 +3559,7 @@ Cddb_Get_Album_Tracks_List (GtkTreeSelection* selection)
g_free(msg);
gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchButton),FALSE);
gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchAutoButton),FALSE);
+ g_free (proxy_hostname);
return FALSE;
}
@@ -3485,6 +3576,7 @@ Cddb_Get_Album_Tracks_List (GtkTreeSelection* selection)
Log_Print(LOG_ERROR,"%s",msg);
g_free(msg);
g_free(cddb_out);
+ g_free (proxy_hostname);
if (file)
fclose(file);
return FALSE;
@@ -3500,12 +3592,14 @@ Cddb_Get_Album_Tracks_List (GtkTreeSelection* selection)
Log_Print(LOG_ERROR,"%s",msg);
g_free(msg);
g_free(cddb_out);
+ g_free (proxy_hostname);
if (file)
fclose(file);
return FALSE;
}
}
g_free(cddb_out);
+ g_free (proxy_hostname);
}
cddb_end_str = g_strdup(".");
@@ -3967,14 +4061,26 @@ Cddb_Set_Track_Infos_To_File_List (void)
if (cddbsettoallfields || cddbsettotrack)
{
- if (NUMBER_TRACK_FORMATED)
snprintf(buffer,sizeof(buffer),"%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,cddbtrackalbum->track_number);
+ if (g_settings_get_boolean (ETSettings, "tag-number-padded"))
+ {
+ snprintf (buffer, sizeof (buffer), "%.*d",
+ g_settings_get_uint (ETSettings,
+ "tag-number-length"),
+ cddbtrackalbum->track_number);
+ }
else snprintf(buffer,sizeof(buffer),"%d",
cddbtrackalbum->track_number);
ET_Set_Field_File_Tag_Item(&FileTag->track,buffer);
}
if (cddbsettoallfields || cddbsettotracktotal)
{
- if (NUMBER_TRACK_FORMATED)
snprintf(buffer,sizeof(buffer),"%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,list_length);
+ if (g_settings_get_boolean (ETSettings, "tag-number-padded"))
+ {
+ snprintf (buffer, sizeof (buffer), "%.*d",
+ g_settings_get_uint (ETSettings,
+ "tag-number-length"),
+ list_length);
+ }
else snprintf(buffer,sizeof(buffer),"%d", list_length);
ET_Set_Field_File_Tag_Item(&FileTag->track_total,buffer);
}
@@ -3999,8 +4105,14 @@ Cddb_Set_Track_Infos_To_File_List (void)
// Allocation of a new FileName
FileName = ET_File_Name_Item_New();
- // Build the filename with the path
- if (NUMBER_TRACK_FORMATED)
snprintf(buffer,sizeof(buffer),"%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,cddbtrackalbum->track_number);
+ /* Build the filename with the path. */
+ if (g_settings_get_boolean (ETSettings, "tag-pag-number"))
+ {
+ snprintf (buffer, sizeof (buffer), "%.*d",
+ g_settings_get_uint (ETSettings,
+ "tag-number-length"),
+ cddbtrackalbum->track_number);
+ }
else snprintf(buffer,sizeof(buffer),"%d",
cddbtrackalbum->track_number);
filename_generated_utf8 = g_strconcat(buffer," - ",cddbtrackalbum->track_name,NULL);
@@ -4053,14 +4165,26 @@ Cddb_Set_Track_Infos_To_File_List (void)
if (cddbsettoallfields || cddbsettotrack)
{
- if (NUMBER_TRACK_FORMATED)
snprintf(buffer,sizeof(buffer),"%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,cddbtrackalbum->track_number);
+ if (g_settings_get_boolean (ETSettings, "tag-number-padded"))
+ {
+ snprintf (buffer, sizeof(buffer), "%.*d",
+ g_settings_get_uint (ETSettings,
+ "tag-number-length"),
+ cddbtrackalbum->track_number);
+ }
else snprintf(buffer,sizeof(buffer),"%d",
cddbtrackalbum->track_number);
ET_Set_Field_File_Tag_Item(&FileTag->track,buffer);
}
if (cddbsettoallfields || cddbsettotracktotal)
{
- if (NUMBER_TRACK_FORMATED)
snprintf(buffer,sizeof(buffer),"%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,list_length);
+ if (g_settings_get_boolean (ETSettings, "tag-number-padded"))
+ {
+ snprintf (buffer, sizeof(buffer), "%.*d",
+ g_settings_get_uint (ETSettings,
+ "tag-number-length"),
+ list_length);
+ }
else snprintf(buffer,sizeof(buffer),"%d", list_length);
ET_Set_Field_File_Tag_Item(&FileTag->track_total,buffer);
}
@@ -4085,8 +4209,14 @@ Cddb_Set_Track_Infos_To_File_List (void)
// Allocation of a new FileName
FileName = ET_File_Name_Item_New();
- // Build the filename with the path
- if (NUMBER_TRACK_FORMATED)
snprintf(buffer,sizeof(buffer),"%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,cddbtrackalbum->track_number);
+ /* Build the filename with the path. */
+ if (g_settings_get_boolean (ETSettings, "tag-number-padded"))
+ {
+ snprintf (buffer, sizeof(buffer), "%.*d",
+ g_settings_get_uint (ETSettings,
+ "tag-number-length"),
+ cddbtrackalbum->track_number);
+ }
else snprintf(buffer,sizeof(buffer),"%d",
cddbtrackalbum->track_number);
filename_generated_utf8 = g_strconcat(buffer," - ",cddbtrackalbum->track_name,NULL);
@@ -4184,14 +4314,18 @@ Cddb_Get_Pixbuf_From_Server_Name (const gchar *server_name)
static gchar *
Cddb_Format_Proxy_Authentification (void)
{
+ gchar *username, *password;
gchar *ret;
- if (CDDB_USE_PROXY && CDDB_PROXY_USER_NAME != NULL && *CDDB_PROXY_USER_NAME != '\0')
+ username = g_settings_get_string (ETSettings, "cddb-proxy-username");
+ password = g_settings_get_string (ETSettings, "cddb-proxy-password");
+ if (g_settings_get_boolean (ETSettings, "cddb-proxy-enabled")
+ && username != NULL && *username != '\0')
{
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);
@@ -4200,5 +4334,8 @@ Cddb_Format_Proxy_Authentification (void)
{
ret = g_strdup("");
}
+
+ g_free (username);
+ g_free (password);
return ret;
}
diff --git a/src/easytag.c b/src/easytag.c
index 92d6603..8602945 100644
--- a/src/easytag.c
+++ b/src/easytag.c
@@ -278,11 +278,15 @@ int main (int argc, char *argv[])
//FIX ME : Should manage directory ".." in path
while (pathsplit[ps_index])
{
- // Activate hidden directories in browser if path contains a dir like ".hidden_dir"
- if ( (g_ascii_strcasecmp (pathsplit[ps_index],"..") != 0)
- && (g_ascii_strncasecmp(pathsplit[ps_index],".", 1) == 0)
- && (strlen(pathsplit[ps_index]) > 1) )
- BROWSE_HIDDEN_DIR = 1; // If user saves the config for this session, this value will be
saved to 1
+ /* Activate hidden directories in browser if path contains a
+ * dir like ".hidden_dir". */
+ if ((g_ascii_strcasecmp (pathsplit[ps_index], "..") != 0)
+ && (g_ascii_strncasecmp (pathsplit[ps_index], ".", 1) == 0)
+ && (strlen (pathsplit[ps_index]) > 1))
+ {
+ g_settings_set_boolean (ETSettings, "browse-show-hidden",
+ TRUE);
+ }
if (pathsplit[ps_index]
&& g_ascii_strcasecmp(pathsplit[ps_index],".") != 0
@@ -555,8 +559,9 @@ Create_File_Area (void)
gtk_widget_show(HBox);
gtk_widget_show(FileIndex);
gtk_widget_show(FileEntry);
- if (SHOW_HEADER_INFO)
- gtk_widget_show_all(HeaderInfosTable);
+ gtk_widget_show_all(HeaderInfosTable);
+ g_settings_bind (ETSettings, "file-show-header", HeaderInfosTable,
+ "visible", G_SETTINGS_BIND_GET);
return FileFrame;
}
@@ -1412,8 +1417,10 @@ Mini_Button_Clicked (GObject *object)
path1 = g_path_get_dirname(FileNameCur->value);
if ( path && path1 && strcmp(path,path1)!=0 )
i = 0;
- if (NUMBER_TRACK_FORMATED)
- string_to_set = g_strdup_printf("%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,++i);
+ if (g_settings_get_boolean (ETSettings, "tag-number-padded"))
+ string_to_set = g_strdup_printf ("%.*d",
+ g_settings_get_uint (ETSettings, "tag-number-length"),
+ ++i);
else
string_to_set = g_strdup_printf("%d",++i);
@@ -1450,8 +1457,10 @@ Mini_Button_Clicked (GObject *object)
etfile = (ET_File *)etfilelist->data;
filename_utf8 = ((File_Name *)etfile->FileNameNew->data)->value_utf8;
path_utf8 = g_path_get_dirname(filename_utf8);
- if (NUMBER_TRACK_FORMATED)
- string_to_set =
g_strdup_printf("%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,ET_Get_Number_Of_Files_In_Directory(path_utf8));
+ if (g_settings_get_boolean (ETSettings, "tag-number-padded"))
+ string_to_set = g_strdup_printf ("%.*d",
+ g_settings_get_uint (ETSettings, "tag-number-length"),
+ ET_Get_Number_Of_Files_In_Directory (path_utf8));
else
string_to_set = g_strdup_printf("%d",ET_Get_Number_Of_Files_In_Directory(path_utf8));
g_free(path_utf8);
@@ -1744,7 +1753,7 @@ void Action_Select_First_File (void)
Scan_Rename_File_Generate_Preview();
Scan_Fill_Tag_Generate_Preview();
- if (SET_FOCUS_TO_FIRST_TAG_FIELD)
+ if (!g_settings_get_boolean (ETSettings, "tag-preserve-focus"))
gtk_widget_grab_focus(GTK_WIDGET(TitleEntry));
}
@@ -1778,7 +1787,7 @@ void Action_Select_Prev_File (void)
Scan_Rename_File_Generate_Preview();
Scan_Fill_Tag_Generate_Preview();
- if (SET_FOCUS_TO_FIRST_TAG_FIELD)
+ if (!g_settings_get_boolean (ETSettings, "tag-preserve-focus"))
gtk_widget_grab_focus(GTK_WIDGET(TitleEntry));
}
@@ -1812,7 +1821,7 @@ void Action_Select_Next_File (void)
Scan_Rename_File_Generate_Preview();
Scan_Fill_Tag_Generate_Preview();
- if (SET_FOCUS_TO_FIRST_TAG_FIELD)
+ if (!g_settings_get_boolean (ETSettings, "tag-preserve-focus"))
gtk_widget_grab_focus(GTK_WIDGET(TitleEntry));
}
@@ -1843,7 +1852,7 @@ void Action_Select_Last_File (void)
Scan_Rename_File_Generate_Preview();
Scan_Fill_Tag_Generate_Preview();
- if (SET_FOCUS_TO_FIRST_TAG_FIELD)
+ if (!g_settings_get_boolean (ETSettings, "tag-preserve-focus"))
gtk_widget_grab_focus(GTK_WIDGET(TitleEntry));
}
@@ -2636,7 +2645,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 (ETSettings, "confirm-write-tags")
+ && !SF_HideMsgbox_Write_Tag)
{
// ET_Display_File_Data_To_UI(ETFile);
@@ -2711,7 +2721,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 (ETSettings, "confirm-rename-file")
+ && !SF_HideMsgbox_Rename_File)
{
gchar *msgdialog_title = NULL;
gchar *msg = NULL;
@@ -3378,7 +3389,8 @@ Delete_File (ET_File *ETFile, gboolean multiple_files)
/*
* Remove the file
*/
- if (CONFIRM_DELETE_FILE && !SF_HideMsgbox_Delete_File)
+ if (g_settings_get_boolean (ETSettings, "confirm-delete-file")
+ && !SF_HideMsgbox_Delete_File)
{
if (multiple_files)
{
@@ -3579,16 +3591,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 (ETSettings, "browse-subdir", uiaction, "sensitive",
+ G_SETTINGS_BIND_GET);
+ 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
- FileList = Read_Directory_Recursively(FileList,path_real,BROWSE_SUBDIR);
+ /* Search the supported files. */
+ FileList = Read_Directory_Recursively (FileList, path_real,
+ g_settings_get_boolean (ETSettings,
+ "browse-subdir"));
nbrfile = g_list_length(FileList);
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(ProgressBar), 0.0);
@@ -3650,7 +3664,7 @@ gboolean Read_Directory (gchar *path_real)
//}
/* Prepare message for the status bar */
- if (BROWSE_SUBDIR)
+ if (g_settings_get_boolean (ETSettings, "browse-subdir"))
msg = g_strdup_printf(_("Found %d file(s) in this directory and
subdirectories."),ETCore->ETFileDisplayedList_Length);
else
msg = g_strdup_printf(_("Found %d file(s) in this
directory."),ETCore->ETFileDisplayedList_Length);
@@ -3671,7 +3685,7 @@ gboolean Read_Directory (gchar *path_real)
Browser_Label_Set_Text(_("No files")); /* See in ET_Display_Filename_To_UI */
/* Prepare message for the status bar */
- if (BROWSE_SUBDIR)
+ if (g_settings_get_boolean (ETSettings, "browse-subdir"))
msg = g_strdup(_("No file found in this directory and subdirectories"));
else
msg = g_strdup(_("No file found in this directory"));
@@ -3716,9 +3730,12 @@ Read_Directory_Recursively (GList *file_list, const gchar *path_real,
return file_list;
}
- // We don't read the directories '.' and '..', but may read hidden directories like '.mydir'
- if ( (g_ascii_strcasecmp (dirent->d_name,"..") != 0)
- && ((g_ascii_strncasecmp(dirent->d_name,".", 1) != 0) || (BROWSE_HIDDEN_DIR &&
strlen(dirent->d_name) > 1)) )
+ /* We do not read the directories '.' and '..', but may read hidden
+ * directories like '.mydir'. */
+ if ((g_ascii_strcasecmp (dirent->d_name, "..") != 0)
+ && ((g_ascii_strncasecmp (dirent->d_name, ".", 1) != 0)
+ || (g_settings_get_boolean (ETSettings, "browse-show-hidden")
+ && strlen (dirent->d_name) > 1)))
{
if (path_real[strlen(path_real)-1]!=G_DIR_SEPARATOR)
filename = g_strconcat(path_real,G_DIR_SEPARATOR_S,dirent->d_name,NULL);
@@ -4195,7 +4212,7 @@ void Tag_Area_Display_Controls (ET_File *ETFile)
switch (ETFile->ETFileDescription->TagType)
{
case ID3_TAG:
- if (!FILE_WRITING_ID3V2_WRITE_TAG)
+ if (!g_settings_get_boolean (ETSettings, "id3v2-enabled"))
{
// ID3v1 : Hide specifics ID3v2 fields if not activated!
gtk_widget_hide(GTK_WIDGET(DiscNumberLabel));
@@ -4508,7 +4525,7 @@ Init_Load_Default_Dir (void)
ET_Core_Initialize();
// Open the scanner window
- if (OPEN_SCANNER_WINDOW_ON_STARTUP)
+ if (g_settings_get_boolean (ETSettings, "scan-startup"))
Open_ScannerWindow(SCANNER_TYPE); // Open the last selected scanner
if (INIT_DIRECTORY)
@@ -4997,7 +5014,8 @@ void Quit_MainWindow (void)
Save_Path_Entry_List(BrowserEntryModel, MISC_COMBO_TEXT);
/* 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 (ETSettings, "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),
@@ -5024,7 +5042,7 @@ void Quit_MainWindow (void)
return;
}
- } else if (CONFIRM_BEFORE_EXIT)
+ } else if (g_settings_get_boolean (ETSettings, "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 6acc612..5b47e1d 100644
--- a/src/et_core.c
+++ b/src/et_core.c
@@ -3353,8 +3353,12 @@ ET_Save_File_Tag_From_UI (File_Tag *FileTag)
if ( g_utf8_strlen(buffer, -1) > 0 )
{
- if (NUMBER_TRACK_FORMATED) {
- FileTag->track = g_strdup_printf("%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,atoi(buffer));
+ if (g_settings_get_boolean (ETSettings, "tag-number-padded"))
+ {
+ FileTag->track = g_strdup_printf ("%.*d",
+ g_settings_get_uint (ETSettings,
+ "tag-number-length"),
+ atoi (buffer));
g_free(buffer);
} else
FileTag->track = buffer;
@@ -3370,9 +3374,11 @@ ET_Save_File_Tag_From_UI (File_Tag *FileTag)
if ( g_utf8_strlen(buffer, -1) > 0 )
{
- if (NUMBER_TRACK_FORMATED)
+ if (g_settings_get_boolean (ETSettings, "tag-number-padded"))
{
- FileTag->track_total = g_strdup_printf("%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,atoi(buffer));
+ FileTag->track_total = g_strdup_printf ("%.*d",
+ g_settings_get_uint (ETSettings, "tag-number-length"),
+ atoi (buffer));
g_free(buffer);
} else
FileTag->track_total = buffer;
@@ -3584,8 +3590,11 @@ ET_Save_File_Tag_Internal (ET_File *ETFile, File_Tag *FileTag)
{
gchar *tmp_str;
- if (NUMBER_TRACK_FORMATED)
- FileTag->track =
g_strdup_printf("%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,atoi(FileTagCur->track));
+ if (g_settings_get_boolean (ETSettings, "tag-number-padded"))
+ FileTag->track = g_strdup_printf ("%.*d",
+ g_settings_get_uint (ETSettings,
+ "tag-number-length"),
+ atoi (FileTagCur->track));
else
FileTag->track = g_strdup(FileTagCur->track);
// This field must contain only digits
@@ -3602,8 +3611,10 @@ ET_Save_File_Tag_Internal (ET_File *ETFile, File_Tag *FileTag)
/* Track Total */
if ( FileTagCur->track_total && g_utf8_strlen(FileTagCur->track_total, -1)>0 )
{
- if (NUMBER_TRACK_FORMATED)
- FileTag->track_total =
g_strdup_printf("%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,atoi(FileTagCur->track_total));
+ if (g_settings_get_boolean (ETSettings, "tag-number-padded"))
+ FileTag->track_total = g_strdup_printf ("%.*d",
+ g_settings_get_uint (ETSettings, "tag-number-length"),
+ atoi (FileTagCur->track_total));
else
FileTag->track_total = g_strdup(FileTagCur->track_total);
Strip_String(FileTag->track_total);
@@ -3777,7 +3788,8 @@ gboolean ET_Save_File_Tag_To_HD (ET_File *ETFile)
chmod(cur_filename,statbuf.st_mode & (S_IRWXU|S_IRWXG|S_IRWXO));
chown(cur_filename,statbuf.st_uid,statbuf.st_gid);
#endif /* !G_OS_WIN32 */
- if (PRESERVE_MODIFICATION_TIME)
+ if (g_settings_get_boolean (ETSettings,
+ "file-preserve-modification-time"))
{
utimbufbuf.actime = statbuf.st_atime; // Last access time
utimbufbuf.modtime = statbuf.st_mtime; // Last modification time
@@ -3793,10 +3805,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 (ETSettings,
+ "file-update-parent-modification-time"))
{
gchar *path = g_path_get_dirname(cur_filename);
utime(g_path_get_dirname(cur_filename),NULL);
@@ -4644,8 +4659,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 (ETSettings, "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 9d8b09f..2e8226e 100644
--- a/src/flac_tag.c
+++ b/src/flac_tag.c
@@ -337,9 +337,10 @@ gboolean Flac_Tag_Read_File_Tag (gchar *filename, File_Tag *FileTag)
field_value_tmp = g_strndup(field_value, field_len);
field_value = Try_To_Validate_Utf8_String(field_value_tmp);
g_free(field_value_tmp);
- if (NUMBER_TRACK_FORMATED)
+ if (g_settings_get_boolean (ETSettings,
+ "tag-number-padded"))
{
- FileTag->track_total =
g_strdup_printf("%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,atoi(field_value));
+ FileTag->track_total = g_strdup_printf("%.*d", g_settings_get_uint
(ETSettings, "tag-number-length"), atoi (field_value));
}else
{
FileTag->track_total = g_strdup(field_value);
@@ -366,15 +367,16 @@ gboolean Flac_Tag_Read_File_Tag (gchar *filename, File_Tag *FileTag)
field_value = Try_To_Validate_Utf8_String(field_value_tmp);
g_free(field_value_tmp);
string = g_utf8_strchr(field_value, -1, '/');
- if (NUMBER_TRACK_FORMATED)
+ if (g_settings_get_boolean (ETSettings,
+ "tag-number-padded"))
{
// If track_total not filled before, try now...
if (string && !FileTag->track_total)
{
- FileTag->track_total =
g_strdup_printf("%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,atoi(string+1));
+ FileTag->track_total = g_strdup_printf ("%.*d", g_settings_get_uint
(ETSettings, "tag-number-length"), atoi (string+1));
*string = '\0';
}
- FileTag->track =
g_strdup_printf("%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,atoi(field_value));
+ FileTag->track = g_strdup_printf ("%.*d", g_settings_get_uint (ETSettings,
"tag-number-length"), atoi (field_value));
}else
{
if (string && !FileTag->track_total)
@@ -1084,8 +1086,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 (ETSettings,
+ "file-preserver-modification-time")))
{
// Error with "FLAC__metadata_chain_write"
FLAC__Metadata_ChainStatus status = FLAC__metadata_chain_status(chain);
@@ -1109,7 +1113,7 @@ gboolean Flac_Tag_Write_File_Tag (ET_File *ETFile)
/*
* Write also the ID3 tags (ID3v1 and/or ID3v2) if wanted (as needed by some players)
*/
- if (WRITE_ID3_TAGS_IN_FLAC_FILE)
+ if (g_settings_get_boolean (ETSettings, "flac-write-id3"))
{
Id3tag_Write_File_Tag(ETFile);
}else
diff --git a/src/id3_tag.c b/src/id3_tag.c
index 43fec5a..de9e76e 100644
--- a/src/id3_tag.c
+++ b/src/id3_tag.c
@@ -293,8 +293,10 @@ Id3tag_Write_File_v23Tag (ET_File *ETFile)
ID3Tag_AttachFrame(id3_tag,id3_frame);
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 not defined do not write genre value between brackets!
+ * (priority problem noted with some tools). */
+ if ((genre_value == ID3_INVALID_GENRE)
+ || g_settings_get_boolean (ETSettings, "id3v2-text-only-genre"))
genre_string_tmp = g_strdup_printf("%s",FileTag->genre);
else
genre_string_tmp = g_strdup_printf("(%d)",genre_value);
@@ -489,10 +491,11 @@ 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 all fields (managed in the UI) are empty and option id3-strip-empty
+ * 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 (g_settings_get_boolean (ETSettings, "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 )
@@ -522,7 +525,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 (ETSettings, "id3v2-enabled")
+ && number_of_frames != 0)
{
error_update_id3v2 = ID3Tag_UpdateByTagType(id3_tag,ID3TT_ID3V2);
if (error_update_id3v2 != ID3E_NoError)
@@ -588,7 +592,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 (ETSettings, "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
@@ -835,7 +840,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 (ETSettings,
+ "id3-override-read-encoding"))
{
// Encoding set by user to ???.
if ( strcmp(FILE_READING_ID3V1V2_CHARACTER_SET,"ISO-8859-1") == 0 )
diff --git a/src/id3v24_tag.c b/src/id3v24_tag.c
index 4caf01b..daf4c77 100644
--- a/src/id3v24_tag.c
+++ b/src/id3v24_tag.c
@@ -136,19 +136,19 @@ gboolean Id3tag_Read_File_Tag (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 (ETSettings, "id3v2-enabled");
}else
{
/* ID3v2 tag found */
- if (FILE_WRITING_ID3V2_WRITE_TAG == 0)
+ if (g_settings_get_boolean (ETSettings, "id3v2-enabled") == 0)
{
// 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 (ETSettings, "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))
@@ -182,13 +182,13 @@ gboolean Id3tag_Read_File_Tag (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 (ETSettings, "id3v1-enabled"))
update = 1;
}else
{
- // ID3v1 tag not found!
- if (FILE_WRITING_ID3V1_WRITE_TAG)
+ /* ID3v1 tag not found! */
+ if (g_settings_get_boolean (ETSettings, "id3v1-enabled"))
update = 1;
}
@@ -261,14 +261,18 @@ gboolean Id3tag_Read_File_Tag (gchar *filename, File_Tag *FileTag)
{
string2 = g_utf8_strchr(string1,-1,'/');
- if (NUMBER_TRACK_FORMATED)
+ if (g_settings_get_boolean (ETSettings, "tag-number-padded"))
{
if (string2)
{
- FileTag->track_total =
g_strdup_printf("%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,atoi(string2+1)); // Just to have numbers like this
: '01', '05', '12', ...
- *string2 = '\0'; // To cut string1
+ /* Just to have numbers like this : '01', '05', '12', ...*/
+ FileTag->track_total = g_strdup_printf ("%.*d", g_settings_get_uint (ETSettings,
"tag-number-length"), atoi (string2+1));
+ *string2 = '\0'; /* To cut string1. */
}
- FileTag->track = g_strdup_printf("%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,atoi(string1)); //
Just to have numbers like this : '01', '05', '12', ...
+ /* Just to have numbers like this : '01', '05', '12', ... */
+ FileTag->track = g_strdup_printf ("%.*d",
+ g_settings_get_uint (ETSettings, "tag-number-length"),
+ atoi (string1));
}else
{
if (string2)
@@ -539,7 +543,7 @@ 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 (ETSettings, "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;
@@ -630,7 +634,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 (ETSettings,
+ "id3-override-read-encoding"))
{
if ((latinstr = (gchar *)id3_ucs4_latin1duplicate(usrc)))
{
@@ -698,7 +703,8 @@ libid3tag_Get_Frame_Str(const struct id3_frame *frame, unsigned etag_field_type,
if (!(etag_field_type & EASYTAG_ID3_FIELD_LATIN1FULL))
continue;
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 (ETSettings,
+ "id3-override-read-encoding"))
{
tmpstr = convert_string(latinstr, FILE_READING_ID3V1V2_CHARACTER_SET, "UTF-8", FALSE);
g_free (latinstr);
@@ -790,8 +796,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 (ETSettings, "id3v2-enabled"))
{
struct id3_file *file;
struct id3_tag *tmptag;
@@ -850,14 +856,14 @@ 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)
+ if (g_settings_get_boolean (ETSettings, "id3v2-crc32"))
id3_tag_options(v2tag, ID3_TAG_OPTION_CRC, ~0);
- if (FILE_WRITING_ID3V2_USE_COMPRESSION)
+ if (g_settings_get_boolean (ETSettings, "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 (ETSettings, "id3v1-enable"))
{
v1tag = id3_tag_new();
if (!v1tag)
@@ -921,7 +927,8 @@ 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))
+ if ((genre_value == ID3_INVALID_GENRE)
+ || g_settings_get_boolean (ETSettings, "id3v2-text-only-genre"))
string1 = g_strdup(FileTag->genre);
else
string1 = g_strdup_printf("(%d)",genre_value);
diff --git a/src/log.c b/src/log.c
index 7fa1fba..138ebff 100644
--- a/src/log.c
+++ b/src/log.c
@@ -160,11 +160,10 @@ GtkWidget *Create_Log_Area (void)
// Load pending messages in the Log list
Log_Print_Tmp_List();
- if (SHOW_LOG_VIEW)
- //gtk_widget_show_all(ScrollWindowLogList);
- gtk_widget_show_all(Frame);
+ gtk_widget_show_all(Frame);
+ g_settings_bind (ETSettings, "log-show", Frame, "visible",
+ G_SETTINGS_BIND_GET);
- //return ScrollWindowLogList;
return Frame;
}
@@ -265,8 +264,9 @@ void Log_Print (Log_Error_Type error_type, gchar const *format, ...)
gchar *time = Log_Format_Date();
// Remove lines that exceed the limit
- if (LogListNbrRows > LOG_MAX_LINES - 1
- && gtk_tree_model_get_iter_first(GTK_TREE_MODEL(logListModel), &iter))
+ if (LogListNbrRows > g_settings_get_uint (ETSettings, "log-lines")
+ - 1 && gtk_tree_model_get_iter_first (GTK_TREE_MODEL (logListModel),
+ &iter))
{
gtk_list_store_remove(GTK_LIST_STORE(logListModel), &iter);
}
diff --git a/src/misc.c b/src/misc.c
index dcac782..f89a12f 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -472,7 +472,10 @@ gboolean Parse_Date (void)
struct tm t0;
/* Early return. */
- if (!DATE_AUTO_COMPLETION) return FALSE;
+ if (!g_settings_get_boolean (ETSettings, "tag-date-autocomplete"))
+ {
+ return FALSE;
+ }
/* Get the info entered by user */
year = gtk_entry_get_text(GTK_ENTRY(YearEntry));
@@ -552,9 +555,12 @@ void Load_Track_List_To_UI (void)
for (i=1; i<=len; i++)
{
- if (NUMBER_TRACK_FORMATED)
+ if (g_settings_get_boolean (ETSettings, "tag-number-padded"))
{
- text = g_strdup_printf("%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,i);
+ text = g_strdup_printf ("%.*d",
+ g_settings_get_uint (ETSettings,
+ "tag-number-length"),
+ i);
} else
{
text = g_strdup_printf("%.2d",i);
@@ -1645,8 +1651,8 @@ Playlist_Write_Button_Pressed (void)
playlist_name = filename_from_display(playlist_name_utf8);
playlist_basename_utf8 = g_path_get_basename(playlist_name_utf8);
- // Check if file exists
- if (CONFIRM_WRITE_PLAYLIST)
+ /* Check if file exists. */
+ if (g_settings_get_boolean (ETSettings, "confirm-write-playlist"))
{
if ( (file=fopen(playlist_name,"r")) != NULL )
{
diff --git a/src/mp4_tag.c b/src/mp4_tag.c
index 8e5edb8..3bc628f 100644
--- a/src/mp4_tag.c
+++ b/src/mp4_tag.c
@@ -119,7 +119,12 @@ gboolean Mp4tag_Read_File_Tag (gchar *filename, File_Tag *FileTag)
track = taglib_tag_track(tag);
if (track != 0)
- FileTag->track = NUMBER_TRACK_FORMATED ?
g_strdup_printf("%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,(gint)track) : g_strdup_printf("%d",(gint)track);
+ FileTag->track = g_settings_get_boolean (ETSettings, "tag-number-padded")
+ ? g_strdup_printf ("%.*d",
+ g_settings_get_uint (ETSettings,
+ "tag-number-length"),
+ (gint)track)
+ : g_strdup_printf ("%d", (gint)track);
/* TODO: No total track support in the TagLib C API! */
/*********
diff --git a/src/ogg_tag.c b/src/ogg_tag.c
index e6fe6e1..ca856ef 100644
--- a/src/ogg_tag.c
+++ b/src/ogg_tag.c
@@ -302,25 +302,34 @@ gboolean Ogg_Tag_Read_File_Tag (gchar *filename, File_Tag *FileTag)
*************************/
if ( (string = vorbis_comment_query(vc,"TRACKNUMBER",0)) != NULL && g_utf8_strlen(string, -1) > 0 )
{
- if (NUMBER_TRACK_FORMATED)
+ if (g_settings_get_boolean (ETSettings, "tag-number-padded"))
{
// Ckeck if TRACKTOTAL used, else takes it in TRACKNUMBER
if ( (string1 = vorbis_comment_query(vc,"TRACKTOTAL",0)) != NULL && g_utf8_strlen(string1, -1) >
0 )
{
- FileTag->track_total =
g_strdup_printf("%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,atoi(string1));
+ FileTag->track_total = g_strdup_printf ("%.*d",
+ g_settings_get_uint (ETSettings,
"tag-number-length"),
+ atoi (string1));
}else
if ( (string1 = g_utf8_strchr(string, -1, '/')) )
{
- FileTag->track_total =
g_strdup_printf("%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,atoi(string1+1));
+ FileTag->track_total = g_strdup_printf ("%.*d",
+ g_settings_get_uint (ETSettings,
"tag-number-length"),
+ atoi (string1 + 1));
*string1 = '\0';
}
- FileTag->track = g_strdup_printf("%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,atoi(string));
+ FileTag->track = g_strdup_printf ("%.*d",
+ g_settings_get_uint (ETSettings,
+ "tag-number-length"),
+ atoi (string));
}else
{
// Ckeck if TRACKTOTAL used, else takes it in TRACKNUMBER
if ( (string1 = vorbis_comment_query(vc,"TRACKTOTAL",0)) != NULL && g_utf8_strlen(string1, -1) >
0 )
{
- FileTag->track_total =
g_strdup_printf("%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,atoi(string1));
+ FileTag->track_total = g_strdup_printf ("%.*d",
+ g_settings_get_uint (ETSettings,
"tag-number-length"),
+ atoi (string1));
}else
if ( (string1 = g_utf8_strchr(string, -1, '/')) )
{
@@ -751,7 +760,7 @@ gboolean Ogg_Tag_Write_File_Tag (ET_File *ETFile)
// Format used in winamp plugin
Ogg_Set_Tag(vc,"COMMENT=",FileTag->comment,VORBIS_SPLIT_FIELD_COMMENT);
- if (OGG_TAG_WRITE_XMMS_COMMENT)
+ if (g_settings_get_boolean (ETSettings, "ogg-xmms-comment"))
{
// Format used into xmms-1.2.5
Ogg_Set_Tag(vc,"=",FileTag->comment,VORBIS_SPLIT_FIELD_COMMENT);
diff --git a/src/prefs.c b/src/prefs.c
index 154ae26..af0c7b8 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -93,7 +93,6 @@ void Open_OptionsWindow (void)
GtkWidget *HBox, *hbox, *id3v1v2hbox;
GtkWidget *Separator;
GtkWidget *EventBox;
- gchar temp[MAX_STRING_LEN];
gchar *path_utf8;
gchar *program_path;
@@ -195,7 +194,8 @@ void Open_OptionsWindow (void)
/* 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 (ETSettings, "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)."));
@@ -203,7 +203,8 @@ void Open_OptionsWindow (void)
/* 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 (ETSettings, "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."));
@@ -211,7 +212,9 @@ void Open_OptionsWindow (void)
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 (ETSettings, "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."));
@@ -220,7 +223,8 @@ void Open_OptionsWindow (void)
#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 (ETSettings, "browse-show-hidden", BrowseHiddendir,
+ "active", G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(BrowseHiddendir,_("Search hidden directories for files "
"(directories starting by a '.')."));
@@ -246,10 +250,11 @@ void Open_OptionsWindow (void)
gtk_container_add(GTK_CONTAINER(Frame),vbox);
gtk_container_set_border_width(GTK_CONTAINER(vbox), 2);
- // Show header infos
+ /* Show header information. */
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 (ETSettings, "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."));
@@ -418,7 +423,8 @@ void Open_OptionsWindow (void)
// 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 (ETSettings, "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."));
@@ -431,7 +437,8 @@ void Open_OptionsWindow (void)
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 (ETSettings, "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 "
@@ -463,7 +470,9 @@ void Open_OptionsWindow (void)
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 (ETSettings, "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 "
@@ -496,7 +505,9 @@ void Open_OptionsWindow (void)
/* 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 (ETSettings, "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."));
@@ -504,7 +515,9 @@ void Open_OptionsWindow (void)
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 (ETSettings, "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 "
@@ -589,7 +602,8 @@ void Open_OptionsWindow (void)
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 (ETSettings, "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â)."));
@@ -599,14 +613,17 @@ void Open_OptionsWindow (void)
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 (ETSettings, "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 (ETSettings, "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,7 +634,8 @@ void Open_OptionsWindow (void)
OggTagWriteXmmsComment = gtk_check_button_new_with_label(_("Ogg Vorbis Files: write also the comment in
the XMMS format"));
gtk_box_pack_start(GTK_BOX(vbox),OggTagWriteXmmsComment,FALSE,FALSE,0);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(OggTagWriteXmmsComment),OGG_TAG_WRITE_XMMS_COMMENT);
+ g_settings_bind (ETSettings, "ogg-xmms-comment", OggTagWriteXmmsComment,
+ "active", G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(OggTagWriteXmmsComment,_("XMMS doesn't make use of the right way to "
"identify a comment in Ogg Vorbis files as other apps do. In fact, this field is usually labeled "
"with 'comment=', whereas XMMS uses only `='. Please, uncheck this option if you don't want "
@@ -628,30 +646,12 @@ void Open_OptionsWindow (void)
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);
-
- 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_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 (ETSettings, "tag-preserve-focus", SetFocusToSameTagField,
+ "active", G_SETTINGS_BIND_DEFAULT);
- Label = gtk_label_new(" ");
- gtk_grid_attach (GTK_GRID (Table), Label, 0, 1, 1, 1);
-
- 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);
@@ -718,7 +718,8 @@ void Open_OptionsWindow (void)
/* Write ID3 tags in FLAC files */
WriteId3TagsInFlacFiles = gtk_check_button_new_with_label(_("Write ID3 tags in FLAC files (in addition
to FLAC tag)"));
gtk_grid_attach (GTK_GRID (Table), WriteId3TagsInFlacFiles, 0, 0, 1, 1);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(WriteId3TagsInFlacFiles),WRITE_ID3_TAGS_IN_FLAC_FILE);
+ g_settings_bind (ETSettings, "flac-write-id3", WriteId3TagsInFlacFiles,
+ "active", G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(WriteId3TagsInFlacFiles,_("If activated, ID3 tags will be "
"also added in the FLAC file (according the two rules above, plus the FLAC tag). "
"Else ID3 tags will be stripped."));
@@ -726,7 +727,8 @@ void Open_OptionsWindow (void)
/* 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, 1, 1, 1);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(StripTagWhenEmptyFields),STRIP_TAG_WHEN_EMPTY_FIELDS);
+ g_settings_bind (ETSettings, "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 picture, lyricsâ), "
"this option allows you to strip the whole tag when these seven standard data fields have "
@@ -735,28 +737,35 @@ void Open_OptionsWindow (void)
/* 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, 2, 1, 1);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ConvertOldId3v2TagVersion),CONVERT_OLD_ID3V2_TAG_VERSION);
+ g_settings_bind (ETSettings, "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 (ETSettings, "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 (ETSettings, "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, 1, 2, 1,
1);
-
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(FileWritingId3v2TextOnlyGenre),FILE_WRITING_ID3V2_TEXT_ONLY_GENRE);
+ g_settings_bind (ETSettings, "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 */
@@ -782,7 +791,8 @@ void Open_OptionsWindow (void)
/* 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 (ETSettings, "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",
@@ -912,7 +922,8 @@ void Open_OptionsWindow (void)
/* 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 (ETSettings, "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",
@@ -984,8 +995,9 @@ void Open_OptionsWindow (void)
// "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 (ETSettings, "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,
@@ -1110,7 +1122,8 @@ void Open_OptionsWindow (void)
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 (ETSettings, "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."));
@@ -1131,7 +1144,8 @@ void Open_OptionsWindow (void)
// 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 (ETSettings, "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."));
@@ -1207,32 +1221,33 @@ void Open_OptionsWindow (void)
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 (ETSettings, "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_entry_new();
+ CddbServerPortAutomaticSearch = gtk_spin_button_new_with_range (0.0,
+ 65535.0,
+ 1.0);
+ g_settings_bind (ETSettings, "cddb-automatic-search-port",
+ CddbServerPortAutomaticSearch, "value",
+ G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_size_request(GTK_WIDGET(CddbServerPortAutomaticSearch), 45, -1);
- gtk_entry_set_max_length(GTK_ENTRY(CddbServerPortAutomaticSearch),5);
gtk_box_pack_start(GTK_BOX(hbox),CddbServerPortAutomaticSearch,FALSE,FALSE,0);
- sprintf(temp,"%i",CDDB_SERVER_PORT_AUTOMATIC_SEARCH);
- gtk_entry_set_text(GTK_ENTRY(CddbServerPortAutomaticSearch),temp);
-
g_signal_connect(G_OBJECT(CddbServerPortAutomaticSearch),"insert_text",G_CALLBACK(Insert_Only_Digit),NULL);
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 (ETSettings, "cddb-automatic-search-path",
+ CddbServerCgiPathAutomaticSearch, "text",
+ G_SETTINGS_BIND_DEFAULT);
// 2sd automatic search server
hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,2);
@@ -1242,25 +1257,28 @@ void Open_OptionsWindow (void)
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 (ETSettings, "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_entry_new();
+ CddbServerPortAutomaticSearch2 = gtk_spin_button_new_with_range (0.0,
+ 65535.0,
+ 1.0);
+ g_settings_bind (ETSettings, "cddb-automatic-search-port2",
+ CddbServerPortAutomaticSearch2, "value",
+ G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_size_request(GTK_WIDGET(CddbServerPortAutomaticSearch2), 45, -1);
- gtk_entry_set_max_length(GTK_ENTRY(CddbServerPortAutomaticSearch2),5);
gtk_box_pack_start(GTK_BOX(hbox),CddbServerPortAutomaticSearch2,FALSE,FALSE,0);
- sprintf(temp,"%i",CDDB_SERVER_PORT_AUTOMATIC_SEARCH2);
- gtk_entry_set_text(GTK_ENTRY(CddbServerPortAutomaticSearch2),temp);
-
g_signal_connect(G_OBJECT(CddbServerPortAutomaticSearch2),"insert_text",G_CALLBACK(Insert_Only_Digit),NULL);
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 (ETSettings, "cddb-automatic-search-path2",
+ CddbServerCgiPathAutomaticSearch2, "text",
+ G_SETTINGS_BIND_DEFAULT);
// CDDB Server Settings (Manual Search)
Frame = gtk_frame_new (_("Server Settings for Manual Search"));
@@ -1277,25 +1295,28 @@ void Open_OptionsWindow (void)
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 (ETSettings, "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);
- CddbServerPortManualSearch = gtk_entry_new();
+ CddbServerPortManualSearch = gtk_spin_button_new_with_range (0.0, 65535.0,
+ 1.0);
+ g_settings_bind (ETSettings, "cddb-manual-search-port",
+ CddbServerPortManualSearch, "value",
+ G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_size_request(GTK_WIDGET(CddbServerPortManualSearch), 45, -1);
gtk_entry_set_max_length(GTK_ENTRY(CddbServerPortManualSearch),5);
gtk_box_pack_start(GTK_BOX(hbox),CddbServerPortManualSearch,FALSE,FALSE,0);
- sprintf(temp,"%i",CDDB_SERVER_PORT_MANUAL_SEARCH);
- gtk_entry_set_text(GTK_ENTRY(CddbServerPortManualSearch),temp);
- g_signal_connect(G_OBJECT(CddbServerPortManualSearch),"insert_text",G_CALLBACK(Insert_Only_Digit),NULL);
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 (ETSettings, "cddb-manual-search-path",
+ CddbServerCgiPathManualSearch, "text",
+ G_SETTINGS_BIND_DEFAULT);
// Local access for CDDB (Automatic Search)
Frame = gtk_frame_new (_("Local CD Data Base"));
@@ -1355,7 +1376,8 @@ void Open_OptionsWindow (void)
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 (ETSettings, "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(" ");
@@ -1366,37 +1388,35 @@ void Open_OptionsWindow (void)
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 (ETSettings, "cddb-proxy-hostname", CddbProxyName, "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 (ETSettings, "cddb-proxy-port", CddbProxyPort, "value",
+ G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_size_request(GTK_WIDGET(CddbProxyPort), 45, -1);
- gtk_entry_set_max_length(GTK_ENTRY(CddbProxyPort),5);
gtk_grid_attach (GTK_GRID (Table), CddbProxyPort, 4, 1, 1, 1);
gtk_widget_set_tooltip_text(CddbProxyPort,_("Port of the proxy server."));
- sprintf(temp,"%i",CDDB_PROXY_PORT);
- gtk_entry_set_text(GTK_ENTRY(CddbProxyPort),temp);
- g_signal_connect(G_OBJECT(CddbProxyPort),"insert_text",G_CALLBACK(Insert_Only_Digit),NULL);
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 (ETSettings, "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 (ETSettings, "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 the proxy server."));
Cddb_Use_Proxy_Toggled();
@@ -1444,30 +1464,36 @@ void Open_OptionsWindow (void)
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 (ETSettings, "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 (ETSettings, "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 (ETSettings, "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 (ETSettings, "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 (ETSettings, "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 (ETSettings, "confirm-when-unsaved-files",
+ ConfirmWhenUnsavedFiles, "active",
+ G_SETTINGS_BIND_DEFAULT);
/*
* Buttons box of Option Window
diff --git a/src/scan.c b/src/scan.c
index 842552a..a28cb7d 100644
--- a/src/scan.c
+++ b/src/scan.c
@@ -322,8 +322,10 @@ Scan_Tag_With_Mask (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 ) )
+ /* We display the text affected to the code. */
+ if (dest && (g_settings_get_boolean (ETSettings,
+ "fill-overwrite-tag-fields")
+ || *dest == NULL || strlen (*dest) == 0))
ET_Set_Field_File_Tag_Item(dest,mask_item->string);
if (!fill_tag_list->next) break;
@@ -331,12 +333,16 @@ Scan_Tag_With_Mask (ET_File *ETFile)
}
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
) )
+ /* Set the default text to comment. */
+ if (SET_DEFAULT_COMMENT
+ && (g_settings_get_boolean (ETSettings, "fill-overwrite-tag-fields")
+ || FileTag->comment == NULL || strlen (FileTag->comment) == 0 ))
ET_Set_Field_File_Tag_Item((void *)&FileTag->comment,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 (SET_CRC32_COMMENT
+ && (g_settings_get_boolean (ETSettings, "fill-overwrite-tag-fields")
+ || FileTag->comment == NULL || strlen (FileTag->comment) == 0 ))
{
guint32 crc32_value;
gchar *buffer;
diff --git a/src/setting.c b/src/setting.c
index e67d856..e52c198 100644
--- a/src/setting.c
+++ b/src/setting.c
@@ -109,13 +109,9 @@ static gboolean Create_Easytag_Directory (void);
********************/
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 },
{"set_main_window_position", CV_TYPE_BOOL, &SET_MAIN_WINDOW_POSITION },
{"main_window_x", CV_TYPE_INT, &MAIN_WINDOW_X },
@@ -126,48 +122,27 @@ tConfigVariable Config_Variables[] =
{"pane_handle_position2", CV_TYPE_INT, &PANE_HANDLE_POSITION2 },
{"pane_handle_position3", CV_TYPE_INT, &PANE_HANDLE_POSITION3 },
{"pane_handle_position4", CV_TYPE_INT, &PANE_HANDLE_POSITION4 },
- {"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 },
- {"ogg_tag_write_xmms_comment", CV_TYPE_BOOL, &OGG_TAG_WRITE_XMMS_COMMENT },
- {"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
},
- {"write_id3_tags_in_flac_file", CV_TYPE_BOOL, &WRITE_ID3_TAGS_IN_FLAC_FILE
},
- {"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},
@@ -196,22 +171,14 @@ tConfigVariable Config_Variables[] =
{"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 },
{"scanner_window_on_top", CV_TYPE_BOOL, &SCANNER_WINDOW_ON_TOP },
{"set_scanner_window_position", CV_TYPE_BOOL, &SET_SCANNER_WINDOW_POSITION },
{"scanner_window_x", CV_TYPE_INT, &SCANNER_WINDOW_X },
{"scanner_window_y", CV_TYPE_INT, &SCANNER_WINDOW_Y },
- {"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 },
@@ -262,21 +229,7 @@ tConfigVariable Config_Variables[] =
{"load_file_window_width", CV_TYPE_INT, &LOAD_FILE_WINDOW_WIDTH },
{"load_file_window_height", CV_TYPE_INT, &LOAD_FILE_WINDOW_HEIGHT },
- {"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 },
{"set_cddb_window_position", CV_TYPE_BOOL, &SET_CDDB_WINDOW_POSITION },
{"cddb_window_x", CV_TYPE_INT, &CDDB_WINDOW_X },
{"cddb_window_y", CV_TYPE_INT, &CDDB_WINDOW_Y },
@@ -353,17 +306,10 @@ void Init_Config_Variables (void)
{
const gchar *music_dir;
+ ETSettings = 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)
@@ -381,24 +327,15 @@ void Init_Config_Variables (void)
PANE_HANDLE_POSITION2 = 360;
PANE_HANDLE_POSITION3 = 300;
PANE_HANDLE_POSITION4 = 300;
- SHOW_HEADER_INFO = 1;
CHANGED_FILES_DISPLAYED_TO_RED = 1;
CHANGED_FILES_DISPLAYED_TO_BOLD = 0;
- DATE_AUTO_COMPLETION = 1;
- NUMBER_TRACK_FORMATED = 1;
- NUMBER_TRACK_FORMATED_SPIN_BUTTON = 2;
- OGG_TAG_WRITE_XMMS_COMMENT = 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;
MESSAGE_BOX_POSITION_NONE = 0;
MESSAGE_BOX_POSITION_CENTER = 0;
@@ -414,12 +351,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 = 1;
- UPDATE_PARENT_DIRECTORY_MODIFICATION_TIME = 0;
FILENAME_CHARACTER_SET_OTHER = 1;
FILENAME_CHARACTER_SET_APPROXIMATE = 0;
@@ -428,19 +362,12 @@ void Init_Config_Variables (void)
/*
* Tag Settings
*/
- WRITE_ID3_TAGS_IN_FLAC_FILE = 0;
- 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");
@@ -451,7 +378,6 @@ 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;
@@ -475,26 +401,15 @@ void Init_Config_Variables (void)
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;
SCANNER_WINDOW_ON_TOP = 1;
SET_SCANNER_WINDOW_POSITION = 1; // Set it to '0' if problem with some Windows Manager
SCANNER_WINDOW_X = -1;
SCANNER_WINDOW_Y = -1;
/*
- * Confirmation
- */
- CONFIRM_BEFORE_EXIT = 1;
- CONFIRM_WRITE_TAG = 1;
- CONFIRM_RENAME_FILE = 1;
- CONFIRM_DELETE_FILE = 1;
- CONFIRM_WRITE_PLAYLIST = 1;
-
- /*
* Scanner window
*/
PROCESS_FILENAME_FIELD = 0;
@@ -558,21 +473,7 @@ void Init_Config_Variables (void)
/*
* 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;
SET_CDDB_WINDOW_POSITION = 1; // Set it to '0' if problem with some Windows Manager
CDDB_WINDOW_X = -1;
@@ -661,7 +562,6 @@ Apply_Changes_Of_Preferences_Window (void)
if (OptionsWindow)
{
/* 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
@@ -669,13 +569,9 @@ 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
+ /* 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));
@@ -684,15 +580,7 @@ Apply_Changes_Of_Preferences_Window (void)
}
/* 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));
- OGG_TAG_WRITE_XMMS_COMMENT =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(OggTagWriteXmmsComment));
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));
SORTING_FILE_MODE = gtk_combo_box_get_active(GTK_COMBO_BOX(SortingFileCombo));
@@ -705,23 +593,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 */
- WRITE_ID3_TAGS_IN_FLAC_FILE =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(WriteId3TagsInFlacFiles));
- 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;
@@ -732,10 +612,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));
@@ -749,7 +625,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);
@@ -777,57 +652,20 @@ Apply_Changes_Of_Preferences_Window (void)
// 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));
SCANNER_WINDOW_ON_TOP = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ScannerWindowOnTop));
/* 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 */
}
@@ -835,28 +673,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) gtk_widget_show_all(LogArea);
- else gtk_widget_hide(LogArea);
-
- /* 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);
- }
-
if (ScannerWindow)
{
if (SCANNER_WINDOW_ON_TOP)
diff --git a/src/setting.h b/src/setting.h
index 59d606a..fec4f64 100644
--- a/src/setting.h
+++ b/src/setting.h
@@ -46,16 +46,14 @@ struct _tConfigVariable
/*
- * Config varariables
+ * Config variables
*/
+GSettings *ETSettings;
+
/* 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 */
// User Interface
@@ -68,7 +66,6 @@ gint PANE_HANDLE_POSITION1;
gint PANE_HANDLE_POSITION2;
gint PANE_HANDLE_POSITION3;
gint PANE_HANDLE_POSITION4;
-gint SHOW_HEADER_INFO;
gint CHANGED_FILES_DISPLAYED_TO_RED;
gint CHANGED_FILES_DISPLAYED_TO_BOLD;
@@ -84,30 +81,18 @@ gint MESSAGE_BOX_POSITION_CENTER_ON_PARENT;
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 WRITE_ID3_TAGS_IN_FLAC_FILE;
-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;
@@ -115,7 +100,6 @@ 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;
@@ -129,16 +113,6 @@ 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 OGG_TAG_WRITE_XMMS_COMMENT;
-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;
@@ -149,24 +123,14 @@ 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;
gint SCANNER_WINDOW_ON_TOP;
gint SET_SCANNER_WINDOW_POSITION;
gint SCANNER_WINDOW_X;
gint SCANNER_WINDOW_Y;
-/* 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;
gint PROCESS_TITLE_FIELD;
@@ -222,21 +186,7 @@ gint LOAD_FILE_WINDOW_WIDTH;
gint LOAD_FILE_WINDOW_HEIGHT;
/* 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 SET_CDDB_WINDOW_POSITION;
gint CDDB_WINDOW_X;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]