[easytag/wip/core-refactoring: 27/27] Simplify scan dialog capitalization settings
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag/wip/core-refactoring: 27/27] Simplify scan dialog capitalization settings
- Date: Wed, 25 May 2016 21:17:06 +0000 (UTC)
commit ef726680a4b6d51937a9eac79502f2885017f51e
Author: David King <amigadave amigadave com>
Date: Wed May 25 23:13:57 2016 +0200
Simplify scan dialog capitalization settings
Use a single flags setting for the individual boolean capitalization
settings.
data/org.gnome.EasyTAG.gschema.xml | 26 +++-----------------
data/scan_dialog.ui | 5 ++++
src/scan_dialog.c | 45 ++++++++++++++++++++++++++---------
src/setting.h | 10 ++++++++
4 files changed, 52 insertions(+), 34 deletions(-)
---
diff --git a/data/org.gnome.EasyTAG.gschema.xml b/data/org.gnome.EasyTAG.gschema.xml
index 211472c..4bb86ee 100644
--- a/data/org.gnome.EasyTAG.gschema.xml
+++ b/data/org.gnome.EasyTAG.gschema.xml
@@ -441,28 +441,10 @@
<default>''</default>
</key>
- <key name="process-lowercase-all" type="b">
- <summary>Lower-case all characters</summary>
- <description>Whether to lower-case all characters of the tag when processing tag fields</description>
- <default>false</default>
- </key>
-
- <key name="process-uppercase-all" type="b">
- <summary>Upper-case all characters</summary>
- <description>Whether to upper-case all characters of the tag when processing tag fields</description>
- <default>false</default>
- </key>
-
- <key name="process-uppercase-first-letter" type="b">
- <summary>Upper-case the first letter of the tag</summary>
- <description>Whether to upper-case the first letter of the tag when processing tag fields</description>
- <default>false</default>
- </key>
-
- <key name="process-uppercase-first-letters" type="b">
- <summary>Upper-case the first letter of each word</summary>
- <description>Whether to upper-case the first letter of each word when processing tag
fields</description>
- <default>true</default>
+ <key name="process-capitalize" enum="org.gnome.EasyTAG.EtProcessCapitalize">
+ <summary>Capitalize tag fields when processing</summary>
+ <description>Whether to change the capitalization when processing tag fields</description>
+ <default>'first-words-up'</default>
</key>
<key name="process-uppercase-prepositions" type="b">
diff --git a/data/scan_dialog.ui b/data/scan_dialog.ui
index 268092b..8a7b5cf 100644
--- a/data/scan_dialog.ui
+++ b/data/scan_dialog.ui
@@ -638,6 +638,7 @@ Use ‘/’ to make directories. If the first character is ‘/’, it is an abs
<object class="GtkRadioButton" id="capitalize_all_radio">
<property name="label" translatable="yes">Capitalize
all</property>
<property name="margin-left">12</property>
+ <property name="name">all-up</property>
<property name="tooltip-text" translatable="yes">Whether to
upper-case all characters of the tag when processing tag fields</property>
<property name="visible">True</property>
</object>
@@ -651,6 +652,7 @@ Use ‘/’ to make directories. If the first character is ‘/’, it is an abs
<property name="group">capitalize_all_radio</property>
<property name="label" translatable="yes">Lowercase
all</property>
<property name="margin-left">12</property>
+ <property name="name">all-down</property>
<property name="tooltip-text" translatable="yes">Whether to
lower-case all characters of the tag when processing tag fields</property>
<property name="visible">True</property>
</object>
@@ -664,6 +666,7 @@ Use ‘/’ to make directories. If the first character is ‘/’, it is an abs
<property name="group">capitalize_all_radio</property>
<property name="label" translatable="yes">Capitalize first
letter</property>
<property name="margin-left">12</property>
+ <property name="name">first-letter-up</property>
<property name="tooltip-text" translatable="yes">Whether to
upper-case the first letter of the tag when processing tag fields</property>
<property name="visible">True</property>
</object>
@@ -677,6 +680,7 @@ Use ‘/’ to make directories. If the first character is ‘/’, it is an abs
<property name="group">capitalize_all_radio</property>
<property name="label" translatable="yes">Capitalize the
first letter of each word</property>
<property name="margin-left">12</property>
+ <property name="name">first-words-up</property>
<property name="tooltip-text" translatable="yes">Whether to
upper-case the first letter of each word when processing tag fields</property>
<property name="visible">True</property>
<signal name="toggled"
handler="Process_Fields_First_Letters_Check_Button_Toggled" swapped="yes"/>
@@ -703,6 +707,7 @@ Use ‘/’ to make directories. If the first character is ‘/’, it is an abs
<property name="group">capitalize_all_radio</property>
<property name="label" translatable="yes">Do not change
capitalization</property>
<property name="margin-left">12</property>
+ <property name="name">no-change</property>
<property name="tooltip-text" translatable="yes"></property>
<property name="visible">True</property>
</object>
diff --git a/src/scan_dialog.c b/src/scan_dialog.c
index 9ecfe7c..e4db63e 100644
--- a/src/scan_dialog.c
+++ b/src/scan_dialog.c
@@ -86,6 +86,7 @@ typedef struct
GtkWidget *capitalize_lower_radio;
GtkWidget *capitalize_first_radio;
GtkWidget *capitalize_first_style_radio;
+ GtkWidget *capitalize_none_radio;
GtkWidget *capitalize_roman_check;
GtkWidget *spaces_remove_radio;
@@ -2439,21 +2440,39 @@ create_scan_dialog (EtScanDialog *self)
priv->convert_to_entry, "text", G_SETTINGS_BIND_DEFAULT);
/* Group: capitalize, ... */
- g_settings_bind (MainSettings, "process-uppercase-all",
- priv->capitalize_all_radio, "active",
- G_SETTINGS_BIND_DEFAULT);
- g_settings_bind (MainSettings, "process-lowercase-all",
- priv->capitalize_lower_radio, "active",
- G_SETTINGS_BIND_DEFAULT);
- g_settings_bind (MainSettings, "process-uppercase-first-letter",
- priv->capitalize_first_radio, "active",
- G_SETTINGS_BIND_DEFAULT);
- g_settings_bind (MainSettings, "process-uppercase-first-letters",
- priv->capitalize_first_style_radio, "active",
- G_SETTINGS_BIND_DEFAULT);
g_settings_bind (MainSettings, "process-detect-roman-numerals",
priv->capitalize_roman_check, "active",
G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind_with_mapping (MainSettings, "process-capitalize",
+ priv->capitalize_all_radio, "active",
+ G_SETTINGS_BIND_DEFAULT,
+ et_settings_enum_radio_get,
+ et_settings_enum_radio_set,
+ priv->capitalize_all_radio, NULL);
+ g_settings_bind_with_mapping (MainSettings, "process-capitalize",
+ priv->capitalize_lower_radio, "active",
+ G_SETTINGS_BIND_DEFAULT,
+ et_settings_enum_radio_get,
+ et_settings_enum_radio_set,
+ priv->capitalize_lower_radio, NULL);
+ g_settings_bind_with_mapping (MainSettings, "process-capitalize",
+ priv->capitalize_first_radio, "active",
+ G_SETTINGS_BIND_DEFAULT,
+ et_settings_enum_radio_get,
+ et_settings_enum_radio_set,
+ priv->capitalize_first_radio, NULL);
+ g_settings_bind_with_mapping (MainSettings, "process-capitalize",
+ priv->capitalize_first_style_radio, "active",
+ G_SETTINGS_BIND_DEFAULT,
+ et_settings_enum_radio_get,
+ et_settings_enum_radio_set,
+ priv->capitalize_first_style_radio, NULL);
+ g_settings_bind_with_mapping (MainSettings, "process-capitalize",
+ priv->capitalize_none_radio, "active",
+ G_SETTINGS_BIND_DEFAULT,
+ et_settings_enum_radio_get,
+ et_settings_enum_radio_set,
+ priv->capitalize_none_radio, NULL);
/* Group: insert/remove spaces */
g_settings_bind (MainSettings, "process-remove-spaces",
@@ -2874,6 +2893,8 @@ et_scan_dialog_class_init (EtScanDialogClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, EtScanDialog,
capitalize_first_style_radio);
gtk_widget_class_bind_template_child_private (widget_class, EtScanDialog,
+ capitalize_none_radio);
+ gtk_widget_class_bind_template_child_private (widget_class, EtScanDialog,
capitalize_roman_check);
gtk_widget_class_bind_template_child_private (widget_class, EtScanDialog,
spaces_remove_radio);
diff --git a/src/setting.h b/src/setting.h
index c6f8169..4451504 100644
--- a/src/setting.h
+++ b/src/setting.h
@@ -125,6 +125,16 @@ typedef enum
ET_FILENAME_EXTENSION_NO_CHANGE
} EtFilenameExtensionMode;
+/* Scanner dialog process fields capitalization options. */
+typedef enum
+{
+ ET_PROCESS_CAPITALIZE_ALL_UP,
+ ET_PROCESS_CAPITALIZE_ALL_DOWN,
+ ET_PROCESS_CAPITALIZE_FIRST_LETTER_UP,
+ ET_PROCESS_CAPITALIZE_FIRST_WORDS_UP,
+ ET_PROCESS_CAPITALIZE_NO_CHANGE
+} EtProcessCapitalize;
+
/* Tag fields to process in the scanner. */
typedef enum
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]