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

Commit

Permalink
Re #10: Load images later to fix stacking
Browse files Browse the repository at this point in the history
If we load images in the constructor then button hit-zones go under
the image but new images have the buttons fully accessible.
But the buttons are still visible, so it's not a complete z-index mixup.

By hooking in to "show()" we can load images late enough that
GTK behaves differently and stacks the button hit-zones correctly.
  • Loading branch information
IBBoard committed Aug 15, 2020
1 parent 6c6a4e2 commit c53b939
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/window/ComposeTweetWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -189,17 +189,15 @@ class ComposeTweetWindow : Gtk.ApplicationWindow {
this.set_default_size (DEFAULT_WIDTH, (int)(DEFAULT_WIDTH / 2.5));
}

private async void load_tweet () {
string? last_tweet = account.db.select ("info").cols ("last_tweet").once_string ();
if (last_tweet != null && last_tweet.length > 0 &&
tweet_text.get_buffer ().text.length == 0) {
this.tweet_text.get_buffer ().text = last_tweet;
}
public override void show () {
base.show();
load_images.begin();
}

private async void load_images () {
string[] failed_paths = {};

for (uint i = 0; i < Cb.ComposeJob.MAX_UPLOADS; i++) {
// FIXME: Loading these images stacks the widgets wrong so that you can't get to all of the buttons
string? image_path = account.db.select ("info").cols ("last_tweet_image_%u".printf(i + 1)).once_string ();

if (image_path != null && image_path.length > 0){
Expand All @@ -224,6 +222,14 @@ class ComposeTweetWindow : Gtk.ApplicationWindow {

cancel_button.label = _("Back");
}
}

private async void load_tweet () {
string? last_tweet = account.db.select ("info").cols ("last_tweet").once_string ();
if (last_tweet != null && last_tweet.length > 0 &&
tweet_text.get_buffer ().text.length == 0) {
this.tweet_text.get_buffer ().text = last_tweet;
}

int64 last_reply_id = account.db.select ("info").cols ("last_tweet_reply_id").once_i64 ();
int64 last_quote_id = account.db.select ("info").cols ("last_tweet_quote_id").once_i64 ();
Expand Down

0 comments on commit c53b939

Please sign in to comment.