~ubuntu-branches/debian/sid/java-gnome/sid

« back to all changes in this revision

Viewing changes to src/bindings/org/gnome/glib/Glib.java

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2010-04-11 21:28:43 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20100411212843-g18x13q4fn02ox4a
Tags: 4.0.15-1
* Team upload
* New upstream release
* Change maintainers into Maintainers.
* Remove Thomas from Uploaders.
* Switch to source format 3.0.
* Update Standards-Version: 3.8.4.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Glib.java
3
 
 *
4
 
 * Copyright (c) 2006-2009 Operational Dynamics Consulting Pty Ltd
5
 
 * 
6
 
 * The code in this file, and the library it is a part of, are made available
7
 
 * to you by the authors under the terms of the "GNU General Public Licence,
8
 
 * version 2" plus the "Classpath Exception" (you may link to this code as a
9
 
 * library into other programs provided you don't make a derivation of it).
10
 
 * See the LICENCE file for the terms governing usage and redistribution.
 
2
 * java-gnome, a UI library for writing GTK and GNOME programs from Java!
 
3
 *
 
4
 * Copyright © 2006-2010 Operational Dynamics Consulting, Pty Ltd and Others
 
5
 *
 
6
 * The code in this file, and the program it is a part of, is made available
 
7
 * to you by its authors as open source software: you can redistribute it
 
8
 * and/or modify it under the terms of the GNU General Public License version
 
9
 * 2 ("GPL") as published by the Free Software Foundation.
 
10
 *
 
11
 * This program is distributed in the hope that it will be useful, but WITHOUT
 
12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 
13
 * FITNESS FOR A PARTICULAR PURPOSE. See the GPL for more details.
 
14
 *
 
15
 * You should have received a copy of the GPL along with this program. If not,
 
16
 * see http://www.gnu.org/licenses/. The authors of this program may be
 
17
 * contacted through http://java-gnome.sourceforge.net/.
 
18
 *
 
19
 * Linking this library statically or dynamically with other modules is making
 
20
 * a combined work based on this library. Thus, the terms and conditions of
 
21
 * the GPL cover the whole combination. As a special exception (the
 
22
 * "Claspath Exception"), the copyright holders of this library give you
 
23
 * permission to link this library with independent modules to produce an
 
24
 * executable, regardless of the license terms of these independent modules,
 
25
 * and to copy and distribute the resulting executable under terms of your
 
26
 * choice, provided that you also meet, for each linked independent module,
 
27
 * the terms and conditions of the license of that module. An independent
 
28
 * module is a module which is not derived from or based on this library. If
 
29
 * you modify this library, you may extend the Classpath Exception to your
 
30
 * version of the library, but you are not obligated to do so. If you do not
 
31
 * wish to do so, delete this exception statement from your version.
11
32
 */
12
33
package org.gnome.glib;
13
34
 
14
35
/**
15
 
 * Static methods to initialize the Java bindings around GLib
 
36
 * Static methods to initialize the Java bindings around GLib.
16
37
 * 
17
38
 * @author Andrew Cowie
 
39
 * @author Serkan Kaba
18
40
 * @since 4.0.0
 
41
 * 
 
42
 * @see <a
 
43
 *      href="http://www.freedesktop.org/wiki/Specifications/basedir-spec?action=show&redirect=Standards%2Fbasedir-spec">
 
44
 *      XDG Base Directory Specification</a>
19
45
 */
