diff --git a/data/ui/widgets/accounts_button.ui b/data/ui/widgets/accounts_button.ui index 47827d0..142cc1f 100644 --- a/data/ui/widgets/accounts_button.ui +++ b/data/ui/widgets/accounts_button.ui @@ -62,7 +62,7 @@ - + True True True diff --git a/data/ui/widgets/status.ui b/data/ui/widgets/status.ui index e603ffc..d7450b3 100644 --- a/data/ui/widgets/status.ui +++ b/data/ui/widgets/status.ui @@ -2,10 +2,15 @@ + + True + False + user-bookmarks-symbolic + True False - emblem-favorite-symbolic + non-starred-symbolic True @@ -52,45 +57,8 @@ False 8 8 - - - 0 - True - True - True - reblog_icon - True - - - - True - True - 0 - - - - - 0 - True - True - True - image2 - True - - - - True - True - 1 - - - 0 True True False @@ -100,6 +68,40 @@ + + True + True + 0 + + + + + True + True + True + reblog_icon + True + + + + True + True + 1 + + + + + True + True + True + image2 + True + + True True @@ -107,7 +109,44 @@ - + + True + True + True + image1 + none + True + + + + True + True + 3 + + + + + True + True + True + + + True + False + view-more-symbolic + + + + + + True + True + 4 + diff --git a/meson.build b/meson.build index a4280e7..3fd22de 100644 --- a/meson.build +++ b/meson.build @@ -77,7 +77,7 @@ executable( 'src/Views/Local.vala', 'src/Views/Federated.vala', 'src/Views/Notifications.vala', - 'src/Views/Direct.vala', + 'src/Views/Conversations.vala', 'src/Views/ExpandedStatus.vala', 'src/Views/Profile.vala', 'src/Views/Favorites.vala', diff --git a/src/API/Conversation.vala b/src/API/Conversation.vala new file mode 100644 index 0000000..e69de29 diff --git a/src/Views/Direct.vala b/src/Views/Conversations.vala similarity index 56% rename from src/Views/Direct.vala rename to src/Views/Conversations.vala index e79c69d..55c7c23 100644 --- a/src/Views/Direct.vala +++ b/src/Views/Conversations.vala @@ -1,9 +1,9 @@ -public class Tootle.Views.Direct : Views.Timeline { +public class Tootle.Views.Conversations : Views.Timeline { - public Direct () { + public Conversations () { Object ( - timeline: "direct", - label: _("Direct Messages"), + url: "/api/v1/conversations", + label: _("Conversations"), icon: "mail-send-symbolic" ); } diff --git a/src/Views/Favorites.vala b/src/Views/Favorites.vala index 96378de..1168fed 100644 --- a/src/Views/Favorites.vala +++ b/src/Views/Favorites.vala @@ -1,14 +1,9 @@ public class Tootle.Views.Favorites : Views.Timeline { public Favorites () { - Object (timeline: "favorites"); - } - - public override string get_url (){ - if (page_next != null) - return page_next; - - return @"/api/v1/favourites"; + Object ( + url: "/api/v1/favourites" + ); } } diff --git a/src/Views/Federated.vala b/src/Views/Federated.vala index 3f0ecf6..0b7f639 100644 --- a/src/Views/Federated.vala +++ b/src/Views/Federated.vala @@ -2,7 +2,7 @@ public class Tootle.Views.Federated : Views.Timeline { public Federated () { Object ( - timeline: "public", + url: "/api/v1/timelines/public", is_public: true, label: _("Federated"), icon: "network-workgroup-symbolic" diff --git a/src/Views/Hashtag.vala b/src/Views/Hashtag.vala index 15d91ef..9cd165e 100644 --- a/src/Views/Hashtag.vala +++ b/src/Views/Hashtag.vala @@ -1,11 +1,13 @@ public class Tootle.Views.Hashtag : Views.Timeline { public Hashtag (string tag) { - Object (timeline: @"tag/$tag"); + Object ( + url: @"/api/v1/timelines/tag/$tag" + ); } public override string? get_stream_url () { - var tag = timeline.substring (4); + var tag = url.substring (4); return account != null ? @"$(account.instance)/api/v1/streaming/?stream=hashtag&tag=$tag&access_token=$(account.token)" : null; } diff --git a/src/Views/Home.vala b/src/Views/Home.vala index 8e52fba..9a082e9 100644 --- a/src/Views/Home.vala +++ b/src/Views/Home.vala @@ -2,7 +2,7 @@ public class Tootle.Views.Home : Views.Timeline { public Home () { Object ( - timeline: "home", + url: "/api/v1/timelines/home", label: _("Home"), icon: "user-home-symbolic" ); diff --git a/src/Views/Notifications.vala b/src/Views/Notifications.vala index cd85883..407ff84 100644 --- a/src/Views/Notifications.vala +++ b/src/Views/Notifications.vala @@ -7,6 +7,7 @@ public class Tootle.Views.Notifications : Views.Timeline, IAccountListener, IStr public Notifications () { Object ( + url: "/api/v1/notifications", label: _("Notifications"), icon: Desktop.fallback_icon ("notification-symbolic", "preferences-system-notifications-symbolic", "user-invisible-symbolic") ); @@ -18,13 +19,6 @@ public class Tootle.Views.Notifications : Views.Timeline, IAccountListener, IStr return account != null ? @"$(account.instance)/api/v1/streaming/?stream=user&access_token=$(account.token)" : null; } - public override string get_url () { - if (page_next != null) - return page_next; - - return "/api/v1/notifications"; - } - public override void on_shown () { if (has_unread ()) { needs_attention = false; diff --git a/src/Views/Profile.vala b/src/Views/Profile.vala index 9be6f92..bb00d6d 100644 --- a/src/Views/Profile.vala +++ b/src/Views/Profile.vala @@ -138,7 +138,7 @@ public class Tootle.Views.Profile : Views.Timeline { relationship.label = label; } - public override string get_url () { + public override string get_req_url () { if (page_next != null) return page_next; diff --git a/src/Views/Timeline.vala b/src/Views/Timeline.vala index 8b7cb70..25a0a3e 100644 --- a/src/Views/Timeline.vala +++ b/src/Views/Timeline.vala @@ -3,14 +3,15 @@ using Gdk; public class Tootle.Views.Timeline : IAccountListener, IStreamListener, Views.Base { - public string timeline { get; construct set; } + public string url { get; construct set; } public bool is_public { get; construct set; default = false; } protected InstanceAccount? account = null; - protected bool is_last_page = false; - protected string? page_next; - protected string? page_prev; - protected string? stream; + + protected bool is_last_page { get; set; default = false; } + protected string? page_next { get; set; } + protected string? page_prev { get; set; } + protected string? stream = null; construct { app.refresh.connect (on_refresh); @@ -89,11 +90,11 @@ public class Tootle.Views.Timeline : IAccountListener, IStreamListener, Views.Ba is_last_page = page_prev != null & page_next == null; } - public virtual string get_url () { + public virtual string get_req_url () { if (page_next != null) return page_next; - return @"/api/v1/timelines/$timeline"; + return url; } public virtual Request append_params (Request req) { @@ -101,7 +102,7 @@ public class Tootle.Views.Timeline : IAccountListener, IStreamListener, Views.Ba } public virtual bool request () { - append_params (new Request.GET (get_url ())) + append_params (new Request.GET (get_req_url ())) .with_account (account) .then_parse_array ((node, msg) => { var obj = node.get_object (); diff --git a/src/Widgets/AccountsButton.vala b/src/Widgets/AccountsButton.vala index c63e0cb..09ae75e 100644 --- a/src/Widgets/AccountsButton.vala +++ b/src/Widgets/AccountsButton.vala @@ -61,7 +61,7 @@ public class Tootle.Widgets.AccountsButton : Gtk.MenuButton, IAccountListener { [GtkChild] private ModelButton item_favs; [GtkChild] - private ModelButton item_direct; + private ModelButton item_conversations; construct { connect_account (); @@ -70,9 +70,8 @@ public class Tootle.Widgets.AccountsButton : Gtk.MenuButton, IAccountListener { Desktop.set_hotkey_tooltip (item_refresh, null, app.ACCEL_REFRESH); item_favs.clicked.connect (() => window.open_view (new Views.Favorites ())); - item_direct.clicked.connect (() => window.open_view (new Views.Direct ())); + item_conversations.clicked.connect (() => window.open_view (new Views.Conversations ())); item_search.clicked.connect (() => window.open_view (new Views.Search ())); - //item_watchlist.clicked.connect (() => Dialogs.WatchlistEditor.open ()); item_prefs.clicked.connect (() => Dialogs.Preferences.open ()); // network.started.connect (() => spinner.show ()); diff --git a/src/Widgets/Status.vala b/src/Widgets/Status.vala index d490501..d9f4690 100644 --- a/src/Widgets/Status.vala +++ b/src/Widgets/Status.vala @@ -42,6 +42,10 @@ public class Tootle.Widgets.Status : EventBox { protected Image reblog_icon; [GtkChild] protected ToggleButton favorite_button; + [GtkChild] + protected ToggleButton bookmark_button; + [GtkChild] + protected Button menu_button; protected string escaped_spoiler { owned get { @@ -78,7 +82,6 @@ public class Tootle.Widgets.Status : EventBox { } construct { - button_press_event.connect (on_clicked); content.activate_link.connect (on_toggle_spoiler); notify["kind"].connect (on_kind_changed); @@ -105,18 +108,6 @@ public class Tootle.Widgets.Status : EventBox { bind_property ("handle", handle_label, "label", BindingFlags.SYNC_CREATE); bind_property ("date", date_label, "label", BindingFlags.SYNC_CREATE); status.formal.bind_property ("pinned", pin_indicator, "visible", BindingFlags.SYNC_CREATE); - status.formal.bind_property ("replies-count", reply_button, "label", BindingFlags.SYNC_CREATE, (b, src, ref target) => { - target.set_string (((int64)src).to_string ()); - return true; - }); - status.formal.bind_property ("reblogs-count", reblog_button, "label", BindingFlags.SYNC_CREATE, (b, src, ref target) => { - target.set_string (((int64)src).to_string ()); - return true; - }); - status.bind_property ("favourites-count", favorite_button, "label", BindingFlags.SYNC_CREATE, (b, src, ref target) => { - target.set_string (((int64)src).to_string ()); - return true; - }); status.formal.bind_property ("has_spoiler", revealer_content, "visible", BindingFlags.SYNC_CREATE); revealer.reveal_child = !status.formal.has_spoiler; @@ -142,14 +133,14 @@ public class Tootle.Widgets.Status : EventBox { if (!attachments.populate (status.formal.attachments) || status.id <= 0) { attachments.destroy (); } + + menu_button.clicked.connect (open_menu); } public Status (API.Status status, API.NotificationType? _kind = null) { Object (status: status, kind: _kind); } - ~Status () { - button_press_event.disconnect (on_clicked); notify["kind"].disconnect (on_kind_changed); } @@ -187,13 +178,7 @@ public class Tootle.Widgets.Status : EventBox { return false; } - protected virtual bool on_clicked (EventButton ev) { - if (ev.button == 3) - return open_menu (ev.button, ev.time); - return false; - } - - public virtual bool open_menu (uint button, uint32 time) { + protected void open_menu () { var menu = new Gtk.Menu (); var item_open_link = new Gtk.MenuItem.with_label (_("Open in Browser")); @@ -206,7 +191,20 @@ public class Tootle.Widgets.Status : EventBox { Desktop.copy (sanitized); }); + // if (is_notification) { + // var item_muting = new Gtk.MenuItem.with_label (status.muted ? _("Unmute Conversation") : _("Mute Conversation")); + // item_muting.activate.connect (() => status.update_muted (!is_muted) ); + // menu.add (item_muting); + // } + + menu.add (item_open_link); + menu.add (new SeparatorMenuItem ()); + menu.add (item_copy_link); + menu.add (item_copy); + if (status.is_owned ()) { + menu.add (new SeparatorMenuItem ()); + var item_pin = new Gtk.MenuItem.with_label (status.pinned ? _("Unpin from Profile") : _("Pin on Profile")); item_pin.activate.connect (() => { status.action (status.formal.pinned ? "unpin" : "pin"); @@ -220,25 +218,10 @@ public class Tootle.Widgets.Status : EventBox { var item_redraft = new Gtk.MenuItem.with_label (_("Redraft")); item_redraft.activate.connect (() => new Dialogs.Compose.redraft (status.formal)); menu.add (item_redraft); - - menu.add (new SeparatorMenuItem ()); } - // if (is_notification) { - // var item_muting = new Gtk.MenuItem.with_label (status.muted ? _("Unmute Conversation") : _("Mute Conversation")); - // item_muting.activate.connect (() => status.update_muted (!is_muted) ); - // menu.add (item_muting); - // } - - menu.add (item_open_link); - menu.add (new SeparatorMenuItem ()); - menu.add (item_copy_link); - menu.add (item_copy); - menu.show_all (); - menu.attach_widget = this; - menu.popup_at_pointer (); - return true; + menu.popup_at_widget (menu_button, Gravity.SOUTH_EAST, Gravity.SOUTH_EAST); } }