// ApplicationNew is a wrapper around g_application_new(). func ApplicationNew(appID string, flags ApplicationFlags) *Application { cstr1 := (*C.gchar)(C.CString(appID)) defer C.free(unsafe.Pointer(cstr1)) c := C.g_application_new(cstr1, C.GApplicationFlags(flags)) if c == nil { return nil } return wrapApplication(wrapObject(unsafe.Pointer(c))) }
// ApplicationNew is a wrapper around gtk_application_new(). func ApplicationNew(appId string, flags glib.ApplicationFlags) (*Application, error) { cstr := (*C.gchar)(C.CString(appId)) defer C.free(unsafe.Pointer(cstr)) c := C.gtk_application_new(cstr, C.GApplicationFlags(flags)) if c == nil { return nil, nilPtrErr } return wrapApplication(wrapObject(unsafe.Pointer(c))), nil }
// Create new application func NewApplication(id string, flags GApplicationFlags) *Application { cid := gobject.GString(id) defer cid.Free() app := C.gtk_application_new((*C.gchar)(cid.GetPtr()), C.GApplicationFlags(flags)) C.g_application_register(C.to_GApplication(app), nil, nil) //C.g_application_activate(C.to_GApplication(app)) gtkapp := &Application{app} gtkapp.Connect("activate", func() {}) return gtkapp }
//Creates a new GApplication instance. //If non-NULL, the application id must be valid. See g_application_id_is_valid(). //If no application ID is given then some features of GApplication (most notably application uniqueness) will be disabled. func ApplicationNew(application_id string, flags ApplicationFlags) (*Application, error) { cstr := C.CString(application_id) defer C.free(unsafe.Pointer(cstr)) c := C.g_application_new((*C.gchar)(cstr), C.GApplicationFlags(flags)) if c == nil { return nil, nilPtrErr } obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))} app := wrapApplication(obj) obj.Ref() runtime.SetFinalizer(obj, (*glib.Object).Unref) return app, nil }
// SetFlags is a wrapper around g_application_set_flags(). func (v *Application) SetFlags(flags ApplicationFlags) { C.g_application_set_flags(v.native(), C.GApplicationFlags(flags)) }
#include <gio/gunixfdmessage.h> #include <gio/gnetworking.h> #include <gio/gunixconnection.h> #include <stdlib.h> */ import "C" var ( // AppInfoCreateFlags APP_INFO_CREATE_NONE = C.GAppInfoCreateFlags(C.G_APP_INFO_CREATE_NONE) APP_INFO_CREATE_NEEDS_TERMINAL = C.GAppInfoCreateFlags(C.G_APP_INFO_CREATE_NEEDS_TERMINAL) APP_INFO_CREATE_SUPPORTS_URIS = C.GAppInfoCreateFlags(C.G_APP_INFO_CREATE_SUPPORTS_URIS) APP_INFO_CREATE_SUPPORTS_STARTUP_NOTIFICATION = C.GAppInfoCreateFlags(C.G_APP_INFO_CREATE_SUPPORTS_STARTUP_NOTIFICATION) // ApplicationFlags APPLICATION_FLAGS_NONE = C.GApplicationFlags(C.G_APPLICATION_FLAGS_NONE) APPLICATION_IS_SERVICE = C.GApplicationFlags(C.G_APPLICATION_IS_SERVICE) APPLICATION_IS_LAUNCHER = C.GApplicationFlags(C.G_APPLICATION_IS_LAUNCHER) APPLICATION_HANDLES_OPEN = C.GApplicationFlags(C.G_APPLICATION_HANDLES_OPEN) APPLICATION_HANDLES_COMMAND_LINE = C.GApplicationFlags(C.G_APPLICATION_HANDLES_COMMAND_LINE) APPLICATION_SEND_ENVIRONMENT = C.GApplicationFlags(C.G_APPLICATION_SEND_ENVIRONMENT) APPLICATION_NON_UNIQUE = C.GApplicationFlags(C.G_APPLICATION_NON_UNIQUE) // AskPasswordFlags ASK_PASSWORD_NEED_PASSWORD = C.GAskPasswordFlags(C.G_ASK_PASSWORD_NEED_PASSWORD) ASK_PASSWORD_NEED_USERNAME = C.GAskPasswordFlags(C.G_ASK_PASSWORD_NEED_USERNAME) ASK_PASSWORD_NEED_DOMAIN = C.GAskPasswordFlags(C.G_ASK_PASSWORD_NEED_DOMAIN) ASK_PASSWORD_SAVING_SUPPORTED = C.GAskPasswordFlags(C.G_ASK_PASSWORD_SAVING_SUPPORTED) ASK_PASSWORD_ANONYMOUS_SUPPORTED = C.GAskPasswordFlags(C.G_ASK_PASSWORD_ANONYMOUS_SUPPORTED) // BusNameOwnerFlags