Exemple #1
0
func (w *window) openFile(f func(filename string)) {
	widget := C.newOpenFileDialog(w.window)
	window := (*C.GtkWindow)(unsafe.Pointer(widget))
	dialog := (*C.GtkDialog)(unsafe.Pointer(widget))
	fc := (*C.GtkFileChooser)(unsafe.Pointer(widget))
	C.gtk_file_chooser_set_local_only(fc, C.FALSE)
	C.gtk_file_chooser_set_select_multiple(fc, C.FALSE)
	C.gtk_file_chooser_set_show_hidden(fc, C.TRUE)
	C.gtk_window_set_modal(window, C.TRUE)
	g_signal_connect(
		C.gpointer(unsafe.Pointer(dialog)),
		"response",
		C.GCallback(C.our_openfile_response_callback),
		C.gpointer(unsafe.Pointer(&f)))
	C.gtk_widget_show_all(widget)
}
Exemple #2
0
func (w *window) openFile(f func(filename string)) {
	widget := C.newOpenFileDialog(w.window)
	window := (*C.GtkWindow)(unsafe.Pointer(widget))
	dialog := (*C.GtkDialog)(unsafe.Pointer(widget))
	fc := (*C.GtkFileChooser)(unsafe.Pointer(widget))
	// non-local filenames are relevant mainly to GIO where we can open *anything*, not to Go os.File; see https://twitter.com/braket/status/506142849654870016
	C.gtk_file_chooser_set_local_only(fc, C.TRUE)
	C.gtk_file_chooser_set_select_multiple(fc, C.FALSE)
	C.gtk_file_chooser_set_show_hidden(fc, C.TRUE)
	C.gtk_window_set_modal(window, C.TRUE)
	g_signal_connect(
		C.gpointer(unsafe.Pointer(dialog)),
		"response",
		C.GCallback(C.our_openfile_response_callback),
		C.gpointer(unsafe.Pointer(&f)))
	C.gtk_widget_show_all(widget)
}
Exemple #3
0
// SetModal is a wrapper around gtk_window_set_modal().
func (v *Window) SetModal(modal bool) {
	C.gtk_window_set_modal(v.native(), gbool(modal))
}