diff --git a/client/src/activities_view.vala b/client/src/activities_view.vala index f1b4240..a65d665 100644 --- a/client/src/activities_view.vala +++ b/client/src/activities_view.vala @@ -1,38 +1,27 @@ namespace StudySystemClient { - public class ActivitiesView : Gtk.Box { + public class ActivitiesView : CardArea { private Client client; - private RefreshingIndicator refreshing_indicator; - private CardArea card_area; public ActivitiesView(Client client) { + base(); + this.client = client; - card_area = new CardArea(); - - var overlay = new Gtk.Overlay(); - overlay.hexpand = overlay.vexpand = true; - overlay.set_child(card_area); - this.append(overlay); - - refreshing_indicator = new RefreshingIndicator(overlay); - this.map.connect(refresh); } private async void refresh() { - refreshing_indicator.show(); try { var activities = yield client.list_activities(); - card_area.clear(); + clear(); foreach (var activity in activities) { var card = new ActivityCard(activity); card.session_logged.connect(log_session); - card_area.add(card); + add(card); } } catch (ClientError e) { stderr.printf("Error refreshing activities: %s\n", e.message); } - refreshing_indicator.hide(); } private async void log_session(string subject, ActivityType type, @@ -45,42 +34,4 @@ namespace StudySystemClient { } } } - - private class RefreshingIndicator { - private Gtk.Overlay overlay; - private Gtk.Frame frame; - - public RefreshingIndicator(Gtk.Overlay overlay) { - this.overlay = overlay; - - var label = new Gtk.Label("Refreshing"); - label.halign = Gtk.Align.START; - - var spinner = new Gtk.Spinner(); - spinner.start(); - - var content = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 6); - content.margin_top = content.margin_bottom - = content.margin_start = content.margin_end = 12; - content.append(label); - content.append(spinner); - - frame = new Gtk.Frame(null); - frame.halign = Gtk.Align.CENTER; - frame.valign = Gtk.Align.START; - frame.add_css_class("osd"); - frame.add_css_class("popdown"); - frame.set_child(content); - - overlay.add_overlay(frame); - } - - public void show() { - frame.add_css_class("visible"); - } - - public void hide() { - frame.remove_css_class("visible"); - } - } } diff --git a/client/styles.css b/client/styles.css index d799846..ec54a54 100644 --- a/client/styles.css +++ b/client/styles.css @@ -27,20 +27,3 @@ margin-top: -2px; margin-left: 3px; } - -/* - * Couldn't find a built-in way to get the common OSD overlay style of - * rounding the bottom corners but not the top ones, so doing this - * myself with this CSS rule. - */ -overlay > frame.osd { - border-radius: 0 0 8px 8px; -} - -.popdown { - transition: transform 200ms ease-in-out; - transform: translateY(-100px); -} -.popdown.visible { - transform: translateY(0); -}