1 Star 0 Fork 0

李超 / gotk3

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
application_since_3_14.go 1.22 KB
一键复制 编辑 原始数据 按行查看 历史
Reinaldo de Souza Jr 提交于 2017-10-12 19:14 . Use glib.Take directly
// +build !gtk_3_6,!gtk_3_8,!gtk_3_10,!gtk_3_12
// See: https://developer.gnome.org/gtk3/3.14/api-index-3-14.html
package gtk
// #include <gtk/gtk.h>
// #include "gtk.go.h"
import "C"
import (
"unsafe"
"github.com/gotk3/gotk3/glib"
)
// PrefersAppMenu is a wrapper around gtk_application_prefers_app_menu().
func (v *Application) PrefersAppMenu() bool {
return gobool(C.gtk_application_prefers_app_menu(v.native()))
}
// GetActionsForAccel is a wrapper around gtk_application_get_actions_for_accel().
func (v *Application) GetActionsForAccel(acc string) []string {
cstr1 := (*C.gchar)(C.CString(acc))
defer C.free(unsafe.Pointer(cstr1))
var acts []string
c := C.gtk_application_get_actions_for_accel(v.native(), cstr1)
originalc := c
defer C.g_strfreev(originalc)
for *c != nil {
acts = append(acts, C.GoString((*C.char)(*c)))
c = C.next_gcharptr(c)
}
return acts
}
// GetMenuByID is a wrapper around gtk_application_get_menu_by_id().
func (v *Application) GetMenuByID(id string) *glib.Menu {
cstr1 := (*C.gchar)(C.CString(id))
defer C.free(unsafe.Pointer(cstr1))
c := C.gtk_application_get_menu_by_id(v.native(), cstr1)
if c == nil {
return nil
}
return &glib.Menu{glib.MenuModel{glib.Take(unsafe.Pointer(c))}}
}
1
https://gitee.com/telhello1/gotk3.git
git@gitee.com:telhello1/gotk3.git
telhello1
gotk3
gotk3
v0.4.0

搜索帮助

53164aa7 5694891 3bd8fe86 5694891