Voting support only for response#265
Conversation
src/Widgets/Status.vala
Outdated
| return status.formal.account.avatar; | ||
| } | ||
| } | ||
| public void get_poll(){ |
There was a problem hiding this comment.
Widgets/Status.vala is already bloated as it is. The voting box should be a separate Widgets/VoteBox.vala file that handles the voting logic as well as populating the voting options.
It should also use a Glade ui template, just like any other view component in Tootle.
| </child> | ||
| <child> | ||
| <object class="GtkBox" id="poll"> | ||
| <property name="visible">True</property> | ||
| <property name="can-focus">False</property> | ||
| <property name="orientation">vertical</property> | ||
| <property name="spacing">8</property> | ||
| </object> | ||
| <packing> | ||
| <property name="expand">False</property> | ||
| <property name="fill">True</property> | ||
| <property name="position">1</property> | ||
| </packing> | ||
| </child> |
There was a problem hiding this comment.
Status widgets are quite expensive, and I don't believe that this box should be present at all times even when the status isn't a poll.
The voting box widget should be injected dynamically.
src/API/Poll.vala
Outdated
| public int64 votes_count { get; set; } | ||
| public int64 voters_count { get; set; } | ||
| public bool voted { get; set; } | ||
| public int64[] own_votes { get; set; } |
There was a problem hiding this comment.
This makes me wish there was a way to (de)serialize Vala arrays automatically, just like Entity.vala does with Gee.ArrayList<Object>'
Maybe we could do something here so that we can omit the boilerplate code for parsing.
|
I have updated code according your recommendations, I hope you like. |
|
Any chance of this being merged? Poll support is the one thing I miss on tootle. |
This PR implements a part of poll support described in #259