[rhythmbox] podcast: use more appropriate error message and title for empty feeds



commit 9d92594d56f839f6df4b1c4f44bb907ba8b9e407
Author: crvi <crvisqr gmail com>
Date:   Mon Mar 8 01:15:50 2021 +0530

    podcast: use more appropriate error message and title for empty feeds
    
    Currently we display "Unable to load the feed. Check your network
    connection." in info bar for feeds with no items. Instead, we now
    display a more appropriate "The feed does not contain any downloadable
    items" ( translated ) error message in info bar.
    
    Also, currently we display the feed URL as title in search results for
    feeds with no items, when in fact a valid feed title might be
    available. So, we use the title rather than the URL in that case.
    
    Closes: #1690

 podcast/rb-podcast-add-dialog.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/podcast/rb-podcast-add-dialog.c b/podcast/rb-podcast-add-dialog.c
index 7f2b1c31d..411710c71 100644
--- a/podcast/rb-podcast-add-dialog.c
+++ b/podcast/rb-podcast-add-dialog.c
@@ -304,12 +304,22 @@ parse_cb (RBPodcastChannel *channel, GError *error, gpointer user_data)
        }
 
        if (error != NULL) {
-               /* fake up a channel with just the url as the title, allowing the user
-                * to subscribe to the podcast anyway.
-                */
-               channel->title = g_strdup (channel->url);
-               gtk_label_set_label (GTK_LABEL (data->dialog->priv->info_bar_message),
-                                    _("Unable to load the feed. Check your network connection."));
+               const char *message;
+               if (g_error_matches (error, RB_PODCAST_PARSE_ERROR, RB_PODCAST_PARSE_ERROR_NO_ITEMS)) {
+                       message = error->message;
+               } else {
+                       message = _("Unable to load the feed. Check your network connection.");
+               }
+
+               if (channel->title == NULL || channel->title[0] == '\0') {
+                       /* fake up a channel with just the url as the
+                        * title, allowing the user to subscribe to
+                        * the podcast anyway.
+                        */
+                       channel->title = g_strdup (channel->url);
+               }
+
+               gtk_label_set_label (GTK_LABEL (data->dialog->priv->info_bar_message), message);
                gtk_widget_show (data->dialog->priv->info_bar);
        } else {
                gtk_widget_hide (data->dialog->priv->info_bar);


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