Remove settings for now

This commit is contained in:
bleakgrey 2018-04-25 14:33:34 +03:00
parent 28456b2aa0
commit d6280d3b8d
3 changed files with 86 additions and 2 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

After

Width:  |  Height:  |  Size: 94 KiB

View File

@ -56,8 +56,8 @@ public class Tootle.AccountsButton : Gtk.MenuButton{
grid.orientation = Gtk.Orientation.VERTICAL;
grid.width_request = 200;
grid.attach(default_account, 0, 1, 1, 1);
grid.attach(item_separator, 0, 2, 1, 1);
grid.attach(item_settings, 0, 3, 1, 1);
//grid.attach(item_separator, 0, 2, 1, 1);
//grid.attach(item_settings, 0, 3, 1, 1);
grid.show_all ();
menu = new Gtk.Popover (null);

View File

@ -0,0 +1,84 @@
using Gtk;
public class Tootle.AccountsButton : Gtk.MenuButton{
Granite.Widgets.Avatar avatar;
Gtk.Grid grid;
Gtk.Popover menu;
AccountView default_account;
private class AccountView : Gtk.Grid{
public Gtk.Label display_name;
public Gtk.Label user;
public Gtk.Button logout;
construct {
margin = 6;
margin_start = 14;
display_name = new Gtk.Label ("<b>Anonymous</b>");
display_name.hexpand = true;
display_name.halign = Gtk.Align.START;
display_name.use_markup = true;
user = new Gtk.Label ("@error");
user.halign = Gtk.Align.START;
logout = new Gtk.Button.from_icon_name ("pane-hide-symbolic", Gtk.IconSize.SMALL_TOOLBAR);
logout.receives_default = false;
logout.tooltip_text = _("Log out");
logout.clicked.connect (() => AccountManager.instance.logout ());
show_all ();
attach(display_name, 1, 0, 1, 1);
attach(user, 1, 1, 1, 1);
attach(logout, 2, 0, 2, 2);
}
public AccountView (){}
}
construct{
avatar = new Granite.Widgets.Avatar.with_default_icon (24);
avatar.button_press_event.connect(event => {
return false;
});
default_account = new AccountView ();
var item_separator = new Gtk.Separator (Gtk.Orientation.HORIZONTAL);
item_separator.hexpand = true;
var item_settings = new Gtk.ModelButton ();
item_settings.text = _("Settings");
grid = new Gtk.Grid ();
grid.orientation = Gtk.Orientation.VERTICAL;
grid.width_request = 200;
grid.attach(default_account, 0, 1, 1, 1);
grid.attach(item_separator, 0, 2, 1, 1);
grid.attach(item_settings, 0, 3, 1, 1);
grid.show_all ();
menu = new Gtk.Popover (null);
menu.add (grid);
get_style_context ().add_class ("button_avatar");
popover = menu;
add(avatar);
show_all ();
AccountManager.instance.switched.connect (account => {
if (account != null){
CacheManager.instance.load_avatar (account.avatar, avatar, 24);
default_account.display_name.label = "<b>"+account.display_name+"</b>";
default_account.user.label = "@"+account.username;
}
});
}
public AccountsButton(){
Object();
}
}