[gitg/wip/commit] Implemented unstage
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg/wip/commit] Implemented unstage
- Date: Wed, 3 Jul 2013 17:13:01 +0000 (UTC)
commit d4ac31a0623eecb5b9017333500a5aae44d739e3
Author: Jesse van den Kieboom <jessevdk gmail com>
Date: Wed Jul 3 19:12:44 2013 +0200
Implemented unstage
gitg/commit/gitg-commit.vala | 49 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 49 insertions(+), 0 deletions(-)
---
diff --git a/gitg/commit/gitg-commit.vala b/gitg/commit/gitg-commit.vala
index eef620c..e5e321d 100644
--- a/gitg/commit/gitg-commit.vala
+++ b/gitg/commit/gitg-commit.vala
@@ -210,12 +210,61 @@ namespace GitgCommit
});
}
+ private void delete_index_file(Gitg.StageStatusFile f)
+ {
+ var stage = application.repository.stage;
+
+ stage.revert_index_path.begin(f.path, (obj, res) => {
+ try
+ {
+ stage.revert_index_path.end(res);
+ }
+ catch (Error e)
+ {
+ var msg = _("Failed to unstage the removal of file
`%s'").printf(f.path);
+ application.show_infobar(msg, e.message, Gtk.MessageType.ERROR);
+ }
+
+ reload();
+ });
+ }
+
+ private void unstage_file(Gitg.StageStatusFile f)
+ {
+ var stage = application.repository.stage;
+
+ stage.unstage_path.begin(f.path, (obj, res) => {
+ try
+ {
+ stage.unstage_path.end(res);
+ }
+ catch (Error e)
+ {
+ var msg = _("Failed to unstage the file `%s'").printf(f.path);
+ application.show_infobar(msg, e.message, Gtk.MessageType.ERROR);
+ }
+
+ reload();
+ });
+ }
+
private void on_staged_activated(Gitg.StageStatusFile f, int numclick)
{
if (numclick == 1)
{
show_staged_diff(f);
}
+ else
+ {
+ if ((f.flags & Ggit.StatusFlags.INDEX_DELETED) != 0)
+ {
+ delete_index_file(f);
+ }
+ else
+ {
+ unstage_file(f);
+ }
+ }
}
private void append_files(Gitg.SidebarStore model,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]