Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Extract variables for readability
Browse files Browse the repository at this point in the history
  • Loading branch information
IBBoard committed Mar 11, 2021
1 parent 8361d54 commit db22c3b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/list/TweetListEntry.vala
Original file line number Diff line number Diff line change
Expand Up @@ -852,16 +852,20 @@ public class TweetListEntry : Cb.TwitterItem, Gtk.ListBoxRow {
}

public override void size_allocate(Gtk.Allocation allocation) {
var current_width = get_allocated_width();
var cur_width = get_allocated_width();
var new_width = allocation.width;

if (shows_actions && current_width != allocation.width) {
if (shows_actions && cur_width != new_width) {
// The grid widget controls our height, but we can't get it right unless it is visible
toggle_mode();
}

if ((allocation.width < Cawbird.RESPONSIVE_LIMIT) != (current_width < Cawbird.RESPONSIVE_LIMIT) || current_width <= 1) {
var new_size_is_responsive = new_width < Cawbird.RESPONSIVE_LIMIT;
var cur_size_is_responsive = cur_width < Cawbird.RESPONSIVE_LIMIT;

if (new_size_is_responsive != cur_size_is_responsive || cur_width <= 1) {
// We've crossed the threshold, so reallocate as appropriate
if (allocation.width < Cawbird.RESPONSIVE_LIMIT) {
if (new_size_is_responsive) {
grid.child_set (avatar_image, "height", 2);
grid.child_set (scroller, "left-attach", 0);
grid.child_set (scroller, "width", 7);
Expand Down

0 comments on commit db22c3b

Please sign in to comment.