Beispiel #1
0
// 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)))
}
Beispiel #2
0
//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
}