remove stale code

This commit is contained in:
piotr 2021-09-23 00:45:35 +02:00
parent bd1aa18506
commit e6088e7345
4 changed files with 6 additions and 41 deletions

Binary file not shown.

10
main.go
View File

@ -365,9 +365,7 @@ func main() {
resultWindow, _ = gtk.ScrolledWindowNew(nil, nil) resultWindow, _ = gtk.ScrolledWindowNew(nil, nil)
resultWindow.SetEvents(int(gdk.ALL_EVENTS_MASK)) resultWindow.SetEvents(int(gdk.ALL_EVENTS_MASK))
resultWindow.SetPolicy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) resultWindow.SetPolicy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
/*resultWindow.Connect("enter-notify-event", func() {
cancelClose()
})*/
resultWindow.Connect("button-release-event", func(sw *gtk.ScrolledWindow, e *gdk.Event) bool { resultWindow.Connect("button-release-event", func(sw *gtk.ScrolledWindow, e *gdk.Event) bool {
btnEvent := gdk.EventButtonNewFromEvent(e) btnEvent := gdk.EventButtonNewFromEvent(e)
if btnEvent.Button() == 1 || btnEvent.Button() == 3 { if btnEvent.Button() == 1 || btnEvent.Button() == 3 {
@ -459,17 +457,17 @@ func restoreStateAndHide() {
timeStart1 := time.Now() timeStart1 := time.Now()
win.Hide() win.Hide()
// 1. clear search // clear search
searchEntry.SetText("") searchEntry.SetText("")
// 2. clear category filter (in gotk3 it means: rebuild, as we have no filtering here) // clear category filter (in gotk3 it means: rebuild, as we have no filtering here)
appFlowBox = setUpAppsFlowBox(nil, "") appFlowBox = setUpAppsFlowBox(nil, "")
for _, btn := range catButtons { for _, btn := range catButtons {
btn.SetImagePosition(gtk.POS_LEFT) btn.SetImagePosition(gtk.POS_LEFT)
btn.SetSizeRequest(0, 0) btn.SetSizeRequest(0, 0)
} }
// 3. scroll to the top // scroll to the top
resultWindow.GetVAdjustment().SetValue(0) resultWindow.GetVAdjustment().SetValue(0)
t := time.Now() t := time.Now()

View File

@ -27,19 +27,6 @@ func wayland() bool {
return os.Getenv("WAYLAND_DISPLAY") != "" || os.Getenv("XDG_SESSION_TYPE") == "wayland" return os.Getenv("WAYLAND_DISPLAY") != "" || os.Getenv("XDG_SESSION_TYPE") == "wayland"
} }
/*
Window leave-notify-event event quits the program with glib Timeout 500 ms.
We might have left the window by accident, so let's clear the timeout if window re-entered.
Furthermore - hovering a widget triggers window leave-notify-event event, and the timeout
needs to be cleared as well.
*/
/*func cancelClose() {
if src > 0 {
glib.SourceRemove(src)
src = 0
}
}*/
func createPixbuf(icon string, size int) (*gdk.Pixbuf, error) { func createPixbuf(icon string, size int) (*gdk.Pixbuf, error) {
iconTheme, err := gtk.IconThemeGetDefault() iconTheme, err := gtk.IconThemeGetDefault()
if err != nil { if err != nil {
@ -367,7 +354,7 @@ func parseDesktopFiles(desktopFiles []string) string {
if entry.NoDisplay { if entry.NoDisplay {
hidden++ hidden++
// We still need hidden entries, so `continue` is disallowed here // We still need hidden entries, so `continue` is disallowed here
// Fixes introduced in #19 // Fixes bug introduced in #19
} }
id2entry[entry.DesktopID] = entry id2entry[entry.DesktopID] = entry
@ -569,13 +556,6 @@ func launch(command string, terminal bool) {
} else { } else {
gtk.MainQuit() gtk.MainQuit()
} }
/*go cmd.Run()
glib.TimeoutAdd(uint(150), func() bool {
gtk.MainQuit()
return false
})*/
} }
func open(filePath string, xdgOpen bool) { func open(filePath string, xdgOpen bool) {

View File

@ -87,11 +87,6 @@ func setUpPinnedFlowBox() *gtk.FlowBox {
item.(*gtk.Widget).SetCanFocus(false) item.(*gtk.Widget).SetCanFocus(false)
}) })
} }
/*flowBox.Connect("enter-notify-event", func() {
cancelClose()
})*/
//flowBox.ShowAll()
return flowBox return flowBox
} }
@ -110,9 +105,7 @@ func setUpCategoriesButtonBox() *gtk.EventBox {
} }
eventBox, _ := gtk.EventBoxNew() eventBox, _ := gtk.EventBoxNew()
/*eventBox.Connect("enter-notify-event", func() {
cancelClose()
})*/
hBox, _ := gtk.BoxNew(gtk.ORIENTATION_HORIZONTAL, 0) hBox, _ := gtk.BoxNew(gtk.ORIENTATION_HORIZONTAL, 0)
eventBox.Add(hBox) eventBox.Add(hBox)
button, _ := gtk.ButtonNewWithLabel("All") button, _ := gtk.ButtonNewWithLabel("All")
@ -291,9 +284,6 @@ func setUpFileSearchResultContainer() *gtk.FlowBox {
} }
flowBox, _ := gtk.FlowBoxNew() flowBox, _ := gtk.FlowBoxNew()
flowBox.SetProperty("orientation", gtk.ORIENTATION_VERTICAL) flowBox.SetProperty("orientation", gtk.ORIENTATION_VERTICAL)
/*flowBox.Connect("enter-notify-event", func() {
cancelClose()
})*/
fileSearchResultWrapper.PackStart(flowBox, false, false, 10) fileSearchResultWrapper.PackStart(flowBox, false, false, 10)
return flowBox return flowBox
@ -396,9 +386,6 @@ func setUpSearchEntry() *gtk.SearchEntry {
} }
} }
}) })
/*searchEntry.Connect("focus-in-event", func() {
searchEntry.SetText("")
})*/
return searchEntry return searchEntry
} }