Code

Merge git://repo.or.cz/git-gui
[git.git] / git-gui / lib / remote_branch_delete.tcl
index 241642062e7d4b8ad267f10fc6123bab52dfc744..f872a3d89d89bc861ea3729ec7974833bdac277f 100644 (file)
@@ -23,34 +23,40 @@ field full_cache
 field cached
 
 constructor dialog {} {
-       global all_remotes M1B
+       global all_remotes M1B use_ttk NS
 
-       make_toplevel top w
+       make_dialog top w
        wm title $top [append "[appname] ([reponame]): " [mc "Delete Branch Remotely"]]
        if {$top ne {.}} {
                wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
        }
 
-       label $w.header -text [mc "Delete Branch Remotely"] -font font_uibold
+       ${NS}::label $w.header -text [mc "Delete Branch Remotely"] \
+               -font font_uibold -anchor center
        pack $w.header -side top -fill x
 
-       frame $w.buttons
-       button $w.buttons.delete -text [mc Delete] \
+       ${NS}::frame $w.buttons
+       ${NS}::button $w.buttons.delete -text [mc Delete] \
                -default active \
                -command [cb _delete]
        pack $w.buttons.delete -side right
-       button $w.buttons.cancel -text [mc "Cancel"] \
+       ${NS}::button $w.buttons.cancel -text [mc "Cancel"] \
                -command [list destroy $w]
        pack $w.buttons.cancel -side right -padx 5
        pack $w.buttons -side bottom -fill x -pady 10 -padx 10
 
-       labelframe $w.dest -text [mc "From Repository"]
+       ${NS}::labelframe $w.dest -text [mc "From Repository"]
        if {$all_remotes ne {}} {
-               radiobutton $w.dest.remote_r \
+               ${NS}::radiobutton $w.dest.remote_r \
                        -text [mc "Remote:"] \
                        -value remote \
                        -variable @urltype
-               eval tk_optionMenu $w.dest.remote_m @remote $all_remotes
+               if {$use_ttk} {
+                       ttk::combobox $w.dest.remote_m -textvariable @remote \
+                               -values $all_remotes -state readonly
+               } else {
+                       eval tk_optionMenu $w.dest.remote_m @remote $all_remotes
+               }
                grid $w.dest.remote_r $w.dest.remote_m -sticky w
                if {[lsearch -sorted -exact $all_remotes origin] != -1} {
                        set remote origin
@@ -62,13 +68,11 @@ constructor dialog {} {
        } else {
                set urltype url
        }
-       radiobutton $w.dest.url_r \
+       ${NS}::radiobutton $w.dest.url_r \
                -text [mc "Arbitrary Location:"] \
                -value url \
                -variable @urltype
-       entry $w.dest.url_t \
-               -borderwidth 1 \
-               -relief sunken \
+       ${NS}::entry $w.dest.url_t \
                -width 50 \
                -textvariable @url \
                -validate key \
@@ -81,33 +85,30 @@ constructor dialog {} {
        grid columnconfigure $w.dest 1 -weight 1
        pack $w.dest -anchor nw -fill x -pady 5 -padx 5
 
-       labelframe $w.heads -text [mc "Branches"]
-       listbox $w.heads.l \
+       ${NS}::labelframe $w.heads -text [mc "Branches"]
+       slistbox $w.heads.l \
                -height 10 \
                -width 70 \
                -listvariable @head_list \
-               -selectmode extended \
-               -yscrollcommand [list $w.heads.sby set]
-       scrollbar $w.heads.sby -command [list $w.heads.l yview]
+               -selectmode extended
 
-       frame $w.heads.footer
-       label $w.heads.footer.status \
+       ${NS}::frame $w.heads.footer
+       ${NS}::label $w.heads.footer.status \
                -textvariable @status \
                -anchor w \
                -justify left
-       button $w.heads.footer.rescan \
+       ${NS}::button $w.heads.footer.rescan \
                -text [mc "Rescan"] \
                -command [cb _rescan]
        pack $w.heads.footer.status -side left -fill x
        pack $w.heads.footer.rescan -side right
 
        pack $w.heads.footer -side bottom -fill x
-       pack $w.heads.sby -side right -fill y
        pack $w.heads.l -side left -fill both -expand 1
        pack $w.heads -fill both -expand 1 -pady 5 -padx 5
 
-       labelframe $w.validate -text [mc "Delete Only If"]
-       radiobutton $w.validate.head_r \
+       ${NS}::labelframe $w.validate -text [mc "Delete Only If"]
+       ${NS}::radiobutton $w.validate.head_r \
                -text [mc "Merged Into:"] \
                -value head \
                -variable @checktype
@@ -115,7 +116,7 @@ constructor dialog {} {
        trace add variable @head_list write [cb _write_head_list]
        trace add variable @check_head write [cb _write_check_head]
        grid $w.validate.head_r $w.validate.head_m -sticky w
-       radiobutton $w.validate.always_r \
+       ${NS}::radiobutton $w.validate.always_r \
                -text [mc "Always (Do not perform merge checks)"] \
                -value always \
                -variable @checktype