[easytag] Add a setting to disable automatic image types



commit 9810819b5442428520dfee21fb5ede5188fb4112
Author: David King <amigadave amigadave com>
Date:   Thu Oct 23 00:12:33 2014 +0100

    Add a setting to disable automatic image types
    
    The heuristic for selecting the type of an image based on the filename
    can get confused quite easily, so provide an option to disable it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=738804

 data/org.gnome.EasyTAG.gschema.xml |    6 ++++++
 data/preferences_dialog.ui         |    8 ++++++++
 src/preferences_dialog.c           |    6 ++++++
 src/tag_area.c                     |   12 ++++++++++--
 4 files changed, 30 insertions(+), 2 deletions(-)
---
diff --git a/data/org.gnome.EasyTAG.gschema.xml b/data/org.gnome.EasyTAG.gschema.xml
index c007a7d..b589e34 100644
--- a/data/org.gnome.EasyTAG.gschema.xml
+++ b/data/org.gnome.EasyTAG.gschema.xml
@@ -327,6 +327,12 @@
       <range min="0" max="6" />
     </key>
 
+    <key name="tag-image-type-automatic" type="b">
+      <summary>Automatically select the type of the image based on its filename</summary>
+      <description>Whether to, when adding cover art, automatically select the type for an image based on 
its filename</description>
+      <default>true</default>
+    </key>
+
     <key name="tag-number-padded" type="b">
       <summary>Pad the track number tag field</summary>
       <description>Whether the track number tag field should be padded with leading zeroes</description>
diff --git a/data/preferences_dialog.ui b/data/preferences_dialog.ui
index 5e2a372..8bd44fa 100644
--- a/data/preferences_dialog.ui
+++ b/data/preferences_dialog.ui
@@ -368,6 +368,14 @@
                     </object>
                 </child>
                 <child>
+                    <object class="GtkCheckButton" id="tags_auto_image_type_check">
+                        <property name="label" translatable="yes">Automatically select the type of the image 
based on its filename</property>
+                        <property name="margin-left">12</property>
+                        <property name="tooltip-text" translatable="yes">Whether to, when adding cover art, 
automatically select a type for an image based on its filename</property>
+                        <property name="visible">True</property>
+                    </object>
+                </child>
+                <child>
                     <object class="GtkCheckButton" id="tags_preserve_focus_check">
                         <property name="label" translatable="yes">Preserve the tag field focus</property>
                         <property name="margin-left">12</property>
diff --git a/src/preferences_dialog.c b/src/preferences_dialog.c
index d8f5dc5..e657c1b 100644
--- a/src/preferences_dialog.c
+++ b/src/preferences_dialog.c
@@ -229,6 +229,7 @@ create_preferences_dialog (EtPreferencesDialog *self)
     GtkWidget *FilenameCharacterSetApproximate;
     GtkWidget *FilenameCharacterSetDiscard;
     GtkWidget *DateAutoCompletion;
+    GtkWidget *widget;
     GtkWidget *NumberTrackFormated;
     GtkWidget *NumberTrackFormatedSpinButton;
     GtkWidget *pad_disc_number;
@@ -486,6 +487,11 @@ create_preferences_dialog (EtPreferencesDialog *self)
     g_settings_bind (MainSettings, "tag-date-autocomplete", DateAutoCompletion,
                      "active", G_SETTINGS_BIND_DEFAULT);
 
+    widget = GTK_WIDGET (gtk_builder_get_object (builder,
+                                                 "tags_auto_image_type_check"));
+    g_settings_bind (MainSettings, "tag-image-type-automatic", widget,
+                     "active", G_SETTINGS_BIND_DEFAULT);
+
     /* Track formatting. */
     NumberTrackFormated = GTK_WIDGET (gtk_builder_get_object (builder,
                                                               "tags_track_check"));
diff --git a/src/tag_area.c b/src/tag_area.c
index 83fb517..079f9b6 100644
--- a/src/tag_area.c
+++ b/src/tag_area.c
@@ -1432,9 +1432,17 @@ load_picture_from_file (GFile *file,
             case APE_TAG:
             case FLAC_TAG:
             case WAVPACK_TAG:
-                // By default, set the filename in the description
                 pic->description = g_strdup (filename_utf8);
-                pic->type = et_picture_type_from_filename (pic->description);
+
+                if (g_settings_get_boolean (MainSettings,
+                                            "tag-image-type-automatic"))
+                {
+                    pic->type = et_picture_type_from_filename (pic->description);
+                }
+                else
+                {
+                    pic->type = ET_PICTURE_TYPE_FRONT_COVER;
+                }
                 break;
 
             default:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]