diff --git a/data/ui/views/sidebar/view.ui b/data/ui/views/sidebar/view.ui index 4cc99be87..6971ab320 100644 --- a/data/ui/views/sidebar/view.ui +++ b/data/ui/views/sidebar/view.ui @@ -47,76 +47,12 @@ items - - vertical - - - - - - - - vertical - 12 - 12 - 12 - 12 - 12 - - - 48 - start - - - - - vertical - center - true - 4 - - - - - - - Handle - 0 - 0 - 1 - word-char - - - - - - - - - - - - - - - - - - - single - - - - - + + single + + diff --git a/src/Application.vala b/src/Application.vala index c3c1af466..e61b3aaca 100644 --- a/src/Application.vala +++ b/src/Application.vala @@ -59,7 +59,8 @@ namespace Tuba { { "back-home", back_home_activated }, { "scroll-page-down", scroll_view_page_down }, { "scroll-page-up", scroll_view_page_up }, - { "open-preferences", open_preferences } + { "open-preferences", open_preferences }, + { "open-current-account-profile", open_current_account_profile } }; construct { @@ -253,6 +254,17 @@ namespace Tuba { Dialogs.Preferences.open (); } + void open_current_account_profile () { + accounts.active.open (); + close_sidebar (); + } + + private void close_sidebar () { + var split_view = app.main_window.split_view; + if (split_view.collapsed) + split_view.show_sidebar = false; + } + string troubleshooting = "os: %s %s\nprefix: %s\nflatpak: %s\nversion: %s (%s)\ngtk: %u.%u.%u (%d.%d.%d)\nlibadwaita: %u.%u.%u (%d.%d.%d)\nlibsoup: %u.%u.%u (%d.%d.%d)%s".printf ( // vala-lint=line-length GLib.Environment.get_os_info ("NAME"), GLib.Environment.get_os_info ("VERSION"), Build.PREFIX, diff --git a/src/Views/Sidebar.vala b/src/Views/Sidebar.vala index 4f262e912..8a4b43c31 100644 --- a/src/Views/Sidebar.vala +++ b/src/Views/Sidebar.vala @@ -7,10 +7,6 @@ public class Tuba.Views.Sidebar : Gtk.Widget, AccountHolder { [GtkChild] unowned Widgets.Avatar accounts_button_avi; [GtkChild] unowned Gtk.MenuButton menu_btn; - [GtkChild] unowned Widgets.Avatar avatar; - [GtkChild] unowned Widgets.EmojiLabel title; - [GtkChild] unowned Gtk.Label subtitle; - protected InstanceAccount? account { get; set; default = null; } protected GLib.ListStore app_items; @@ -24,9 +20,17 @@ public class Tuba.Views.Sidebar : Gtk.Widget, AccountHolder { construct { var menu_model = new GLib.Menu (); - menu_model.append (_("Preferences"), "app.open-preferences"); - menu_model.append (_("Keyboard Shortcuts"), "win.show-help-overlay"); - menu_model.append (_("About"), "app.about"); + + var account_submenu_model = new GLib.Menu (); + account_submenu_model.append (_("Open Profile"), "app.open-current-account-profile"); + menu_model.append_section (null, account_submenu_model); + + var misc_submenu_model = new GLib.Menu (); + misc_submenu_model.append (_("Preferences"), "app.open-preferences"); + misc_submenu_model.append (_("Keyboard Shortcuts"), "win.show-help-overlay"); + misc_submenu_model.append (_("About"), "app.about"); + menu_model.append_section (null, misc_submenu_model); + menu_btn.menu_model = menu_model; app_items = new GLib.ListStore (typeof (Place)); @@ -66,15 +70,10 @@ public class Tuba.Views.Sidebar : Gtk.Widget, AccountHolder { } } - private Binding sidebar_handle_short; - private Binding sidebar_avatar; - private Binding sidebar_display_name; private Binding sidebar_avatar_btn; protected virtual void on_account_changed (InstanceAccount? account) { if (this.account != null) { - sidebar_handle_short.unbind (); - sidebar_avatar.unbind (); - sidebar_display_name.unbind (); + sidebar_avatar_btn.unbind (); } if (app?.main_window != null) @@ -84,28 +83,11 @@ public class Tuba.Views.Sidebar : Gtk.Widget, AccountHolder { accounts_button.active = false; if (account != null) { - sidebar_handle_short = this.account.bind_property ("handle_short", subtitle, "label", BindingFlags.SYNC_CREATE); - sidebar_avatar = this.account.bind_property ("avatar", avatar, "avatar-url", BindingFlags.SYNC_CREATE); sidebar_avatar_btn = this.account.bind_property ("avatar", accounts_button_avi, "avatar-url", BindingFlags.SYNC_CREATE); - sidebar_display_name = this.account.bind_property ( - "display-name", - title, - "content", - BindingFlags.SYNC_CREATE, - (b, src, ref target) => { - title.instance_emojis = this.account.emojis_map; - target.set_string (src.get_string ()); - return true; - } - ); - account_items.model = account.known_places; } else { saved_accounts.unselect_all (); - title.content = _("Anonymous"); - subtitle.label = _("No account selected"); - avatar.account = null; account_items.model = null; accounts_button_avi.account = null; } @@ -115,16 +97,6 @@ public class Tuba.Views.Sidebar : Gtk.Widget, AccountHolder { mode.visible_child_name = accounts_button.active ? "saved_accounts" : "items"; } - [GtkCallback] void on_open () { - if (account == null) return; - account.open (); - - var split_view = app.main_window.split_view; - if (split_view.collapsed) - split_view.show_sidebar = false; - } - - // Item [GtkTemplate (ui = "/dev/geopjr/Tuba/ui/views/sidebar/item.ui")]