20
46
public class Glib
21
47
{
63
89
    public static void setProgramName(String name) {
64
90
        GlibMisc.setPrgname(name);
65
91
    }
 
92
 
 
93
    /**
 
94
     * Get the XDG user specific configuration directory. In all likelihood
 
95
     * this will be <code>~/.config</code>.
 
96
     * 
 
97
     * @since 4.0.15
 
98
     */
 
99
    public static String getUserConfigDir() {
 
100
        return GlibMisc.getUserConfigDir();
 
101
    }
 
102
 
 
103
    /**
 
104
     * Returns the username (i.e Linux login name) running the application.<br>
 
105
     * 
 
106
     * <p>
 
107
     * <b>WARNING:</b><br>
 
108
     * This method assumes that your system uses UTF-8 as encoding. Please
 
109
     * file a bug if this assumption is not valid for your system.</b>
 
110
     * 
 
111
     * @since 4.0.15
 
112
     */
 
113
    public static String getUserName() {
 
114
        return GlibMisc.getUserName();
 
115
    }
 
116
 
 
117
    /**
 
118
     * Returns the real name of the user running the application from
 
119
     * <code>/etc/passwd</code> file. If it can't be determined
 
120
     * <code>"Unknown"</code> is returned.
 
121
     * 
 
122
     * <p>
 
123
     * The warning about encoding in {@link #getUserName() getUserName()} also
 
124
     * applies.
 
125
     * 
 
126
     * @since 4.0.15
 
127
     */
 
128
    public static String getRealName() {
 
129
        return GlibMisc.getRealName();
 
130
    }
 
131
 
 
132
    /**
 
133
     * Get the XDG user specific cache directory. In all likelihood this will
 
134
     * be <code>~/.cache</code>.
 
135
     * 
 
136
     * @since 4.0.15
 
137
     */
 
138
    public static String getUserCacheDir() {
 
139
        return GlibMisc.getUserCacheDir();
 
140
    }
 
141
 
 
142
    /**
 
143
     * Get the XDG user specific data directory. In all likelihood this will
 
144
     * be <code>~/.local/share</code>.
 
145
     * 
 
146
     * @since 4.0.15
 
147
     */
 
148
    public static String getUserDataDir() {
 
149
        return GlibMisc.getUserDataDir();
 
150
    }
 
151
 
 
152
    /**
 
153
     * Get the XDG user specific special directory. Directory constants are
 
154
     * defined in {@link UserDirectory}. System wide defaults are defined in
 
155
     * <code>/etc/xdg/user-dirs.defaults</code> and can be overridden in
 
156
     * <code>~/.config/user-dir.dirs</code>.
 
157
     * 
 
158
     * <p>
 
159
     * If you've already queried the "special" directories then those values
 
160
     * are cached; they certainly don't change often. If you're writing a
 
161
     * program that absolutely needs to be aware if those settings have
 
162
     * changed after you're already used this, then you can force up to date
 
163
     * information by calling {@link #reloadUserSpecialDirsCache()
 
164
     * Glib.reloadUserSpecialDirsCache()}.
 
165
     * 
 
166
     * @since 4.0.15
 
167
     */
 
168
    public static String getUserSpecialDir(UserDirectory directory) {
 
169
        return GlibMisc.getUserSpecialDir(directory);
 
170
    }
 
171
 
 
172
    /**
 
173
     * Reset the cache used for {@link #getUserSpecialDir(UserDirectory)
 
174
     * getUserSpecialDir()}.
 
175
     * 
 
176
     * <p>
 
177
     * <b>WARNING:</b><br>
 
178
     * This may cause memory leaks if the return values change between calls.
 
179
     * 
 
180
     * @since 4.0.15
 
181
     */
 
182
    public static void reloadUserSpecialDirsCache() {
 
183
        GlibMisc.reloadUserSpecialDirsCache();
 
184
    }
 
185
 
 
186
    /**
 
187
     * Get a list of system-wide XDG data directories.
 
188
     * 
 
189
     * @since 4.0.15
 
190
     */
 
191
    public static String[] getSystemDataDirs() {
 
192
        return GlibMisc.getSystemDataDirs();
 
193
    }
 
194
 
 
195
    /**
 
196
     * Get a list of system-wide XDG configuration directories.
 
197
     * 
 
198
     * @since 4.0.15
 
199
     */
 
200
    public static String[] getSystemConfigDirs() {
 
201
        return GlibMisc.getSystemConfigDirs();
 
202
    }
66
203
}