shortening long names fixed (Unicode)

This commit is contained in:
piotr
2021-05-29 02:07:34 +02:00
parent 675631949e
commit fa6ce8ef49
4 changed files with 9 additions and 23 deletions

Binary file not shown.

View File

@@ -83,8 +83,7 @@ var desktopEntries []desktopEntry
// UI elements // UI elements
var ( var (
resultWindow *gtk.ScrolledWindow resultWindow *gtk.ScrolledWindow
//fileSearchResults map[string]string
fileSearchResults []string fileSearchResults []string
searchEntry *gtk.SearchEntry searchEntry *gtk.SearchEntry
phrase string phrase string
@@ -92,7 +91,6 @@ var (
fileSearchResultFlowBox *gtk.FlowBox fileSearchResultFlowBox *gtk.FlowBox
buttonsWrapper *gtk.Box buttonsWrapper *gtk.Box
buttonBox *gtk.EventBox buttonBox *gtk.EventBox
confirmationBox *gtk.Box
userDirsMap map[string]string userDirsMap map[string]string
appFlowBox *gtk.FlowBox appFlowBox *gtk.FlowBox
appSearchResultWrapper *gtk.Box appSearchResultWrapper *gtk.Box
@@ -334,7 +332,6 @@ func main() {
fileSearchResultWrapper.SetSizeRequest(appFlowBox.GetAllocatedWidth(), 1) fileSearchResultWrapper.SetSizeRequest(appFlowBox.GetAllocatedWidth(), 1)
categoriesWrapper.SetSizeRequest(1, categoriesWrapper.GetAllocatedHeight()*2) categoriesWrapper.SetSizeRequest(1, categoriesWrapper.GetAllocatedHeight()*2)
//searchEntry.GrabFocus()
t := time.Now() t := time.Now()
println(fmt.Sprintf("UI created in %v ms. Thank you for your patience.", t.Sub(timeStart).Milliseconds())) println(fmt.Sprintf("UI created in %v ms. Thank you for your patience.", t.Sub(timeStart).Milliseconds()))
gtk.Main() gtk.Main()

View File

@@ -667,18 +667,3 @@ func mapOutputs() (map[string]*gdk.Monitor, error) {
} }
return result, nil return result, nil
} }
func listMonitors() ([]gdk.Monitor, error) {
var monitors []gdk.Monitor
display, err := gdk.DisplayGetDefault()
if err != nil {
return nil, err
}
num := display.GetNMonitors()
for i := 0; i < num; i++ {
monitor, _ := display.GetMonitor(i)
monitors = append(monitors, *monitor)
}
return monitors, nil
}

View File

@@ -48,7 +48,9 @@ func setUpPinnedFlowBox() *gtk.FlowBox {
name = entry.Name name = entry.Name
} }
if len(name) > 20 { if len(name) > 20 {
name = fmt.Sprintf("%s ...", name[:17]) r := []rune(name)
name = string(r[:20])
name = fmt.Sprintf("%s…", name)
} }
btn.SetLabel(name) btn.SetLabel(name)
@@ -223,7 +225,9 @@ func flowBoxButton(entry desktopEntry) *gtk.Button {
button.SetImagePosition(gtk.POS_TOP) button.SetImagePosition(gtk.POS_TOP)
name := entry.NameLoc name := entry.NameLoc
if len(name) > 20 { if len(name) > 20 {
name = fmt.Sprintf("%s ...", name[:17]) r := []rune(name)
name = string(r[:20])
name = fmt.Sprintf("%s…", name)
} }
button.SetLabel(name) button.SetLabel(name)
@@ -383,7 +387,7 @@ func setUpUserDirButton(iconName, displayName, entryName string, userDirsMap map
button.SetImage(img) button.SetImage(img)
if len(displayName) > *nameLimit { if len(displayName) > *nameLimit {
displayName = fmt.Sprintf("%s...", displayName[:*nameLimit-3]) displayName = fmt.Sprintf("%s", displayName[:*nameLimit-3])
} }
button.SetLabel(displayName) button.SetLabel(displayName)
@@ -409,7 +413,7 @@ func setUpUserFileSearchResultButton(fileName, filePath string) *gtk.Box {
tooltipText := "" tooltipText := ""
if len(fileName) > *nameLimit { if len(fileName) > *nameLimit {
tooltipText = fileName tooltipText = fileName
fileName = fmt.Sprintf("%s...", fileName[:*nameLimit-3]) fileName = fmt.Sprintf("%s", fileName[:*nameLimit-3])
} }
button.SetLabel(fileName) button.SetLabel(fileName)
if tooltipText != "" { if tooltipText != "" {