This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 198921
Collapse All | Expand All

(-)a/keyring.impl/src/org/netbeans/modules/keyring/gnome/GnomeKeyringLibrary.java (-1 / +26 lines)
Lines 42-51 Link Here
42
42
43
package org.netbeans.modules.keyring.gnome;
43
package org.netbeans.modules.keyring.gnome;
44
44
45
import com.sun.jna.DefaultTypeMapper;
46
import com.sun.jna.FromNativeContext;
45
import com.sun.jna.Library;
47
import com.sun.jna.Library;
46
import com.sun.jna.Native;
48
import com.sun.jna.Native;
47
import com.sun.jna.Pointer;
49
import com.sun.jna.Pointer;
48
import com.sun.jna.Structure;
50
import com.sun.jna.Structure;
51
import com.sun.jna.ToNativeContext;
52
import com.sun.jna.TypeConverter;
53
import java.util.HashMap;
49
54
50
/**
55
/**
51
 * JNA wrapper for certain functions from GNOME Keyring API.
56
 * JNA wrapper for certain functions from GNOME Keyring API.
Lines 54-60 Link Here
54
 */
59
 */
55
public interface GnomeKeyringLibrary extends Library {
60
public interface GnomeKeyringLibrary extends Library {
56
61
57
    GnomeKeyringLibrary LIBRARY = (GnomeKeyringLibrary) Native.loadLibrary("gnome-keyring", GnomeKeyringLibrary.class);
62
    GnomeKeyringLibrary LIBRARY = (GnomeKeyringLibrary) Native.loadLibrary("gnome-keyring", GnomeKeyringLibrary.class, new HashMap() {
63
        {
64
            put(OPTION_TYPE_MAPPER, new DefaultTypeMapper() {
65
                {
66
                    TypeConverter booleanConverter = new TypeConverter() {
67
                        @Override public Object toNative(Object value, ToNativeContext context) {
68
                            return new Integer(Boolean.TRUE.equals(value) ? 1 : 0);
69
                        }
70
                        @Override public Object fromNative(Object value, FromNativeContext context) {
71
                            return ((Integer)value).intValue() != 0 ? Boolean.TRUE : Boolean.FALSE;
72
                        }
73
                        @Override public Class nativeType() {
74
                            // gint is 32-bit int
75
                            return Integer.class;
76
                        }
77
                    };
78
                    addTypeConverter(Boolean.class, booleanConverter);
79
                }
80
            });
81
        }
82
    });
58
83
59
    boolean gnome_keyring_is_available();
84
    boolean gnome_keyring_is_available();
60
85

Return to bug 198921