[gitg/wip/sindhus/interactive-rebase] Make rebase commit editor save modified text
- From: Sindhu Sundar <sindhus src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg/wip/sindhus/interactive-rebase] Make rebase commit editor save modified text
- Date: Wed, 11 Sep 2013 12:38:01 +0000 (UTC)
commit 895d045faabf511b21161ad81d2cb7c22b67567e
Author: Sindhu S <sindhus live in>
Date: Wed Sep 11 18:07:34 2013 +0530
Make rebase commit editor save modified text
gitg/gitg-rebase-commit-editor-window.vala | 21 +++++++++++++++++++++
gitg/gitg-rebase-window.vala | 6 +++++-
2 files changed, 26 insertions(+), 1 deletions(-)
---
diff --git a/gitg/gitg-rebase-commit-editor-window.vala b/gitg/gitg-rebase-commit-editor-window.vala
index ae0e586..e4bd4c0 100644
--- a/gitg/gitg-rebase-commit-editor-window.vala
+++ b/gitg/gitg-rebase-commit-editor-window.vala
@@ -22,6 +22,7 @@ namespace Gitg
public class RebaseCommitEditorWindow : Gtk.Window
{
private GtkSource.View r_commit_editor;
+ private string r_filepath;
public RebaseCommitEditorWindow()
{
@@ -31,12 +32,18 @@ namespace Gitg
var hbox = new Gtk.Box (Gtk.Orientation.VERTICAL, 1);
hbox.homogeneous = true;
hbox.add (r_commit_editor);
+ var save_button = new Gtk.Button();
+ save_button.label = "Save and load next...";
+ save_button.clicked.connect(save_and_continue);
+ hbox.add(save_button);
add (hbox);
}
public void load_commit_file(string filename)
{
+ r_filepath = filename;
string contents = "";
+
try
{
FileUtils.get_contents(filename, out contents);
@@ -44,6 +51,20 @@ namespace Gitg
catch {}
r_commit_editor.buffer.set_text(contents);
}
+
+ private void save_and_continue()
+ {
+ var buffer = r_commit_editor.buffer;
+ Gtk.TextIter start, end;
+ buffer.get_bounds(out start, out end);
+ string contents = buffer.get_text(start, end, false);
+ try
+ {
+ FileUtils.set_contents(r_filepath, contents);
+ }
+ catch {}
+ destroy();
+ }
}
}
\ No newline at end of file
diff --git a/gitg/gitg-rebase-window.vala b/gitg/gitg-rebase-window.vala
index 2d5dee5..d0ef657 100644
--- a/gitg/gitg-rebase-window.vala
+++ b/gitg/gitg-rebase-window.vala
@@ -58,7 +58,11 @@ public class RebaseWindow : Gtk.Window
string rebase_output = "";
rebase_output = parser.generate_rebase_todo(rebase_array);
stdout.printf("\nrebase_output: \n%s", rebase_output);
- FileUtils.set_contents(r_filepath, rebase_output);
+ try
+ {
+ FileUtils.set_contents(r_filepath, rebase_output);
+ }
+ catch {}
destroy();
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]