[easytag/wip/application-window: 34/34] Store case sensitive sorting mode in GSettings
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag/wip/application-window: 34/34] Store case sensitive sorting mode in GSettings
- Date: Sun, 18 May 2014 13:40:17 +0000 (UTC)
commit 43b40d42321f43c438ec8fb3df6795317556a2c5
Author: David King <amigadave amigadave com>
Date: Sat May 10 20:49:46 2014 +0100
Store case sensitive sorting mode in GSettings
src/cddb_dialog.c | 4 +++-
src/et_core.c | 34 ++++++++++++++++++----------------
src/preferences_dialog.c | 15 +++++----------
src/preferences_dialog.h | 6 ------
src/setting.c | 9 ---------
src/setting.h | 1 -
6 files changed, 26 insertions(+), 43 deletions(-)
---
diff --git a/src/cddb_dialog.c b/src/cddb_dialog.c
index 6e76cfc..343bc1e 100644
--- a/src/cddb_dialog.c
+++ b/src/cddb_dialog.c
@@ -3681,7 +3681,9 @@ Cddb_Track_List_Sort_Func (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b,
text2cp = g_utf8_collate_key_for_filename(text2, -1);
// Must be the same rules as "ET_Comp_Func_Sort_File_By_Ascending_Filename" to be
// able to sort in the same order files in cddb and in the file list.
- ret = SORTING_FILE_CASE_SENSITIVE ? strcmp(text1cp,text2cp) : strcasecmp(text1cp,text2cp);
+ ret = g_settings_get_boolean (MainSettings,
+ "sort-case-sensitive") ? strcmp (text1cp, text2cp)
+ : strcasecmp (text1cp, text2cp);
g_free(text1);
g_free(text2);
diff --git a/src/et_core.c b/src/et_core.c
index 99e8b6c..08d00c8 100644
--- a/src/et_core.c
+++ b/src/et_core.c
@@ -1199,7 +1199,9 @@ gint ET_Comp_Func_Sort_File_By_Ascending_Filename (ET_File *ETFile1, ET_File *ET
gchar *file2_ck = ((File_Name *)((GList *)ETFile2->FileNameCur)->data)->value_ck;
// !!!! : Must be the same rules as "Cddb_Track_List_Sort_Func" to be
// able to sort in the same order files in cddb and in the file list.
- return SORTING_FILE_CASE_SENSITIVE ? strcmp(file1_ck,file2_ck) : strcasecmp(file1_ck,file2_ck);
+ return g_settings_get_boolean (MainSettings,
+ "sort-case-sensitive") ? strcmp (file1_ck, file2_ck)
+ : strcasecmp (file1_ck, file2_ck);
}
/*
@@ -1366,7 +1368,7 @@ gint ET_Comp_Func_Sort_File_By_Ascending_Title (ET_File *ETFile1, ET_File *ETFil
if ( !ETFile2->FileTag->data || !((File_Tag *)ETFile2->FileTag->data)->title )
return 1;
- if (SORTING_FILE_CASE_SENSITIVE)
+ if (g_settings_get_boolean (MainSettings, "sort-case-sensitive"))
{
if ( strcmp(((File_Tag *)ETFile1->FileTag->data)->title,((File_Tag *)ETFile2->FileTag->data)->title)
== 0 )
// Second criterion
@@ -1409,7 +1411,7 @@ gint ET_Comp_Func_Sort_File_By_Ascending_Artist (ET_File *ETFile1, ET_File *ETFi
if ( !ETFile2->FileTag->data || !((File_Tag *)ETFile2->FileTag->data)->artist )
return 1;
- if (SORTING_FILE_CASE_SENSITIVE)
+ if (g_settings_get_boolean (MainSettings, "sort-case-sensitive"))
{
if ( strcmp(((File_Tag *)ETFile1->FileTag->data)->artist,((File_Tag
*)ETFile2->FileTag->data)->artist) == 0 )
// Second criterion
@@ -1451,7 +1453,7 @@ gint ET_Comp_Func_Sort_File_By_Ascending_Album_Artist (ET_File *ETFile1, ET_File
if ( !ETFile2->FileTag->data || !((File_Tag *)ETFile2->FileTag->data)->album_artist )
return 1;
- if (SORTING_FILE_CASE_SENSITIVE)
+ if (g_settings_get_boolean (MainSettings, "sort-case-sensitive"))
{
if ( strcmp(((File_Tag *)ETFile1->FileTag->data)->album_artist,((File_Tag
*)ETFile2->FileTag->data)->album_artist) == 0 )
// Second criterion
@@ -1493,7 +1495,7 @@ gint ET_Comp_Func_Sort_File_By_Ascending_Album (ET_File *ETFile1, ET_File *ETFil
if ( !ETFile2->FileTag->data || !((File_Tag *)ETFile2->FileTag->data)->album )
return 1;
- if (SORTING_FILE_CASE_SENSITIVE)
+ if (g_settings_get_boolean (MainSettings, "sort-case-sensitive"))
{
if ( strcmp(((File_Tag *)ETFile1->FileTag->data)->album,((File_Tag *)ETFile2->FileTag->data)->album)
== 0 )
// Second criterion
@@ -1568,7 +1570,7 @@ gint ET_Comp_Func_Sort_File_By_Ascending_Genre (ET_File *ETFile1, ET_File *ETFil
if ( !ETFile1->FileTag->data || !((File_Tag *)ETFile1->FileTag->data)->genre ) return -1;
if ( !ETFile2->FileTag->data || !((File_Tag *)ETFile2->FileTag->data)->genre ) return 1;
- if (SORTING_FILE_CASE_SENSITIVE)
+ if (g_settings_get_boolean (MainSettings, "sort-case-sensitive"))
{
if ( strcmp(((File_Tag *)ETFile1->FileTag->data)->genre,((File_Tag *)ETFile2->FileTag->data)->genre)
== 0 )
// Second criterion
@@ -1611,7 +1613,7 @@ gint ET_Comp_Func_Sort_File_By_Ascending_Comment (ET_File *ETFile1, ET_File *ETF
if ( !ETFile2->FileTag->data || !((File_Tag *)ETFile2->FileTag->data)->comment )
return 1;
- if (SORTING_FILE_CASE_SENSITIVE)
+ if (g_settings_get_boolean (MainSettings, "sort-case-sensitive"))
{
if ( strcmp(((File_Tag *)ETFile1->FileTag->data)->comment,((File_Tag
*)ETFile2->FileTag->data)->comment) == 0 )
// Second criterion
@@ -1654,7 +1656,7 @@ gint ET_Comp_Func_Sort_File_By_Ascending_Composer (ET_File *ETFile1, ET_File *ET
if ( !ETFile2->FileTag->data || !((File_Tag *)ETFile2->FileTag->data)->composer )
return 1;
- if (SORTING_FILE_CASE_SENSITIVE)
+ if (g_settings_get_boolean (MainSettings, "sort-case-sensitive"))
{
if ( strcmp(((File_Tag *)ETFile1->FileTag->data)->composer,((File_Tag
*)ETFile2->FileTag->data)->composer) == 0 )
// Second criterion
@@ -1697,7 +1699,7 @@ gint ET_Comp_Func_Sort_File_By_Ascending_Orig_Artist (ET_File *ETFile1, ET_File
if ( !ETFile2->FileTag->data || !((File_Tag *)ETFile2->FileTag->data)->orig_artist )
return 1;
- if (SORTING_FILE_CASE_SENSITIVE)
+ if (g_settings_get_boolean (MainSettings, "sort-case-sensitive"))
{
if ( strcmp(((File_Tag *)ETFile1->FileTag->data)->orig_artist,((File_Tag
*)ETFile2->FileTag->data)->orig_artist) == 0 )
// Second criterion
@@ -1740,7 +1742,7 @@ gint ET_Comp_Func_Sort_File_By_Ascending_Copyright (ET_File *ETFile1, ET_File *E
if ( !ETFile2->FileTag->data || !((File_Tag *)ETFile2->FileTag->data)->copyright )
return 1;
- if (SORTING_FILE_CASE_SENSITIVE)
+ if (g_settings_get_boolean (MainSettings, "sort-case-sensitive"))
{
if ( strcmp(((File_Tag *)ETFile1->FileTag->data)->copyright,((File_Tag
*)ETFile2->FileTag->data)->copyright) == 0 )
// Second criterion
@@ -1783,7 +1785,7 @@ gint ET_Comp_Func_Sort_File_By_Ascending_Url (ET_File *ETFile1, ET_File *ETFile2
if ( !ETFile2->FileTag->data || !((File_Tag *)ETFile2->FileTag->data)->url )
return 1;
- if (SORTING_FILE_CASE_SENSITIVE)
+ if (g_settings_get_boolean (MainSettings, "sort-case-sensitive"))
{
if ( strcmp(((File_Tag *)ETFile1->FileTag->data)->url,((File_Tag *)ETFile2->FileTag->data)->url) ==
0 )
// Second criterion
@@ -1826,7 +1828,7 @@ gint ET_Comp_Func_Sort_File_By_Ascending_Encoded_By (ET_File *ETFile1, ET_File *
if ( !ETFile2->FileTag->data || !((File_Tag *)ETFile2->FileTag->data)->encoded_by )
return 1;
- if (SORTING_FILE_CASE_SENSITIVE)
+ if (g_settings_get_boolean (MainSettings, "sort-case-sensitive"))
{
if ( strcmp(((File_Tag *)ETFile1->FileTag->data)->encoded_by,((File_Tag
*)ETFile2->FileTag->data)->encoded_by) == 0 )
// Second criterion
@@ -2001,8 +2003,8 @@ static gint ET_Comp_Func_Sort_Artist_Item_By_Ascending_Artist (GList *AlbumList1
|| !(etfile2_artist = ((File_Tag *)etfile2->FileTag->data)->artist) )
return 1;
- //if (SORTING_FILE_CASE_SENSITIVE)
- // return strcmp(etfile1_artist,etfile2_artist);
+ /*if (g_settings_get_boolean (MainSettings, "sort-case-sensitive"))
+ * return strcmp(etfile1_artist,etfile2_artist); */
//else
return strcasecmp(etfile1_artist,etfile2_artist);
}
@@ -2027,8 +2029,8 @@ ET_Comp_Func_Sort_Album_Item_By_Ascending_Album (GList *etfilelist1,
|| !(etfile2_album = ((File_Tag *)etfile2->FileTag->data)->album) )
return 1;
- //if (SORTING_FILE_CASE_SENSITIVE)
- // return strcmp(etfile1_album,etfile2_album);
+ /*if (g_settings_get_boolean (MainSettings, "sort-case-sensitive"))
+ * return strcmp(etfile1_album,etfile2_album); */
//else
return strcasecmp(etfile1_album,etfile2_album);
}
diff --git a/src/preferences_dialog.c b/src/preferences_dialog.c
index 9af16dc..a70b968 100644
--- a/src/preferences_dialog.c
+++ b/src/preferences_dialog.c
@@ -180,10 +180,12 @@ create_preferences_dialog (EtPreferencesDialog *self)
GtkWidget *LoadOnStartup;
GtkWidget *BrowseSubdir;
GtkWidget *OpenSelectedBrowserNode;
+ GtkWidget *BrowseHiddendir;
GtkWidget *ShowHeaderInfos;
GtkWidget *ChangedFilesDisplayedToRed;
GtkWidget *ChangedFilesDisplayedToBold;
GtkWidget *SortingFileCombo;
+ GtkWidget *SortingFileCaseSensitive;
GtkWidget *ShowLogView;
GtkWidget *LogMaxLinesSpinButton;
GtkWidget *ReplaceIllegalCharactersInFilename;
@@ -343,9 +345,6 @@ create_preferences_dialog (EtPreferencesDialog *self)
/* Browse hidden directories */
BrowseHiddendir = gtk_check_button_new_with_label(_("Search hidden directories"));
-#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 */
g_settings_bind (MainSettings, "browse-show-hidden", BrowseHiddendir,
"active", G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(BrowseHiddendir,_("Search hidden directories for files "
@@ -477,14 +476,10 @@ create_preferences_dialog (EtPreferencesDialog *self)
"loading a directory."));
SortingFileCaseSensitive = gtk_check_button_new_with_label(_("Case sensitive"));
-#ifndef G_OS_WIN32
- /* Always true and not user modifiable on win32, as strncasecmp() does not
- * work correctly with g_utf8_collate_key().
- */
gtk_box_pack_start(GTK_BOX(hbox),SortingFileCaseSensitive,FALSE,FALSE,0);
-#endif /* !G_OS_WIN32 */
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(SortingFileCaseSensitive),
- SORTING_FILE_CASE_SENSITIVE);
+ g_settings_bind (MainSettings, "sort-case-sensitive",
+ SortingFileCaseSensitive, "active",
+ G_SETTINGS_BIND_DEFAULT);
gtk_widget_set_tooltip_text(SortingFileCaseSensitive,_("If activated, the "
"sorting of the list will be dependent on the case."));
diff --git a/src/preferences_dialog.h b/src/preferences_dialog.h
index 12c4d6b..6ae3836 100644
--- a/src/preferences_dialog.h
+++ b/src/preferences_dialog.h
@@ -53,13 +53,7 @@ void et_preferences_dialog_show_scanner (EtPreferencesDialog *self);
G_END_DECLS
/* FIXME: Remove widget declarations when switching to GSettings. */
-/* Widgets included in config */
-/* Common */
-GtkWidget *BrowseHiddendir;
-
/* Misc */
-GtkWidget *SortingFileCaseSensitive;
-
GtkWidget *FilePlayerCombo;
/* Tag Settings */
diff --git a/src/setting.c b/src/setting.c
index 9fa9a67..3c4f691 100644
--- a/src/setting.c
+++ b/src/setting.c
@@ -113,7 +113,6 @@ static void set_sorting_indicator_for_column_id (EtApplicationWindow *self,
********************/
static const tConfigVariable Config_Variables[] =
{
- {"sorting_file_case_sensitive", CV_TYPE_BOOL, &SORTING_FILE_CASE_SENSITIVE },
{"file_reading_id3v1v2_character_set", CV_TYPE_STRING,&FILE_READING_ID3V1V2_CHARACTER_SET},
{"file_writing_id3v2_unicode_character_set",
CV_TYPE_STRING,&FILE_WRITING_ID3V2_UNICODE_CHARACTER_SET},
@@ -204,12 +203,6 @@ void Init_Config_Variables (void)
* Misc
*/
#ifdef G_OS_WIN32
- SORTING_FILE_CASE_SENSITIVE = 1;
-#else /* !G_OS_WIN32 */
- SORTING_FILE_CASE_SENSITIVE = 0;
-#endif /* !G_OS_WIN32 */
-
-#ifdef G_OS_WIN32
AUDIO_FILE_PLAYER = ET_Win32_Get_Audio_File_Player();
#else /* !G_OS_WIN32 */
AUDIO_FILE_PLAYER = g_strdup("xdg-open");
@@ -302,8 +295,6 @@ Apply_Changes_Of_Preferences_Window (void)
if (dialog)
{
/* Misc */
- SORTING_FILE_CASE_SENSITIVE =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(SortingFileCaseSensitive));
-
/* FIXME: Port to GSettings? */
/* Is this needed any more? */
#if 0
diff --git a/src/setting.h b/src/setting.h
index e9a7082..c9ff7fc 100644
--- a/src/setting.h
+++ b/src/setting.h
@@ -165,7 +165,6 @@ GSettings *MainSettings;
/* Misc */
gint SORTING_FILE_MODE;
-gint SORTING_FILE_CASE_SENSITIVE;
gchar *AUDIO_FILE_PLAYER;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]