From 27da983c52c886e4913eeeb3e45eeb0d94c24055 Mon Sep 17 00:00:00 2001 From: IBBoard Date: Mon, 10 Aug 2020 19:06:26 +0100 Subject: [PATCH] Re #10: Consistency cleanup --- src/widgets/ComposeImageManager.vala | 3 ++- src/window/ComposeTweetWindow.vala | 21 ++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/widgets/ComposeImageManager.vala b/src/widgets/ComposeImageManager.vala index 8078a818f..25a675410 100644 --- a/src/widgets/ComposeImageManager.vala +++ b/src/widgets/ComposeImageManager.vala @@ -118,6 +118,7 @@ class ComposeImageManager : Gtk.Container { // GtkContainer API {{{ public override void forall_internal (bool include_internals, Gtk.Callback cb) { assert (buttons.length == close_buttons.length); + assert (buttons.length == desc_buttons.length); assert (buttons.length == progress_bars.length); for (int i = 0; i < this.close_buttons.length;) { @@ -165,7 +166,7 @@ class ComposeImageManager : Gtk.Container { bar.show_all (); this.progress_bars.add (bar); - // Add the progress bar first so it goes under the image description button + // Add the progress bar first so it (should) go under the image description button var desc_btn = new Gtk.Button.from_icon_name("cawbird-compose-symbolic"); desc_btn.set_parent(this); desc_btn.get_style_context ().add_class ("image-button"); diff --git a/src/window/ComposeTweetWindow.vala b/src/window/ComposeTweetWindow.vala index b307f34c0..f7e16b1fc 100644 --- a/src/window/ComposeTweetWindow.vala +++ b/src/window/ComposeTweetWindow.vala @@ -199,6 +199,7 @@ class ComposeTweetWindow : Gtk.ApplicationWindow { 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){ @@ -533,6 +534,7 @@ class ComposeTweetWindow : Gtk.ApplicationWindow { this.add_image_button.sensitive = false; this.fav_image_button.sensitive = false; } + update_send_button_sensitivity (); } } @@ -546,18 +548,15 @@ class ComposeTweetWindow : Gtk.ApplicationWindow { [GtkCallback] public void favorite_image_selected_cb (string path) { cancel_clicked (); - this.compose_image_manager.show (); - this.compose_image_manager.load_image (path, null); - this.compose_job.upload_image_async (path); - if (this.compose_image_manager.full) { - this.add_image_button.sensitive = false; - this.fav_image_button.sensitive = false; + try { + load_image (path); + } + catch (GLib.Error e) { + // TODO: Proper error checking/reporting + // But it shouldn't happen because we only just picked it from the fav list, + // so the file info should just work + warning ("%s (%s)", e.message, path); } - - if (this.compose_image_manager.n_images > 0) - fav_image_view.set_gifs_enabled (false); - - update_send_button_sensitivity (); } [GtkCallback]