[easytag/wip/musicbrainz-support-merge: 25/75] Check before setting SearchEntryField



commit 1a1e4089f7552d921d7670e01e5fdfbccea84cc2
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 7543b78..8be43a7 100755
--- a/src/musicbrainz_dialog.c
+++ b/src/musicbrainz_dialog.c
@@ -464,15 +464,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]