Skip to content

Commit

Permalink
- gui: added "Backward" and "Forward" buttons for navigating the hist…
Browse files Browse the repository at this point in the history
…ory.
  • Loading branch information
trizen committed Apr 3, 2024
1 parent bd053b0 commit b493ced
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 14 deletions.
2 changes: 2 additions & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ share/icons/default_thumb.jpg
share/icons/feed.png
share/icons/feed_gray.png
share/icons/gtk-youtube-viewer.png
share/icons/left_arrow.png
share/icons/right_arrow.png
share/icons/user.png
t/00-load.t
t/kwalitee.t
Expand Down
16 changes: 14 additions & 2 deletions bin/gtk-youtube-viewer
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,9 @@ my $feed_icon_pixbuf = 'Gtk3::Gdk::Pixbuf'->new_from_file_at_size(catfile($
my $feed_icon_gray_pixbuf = 'Gtk3::Gdk::Pixbuf'->new_from_file_at_size(catfile($icons_path, "feed_gray.png"), 16, 16);
my $default_thumb = 'Gtk3::Gdk::Pixbuf'->new_from_file_at_size(catfile($icons_path, "default_thumb.jpg"), 160, 90);

my $left_arrow_pixbuf = 'Gtk3::Gdk::Pixbuf'->new_from_file_at_size(catfile($icons_path, "left_arrow.png"), 24, 24);
my $right_arrow_pixbuf = 'Gtk3::Gdk::Pixbuf'->new_from_file_at_size(catfile($icons_path, "right_arrow.png"), 24, 24);

# Setting application title and icon
$mainw->set_title("$appname $version");
$mainw->set_icon($app_icon_pixbuf);
Expand Down Expand Up @@ -1109,6 +1112,8 @@ sub new_image_from_pixbuf {
$gui->get_object('button6')->set_image(new_image_from_pixbuf('icon_from_pixbuf', $feed_icon_pixbuf));
$gui->get_object('subscription_videos')->set_image(new_image_from_pixbuf('icon_from_pixbuf', $feed_icon_pixbuf));
$gui->get_object('subscription_videos_button')->set_image(new_image_from_pixbuf('icon_from_pixbuf', $feed_icon_gray_pixbuf));
$gui->get_object('left_button_image')->set_from_pixbuf($left_arrow_pixbuf);
$gui->get_object('right_button_image')->set_from_pixbuf($right_arrow_pixbuf);
#>>>
}

Expand Down Expand Up @@ -4134,8 +4139,15 @@ sub display_relative_results {
}

sub set_prev_next_results_sensitivity {
$gui->get_object('show_prev_results')->set_sensitive($ResultsHistory{current} > 0);
$gui->get_object('show_next_results')->set_sensitive($ResultsHistory{current} < $#{$ResultsHistory{results}});

my $prev_sensitivity = $ResultsHistory{current} > 0;
my $next_sensitivity = $ResultsHistory{current} < $#{$ResultsHistory{results}};

$gui->get_object('show_prev_results')->set_sensitive($prev_sensitivity);
$gui->get_object('show_next_results')->set_sensitive($next_sensitivity);

$gui->get_object('show_prev_results_button')->set_sensitive($prev_sensitivity);
$gui->get_object('show_next_results_button')->set_sensitive($next_sensitivity);
}

sub show_videos_from_selected_author {
Expand Down
2 changes: 1 addition & 1 deletion bin/youtube-viewer
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ use 5.016;
use warnings;
no warnings 'once';

use Term::ReadLine qw();
use File::Spec::Functions qw(
catdir
catfile
Expand Down Expand Up @@ -91,7 +92,6 @@ my $version = $WWW::YoutubeViewer::VERSION;
my $execname = 'youtube-viewer';

# A better <STDIN> support:
require Term::ReadLine;
my $term = Term::ReadLine->new("$appname $version");

sub VIDEO_PART () { 'contentDetails,statistics,snippet' }
Expand Down
65 changes: 54 additions & 11 deletions share/gtk3-youtube-viewer.glade
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.40.0
<!-- Generated with glade 3.40.0
Copyright (C) Copyright © 2010-2024 Trizen
Expand Down Expand Up @@ -192,6 +192,11 @@ Author: Trizen https://github.com/trizen
<property name="can-focus">False</property>
<property name="stock">gtk-index</property>
</object>
<object class="GtkImage" id="left_button_image">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="stock">gtk-missing-image</property>
</object>
<object class="GtkListStore" id="liststore1">
<columns>
<!-- column-name name -->
Expand Down Expand Up @@ -266,6 +271,11 @@ Author: Trizen https://github.com/trizen
<column type="gchararray"/>
</columns>
</object>
<object class="GtkImage" id="right_button_image">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="stock">gtk-missing-image</property>
</object>
<object class="GtkImage" id="terminal_icon2">
<property name="visible">True</property>
<property name="can-focus">False</property>
Expand Down Expand Up @@ -500,21 +510,35 @@ Author: Trizen https://github.com/trizen
<property name="can-focus">False</property>
<property name="border-width">4</property>
<child>
<object class="GtkSearchEntry" id="search_entry">
<object class="GtkButton" id="show_prev_results_button">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="buffer">entrybuffer1</property>
<property name="activates-default">True</property>
<property name="caps-lock-warning">False</property>
<signal name="activate" handler="search" swapped="no"/>
<signal name="icon-press" handler="search_or_focus" swapped="no"/>
<property name="can-focus">False</property>
<property name="receives-default">True</property>
<property name="image">left_button_image</property>
<signal name="clicked" handler="display_previous_results" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">5</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="show_next_results_button">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="receives-default">True</property>
<property name="image">right_button_image</property>
<signal name="clicked" handler="display_next_results" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">5</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButtonBox" id="hbuttonbox6">
<property name="visible">True</property>
Expand All @@ -532,6 +556,7 @@ Author: Trizen https://github.com/trizen
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack-type">end</property>
<property name="position">0</property>
</packing>
</child>
Expand All @@ -540,7 +565,25 @@ Author: Trizen https://github.com/trizen
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">14</property>
<property name="position">1</property>
<property name="pack-type">end</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkSearchEntry" id="search_entry">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="buffer">entrybuffer1</property>
<property name="activates-default">True</property>
<property name="caps-lock-warning">False</property>
<signal name="activate" handler="search" swapped="no"/>
<signal name="icon-press" handler="search_or_focus" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
Expand Down
Binary file added share/icons/left_arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added share/icons/right_arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b493ced

Please sign in to comment.