Skip to content

Commit

Permalink
Add local notification
Browse files Browse the repository at this point in the history
  • Loading branch information
Alain M committed Aug 5, 2019
1 parent 6c58afa commit c8395f7
Showing 5 changed files with 69 additions and 14 deletions.
6 changes: 3 additions & 3 deletions data/com.github.alainm23.byte.appdata.xml.in
Original file line number Diff line number Diff line change
@@ -33,10 +33,10 @@
<screenshot type="default">
<image>https://raw.githubusercontent.com/alainm23/byte/master/data/screenshot/screenshot-01.png</image>
</screenshot>
<screenshot type="default">
<screenshot>
<image>https://raw.githubusercontent.com/alainm23/byte/master/data/screenshot/screenshot-02.png</image>
</screenshot>
<screenshot type="default">
<screenshot>
<image>https://raw.githubusercontent.com/alainm23/byte/master/data/screenshot/screenshot-03.png</image>
</screenshot>
</screenshots>
@@ -75,6 +75,6 @@
<custom>
<value key="x-appcenter-color-primary">#333333</value>
<value key="x-appcenter-color-primary-text">#FE2851</value>
<value key="x-appcenter-suggested-price">6</value>
<value key="x-appcenter-suggested-price">3</value>
</custom>
</component>
18 changes: 18 additions & 0 deletions data/stylesheet.css
Original file line number Diff line number Diff line change
@@ -395,3 +395,21 @@ overshoot.left {
animation: spin 1000ms linear infinite;
color: @colorAccent
}

/*
Animations
*/

@keyframes fancy_turn {
0% { -gtk-icon-transform: rotate(0deg); }
20% { -gtk-icon-transform: rotate(-30deg); }
40% { -gtk-icon-transform: rotate(0deg); }
80% { -gtk-icon-transform: rotate(30deg); }
100% { -gtk-icon-transform: rotate(0deg); }
}

.active {
animation-name: fancy_turn;
animation-duration: 0.7s;
animation-timing-function: ease-in-out;
}
2 changes: 1 addition & 1 deletion src/Views/Radios.vala
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ public class Views.Radios : Gtk.EventBox {

var internet_radio_button = new Gtk.Button.from_icon_name ("internet-radio-symbolic", Gtk.IconSize.MENU);
internet_radio_button.can_focus = false;
internet_radio_button.tooltip_text = _("Search radio on internet");
internet_radio_button.tooltip_text = _("Search internet radios");
internet_radio_button.margin = 6;
internet_radio_button.get_style_context ().add_class (Gtk.STYLE_CLASS_FLAT);
internet_radio_button.get_style_context ().add_class ("label-color-primary");
55 changes: 46 additions & 9 deletions src/Widgets/Queue.vala
Original file line number Diff line number Diff line change
@@ -48,7 +48,44 @@ public class Widgets.Queue : Gtk.Revealer {
var top_eventbox = new Gtk.EventBox ();
top_eventbox.add (next_track_grid);

// Sync
/*
Notifications
*/

var notification_image = new Gtk.Image ();
notification_image.gicon = new ThemedIcon ("notification-symbolic");
notification_image.pixel_size = 24;
notification_image.margin_top = 1;
notification_image.valign = Gtk.Align.CENTER;
notification_image.halign = Gtk.Align.CENTER;
notification_image.get_style_context ().add_class ("label-color-primary");

var notification_primary_label = new Gtk.Label (null);
notification_primary_label.margin_start = 6;
notification_primary_label.valign = Gtk.Align.END;
notification_primary_label.halign = Gtk.Align.START;
notification_primary_label.use_markup = true;
notification_primary_label.get_style_context ().add_class ("label-color-primary");
notification_primary_label.get_style_context ().add_class ("font-bold");

var notification_secondary_label = new Gtk.Label (null);
notification_secondary_label.margin_start = 6;
notification_secondary_label.valign = Gtk.Align.START;
notification_secondary_label.halign = Gtk.Align.START;
notification_secondary_label.use_markup = true;
notification_secondary_label.max_width_chars = 31;
notification_secondary_label.ellipsize = Pango.EllipsizeMode.END;

var notification_grid = new Gtk.Grid ();
notification_grid.margin_start = 6;
notification_grid.column_spacing = 3;
notification_grid.attach (notification_image, 0, 0, 1, 2);
notification_grid.attach (notification_primary_label, 1, 0, 1, 1);
notification_grid.attach (notification_secondary_label, 1, 1, 1, 1);

/*
Sync
*/

var sync_image = new Gtk.Image ();
sync_image.gicon = new ThemedIcon ("emblem-synchronizing-symbolic");
@@ -82,10 +119,11 @@ public class Widgets.Queue : Gtk.Revealer {

var top_stack = new Gtk.Stack ();
top_stack.expand = true;
top_stack.transition_type = Gtk.StackTransitionType.CROSSFADE;
top_stack.transition_type = Gtk.StackTransitionType.SLIDE_DOWN;

top_stack.add_named (top_eventbox, "top_eventbox");
top_stack.add_named (sync_grid, "sync_grid");
top_stack.add_named (notification_grid, "notification_grid");

var top_revealer = new Gtk.Revealer ();
top_revealer.transition_type = Gtk.RevealerTransitionType.SLIDE_DOWN;
@@ -338,23 +376,22 @@ public class Widgets.Queue : Gtk.Revealer {
});
});

/*
Byte.database.updated_track_favorite.connect ((track, favorite) => {
if (favorite == 1) {
string old_text = next_track_name.label;
top_stack.visible_child_name = "notification_grid";

next_track_label.label = _("Add Favorite");
next_track_name.label = track.title;
notification_primary_label.label = "<small>Add Favorite</small>";
notification_secondary_label.label = track.title;
notification_image.get_style_context ().add_class ("active");

Timeout.add (1000, () => {
next_track_label.label = _("Next track");
next_track_name.label = old_text;
top_stack.visible_child_name = "top_eventbox";
notification_image.get_style_context ().remove_class ("active");

return false;
});
}
});
*/

Byte.scan_service.sync_started.connect (() => {
top_stack.visible_child_name = "sync_grid";
2 changes: 1 addition & 1 deletion src/Widgets/RadioRow.vala
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ public class Widgets.RadioRow : Gtk.ListBoxRow {
}

construct {
get_style_context ().add_class ("track-row");
get_style_context ().add_class ("album-row");
tooltip_text = radio.name;

var playing_icon = new Gtk.Image ();

0 comments on commit c8395f7

Please sign in to comment.