[RFC PATCH 4/8] git gui: teach fetch operation to close dialog on successful completion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 git-gui/lib/console.tcl   |    6 ++++++
 git-gui/lib/transport.tcl |   12 ++++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/git-gui/lib/console.tcl b/git-gui/lib/console.tcl
index c112464..84eef13 100644
--- a/git-gui/lib/console.tcl
+++ b/git-gui/lib/console.tcl
@@ -168,6 +168,7 @@ method chain {cmdlist {ok 1}} {
 	} else {
 		done $this $ok
 	}
+	return $ok
 }
 
 method insert {txt} {
@@ -178,6 +179,11 @@ method insert {txt} {
 	$w_t conf -state disabled
 }
 
+method close_window {} {
+	wm protocol $w WM_DELETE_WINDOW {}
+	destroy $w
+}
+
 method done {ok} {
 	if {$ok} {
 		if {[winfo exists $w.m.s]} {
diff --git a/git-gui/lib/transport.tcl b/git-gui/lib/transport.tcl
index d717468..39443ab 100644
--- a/git-gui/lib/transport.tcl
+++ b/git-gui/lib/transport.tcl
@@ -1,7 +1,7 @@
 # git-gui transport (fetch/push) support
 # Copyright (C) 2006, 2007 Shawn Pearce
 
-proc fetch_from {remote} {
+proc fetch_from {remote {close_after {}}} {
 	set w [console::new \
 		[mc "fetch %s" $remote] \
 		[mc "Fetching new changes from %s" $remote]]
@@ -10,7 +10,15 @@ proc fetch_from {remote} {
 	if {[is_config_true gui.pruneduringfetch]} {
 		lappend cmds [list exec git remote prune $remote]
 	}
-	console::chain $w $cmds
+	set ok [console::chain $w $cmds]
+
+	if {$ok} {
+		if {$close_after ne {}} {
+			console::close_window $w
+		}
+		return 1
+	}
+	return 0
 }
 
 proc prune_from {remote} {
-- 
1.6.5.rc1.12.gc72fe

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]