Skip to content

Commit

Permalink
- GUI: also clear the results lists when loading results from the nex…
Browse files Browse the repository at this point in the history
…t page (and config-option `clear_search_list` is set to 1).
  • Loading branch information
trizen committed Jul 22, 2021
1 parent 72de10b commit 7b93f28
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions bin/gtk-youtube-viewer
Original file line number Diff line number Diff line change
Expand Up @@ -2365,7 +2365,6 @@ sub popular_uploads {
my $results = $yv_obj->popular_videos($channel);

if ($yv_utils->has_entries($results)) {
$liststore->clear if $CONFIG{clear_search_list};
display_results($results);
}
else {
Expand Down Expand Up @@ -2416,7 +2415,6 @@ sub popular_uploads {
);

if ($yv_utils->has_entries($request)) {
$liststore->clear if $CONFIG{clear_search_list};
display_results($request);
}
else {
Expand Down Expand Up @@ -2483,8 +2481,6 @@ sub search {

return if check_keywords($keywords);

$liststore->clear if $CONFIG{clear_search_list};

# Remember the input text when "history" is enabled
if ($CONFIG{history}) {
append_to_history($keywords, 1);
Expand Down Expand Up @@ -2642,7 +2638,7 @@ sub append_next_page {

$liststore->set(
$iter,
0 => "<big><b>LOAD MORE</b></big>",
0 => "<big><b>NEXT PAGE</b></big>",
3 => $url,
5 => $token,
7 => 'next_page',
Expand Down Expand Up @@ -2881,12 +2877,10 @@ sub get_watched_video_results {
}

sub display_watched_videos {
$liststore->clear if $CONFIG{clear_search_list};
display_results(get_watched_video_results());
}

sub display_subscription_videos {
$liststore->clear if $CONFIG{clear_search_list};
display_results(get_subscription_video_results());
}

Expand All @@ -2897,6 +2891,8 @@ sub display_results {
die "No results...\n";
}

$liststore->clear if $CONFIG{clear_search_list};

add_results_to_history($results) if not $from_history;

my $url = $results->{url};
Expand Down Expand Up @@ -3354,7 +3350,6 @@ sub list_playlist {

my $results = $yv_obj->videos_from_playlist_id($playlist_id);
if ($yv_utils->has_entries($results)) {
$liststore->clear if $CONFIG{clear_search_list};
display_results($results);
return 1;
}
Expand All @@ -3370,7 +3365,6 @@ sub list_channel_videos {
my $results = $yv_obj->uploads($channel_id);

if ($yv_utils->has_entries($results)) {
$liststore->clear if $CONFIG{clear_search_list};
display_results($results);
return 1;
}
Expand All @@ -3386,7 +3380,6 @@ sub list_username_videos {
my $results = $yv_obj->uploads_from_username($username);

if ($yv_utils->has_entries($results)) {
$liststore->clear if $CONFIG{clear_search_list};
display_results($results);
return 1;
}
Expand All @@ -3402,7 +3395,6 @@ sub list_channel_playlists {
my $results = $yv_obj->playlists($channel_id);

if ($yv_utils->has_entries($results)) {
$liststore->clear if $CONFIG{clear_search_list};
display_results($results);
return 1;
}
Expand All @@ -3418,7 +3410,6 @@ sub list_username_playlists {
my $results = $yv_obj->playlists_from_username($username);

if ($yv_utils->has_entries($results)) {
$liststore->clear if $CONFIG{clear_search_list};
display_results($results);
return 1;
}
Expand Down Expand Up @@ -3640,7 +3631,6 @@ sub list_category {
: $yv_obj->videos_from_category($cat_id);

if ($yv_utils->has_entries($videos)) {
$liststore->clear if $CONFIG{clear_search_list};
display_results($videos);
}
else {
Expand All @@ -3663,7 +3653,6 @@ sub list_local_playlist {
@video_ids = reverse(@video_ids);
}

$liststore->clear if $CONFIG{clear_search_list};
display_results(get_results_from_list(ids => \@video_ids));
}

Expand Down Expand Up @@ -3857,7 +3846,6 @@ sub show_related_videos {

my $results = $yv_obj->related_to_videoID($video_id);
if ($yv_utils->has_entries($results)) {
$liststore->clear if $CONFIG{clear_search_list};
display_results($results);
}
else {
Expand Down Expand Up @@ -4029,7 +4017,6 @@ sub display_next_results {

sub display_relative_results {
my ($nth_item) = @_;
$liststore->clear if $CONFIG{clear_search_list};
my $results_copy = $ResultsHistory{results}[$nth_item];
display_results($results_copy, 1);
set_prev_next_results_sensitivity();
Expand All @@ -4047,7 +4034,6 @@ sub show_videos_from_selected_author {
sub show_playlists_from_selected_author {
my $request = $yv_obj->playlists(get_channel_id_for_selected_video() || return);
if ($yv_utils->has_entries($request)) {
$liststore->clear if $CONFIG{clear_search_list};
display_results($request);
}
else {
Expand Down

0 comments on commit 7b93f28

Please sign in to comment.