[easytag/wip/musicbrainz-support] Check before setting SearchEntryField



commit 2744482b4b5011fe98f1ec1a02a7f1cc380a11ee
Author: Abhinav <abhijangda hotmail com>
Date:   Thu Jun 26 00:18:02 2014 +0530

    Check before setting SearchEntryField

 src/musicbrainz_dialog.c |   30 +++++++++++++++++++++++++++---
 1 files changed, 27 insertions(+), 3 deletions(-)
---
diff --git a/src/musicbrainz_dialog.c b/src/musicbrainz_dialog.c
index c6a471f..f0d7964 100755
--- a/src/musicbrainz_dialog.c
+++ b/src/musicbrainz_dialog.c
@@ -465,15 +465,39 @@ bt_selected_find_clicked (GtkWidget *widget, gpointer user_data)
 
     if (type == MB_ENTITY_KIND_ARTIST)
     {
-        gtk_entry_set_text (GTK_ENTRY (entry), file_tag->artist);
+        if (file_tag->artist && *(file_tag->artist))
+        {
+            gtk_entry_set_text (GTK_ENTRY (entry), file_tag->artist);
+        }
+        else
+        {
+            gtk_statusbar_push (GTK_STATUSBAR (gtk_builder_get_object (builder, "statusbar")),
+                        0, _("Artist of current file is not set"));
+        }
     }
     else if (type == MB_ENTITY_KIND_ALBUM)
     {
-        gtk_entry_set_text (GTK_ENTRY (entry), file_tag->album);
+        if (file_tag->album && *(file_tag->album))
+        {
+            gtk_entry_set_text (GTK_ENTRY (entry), file_tag->album);
+        }
+        else
+        {
+            gtk_statusbar_push (GTK_STATUSBAR (gtk_builder_get_object (builder, "statusbar")),
+                        0, _("Album of current file is not set"));
+        }
     }
     else if (type == MB_ENTITY_KIND_TRACK)
     {
-        gtk_entry_set_text (GTK_ENTRY (entry), file_tag->title);
+        if (file_tag->title && *(file_tag->title))
+        {
+            gtk_entry_set_text (GTK_ENTRY (entry), file_tag->title);
+        }
+        else
+        {
+            gtk_statusbar_push (GTK_STATUSBAR (gtk_builder_get_object (builder, "statusbar")),
+                        0, _("Track of current file is not set"));
+        }
     }
 
     btn_manual_find_clicked (NULL, NULL);


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