Display image tooltips (#54)

This commit is contained in:
bleakgrey 2018-06-19 11:00:51 +03:00
parent 58793b0d4b
commit 56258c8e50
2 changed files with 5 additions and 0 deletions

View File

@ -4,6 +4,7 @@ public class Tootle.Attachment{
public string type; public string type;
public string url; public string url;
public string preview_url; public string preview_url;
public string? description;
public Attachment(int64 id){ public Attachment(int64 id){
this.id = id; this.id = id;
@ -17,6 +18,9 @@ public class Tootle.Attachment{
attachment.preview_url = obj.get_string_member ("preview_url"); attachment.preview_url = obj.get_string_member ("preview_url");
attachment.url = obj.get_string_member ("url"); attachment.url = obj.get_string_member ("url");
if (obj.has_member ("description"))
attachment.description = obj.get_string_member ("description");
return attachment; return attachment;
} }

View File

@ -52,6 +52,7 @@ public class Tootle.AttachmentWidget : Gtk.EventBox {
image.valign = Gtk.Align.CENTER; image.valign = Gtk.Align.CENTER;
image.halign = Gtk.Align.CENTER; image.halign = Gtk.Align.CENTER;
image.margin = 3; image.margin = 3;
image.set_tooltip_text (attachment.description);
image.show (); image.show ();
if (editable) if (editable)
Tootle.network.load_scaled_image (attachment.preview_url, image, get_small_size ()); Tootle.network.load_scaled_image (attachment.preview_url, image, get_small_size ());