Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Voting support only for response #265

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

jcamposz
Copy link

@jcamposz jcamposz commented Nov 26, 2020

This PR implements a part of poll support described in #259

@@ -99,6 +104,116 @@ public class Tootle.Widgets.Status : ListBoxRow {
return status.formal.account.avatar;
}
}
public void get_poll(){
Copy link
Owner

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.

Comment on lines 295 to 308
</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>
Copy link
Owner

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.

public int64 votes_count { get; set; }
public int64 voters_count { get; set; }
public bool voted { get; set; }
public int64[] own_votes { get; set; }
Copy link
Owner

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.

@jcamposz
Copy link
Author

jcamposz commented Dec 2, 2020

I have updated code according your recommendations, I hope you like.

@mickenordin
Copy link

Any chance of this being merged? Poll support is the one thing I miss on tootle.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants