diff options
Diffstat (limited to 'git-gui/lib')
-rw-r--r-- | git-gui/lib/blame.tcl | 2 | ||||
-rw-r--r-- | git-gui/lib/branch_checkout.tcl | 2 | ||||
-rw-r--r-- | git-gui/lib/branch_create.tcl | 2 | ||||
-rw-r--r-- | git-gui/lib/branch_delete.tcl | 4 | ||||
-rw-r--r-- | git-gui/lib/branch_rename.tcl | 2 | ||||
-rw-r--r-- | git-gui/lib/browser.tcl | 6 | ||||
-rw-r--r-- | git-gui/lib/choose_repository.tcl | 17 | ||||
-rw-r--r-- | git-gui/lib/commit.tcl | 47 | ||||
-rw-r--r-- | git-gui/lib/database.tcl | 4 | ||||
-rw-r--r-- | git-gui/lib/diff.tcl | 15 | ||||
-rw-r--r-- | git-gui/lib/error.tcl | 8 | ||||
-rw-r--r-- | git-gui/lib/index.tcl | 12 | ||||
-rw-r--r-- | git-gui/lib/merge.tcl | 18 | ||||
-rw-r--r-- | git-gui/lib/option.tcl | 8 | ||||
-rw-r--r-- | git-gui/lib/remote.tcl | 8 | ||||
-rw-r--r-- | git-gui/lib/remote_add.tcl | 2 | ||||
-rw-r--r-- | git-gui/lib/remote_branch_delete.tcl | 2 | ||||
-rw-r--r-- | git-gui/lib/shortcut.tcl | 17 | ||||
-rw-r--r-- | git-gui/lib/sshkey.tcl | 5 | ||||
-rw-r--r-- | git-gui/lib/themed.tcl | 100 | ||||
-rw-r--r-- | git-gui/lib/tools.tcl | 3 | ||||
-rw-r--r-- | git-gui/lib/tools_dlg.tcl | 6 | ||||
-rw-r--r-- | git-gui/lib/transport.tcl | 2 |
23 files changed, 220 insertions, 72 deletions
diff --git a/git-gui/lib/blame.tcl b/git-gui/lib/blame.tcl index b1d15f4621..a1aeb8b96e 100644 --- a/git-gui/lib/blame.tcl +++ b/git-gui/lib/blame.tcl @@ -70,7 +70,7 @@ constructor new {i_commit i_path i_jump} { set path $i_path make_toplevel top w - wm title $top [append "[appname] ([reponame]): " [mc "File Viewer"]] + wm title $top [mc "%s (%s): File Viewer" [appname] [reponame]] set font_w [font measure font_diff "0"] diff --git a/git-gui/lib/branch_checkout.tcl b/git-gui/lib/branch_checkout.tcl index 2e459a8297..d06037decc 100644 --- a/git-gui/lib/branch_checkout.tcl +++ b/git-gui/lib/branch_checkout.tcl @@ -13,7 +13,7 @@ constructor dialog {} { global use_ttk NS make_dialog top w wm withdraw $w - wm title $top [append "[appname] ([reponame]): " [mc "Checkout Branch"]] + wm title $top [mc "%s (%s): Checkout Branch" [appname] [reponame]] if {$top ne {.}} { wm geometry $top "+[winfo rootx .]+[winfo rooty .]" } diff --git a/git-gui/lib/branch_create.tcl b/git-gui/lib/branch_create.tcl index 4bb907705c..ba367d551d 100644 --- a/git-gui/lib/branch_create.tcl +++ b/git-gui/lib/branch_create.tcl @@ -20,7 +20,7 @@ constructor dialog {} { make_dialog top w wm withdraw $w - wm title $top [append "[appname] ([reponame]): " [mc "Create Branch"]] + wm title $top [mc "%s (%s): Create Branch" [appname] [reponame]] if {$top ne {.}} { wm geometry $top "+[winfo rootx .]+[winfo rooty .]" } diff --git a/git-gui/lib/branch_delete.tcl b/git-gui/lib/branch_delete.tcl index 867938ec6a..a5051637bb 100644 --- a/git-gui/lib/branch_delete.tcl +++ b/git-gui/lib/branch_delete.tcl @@ -13,7 +13,7 @@ constructor dialog {} { make_dialog top w wm withdraw $w - wm title $top [append "[appname] ([reponame]): " [mc "Delete Branch"]] + wm title $top [mc "%s (%s): Delete Branch" [appname] [reponame]] if {$top ne {.}} { wm geometry $top "+[winfo rootx .]+[winfo rooty .]" } @@ -128,7 +128,7 @@ method _delete {} { set b [lindex $i 0] set o [lindex $i 1] if {[catch {git branch -D $b} err]} { - append failed " - $b: $err\n" + append failed [mc " - %s:" $b] " $err\n" } } diff --git a/git-gui/lib/branch_rename.tcl b/git-gui/lib/branch_rename.tcl index 6e510ec2e3..3a2d79a9cc 100644 --- a/git-gui/lib/branch_rename.tcl +++ b/git-gui/lib/branch_rename.tcl @@ -12,7 +12,7 @@ constructor dialog {} { make_dialog top w wm withdraw $w - wm title $top [append "[appname] ([reponame]): " [mc "Rename Branch"]] + wm title $top [mc "%s (%s): Rename Branch" [appname] [reponame]] if {$top ne {.}} { wm geometry $top "+[winfo rootx .]+[winfo rooty .]" } diff --git a/git-gui/lib/browser.tcl b/git-gui/lib/browser.tcl index 0328338fda..a982983667 100644 --- a/git-gui/lib/browser.tcl +++ b/git-gui/lib/browser.tcl @@ -24,7 +24,7 @@ constructor new {commit {path {}}} { global cursor_ptr M1B use_ttk NS make_dialog top w wm withdraw $top - wm title $top [append "[appname] ([reponame]): " [mc "File Browser"]] + wm title $top [mc "%s (%s): File Browser" [appname] [reponame]] if {$path ne {}} { if {[string index $path end] ne {/}} { @@ -197,7 +197,7 @@ method _ls {tree_id {name {}}} { $w conf -state disabled set fd [git_read ls-tree -z $tree_id] - fconfigure $fd -blocking 0 -translation binary -encoding binary + fconfigure $fd -blocking 0 -translation binary -encoding utf-8 fileevent $fd readable [cb _read $fd] } @@ -272,7 +272,7 @@ constructor dialog {} { global use_ttk NS make_dialog top w wm withdraw $top - wm title $top [append "[appname] ([reponame]): " [mc "Browse Branch Files"]] + wm title $top [mc "%s (%s): Browse Branch Files" [appname] [reponame]] if {$top ne {.}} { wm geometry $top "+[winfo rootx .]+[winfo rooty .]" wm transient $top . diff --git a/git-gui/lib/choose_repository.tcl b/git-gui/lib/choose_repository.tcl index 75d1da8d31..80f5a59bbb 100644 --- a/git-gui/lib/choose_repository.tcl +++ b/git-gui/lib/choose_repository.tcl @@ -142,6 +142,10 @@ constructor pick {} { -label [mc "Recent Repositories"] } + if {[set lenrecent [llength $sorted_recent]] < $maxrecent} { + set lenrecent $maxrecent + } + ${NS}::label $w_body.space ${NS}::label $w_body.recentlabel \ -anchor w \ @@ -153,7 +157,7 @@ constructor pick {} { -background [get_bg_color $w_body.recentlabel] \ -wrap none \ -width 50 \ - -height $maxrecent + -height $lenrecent $w_recentlist tag conf link \ -foreground blue \ -underline 1 @@ -235,19 +239,19 @@ method _invoke_next {} { proc _get_recentrepos {} { set recent [list] - foreach p [get_config gui.recentrepo] { + foreach p [lsort -unique [get_config gui.recentrepo]] { if {[_is_git [file join $p .git]]} { lappend recent $p } else { _unset_recentrepo $p } } - return [lsort $recent] + return $recent } proc _unset_recentrepo {p} { regsub -all -- {([()\[\]{}\.^$+*?\\])} $p {\\\1} p - git config --global --unset gui.recentrepo "^$p\$" + catch {git config --global --unset-all gui.recentrepo "^$p\$"} load_config 1 } @@ -262,12 +266,11 @@ proc _append_recentrepos {path} { set i [lsearch $recent $path] if {$i >= 0} { _unset_recentrepo $path - set recent [lreplace $recent $i $i] } - lappend recent $path git config --global --add gui.recentrepo $path load_config 1 + set recent [get_config gui.recentrepo] if {[set maxrecent [get_config gui.maxrecentrepo]] eq {}} { set maxrecent 10 @@ -275,7 +278,7 @@ proc _append_recentrepos {path} { while {[llength $recent] > $maxrecent} { _unset_recentrepo [lindex $recent 0] - set recent [lrange $recent 1 end] + set recent [get_config gui.recentrepo] } } diff --git a/git-gui/lib/commit.tcl b/git-gui/lib/commit.tcl index 864b687057..75ea965dac 100644 --- a/git-gui/lib/commit.tcl +++ b/git-gui/lib/commit.tcl @@ -2,7 +2,7 @@ # Copyright (C) 2006, 2007 Shawn Pearce proc load_last_commit {} { - global HEAD PARENT MERGE_HEAD commit_type ui_comm + global HEAD PARENT MERGE_HEAD commit_type ui_comm commit_author global repo_config if {[llength $PARENT] == 0} { @@ -25,6 +25,8 @@ You are currently in the middle of a merge that has not been fully completed. Y set msg {} set parents [list] if {[catch { + set name "" + set email "" set fd [git_read cat-file commit $curHEAD] fconfigure $fd -encoding binary -translation lf # By default commits are assumed to be in utf-8 @@ -34,7 +36,7 @@ You are currently in the middle of a merge that has not been fully completed. Y lappend parents [string range $line 7 end] } elseif {[string match {encoding *} $line]} { set enc [string tolower [string range $line 9 end]] - } + } elseif {[regexp "author (.*)\\s<(.*)>\\s(\\d.*$)" $line all name email time]} { } } set msg [read $fd] close $fd @@ -42,7 +44,13 @@ You are currently in the middle of a merge that has not been fully completed. Y set enc [tcl_encoding $enc] if {$enc ne {}} { set msg [encoding convertfrom $enc $msg] + set name [encoding convertfrom $enc $name] + set email [encoding convertfrom $enc $email] } + if {$name ne {} && $email ne {}} { + set commit_author [list name $name email $email date $time] + } + set msg [string trim $msg] } err]} { error_popup [strcat [mc "Error loading commit data for amend:"] "\n\n$err"] @@ -106,9 +114,10 @@ proc do_signoff {} { } proc create_new_commit {} { - global commit_type ui_comm + global commit_type ui_comm commit_author set commit_type normal + unset -nocomplain commit_author $ui_comm delete 0.0 end $ui_comm edit reset $ui_comm edit modified false @@ -322,11 +331,12 @@ proc commit_writetree {curHEAD msg_p} { } proc commit_committree {fd_wt curHEAD msg_p} { - global HEAD PARENT MERGE_HEAD commit_type + global HEAD PARENT MERGE_HEAD commit_type commit_author global current_branch global ui_comm selected_commit_type global file_states selected_paths rescan_active global repo_config + global env gets $fd_wt tree_id if {[catch {close $fd_wt} err]} { @@ -366,9 +376,15 @@ A rescan will be automatically started now. } } + if {[info exists commit_author]} { + set old_author [commit_author_ident $commit_author] + } # -- Create the commit. # set cmd [list commit-tree $tree_id] + if {[is_config_true commit.gpgsign]} { + lappend cmd -S + } foreach p [concat $PARENT $MERGE_HEAD] { lappend cmd -p $p } @@ -378,8 +394,14 @@ A rescan will be automatically started now. error_popup [strcat [mc "commit-tree failed:"] "\n\n$err"] ui_status [mc "Commit failed."] unlock_index + unset -nocomplain commit_author + commit_author_reset $old_author return } + if {[info exists commit_author]} { + unset -nocomplain commit_author + commit_author_reset $old_author + } # -- Update the HEAD ref. # @@ -506,3 +528,20 @@ proc commit_postcommit_wait {fd_ph cmt_id} { } fconfigure $fd_ph -blocking 0 } + +proc commit_author_ident {details} { + global env + array set author $details + set old [array get env GIT_AUTHOR_*] + set env(GIT_AUTHOR_NAME) $author(name) + set env(GIT_AUTHOR_EMAIL) $author(email) + set env(GIT_AUTHOR_DATE) $author(date) + return $old +} +proc commit_author_reset {details} { + global env + unset env(GIT_AUTHOR_NAME) env(GIT_AUTHOR_EMAIL) env(GIT_AUTHOR_DATE) + if {$details ne {}} { + array set env $details + } +} diff --git a/git-gui/lib/database.tcl b/git-gui/lib/database.tcl index 1f187ed286..85783081e0 100644 --- a/git-gui/lib/database.tcl +++ b/git-gui/lib/database.tcl @@ -54,7 +54,7 @@ proc do_stats {} { set value "$value[lindex $s 2]" } - ${NS}::label $w.stat.l_$name -text "$label:" -anchor w + ${NS}::label $w.stat.l_$name -text [mc "%s:" $label] -anchor w ${NS}::label $w.stat.v_$name -text $value -anchor w grid $w.stat.l_$name $w.stat.v_$name -sticky we -padx {0 5} } @@ -63,7 +63,7 @@ proc do_stats {} { bind $w <Visibility> "grab $w; focus $w.buttons.close" bind $w <Key-Escape> [list destroy $w] bind $w <Key-Return> [list destroy $w] - wm title $w [append "[appname] ([reponame]): " [mc "Database Statistics"]] + wm title $w [mc "%s (%s): Database Statistics" [appname] [reponame]] wm deiconify $w tkwait window $w } diff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl index 0d56986215..68c4a6c736 100644 --- a/git-gui/lib/diff.tcl +++ b/git-gui/lib/diff.tcl @@ -127,6 +127,9 @@ proc show_diff {path w {lno {}} {scroll_pos {}} {callback {}}} { } else { start_show_diff $cont_info } + + global current_diff_path selected_paths + set selected_paths($current_diff_path) 1 } proc show_unmerged_diff {cont_info} { @@ -220,10 +223,9 @@ proc show_other_diff {path w m cont_info} { } $ui_diff conf -state normal if {$type eq {submodule}} { - $ui_diff insert end [append \ - "* " \ - [mc "Git Repository (subproject)"] \ - "\n"] d_info + $ui_diff insert end \ + "* [mc "Git Repository (subproject)"]\n" \ + d_info } elseif {![catch {set type [exec file $path]}]} { set n [string length $path] if {[string equal -length $n $path $type]} { @@ -608,7 +610,7 @@ proc apply_hunk {x y} { puts -nonewline $p $current_diff_header puts -nonewline $p [$ui_diff get $s_lno $e_lno] close $p} err]} { - error_popup [append $failed_msg "\n\n$err"] + error_popup "$failed_msg\n\n$err" unlock_index return } @@ -696,6 +698,7 @@ proc apply_range_or_line {x y} { set hh [$ui_diff get $i_l "$i_l + 1 lines"] set hh [lindex [split $hh ,] 0] set hln [lindex [split $hh -] 1] + set hln [lindex [split $hln " "] 0] # There is a special situation to take care of. Consider this # hunk: @@ -826,7 +829,7 @@ proc apply_range_or_line {x y} { puts -nonewline $p $current_diff_header puts -nonewline $p $wholepatch close $p} err]} { - error_popup [append $failed_msg "\n\n$err"] + error_popup "$failed_msg\n\n$err" } unlock_index diff --git a/git-gui/lib/error.tcl b/git-gui/lib/error.tcl index c0fa69af56..8968a57f33 100644 --- a/git-gui/lib/error.tcl +++ b/git-gui/lib/error.tcl @@ -17,7 +17,7 @@ proc error_popup {msg} { set cmd [list tk_messageBox \ -icon error \ -type ok \ - -title [append "$title: " [mc "error"]] \ + -title [mc "%s: error" $title] \ -message $msg] if {[winfo ismapped [_error_parent]]} { lappend cmd -parent [_error_parent] @@ -33,7 +33,7 @@ proc warn_popup {msg} { set cmd [list tk_messageBox \ -icon warning \ -type ok \ - -title [append "$title: " [mc "warning"]] \ + -title [mc "%s: warning" $title] \ -message $msg] if {[winfo ismapped [_error_parent]]} { lappend cmd -parent [_error_parent] @@ -77,7 +77,7 @@ proc hook_failed_popup {hook msg {is_fatal 1}} { wm withdraw $w ${NS}::frame $w.m - ${NS}::label $w.m.l1 -text "$hook hook failed:" \ + ${NS}::label $w.m.l1 -text [mc "%s hook failed:" $hook] \ -anchor w \ -justify left \ -font font_uibold @@ -113,7 +113,7 @@ proc hook_failed_popup {hook msg {is_fatal 1}} { bind $w <Visibility> "grab $w; focus $w" bind $w <Key-Return> "destroy $w" - wm title $w [strcat "[appname] ([reponame]): " [mc "error"]] + wm title $w [mc "%s (%s): error" [appname] [reponame]] wm deiconify $w tkwait window $w } diff --git a/git-gui/lib/index.tcl b/git-gui/lib/index.tcl index 74a81a7b42..b588db11d9 100644 --- a/git-gui/lib/index.tcl +++ b/git-gui/lib/index.tcl @@ -115,7 +115,7 @@ proc write_update_indexinfo {fd pathList totalCnt batch after} { set info [lindex $s 2] if {$info eq {}} continue - puts -nonewline $fd "$info\t[encoding convertto $path]\0" + puts -nonewline $fd "$info\t[encoding convertto utf-8 $path]\0" display_file $path $new } @@ -186,7 +186,7 @@ proc write_update_index {fd pathList totalCnt batch after} { ?M {set new M_} ?? {continue} } - puts -nonewline $fd "[encoding convertto $path]\0" + puts -nonewline $fd "[encoding convertto utf-8 $path]\0" display_file $path $new } @@ -247,7 +247,7 @@ proc write_checkout_index {fd pathList totalCnt batch after} { ?M - ?T - ?D { - puts -nonewline $fd "[encoding convertto $path]\0" + puts -nonewline $fd "[encoding convertto utf-8 $path]\0" display_file $path ?_ } } @@ -291,7 +291,7 @@ proc do_unstage_selection {} { if {[array size selected_paths] > 0} { unstage_helper \ - {Unstaging selected files from commit} \ + [mc "Unstaging selected files from commit"] \ [array names selected_paths] } elseif {$current_diff_path ne {}} { unstage_helper \ @@ -343,7 +343,7 @@ proc do_add_selection {} { if {[array size selected_paths] > 0} { add_helper \ - {Adding selected files} \ + [mc "Adding selected files"] \ [array names selected_paths] } elseif {$current_diff_path ne {}} { add_helper \ @@ -385,7 +385,7 @@ proc do_add_all {} { set paths [concat $paths $untracked_paths] } } - add_helper {Adding all changed files} $paths + add_helper [mc "Adding all changed files"] $paths } proc revert_helper {txt paths} { diff --git a/git-gui/lib/merge.tcl b/git-gui/lib/merge.tcl index 460d32fa22..9f253db5b3 100644 --- a/git-gui/lib/merge.tcl +++ b/git-gui/lib/merge.tcl @@ -112,12 +112,16 @@ method _start {} { close $fh set _last_merged_branch $branch - set cmd [list git] - lappend cmd merge - lappend cmd --strategy=recursive - lappend cmd [git fmt-merge-msg <[gitdir FETCH_HEAD]] - lappend cmd HEAD - lappend cmd $name + if {[git-version >= "2.5.0"]} { + set cmd [list git merge --strategy=recursive FETCH_HEAD] + } else { + set cmd [list git] + lappend cmd merge + lappend cmd --strategy=recursive + lappend cmd [git fmt-merge-msg <[gitdir FETCH_HEAD]] + lappend cmd HEAD + lappend cmd $name + } ui_status [mc "Merging %s and %s..." $current_branch $stitle] set cons [console::new [mc "Merge"] "merge $stitle"] @@ -149,7 +153,7 @@ constructor dialog {} { } make_dialog top w - wm title $top [append "[appname] ([reponame]): " [mc "Merge"]] + wm title $top [mc "%s (%s): Merge" [appname] [reponame]] if {$top ne {.}} { wm geometry $top "+[winfo rootx .]+[winfo rooty .]" } diff --git a/git-gui/lib/option.tcl b/git-gui/lib/option.tcl index b5b6b2fea6..e43971bfa3 100644 --- a/git-gui/lib/option.tcl +++ b/git-gui/lib/option.tcl @@ -179,7 +179,7 @@ proc do_options {} { i-* { regexp -- {-(\d+)\.\.(\d+)$} $type _junk min max ${NS}::frame $w.$f.$optid - ${NS}::label $w.$f.$optid.l -text "$text:" + ${NS}::label $w.$f.$optid.l -text [mc "%s:" $text] pack $w.$f.$optid.l -side left -anchor w -fill x tspinbox $w.$f.$optid.v \ -textvariable ${f}_config_new($name) \ @@ -194,7 +194,7 @@ proc do_options {} { c - t { ${NS}::frame $w.$f.$optid - ${NS}::label $w.$f.$optid.l -text "$text:" + ${NS}::label $w.$f.$optid.l -text [mc "%s:" $text] ${NS}::entry $w.$f.$optid.v \ -width 20 \ -textvariable ${f}_config_new($name) @@ -217,7 +217,7 @@ proc do_options {} { s { set opts [eval [lindex $option 3]] ${NS}::frame $w.$f.$optid - ${NS}::label $w.$f.$optid.l -text "$text:" + ${NS}::label $w.$f.$optid.l -text [mc "%s:" $text] if {$use_ttk} { ttk::combobox $w.$f.$optid.v \ -textvariable ${f}_config_new($name) \ @@ -279,7 +279,7 @@ proc do_options {} { [font configure $font -size] ${NS}::frame $w.global.$name - ${NS}::label $w.global.$name.l -text "$text:" + ${NS}::label $w.global.$name.l -text [mc "%s:" $text] ${NS}::button $w.global.$name.b \ -text [mc "Change Font"] \ -command [list \ diff --git a/git-gui/lib/remote.tcl b/git-gui/lib/remote.tcl index 4e5c784418..ef77ed7399 100644 --- a/git-gui/lib/remote.tcl +++ b/git-gui/lib/remote.tcl @@ -246,22 +246,22 @@ proc update_all_remotes_menu_entry {} { if {$have_remote > 1} { make_sure_remote_submenues_exist $remote_m if {[$fetch_m type end] eq "command" \ - && [$fetch_m entrycget end -label] ne "All"} { + && [$fetch_m entrycget end -label] ne [mc "All"]} { $fetch_m insert end separator $fetch_m insert end command \ - -label "All" \ + -label [mc "All"] \ -command fetch_from_all $prune_m insert end separator $prune_m insert end command \ - -label "All" \ + -label [mc "All"] \ -command prune_from_all } } else { if {[winfo exists $fetch_m]} { if {[$fetch_m type end] eq "command" \ - && [$fetch_m entrycget end -label] eq "All"} { + && [$fetch_m entrycget end -label] eq [mc "All"]} { delete_from_menu $fetch_m end delete_from_menu $fetch_m end diff --git a/git-gui/lib/remote_add.tcl b/git-gui/lib/remote_add.tcl index 50029d0cee..480a6b30d0 100644 --- a/git-gui/lib/remote_add.tcl +++ b/git-gui/lib/remote_add.tcl @@ -17,7 +17,7 @@ constructor dialog {} { make_dialog top w wm withdraw $top - wm title $top [append "[appname] ([reponame]): " [mc "Add Remote"]] + wm title $top [mc "%s (%s): Add Remote" [appname] [reponame]] if {$top ne {.}} { wm geometry $top "+[winfo rootx .]+[winfo rooty .]" } diff --git a/git-gui/lib/remote_branch_delete.tcl b/git-gui/lib/remote_branch_delete.tcl index fcc06d03a1..5ba9fcadd1 100644 --- a/git-gui/lib/remote_branch_delete.tcl +++ b/git-gui/lib/remote_branch_delete.tcl @@ -26,7 +26,7 @@ constructor dialog {} { global all_remotes M1B use_ttk NS make_dialog top w - wm title $top [append "[appname] ([reponame]): " [mc "Delete Branch Remotely"]] + wm title $top [mc "%s (%s): Delete Branch Remotely" [appname] [reponame]] if {$top ne {.}} { wm geometry $top "+[winfo rootx .]+[winfo rooty .]" } diff --git a/git-gui/lib/shortcut.tcl b/git-gui/lib/shortcut.tcl index 78878ef89d..97d1d7aa02 100644 --- a/git-gui/lib/shortcut.tcl +++ b/git-gui/lib/shortcut.tcl @@ -5,17 +5,20 @@ proc do_windows_shortcut {} { global _gitworktree set fn [tk_getSaveFile \ -parent . \ - -title [append "[appname] ([reponame]): " [mc "Create Desktop Icon"]] \ + -title [mc "%s (%s): Create Desktop Icon" [appname] [reponame]] \ -initialfile "Git [reponame].lnk"] if {$fn != {}} { if {[file extension $fn] ne {.lnk}} { set fn ${fn}.lnk } + # Use git-gui.exe if available (ie: git-for-windows) + set cmdLine [auto_execok git-gui.exe] + if {$cmdLine eq {}} { + set cmdLine [list [info nameofexecutable] \ + [file normalize $::argv0]] + } if {[catch { - win32_create_lnk $fn [list \ - [info nameofexecutable] \ - [file normalize $::argv0] \ - ] \ + win32_create_lnk $fn $cmdLine \ [file normalize $_gitworktree] } err]} { error_popup [strcat [mc "Cannot write shortcut:"] "\n\n$err"] @@ -37,7 +40,7 @@ proc do_cygwin_shortcut {} { } set fn [tk_getSaveFile \ -parent . \ - -title [append "[appname] ([reponame]): " [mc "Create Desktop Icon"]] \ + -title [mc "%s (%s): Create Desktop Icon" [appname] [reponame]] \ -initialdir $desktop \ -initialfile "Git [reponame].lnk"] if {$fn != {}} { @@ -69,7 +72,7 @@ proc do_macosx_app {} { set fn [tk_getSaveFile \ -parent . \ - -title [append "[appname] ([reponame]): " [mc "Create Desktop Icon"]] \ + -title [mc "%s (%s): Create Desktop Icon" [appname] [reponame]] \ -initialdir [file join $env(HOME) Desktop] \ -initialfile "Git [reponame].app"] if {$fn != {}} { diff --git a/git-gui/lib/sshkey.tcl b/git-gui/lib/sshkey.tcl index aa6457bbb5..589ff8f78a 100644 --- a/git-gui/lib/sshkey.tcl +++ b/git-gui/lib/sshkey.tcl @@ -2,7 +2,10 @@ # Copyright (C) 2006, 2007 Shawn Pearce proc find_ssh_key {} { - foreach name {~/.ssh/id_dsa.pub ~/.ssh/id_rsa.pub ~/.ssh/identity.pub} { + foreach name { + ~/.ssh/id_dsa.pub ~/.ssh/id_ecdsa.pub ~/.ssh/id_ed25519.pub + ~/.ssh/id_rsa.pub ~/.ssh/identity.pub + } { if {[file exists $name]} { set fh [open $name r] set cont [read $fh] diff --git a/git-gui/lib/themed.tcl b/git-gui/lib/themed.tcl index 8b88d3678b..88b3119a75 100644 --- a/git-gui/lib/themed.tcl +++ b/git-gui/lib/themed.tcl @@ -1,6 +1,14 @@ # Functions for supporting the use of themed Tk widgets in git-gui. # Copyright (C) 2009 Pat Thoyts <patthoyts@users.sourceforge.net> +proc ttk_get_current_theme {} { + # Handle either current Tk or older versions of 8.5 + if {[catch {set theme [ttk::style theme use]}]} { + set theme $::ttk::currentTheme + } + return $theme +} + proc InitTheme {} { # Create a color label style (bg can be overridden by widget option) ttk::style layout Color.TLabel { @@ -28,10 +36,7 @@ proc InitTheme {} { } } - # Handle either current Tk or older versions of 8.5 - if {[catch {set theme [ttk::style theme use]}]} { - set theme $::ttk::currentTheme - } + set theme [ttk_get_current_theme] if {[lsearch -exact {default alt classic clam} $theme] != -1} { # Simple override of standard ttk::entry to change the field @@ -78,6 +83,57 @@ proc InitTheme {} { } } +# Define a style used for the surround of text widgets. +proc InitEntryFrame {} { + ttk::style theme settings default { + ttk::style layout EntryFrame { + EntryFrame.field -sticky nswe -border 0 -children { + EntryFrame.fill -sticky nswe -children { + EntryFrame.padding -sticky nswe + } + } + } + ttk::style configure EntryFrame -padding 1 -relief sunken + ttk::style map EntryFrame -background {} + } + ttk::style theme settings classic { + ttk::style configure EntryFrame -padding 2 -relief sunken + ttk::style map EntryFrame -background {} + } + ttk::style theme settings alt { + ttk::style configure EntryFrame -padding 2 + ttk::style map EntryFrame -background {} + } + ttk::style theme settings clam { + ttk::style configure EntryFrame -padding 2 + ttk::style map EntryFrame -background {} + } + + # Ignore errors for missing native themes + catch { + ttk::style theme settings winnative { + ttk::style configure EntryFrame -padding 2 + } + ttk::style theme settings xpnative { + ttk::style configure EntryFrame -padding 1 + ttk::style element create EntryFrame.field vsapi \ + EDIT 1 {disabled 4 focus 3 active 2 {} 1} -padding 1 + } + ttk::style theme settings vista { + ttk::style configure EntryFrame -padding 2 + ttk::style element create EntryFrame.field vsapi \ + EDIT 6 {disabled 4 focus 3 active 2 {} 1} -padding 2 + } + } + + bind EntryFrame <Enter> {%W instate !disabled {%W state active}} + bind EntryFrame <Leave> {%W state !active} + bind EntryFrame <<ThemeChanged>> { + set pad [ttk::style lookup EntryFrame -padding] + %W configure -padding [expr {$pad eq {} ? 1 : $pad}] + } +} + proc gold_frame {w args} { global use_ttk if {$use_ttk} { @@ -123,7 +179,7 @@ proc paddedlabel {w args} { # place a themed frame over the surface. proc Dialog {w args} { eval [linsert $args 0 toplevel $w -class Dialog] - catch {wm attributes $w -type dialog} + catch {wm attributes $w -type dialog} pave_toplevel $w return $w } @@ -193,6 +249,40 @@ proc tspinbox {w args} { } } +# Create a text widget with any theme specific properties. +proc ttext {w args} { + global use_ttk + if {$use_ttk} { + switch -- [ttk_get_current_theme] { + "vista" - "xpnative" { + lappend args -highlightthickness 0 -borderwidth 0 + } + } + } + set w [eval [linsert $args 0 text $w]] + if {$use_ttk} { + if {[winfo class [winfo parent $w]] eq "EntryFrame"} { + bind $w <FocusIn> {[winfo parent %W] state focus} + bind $w <FocusOut> {[winfo parent %W] state !focus} + } + } + return $w +} + +# themed frame suitable for surrounding a text field. +proc textframe {w args} { + global use_ttk + if {$use_ttk} { + if {[catch {ttk::style layout EntryFrame}]} { + InitEntryFrame + } + eval [linsert $args 0 ttk::frame $w -class EntryFrame -style EntryFrame] + } else { + eval [linsert $args 0 frame $w] + } + return $w +} + proc tentry {w args} { global use_ttk if {$use_ttk} { diff --git a/git-gui/lib/tools.tcl b/git-gui/lib/tools.tcl index 6ec94113db..413f1a1700 100644 --- a/git-gui/lib/tools.tcl +++ b/git-gui/lib/tools.tcl @@ -69,6 +69,7 @@ proc tools_populate_one {fullname} { proc tools_exec {fullname} { global repo_config env current_diff_path global current_branch is_detached + global selected_paths if {[is_config_true "guitool.$fullname.needsfile"]} { if {$current_diff_path eq {}} { @@ -100,6 +101,7 @@ proc tools_exec {fullname} { set env(GIT_GUITOOL) $fullname set env(FILENAME) $current_diff_path + set env(FILENAMES) [join [array names selected_paths] \n] if {$is_detached} { set env(CUR_BRANCH) "" } else { @@ -121,6 +123,7 @@ proc tools_exec {fullname} { unset env(GIT_GUITOOL) unset env(FILENAME) + unset env(FILENAMES) unset env(CUR_BRANCH) catch { unset env(ARGS) } catch { unset env(REVISION) } diff --git a/git-gui/lib/tools_dlg.tcl b/git-gui/lib/tools_dlg.tcl index 7eeda9daf2..c05413ce43 100644 --- a/git-gui/lib/tools_dlg.tcl +++ b/git-gui/lib/tools_dlg.tcl @@ -19,7 +19,7 @@ constructor dialog {} { global repo_config use_ttk NS make_dialog top w - wm title $top [append "[appname] ([reponame]): " [mc "Add Tool"]] + wm title $top [mc "%s (%s): Add Tool" [appname] [reponame]] if {$top ne {.}} { wm geometry $top "+[winfo rootx .]+[winfo rooty .]" wm transient $top . @@ -184,7 +184,7 @@ constructor dialog {} { load_config 1 make_dialog top w - wm title $top [append "[appname] ([reponame]): " [mc "Remove Tool"]] + wm title $top [mc "%s (%s): Remove Tool" [appname] [reponame]] if {$top ne {.}} { wm geometry $top "+[winfo rootx .]+[winfo rooty .]" wm transient $top . @@ -280,7 +280,7 @@ constructor dialog {fullname} { } make_dialog top w -autodelete 0 - wm title $top [append "[appname] ([reponame]): " $title] + wm title $top "[mc "%s (%s):" [appname] [reponame]] $title" if {$top ne {.}} { wm geometry $top "+[winfo rootx .]+[winfo rooty .]" wm transient $top . diff --git a/git-gui/lib/transport.tcl b/git-gui/lib/transport.tcl index e5d211edea..a1a424aab5 100644 --- a/git-gui/lib/transport.tcl +++ b/git-gui/lib/transport.tcl @@ -226,7 +226,7 @@ proc do_push_anywhere {} { bind $w <Visibility> "grab $w; focus $w.buttons.create" bind $w <Key-Escape> "destroy $w" bind $w <Key-Return> [list start_push_anywhere_action $w] - wm title $w [append "[appname] ([reponame]): " [mc "Push"]] + wm title $w [mc "%s (%s): Push" [appname] [reponame]] wm deiconify $w tkwait window $w } |