diff --git a/main.go b/main.go index 73d3576..57e56d2 100644 --- a/main.go +++ b/main.go @@ -13,6 +13,12 @@ import ( const AutoRefreshInterval = 1 * time.Second +const ( + ContainersTab int = 0 + ImagesTab int = 1 + NetworksTab int = 2 + VolumesTab int = 3 +) func NewStatusDelegate(status string) *qt.QWidget { mw := qt.NewQWidget2() @@ -318,23 +324,23 @@ func (self *DockerGUI) update_toolbar_buttons(index int) { // Show actions based on the current tab // Containers tab - self.start_action.SetVisible(index == 0) - self.stop_action.SetVisible(index == 0) - self.remove_action.SetVisible(index == 0) - self.terminal_action.SetVisible(index == 0) - self.logs_action.SetVisible(index == 0) + self.start_action.SetVisible(index == ContainersTab) + self.stop_action.SetVisible(index == ContainersTab) + self.remove_action.SetVisible(index == ContainersTab) + self.terminal_action.SetVisible(index == ContainersTab) + self.logs_action.SetVisible(index == ContainersTab) // Images tab - self.pull_image_action.SetVisible(index == 1) - self.remove_image_action.SetVisible(index == 1) + self.pull_image_action.SetVisible(index == ImagesTab) + self.remove_image_action.SetVisible(index == ImagesTab) // Networks tab - self.create_network_action.SetVisible(index == 2) - self.remove_network_action.SetVisible(index == 2) + self.create_network_action.SetVisible(index == NetworksTab) + self.remove_network_action.SetVisible(index == NetworksTab) // Volumes tab - self.create_volume_action.SetVisible(index == 3) - self.remove_volume_action.SetVisible(index == 3) + self.create_volume_action.SetVisible(index == VolumesTab) + self.remove_volume_action.SetVisible(index == VolumesTab) } func (self *DockerGUI) create_menu_bar() {