[gitg] Implemented unstaging of selection
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg] Implemented unstaging of selection
- Date: Thu, 2 Jan 2014 12:41:58 +0000 (UTC)
commit a1ec2c72dc1b6b6255768b4b660a7f05f340d8ce
Author: Jesse van den Kieboom <jessevdk gmail com>
Date: Thu Jan 2 13:29:44 2014 +0100
Implemented unstaging of selection
gitg/commit/gitg-commit.vala | 30 ++++++++++++++++++++++++------
1 files changed, 24 insertions(+), 6 deletions(-)
---
diff --git a/gitg/commit/gitg-commit.vala b/gitg/commit/gitg-commit.vala
index 3744a3f..21598a5 100644
--- a/gitg/commit/gitg-commit.vala
+++ b/gitg/commit/gitg-commit.vala
@@ -733,29 +733,47 @@ namespace GitgCommit
}
}
- private async void stage_selection() throws Error
+ private async void stage_unstage_selection(bool staging) throws Error
{
var selection = yield d_main.diff_view.get_selection();
var stage = application.repository.stage;
foreach (var pset in selection)
{
- yield stage.stage_patch(pset);
+ if (staging)
+ {
+ yield stage.stage_patch(pset);
+ }
+ else
+ {
+ yield stage.unstage_patch(pset);
+ }
}
}
private void on_stage_clicked()
{
- stage_selection.begin((obj, res) => {
+ var staging = d_main.diff_view.unstaged;
+
+ stage_unstage_selection.begin(staging, (obj, res) => {
try
{
- stage_selection.end(res);
+ stage_unstage_selection.end(res);
}
catch (Error e)
{
- var msg = _("Failed to stage selection");
- application.show_infobar(msg, e.message, Gtk.MessageType.ERROR);
+ string msg;
+ if (staging)
+ {
+ msg = _("Failed to stage selection");
+ }
+ else
+ {
+ msg = _("Failed to unstage selection");
+ }
+
+ application.show_infobar(msg, e.message, Gtk.MessageType.ERROR);
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]