Remove run_after_async

This commit is contained in:
Jesse van den Kieboom 2013-12-27 20:10:15 +01:00
parent bdcecc96b1
commit 0129670140
2 changed files with 30 additions and 21 deletions

View file

@ -74,7 +74,7 @@ namespace Gitg
} }
} }
public override void run_after_async() protected override InputStream? run_async(Cancellable? cancellable)
{ {
var selected_commit = (Gitg.Commit) d_commit; var selected_commit = (Gitg.Commit) d_commit;
string commit_subject = selected_commit.get_subject(); string commit_subject = selected_commit.get_subject();
@ -97,23 +97,37 @@ namespace Gitg
commit_subject = ""; commit_subject = "";
} }
var chooser = new Gtk.FileChooserDialog(_("Save Patch File"), null, // Show file chooser and finish create patch in idle.
Gtk.FileChooserAction.SAVE, Idle.add(() => {
_("_Cancel"), if (cancellable.is_cancelled())
Gtk.ResponseType.CANCEL, {
_("_Save"), return false;
Gtk.ResponseType.OK);
chooser.do_overwrite_confirmation = true;
chooser.set_current_name(commit_subject + ".patch");
chooser.show();
chooser.response.connect((dialog, id) => {
if (id != -6) {
create_patch (selected_commit, chooser.get_file());
} }
chooser.destroy();
var chooser = new Gtk.FileChooserDialog(_("Save Patch File"), null,
Gtk.FileChooserAction.SAVE,
_("_Cancel"),
Gtk.ResponseType.CANCEL,
_("_Save"),
Gtk.ResponseType.OK);
chooser.do_overwrite_confirmation = true;
chooser.set_current_name(commit_subject + ".patch");
chooser.show();
chooser.response.connect((dialog, id) => {
if (!cancellable.is_cancelled() && id != -6)
{
create_patch (selected_commit, chooser.get_file());
}
chooser.destroy();
});
return false;
}); });
return null;
} }
} }
} }

View file

@ -86,9 +86,6 @@ namespace Gitg
return null; return null;
} }
protected virtual void run_after_async()
{}
private async InputStream? run_impl(Cancellable? cancellable) throws GLib.Error private async InputStream? run_impl(Cancellable? cancellable) throws GLib.Error
{ {
SourceFunc callback = run_impl.callback; SourceFunc callback = run_impl.callback;
@ -107,8 +104,6 @@ namespace Gitg
return null; return null;
}); });
run_after_async();
// Wait for it to finish, yield to caller // Wait for it to finish, yield to caller
yield; yield;