Add direct timeline
This commit is contained in:
parent
68757c7d8e
commit
ef2b9f55fb
|
@ -55,6 +55,7 @@ executable(
|
||||||
'src/Views/LocalView.vala',
|
'src/Views/LocalView.vala',
|
||||||
'src/Views/FederatedView.vala',
|
'src/Views/FederatedView.vala',
|
||||||
'src/Views/NotificationsView.vala',
|
'src/Views/NotificationsView.vala',
|
||||||
|
'src/Views/DirectView.vala',
|
||||||
'src/Views/StatusView.vala',
|
'src/Views/StatusView.vala',
|
||||||
'src/Views/AccountView.vala',
|
'src/Views/AccountView.vala',
|
||||||
'src/Views/FollowersView.vala',
|
'src/Views/FollowersView.vala',
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
public class Tootle.DirectView : TimelineView {
|
||||||
|
|
||||||
|
public DirectView () {
|
||||||
|
base ("direct");
|
||||||
|
notificator = new Notificator (get_stream ());
|
||||||
|
notificator.status_added.connect ((ref status) => {
|
||||||
|
if (settings.live_updates)
|
||||||
|
on_status_added (ref status);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string get_icon () {
|
||||||
|
return "mail-send-symbolic";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string get_name () {
|
||||||
|
return _("Direct Messages");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Soup.Message get_stream () {
|
||||||
|
var url = "%s/api/v1/streaming/?stream=direct&access_token=%s".printf (accounts.formal.instance, accounts.formal.token);
|
||||||
|
return new Soup.Message("GET", url);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -11,6 +11,7 @@ public class Tootle.AccountsButton : Gtk.MenuButton{
|
||||||
Gtk.ModelButton item_refresh;
|
Gtk.ModelButton item_refresh;
|
||||||
Gtk.ModelButton item_search;
|
Gtk.ModelButton item_search;
|
||||||
Gtk.ModelButton item_favs;
|
Gtk.ModelButton item_favs;
|
||||||
|
Gtk.ModelButton item_direct;
|
||||||
|
|
||||||
private class AccountView : Gtk.ListBoxRow{
|
private class AccountView : Gtk.ListBoxRow{
|
||||||
|
|
||||||
|
@ -68,6 +69,10 @@ public class Tootle.AccountsButton : Gtk.MenuButton{
|
||||||
item_favs = new Gtk.ModelButton ();
|
item_favs = new Gtk.ModelButton ();
|
||||||
item_favs.text = _("Favorites");
|
item_favs.text = _("Favorites");
|
||||||
item_favs.clicked.connect (() => window.open_view (new FavoritesView ()));
|
item_favs.clicked.connect (() => window.open_view (new FavoritesView ()));
|
||||||
|
|
||||||
|
item_direct = new Gtk.ModelButton ();
|
||||||
|
item_direct.text = _("Direct Messages");
|
||||||
|
item_direct.clicked.connect (() => window.open_view (new DirectView ()));
|
||||||
|
|
||||||
item_search = new Gtk.ModelButton ();
|
item_search = new Gtk.ModelButton ();
|
||||||
item_search.text = _("Search");
|
item_search.text = _("Search");
|
||||||
|
@ -83,10 +88,11 @@ public class Tootle.AccountsButton : Gtk.MenuButton{
|
||||||
grid.attach(list, 0, 1, 1, 1);
|
grid.attach(list, 0, 1, 1, 1);
|
||||||
grid.attach(item_separator, 0, 3, 1, 1);
|
grid.attach(item_separator, 0, 3, 1, 1);
|
||||||
grid.attach(item_favs, 0, 4, 1, 1);
|
grid.attach(item_favs, 0, 4, 1, 1);
|
||||||
grid.attach(new Gtk.Separator (Gtk.Orientation.HORIZONTAL), 0, 5, 1, 1);
|
grid.attach(item_direct, 0, 5, 1, 1);
|
||||||
grid.attach(item_refresh, 0, 6, 1, 1);
|
grid.attach(new Gtk.Separator (Gtk.Orientation.HORIZONTAL), 0, 6, 1, 1);
|
||||||
grid.attach(item_search, 0, 7, 1, 1);
|
grid.attach(item_refresh, 0, 7, 1, 1);
|
||||||
grid.attach(item_settings, 0, 8, 1, 1);
|
grid.attach(item_search, 0, 8, 1, 1);
|
||||||
|
grid.attach(item_settings, 0, 9, 1, 1);
|
||||||
grid.show_all ();
|
grid.show_all ();
|
||||||
|
|
||||||
menu = new Gtk.Popover (null);
|
menu = new Gtk.Popover (null);
|
||||||
|
|
Loading…
Reference in New Issue