[gitg] Remove run_after_async
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg] Remove run_after_async
- Date: Fri, 27 Dec 2013 19:15:02 +0000 (UTC)
commit 0129670140393d555f7c77c28ccf4b01d635ee73
Author: Jesse van den Kieboom <jessevdk gmail com>
Date: Fri Dec 27 20:10:15 2013 +0100
Remove run_after_async
libgitg/gitg-diff-view-request-patch.vala | 44 +++++++++++++++++++----------
libgitg/gitg-diff-view-request.vala | 5 ---
2 files changed, 29 insertions(+), 20 deletions(-)
---
diff --git a/libgitg/gitg-diff-view-request-patch.vala b/libgitg/gitg-diff-view-request-patch.vala
index 0ebb854..de2dc96 100644
--- a/libgitg/gitg-diff-view-request-patch.vala
+++ b/libgitg/gitg-diff-view-request-patch.vala
@@ -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;
string commit_subject = selected_commit.get_subject();
@@ -97,23 +97,37 @@ namespace Gitg
commit_subject = "";
}
- var chooser = new Gtk.FileChooserDialog(_("Save Patch File"), null,
- Gtk.FileChooserAction.SAVE,
- _("_Cancel"),
- Gtk.ResponseType.CANCEL,
- _("_Save"),
- Gtk.ResponseType.OK);
+ // Show file chooser and finish create patch in idle.
+ Idle.add(() => {
+ if (cancellable.is_cancelled())
+ {
+ return false;
+ }
- chooser.do_overwrite_confirmation = true;
- chooser.set_current_name(commit_subject + ".patch");
+ var chooser = new Gtk.FileChooserDialog(_("Save Patch File"), null,
+ Gtk.FileChooserAction.SAVE,
+ _("_Cancel"),
+ Gtk.ResponseType.CANCEL,
+ _("_Save"),
+ Gtk.ResponseType.OK);
- chooser.show();
- chooser.response.connect((dialog, id) => {
- if (id != -6) {
- create_patch (selected_commit, chooser.get_file());
- }
- chooser.destroy();
+ 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;
}
}
}
diff --git a/libgitg/gitg-diff-view-request.vala b/libgitg/gitg-diff-view-request.vala
index 86d174e..c70d671 100644
--- a/libgitg/gitg-diff-view-request.vala
+++ b/libgitg/gitg-diff-view-request.vala
@@ -86,9 +86,6 @@ namespace Gitg
return null;
}
- protected virtual void run_after_async()
- {}
-
private async InputStream? run_impl(Cancellable? cancellable) throws GLib.Error
{
SourceFunc callback = run_impl.callback;
@@ -107,8 +104,6 @@ namespace Gitg
return null;
});
- run_after_async();
-
// Wait for it to finish, yield to caller
yield;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]