Add stub status page

This commit is contained in:
bleakgrey 2018-04-19 22:03:28 +03:00
parent 0b697a1b6e
commit c2a2d569aa
6 changed files with 56 additions and 9 deletions

View File

@ -33,13 +33,14 @@ executable(
'src/Widgets/AccountsButton.vala',
'src/Widgets/StatusWidget.vala',
'src/Widgets/NotificationWidget.vala',
'src/Dialogs/DialogToot.vala',
'src/Dialogs/PostDialog.vala',
'src/Views/AbstractView.vala',
'src/Views/AddAccountView.vala',
'src/Views/HomeView.vala',
'src/Views/LocalView.vala',
'src/Views/FederatedView.vala',
'src/Views/NotificationsView.vala',
'src/Views/StatusView.vala',
dependencies: [
dependency('gtk+-3.0'),
dependency('glib-2.0', version: '>=2.30.0'),

View File

@ -1,9 +1,9 @@
using Gtk;
using Tootle;
public class Tootle.TootDialog : Gtk.Dialog {
public class Tootle.PostDialog : Gtk.Dialog {
private static TootDialog dialog;
private static PostDialog dialog;
private Gtk.TextView text;
private Gtk.Label counter;
private Gtk.MenuButton visibility;
@ -11,7 +11,7 @@ public class Tootle.TootDialog : Gtk.Dialog {
private StatusVisibility visibility_opt;
public TootDialog (Gtk.Window? parent) {
public PostDialog (Gtk.Window? parent) {
Object (
border_width: 5,
deletable: false,
@ -98,7 +98,7 @@ public class Tootle.TootDialog : Gtk.Dialog {
public static void open (Gtk.Window? parent){
if(dialog == null){
dialog = new TootDialog (parent);
dialog = new PostDialog (parent);
dialog.destroy.connect (() => {
dialog = null;
});

View File

@ -48,13 +48,19 @@ public class Tootle.MainWindow: Gtk.Window {
accounts = new AccountsButton ();
button_back = new Button ();
button_back.label = _("Back");
button_back.get_style_context ().add_class (Granite.STYLE_CLASS_BACK_BUTTON);
button_back.clicked.connect (() => {
primary_stack.set_visible_child_name ("modes");
var child = primary_stack.get_child_by_name ("details");
child.destroy ();
});
button_toot = new Button ();
button_toot.tooltip_text = "Toot";
button_toot.image = new Gtk.Image.from_icon_name ("edit-symbolic", Gtk.IconSize.LARGE_TOOLBAR);
button_toot.clicked.connect (() => {
TootDialog.open (this);
PostDialog.open (this);
});
button_mode = new Granite.Widgets.ModeButton ();
@ -66,7 +72,7 @@ public class Tootle.MainWindow: Gtk.Window {
header = new HeaderBar ();
header.custom_title = button_mode;
header.show_close_button = true;
//header.pack_start (button_back);
header.pack_start (button_back);
header.pack_start (button_toot);
header.pack_end (accounts);
header.pack_end (spinner);
@ -118,5 +124,12 @@ public class Tootle.MainWindow: Gtk.Window {
secondary_stack.add_named(view, view.get_name ());
}
}
public void open_secondary_view (Widget widget) {
widget.show ();
primary_stack.add_named (widget, "details");
primary_stack.set_visible_child_name ("details");
button_back.show ();
}
}

View File

@ -16,5 +16,5 @@ public abstract class Tootle.AbstractView : Gtk.Box {
public virtual string get_name () {
return "unnamed";
}
}

View File

@ -52,7 +52,9 @@ public class Tootle.HomeView : Tootle.AbstractView {
widget.separator = separator;
widget.rebind (status);
widget.button_press_event.connect(() => {
//TODO: status page
var view = new StatusView (status);
Tootle.window.open_secondary_view (view);
return false;
});
view.pack_start(separator, false, false, 0);
view.pack_start(widget, false, false, 0);

31
src/Views/StatusView.vala Normal file
View File

@ -0,0 +1,31 @@
using Gtk;
public class Tootle.StatusView : Tootle.AbstractView {
Gtk.Box view;
Gtk.ScrolledWindow scroll;
construct {
view = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
view.hexpand = true;
view.valign = Gtk.Align.START;
scroll = new Gtk.ScrolledWindow (null, null);
scroll.hexpand = true;
scroll.vexpand = true;
scroll.hscrollbar_policy = Gtk.PolicyType.NEVER;
scroll.add (view);
add (scroll);
}
public StatusView (Status status) {
base (false);
var widget = new StatusWidget(status);
widget.rebind (status);
view.pack_start (widget, false, false, 0);
show_all();
}
}