-
-
Notifications
You must be signed in to change notification settings - Fork 61
Voting support only for response #265
base: master
Are you sure you want to change the base?
Conversation
src/Widgets/Status.vala
Outdated
@@ -99,6 +104,116 @@ public class Tootle.Widgets.Status : ListBoxRow { | |||
return status.formal.account.avatar; | |||
} | |||
} | |||
public void get_poll(){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
data/ui/widgets/status.ui
Outdated
</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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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