mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-19 02:19:31 +08:00
change service bus topics for dialogs
This commit is contained in:
parent
5ce5e129cf
commit
3b851e9a22
@ -333,10 +333,10 @@ func (d *Dispatcher) processDialogMessage(result *servicebus.Message) {
|
|||||||
filter = splitTopic[4]
|
filter = splitTopic[4]
|
||||||
}
|
}
|
||||||
switch dialogType {
|
switch dialogType {
|
||||||
case "file":
|
case "open":
|
||||||
responseTopic, ok := result.Data().(string)
|
responseTopic, ok := result.Data().(string)
|
||||||
if !ok {
|
if !ok {
|
||||||
d.logger.Error("Invalid responseTopic for 'dialog:select:file' : %#v", result.Data())
|
d.logger.Error("Invalid responseTopic for 'dialog:select:open' : %#v", result.Data())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
d.logger.Info("Opening File dialog! responseTopic = %s", responseTopic)
|
d.logger.Info("Opening File dialog! responseTopic = %s", responseTopic)
|
||||||
@ -350,39 +350,6 @@ func (d *Dispatcher) processDialogMessage(result *servicebus.Message) {
|
|||||||
|
|
||||||
// Send dummy response
|
// Send dummy response
|
||||||
d.servicebus.Publish(responseTopic, result)
|
d.servicebus.Publish(responseTopic, result)
|
||||||
case "filesave":
|
|
||||||
responseTopic, ok := result.Data().(string)
|
|
||||||
if !ok {
|
|
||||||
d.logger.Error("Invalid responseTopic for 'dialog:select:filesave' : %#v", result.Data())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
d.logger.Info("Opening Save File dialog! responseTopic = %s", responseTopic)
|
|
||||||
|
|
||||||
// TODO: Work out what we mean in a multi window environment...
|
|
||||||
// For now we will just pick the first one
|
|
||||||
var result []string
|
|
||||||
for _, client := range d.clients {
|
|
||||||
result = client.frontend.OpenDialog(title, filter)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Send dummy response
|
|
||||||
d.servicebus.Publish(responseTopic, result)
|
|
||||||
case "directory":
|
|
||||||
responseTopic, ok := result.Data().(string)
|
|
||||||
if !ok {
|
|
||||||
d.logger.Error("Invalid responseTopic for 'dialog:select:directory' : %#v", result.Data())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
d.logger.Info("Opening Directory dialog! responseTopic = %s", responseTopic)
|
|
||||||
|
|
||||||
// TODO: Work out what we mean in a multi window environment...
|
|
||||||
// For now we will just pick the first one
|
|
||||||
var result []string
|
|
||||||
for _, client := range d.clients {
|
|
||||||
result = client.frontend.OpenDialog(title, filter)
|
|
||||||
}
|
|
||||||
// Send dummy response
|
|
||||||
d.servicebus.Publish(responseTopic, result)
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
d.logger.Error("Unknown dialog command: %s", command)
|
d.logger.Error("Unknown dialog command: %s", command)
|
||||||
|
@ -51,14 +51,14 @@ func (r *dialog) OpenDialog(params ...string) []string {
|
|||||||
uniqueCallback := crypto.RandomID()
|
uniqueCallback := crypto.RandomID()
|
||||||
|
|
||||||
// Subscribe to the respose channel
|
// Subscribe to the respose channel
|
||||||
responseTopic := "dialog:directoryselected:" + uniqueCallback
|
responseTopic := "dialog:openselected:" + uniqueCallback
|
||||||
dialogResponseChannel, err := r.bus.Subscribe(responseTopic)
|
dialogResponseChannel, err := r.bus.Subscribe(responseTopic)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("ERROR: Cannot subscribe to bus topic: %+v\n", err.Error())
|
fmt.Printf("ERROR: Cannot subscribe to bus topic: %+v\n", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Publish dialog request
|
// Publish dialog request
|
||||||
message := "dialog:select:directory:" + title
|
message := "dialog:select:open:" + title
|
||||||
if filter != "" {
|
if filter != "" {
|
||||||
message += ":" + filter
|
message += ":" + filter
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user