[rhythmbox] podcast: check if the parsed channel is currently selected before updating info bar
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox] podcast: check if the parsed channel is currently selected before updating info bar
- Date: Tue, 1 Jun 2021 11:59:14 +0000 (UTC)
commit 8bd271bd7ba992513e4216e6fcf89b396213035c
Author: crvi <crvisqr gmail com>
Date: Wed Mar 17 14:56:33 2021 +0530
podcast: check if the parsed channel is currently selected before updating info bar
This is to avoid updating info bar with status from previously
selected feeds whose callbacks were invoked after the feed selection
changed to a different feed.
podcast/rb-podcast-add-dialog.c | 36 ++++++++++++++++++++++++++----------
1 file changed, 26 insertions(+), 10 deletions(-)
---
diff --git a/podcast/rb-podcast-add-dialog.c b/podcast/rb-podcast-add-dialog.c
index fa7380d2a..a87883aad 100644
--- a/podcast/rb-podcast-add-dialog.c
+++ b/podcast/rb-podcast-add-dialog.c
@@ -292,6 +292,7 @@ static void
parse_cb (RBPodcastChannel *channel, GError *error, gpointer user_data)
{
ParseData *data = user_data;
+ gboolean is_selected_channel = FALSE;
g_assert (channel == data->channel);
@@ -303,14 +304,18 @@ parse_cb (RBPodcastChannel *channel, GError *error, gpointer user_data)
return;
}
- if (error != NULL) {
- 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.");
- }
+ /* get selected feed if any */
+ if (data->dialog->priv->have_selection) {
+ RBPodcastChannel *selected_channel;
+ gtk_tree_model_get (GTK_TREE_MODEL (data->dialog->priv->feed_model),
+ &data->dialog->priv->selected_feed,
+ FEED_COLUMN_PARSED_FEED, &selected_channel,
+ -1);
+ if (channel == selected_channel)
+ is_selected_channel = TRUE;
+ }
+ if (error != NULL) {
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
@@ -319,10 +324,21 @@ parse_cb (RBPodcastChannel *channel, GError *error, gpointer user_data)
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);
+ if (is_selected_channel) {
+ 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.");
+ }
+
+ 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);
+ if (is_selected_channel) {
+ gtk_widget_hide (data->dialog->priv->info_bar);
+ }
}
if (data->channel->is_opml) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]