AccountView polish
This commit is contained in:
parent
c5539c6a28
commit
09bd3d6424
|
@ -21,5 +21,9 @@
|
||||||
|
|
||||||
.header{
|
.header{
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
opacity: 0.1;
|
background-position: 50%;
|
||||||
|
opacity: 0.2;
|
||||||
|
}
|
||||||
|
.header-counters{
|
||||||
|
background:rgba(255,255,255,.4);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,8 @@ public class Tootle.Account{
|
||||||
account.note = obj.get_string_member ("note");
|
account.note = obj.get_string_member ("note");
|
||||||
account.avatar = obj.get_string_member ("avatar");
|
account.avatar = obj.get_string_member ("avatar");
|
||||||
account.header = obj.get_string_member ("header");
|
account.header = obj.get_string_member ("header");
|
||||||
|
if ("missing.png" in account.header)
|
||||||
|
account.header = "https://files.mastodon.social/accounts/headers/000/320/555/original/cebce998b571acf2.jpeg";
|
||||||
account.url = obj.get_string_member ("url");
|
account.url = obj.get_string_member ("url");
|
||||||
|
|
||||||
account.followers_count = obj.get_int_member ("followers_count");
|
account.followers_count = obj.get_int_member ("followers_count");
|
||||||
|
|
|
@ -7,6 +7,7 @@ public class Tootle.AccountView : Tootle.HomeView {
|
||||||
|
|
||||||
Gtk.Grid header;
|
Gtk.Grid header;
|
||||||
Gtk.Grid header_image;
|
Gtk.Grid header_image;
|
||||||
|
Gtk.Box header_info;
|
||||||
Granite.Widgets.Avatar avatar;
|
Granite.Widgets.Avatar avatar;
|
||||||
Gtk.Label display_name;
|
Gtk.Label display_name;
|
||||||
Gtk.Label username;
|
Gtk.Label username;
|
||||||
|
@ -16,36 +17,40 @@ public class Tootle.AccountView : Tootle.HomeView {
|
||||||
public override void pre_construct () {
|
public override void pre_construct () {
|
||||||
header = new Gtk.Grid ();
|
header = new Gtk.Grid ();
|
||||||
|
|
||||||
|
header_info = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
|
||||||
|
header_info.margin = 16;
|
||||||
|
|
||||||
avatar = new Granite.Widgets.Avatar.with_default_icon (128);
|
avatar = new Granite.Widgets.Avatar.with_default_icon (128);
|
||||||
avatar.hexpand = true;
|
avatar.hexpand = true;
|
||||||
avatar.margin_top = 16;
|
avatar.margin = 16;
|
||||||
avatar.margin_bottom = 16;
|
header_info.pack_start(avatar, false, false, 0);
|
||||||
header.attach (avatar, 0, 1, 1, 1);
|
|
||||||
|
|
||||||
display_name = new RichLabel ("");
|
display_name = new RichLabel ("");
|
||||||
display_name.get_style_context ().add_class (Granite.STYLE_CLASS_H2_LABEL);
|
display_name.get_style_context ().add_class (Granite.STYLE_CLASS_H2_LABEL);
|
||||||
header.attach (display_name, 0, 2, 1, 1);
|
header_info.pack_start(display_name, false, false, 0);
|
||||||
|
|
||||||
username = new Gtk.Label ("");
|
username = new Gtk.Label ("");
|
||||||
username.get_style_context ().add_class (Granite.STYLE_CLASS_H3_LABEL);
|
username.get_style_context ().add_class (Granite.STYLE_CLASS_H3_LABEL);
|
||||||
header.attach (username, 0, 3, 1, 1);
|
header_info.pack_start(username, false, false, 0);
|
||||||
|
|
||||||
note = new RichLabel ("");
|
note = new RichLabel ("");
|
||||||
note.set_line_wrap (true);
|
note.set_line_wrap (true);
|
||||||
|
note.selectable = true;
|
||||||
|
note.margin_top = 16;
|
||||||
note.get_style_context ().add_class (Granite.STYLE_CLASS_H3_LABEL);
|
note.get_style_context ().add_class (Granite.STYLE_CLASS_H3_LABEL);
|
||||||
note.justify = Gtk.Justification.CENTER;
|
note.justify = Gtk.Justification.CENTER;
|
||||||
note.margin_start = 16;
|
header_info.pack_start(note, false, false, 0);
|
||||||
note.margin_end = 16;
|
header_info.show_all ();
|
||||||
header.attach (note, 0, 4, 1, 1);
|
header.attach (header_info, 0, 0, 1, 1);
|
||||||
|
|
||||||
counters = new Gtk.Grid ();
|
counters = new Gtk.Grid ();
|
||||||
counters.margin_top = 16;
|
|
||||||
counters.column_homogeneous = true;
|
counters.column_homogeneous = true;
|
||||||
header.attach (counters, 0, 5, 1, 1);
|
counters.get_style_context ().add_class ("header-counters");
|
||||||
|
header.attach (counters, 0, 1, 1, 1);
|
||||||
|
|
||||||
header_image = new Gtk.Grid ();
|
header_image = new Gtk.Grid ();
|
||||||
header_image.get_style_context ().add_class ("header");
|
header_image.get_style_context ().add_class ("header");
|
||||||
header.attach (header_image, 0, 1, 1, 5);
|
header.attach (header_image, 0, 0, 2, 2);
|
||||||
|
|
||||||
view.pack_start (header, false, false, 0);
|
view.pack_start (header, false, false, 0);
|
||||||
}
|
}
|
||||||
|
@ -59,9 +64,9 @@ public class Tootle.AccountView : Tootle.HomeView {
|
||||||
note.label = Utils.escape_html (account.note);
|
note.label = Utils.escape_html (account.note);
|
||||||
Tootle.cache.load_avatar (account.avatar, avatar, 128);
|
Tootle.cache.load_avatar (account.avatar, avatar, 128);
|
||||||
|
|
||||||
add_counter (_("Toots"), 1, account.statuses_count);
|
add_counter (_("TOOTS"), 1, account.statuses_count);
|
||||||
add_counter (_("Follows"), 2, account.following_count);
|
add_counter (_("FOLLOWS"), 2, account.following_count);
|
||||||
add_counter (_("Followers"), 3, account.followers_count);
|
add_counter (_("FOLLOWERS"), 3, account.followers_count);
|
||||||
show_all ();
|
show_all ();
|
||||||
|
|
||||||
var stylesheet = ".header{background-image: url(\"%s\")}".printf (account.header);
|
var stylesheet = ".header{background-image: url(\"%s\")}".printf (account.header);
|
||||||
|
@ -73,7 +78,11 @@ public class Tootle.AccountView : Tootle.HomeView {
|
||||||
|
|
||||||
private void add_counter (string name, int i, int64 val) {
|
private void add_counter (string name, int i, int64 val) {
|
||||||
var label_name = new Gtk.Label (name);
|
var label_name = new Gtk.Label (name);
|
||||||
|
label_name.margin_top = 8;
|
||||||
|
label_name.get_style_context ().add_class (Granite.STYLE_CLASS_H3_LABEL);
|
||||||
var label_val = new Gtk.Label (val.to_string ());
|
var label_val = new Gtk.Label (val.to_string ());
|
||||||
|
label_val.get_style_context ().add_class (Granite.STYLE_CLASS_H3_LABEL);
|
||||||
|
label_val.margin_bottom = 8;
|
||||||
counters.attach (label_name, i, 1, 1, 1);
|
counters.attach (label_name, i, 1, 1, 1);
|
||||||
counters.attach (label_val, i, 2, 1, 1);
|
counters.attach (label_val, i, 2, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,11 +22,11 @@ public class Tootle.RichLabel : Gtk.Label {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("/tags/" in url){
|
// if ("/tags/" in url){
|
||||||
var hashtag = url.split("/tags/")[1];
|
// var hashtag = url.split("/tags/")[1];
|
||||||
//TODO: search hashtags
|
// //TODO: search hashtags
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if ("/@" in url){
|
if ("/@" in url){
|
||||||
var profile = url.split("/@")[1];
|
var profile = url.split("/@")[1];
|
||||||
|
|
Loading…
Reference in New Issue