Skip to content

Commit 165a6cc

Browse files
TheAssassinprobonopd
authored andcommitted
Disable launch button until update finished successfully (AppImageCommunity#6)
Fixes AppImageCommunity#5
1 parent 1513312 commit 165a6cc

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

progress.vala

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class ProgressWindow : Window {
2323
private Revealer revealer2;
2424

2525
private Button btn_cancel;
26-
private Button btn_show_files;
26+
private Button btn_launch_now;
2727
private Button btn_quit;
2828

2929
private Pid child_pid;
@@ -85,9 +85,10 @@ public class ProgressWindow : Window {
8585
btn_quit.clicked.connect(Gtk.main_quit);
8686
btn_quit.set_visible(false);
8787

88-
btn_show_files = builder.get_object("btn_show_files") as Button;
89-
btn_show_files.clicked.connect(this.show_files);
90-
btn_show_files.set_visible(false);
88+
btn_launch_now = builder.get_object("btn_launch_now") as Button;
89+
btn_launch_now.clicked.connect(this.show_files);
90+
btn_launch_now.set_visible(false);
91+
btn_launch_now.set_sensitive(false);
9192

9293
this.files_to_be_updated = files_to_be_updated;
9394
this.file_name = file_name;
@@ -136,16 +137,15 @@ public class ProgressWindow : Window {
136137
return this.process_error (channel, condition, "stderr");
137138
});
138139

139-
ChildWatch.add (child_pid, (pid, status) => {
140-
// Triggered when the child indicated by child_pid exits
141-
Process.close_pid (pid);
142-
140+
ChildWatch.add (child_pid, (pid, status) => {
141+
// Triggered when the child indicated by child_pid exits
142+
Process.close_pid(pid);
143+
btn_launch_now.set_sensitive(true);
143144
});
144145

145146
} catch (SpawnError e) {
146147
action_label.label = "Error: " + e.message;
147148
}
148-
149149
}
150150

151151
/* Handle output pipe */
@@ -187,7 +187,7 @@ public class ProgressWindow : Window {
187187
revealer2.set_reveal_child (true);
188188
icon_image.icon_name="emblem-ok-symbolic";
189189
Posix.system("chmod 0755 " + result_file_name); // Because the CLI does not reliably do it (FIXME)
190-
btn_show_files.set_visible(true);
190+
btn_launch_now.set_visible(true);
191191
}
192192

193193
if(line.contains("Cannot") || line.contains("Error")) {

ui/progress.ui

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
<property name="margin_right">5</property>
5757
<property name="spacing">10</property>
5858
<child>
59-
<object class="GtkButton" id="btn_show_files">
59+
<object class="GtkButton" id="btn_launch_now">
6060
<property name="label" translatable="yes">Launch now</property>
6161
<property name="visible">False</property>
6262
<property name="can_focus">True</property>

0 commit comments

Comments
 (0)