[easytag/wip/musicbrainz-support-merge: 23/69] Check before setting SearchEntryField



commit 9cc06ab0b5ea25ae9945837378b212b667073bf0
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 d5b9073..c66da87 100644
--- 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]