diff --git a/src/DefaultTimeline.vala b/src/DefaultTimeline.vala index 3ddf09839..2c5f9f9e3 100644 --- a/src/DefaultTimeline.vala +++ b/src/DefaultTimeline.vala @@ -35,6 +35,7 @@ public abstract class DefaultTimeline : ScrollWidget, IPage { public unowned MainWindow window { set { main_window = value; + tweet_list.main_window = main_window; } } public TweetListBox tweet_list = new TweetListBox (); diff --git a/src/ListStatusesPage.vala b/src/ListStatusesPage.vala index ed49f3a04..5f369c560 100644 --- a/src/ListStatusesPage.vala +++ b/src/ListStatusesPage.vala @@ -33,6 +33,7 @@ class ListStatusesPage : ScrollWidget, Cb.MessageReceiver, IPage { public unowned MainWindow window { set { main_window = value; + tweet_list.main_window = main_window; } } public unowned Account account; diff --git a/src/MainWidget.vala b/src/MainWidget.vala index 26c89b663..9b32998b9 100644 --- a/src/MainWidget.vala +++ b/src/MainWidget.vala @@ -56,13 +56,11 @@ public class MainWidget : Gtk.Box { stack.notify["transition-running"].connect(() => { if (stack.transition_running == false) { var visible_child = stack.visible_child; - stack.get_children().foreach((w) => { if (w != visible_child) { w.hide(); }}); + stack.get_children().foreach((w) => { if (w != visible_child) { stack.remove(w); }}); } }); this.add (stack); - stack.add (stack_impostor); - pages = new IPage[11]; pages[0] = new HomeTimeline (Page.STREAM, account); pages[1] = new MentionsTimeline (Page.MENTIONS, account); @@ -85,7 +83,7 @@ public class MainWidget : Gtk.Box { account.user_stream.register ((Cb.MessageReceiver)page); page.create_radio_button (dummy_button); - stack.add (page); + if (page.get_radio_button () != null) { top_box.add (page.get_radio_button ()); page.get_radio_button ().clicked.connect (() => { @@ -146,12 +144,18 @@ public class MainWidget : Gtk.Box { args = history.get_current_bundle (); } + IPage page = pages[page_id]; + if (page_id == current_page) { - stack_impostor.clone (pages[page_id]); + stack_impostor.clone (page); var transition_type = stack.transition_type; stack.transition_type = Gtk.StackTransitionType.NONE; + if (stack_impostor.parent == null) { + stack.add(stack_impostor); + } stack.set_visible_child (stack_impostor); stack.transition_type = transition_type; + stack.remove(page); } if (current_page != -1) @@ -166,7 +170,6 @@ public class MainWidget : Gtk.Box { /* XXX The following will cause switch_page to be called twice because setting the active property of the button will cause the clicked event to be emitted, which will call switch_page. */ - IPage page = pages[page_id]; Gtk.ToggleButton button = page.get_radio_button (); page_switch_lock = true; if (button != null) @@ -174,10 +177,13 @@ public class MainWidget : Gtk.Box { else dummy_button.active = true; + if (page.parent == null) { + stack.add(page); + } /* on_join first, then set_visible_child so the new page is still !child-visible, so e.g. GtkStack transitions inside the page aren't animated */ page.on_join (page_id, args); - page.show(); + page.show_all(); stack.set_visible_child (page); ((MainWindow)this.parent).set_window_title (page.get_title (), stack.transition_type); diff --git a/src/ProfilePage.vala b/src/ProfilePage.vala index 191382349..1d586c970 100644 --- a/src/ProfilePage.vala +++ b/src/ProfilePage.vala @@ -35,6 +35,9 @@ class ProfilePage : ScrollWidget, IPage, Cb.MessageReceiver { set { main_window = value; user_lists.main_window = value; + tweet_list.main_window = main_window; + followers_list.main_window = main_window; + followers_list.main_window = main_window; } } public unowned Account account; diff --git a/src/SearchPage.vala b/src/SearchPage.vala index d8e357753..f1e8b21ed 100644 --- a/src/SearchPage.vala +++ b/src/SearchPage.vala @@ -29,6 +29,7 @@ class SearchPage : IPage, Cb.MessageReceiver, Gtk.Box { public unowned MainWindow window { set { main_window = value; + tweet_list.main_window = main_window; } } diff --git a/src/TweetInfoPage.vala b/src/TweetInfoPage.vala index 6e2824a8d..5aedaa2aa 100644 --- a/src/TweetInfoPage.vala +++ b/src/TweetInfoPage.vala @@ -38,6 +38,10 @@ class TweetInfoPage : IPage, ScrollWidget, Cb.MessageReceiver { public unowned MainWindow window { set { main_window = value; + replied_to_list_box.main_window = main_window; + replies_list_box.main_window = main_window; + self_replies_list_box.main_window = main_window; + mentioned_replies_list_box.main_window = main_window; } } public unowned Account account; diff --git a/src/widgets/TweetListBox.vala b/src/widgets/TweetListBox.vala index bd2daf2fa..c032c7baf 100644 --- a/src/widgets/TweetListBox.vala +++ b/src/widgets/TweetListBox.vala @@ -26,6 +26,7 @@ public class TweetListBox : ListBox { return _action_entry; } } + public MainWindow main_window { private get; set; } public TweetListBox () { } @@ -48,7 +49,7 @@ public class TweetListBox : ListBox { assert (obj is Cb.Tweet); var row = new TweetListEntry ((Cb.Tweet) obj, - (MainWindow) get_toplevel (), + main_window, this.account); row.fade_in (); return row; diff --git a/ui/tweet-info-page.ui b/ui/tweet-info-page.ui index 5ed4cab89..89d3e6cef 100644 --- a/ui/tweet-info-page.ui +++ b/ui/tweet-info-page.ui @@ -30,6 +30,7 @@ 0 + 1 18 18 6 @@ -41,6 +42,7 @@ 0 + 1 False none @@ -439,21 +441,24 @@ - 1 + 0 + 1 none 1 - 1 + 0 + 1 none 1 - 1 + 0 + 1 none 1