Ejemplo n.º 1
0
        public GSettings(string schema)
        {
            var gss = new GSettingsSchemaSource();

            _gSettingsSchema = gss.Lookup(schema, true);
            if (_gSettingsSchema == null)
            {
                throw new GSettingsSchemaException($"Settings Schema not found or not installed: {schema}");
            }

            GSettingsPtr = PInvokes.GSettings.New(schema);
        }
Ejemplo n.º 2
0
        public GSettings(string schema, string path)
        {
            var gss   = new GSettingsSchemaSource(path, null, true);
            var found = gss.Lookup(schema, true);

            if (found == null)
            {
                throw new GSettingsSchemaException($"Settings Schema not found or not installed: {schema}");
            }

            GSettingsPtr = PInvokes.GSettings.New(schema, path);
        }
Ejemplo n.º 3
0
        internal GSettings(IntPtr rawGSettings, string schema)
        {
            if (rawGSettings == IntPtr.Zero)
            {
                throw new GSettingsSchemaException($"Settings Schema not found or not installed: {schema}");
            }

            var gss = new GSettingsSchemaSource();

            _gSettingsSchema = gss.Lookup(schema, true);

            GSettingsPtr = rawGSettings;
        }
        public GSettingsSchemaSource(string directory, GSettingsSchemaSource parent, bool trusted)
        {
            IntPtr errorPtr;

            if (parent != null && parent.GSettingsSchemaSourcePtr != IntPtr.Zero)
            {
                GSettingsSchemaSourcePtr = PInvokes.GSettingsSchemaSource.NewFromDirectory(directory, parent.GSettingsSchemaSourcePtr, trusted, out errorPtr);
            }
            else
            {
                GSettingsSchemaSourcePtr = PInvokes.GSettingsSchemaSource.NewFromDirectory(directory, IntPtr.Zero, trusted, out errorPtr);
            }

            if (errorPtr != IntPtr.Zero)
            {
                var gerror = Marshal.PtrToStructure <GStructs.GError>(errorPtr);
                // There's an enum for the error id/message? (TBD by testing)
                throw new GSettingsSchemaSourceException($"Unable to create from directory: [Domain={gerror.domain}], [Code={gerror.code}], [Message={gerror.message}]", gerror);
            }
        }