source: trunk/third/libgnome/libgnome/gnome-util.h @ 18320

Revision 18320, 3.8 KB checked in by ghudson, 22 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r18319, which included commits to RCS files with non-trunk default branches.
Line 
1/*
2 * Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
3 * Copyright (C) 1999, 2000 Red Hat, Inc.
4 * All rights reserved.
5 *
6 * This file is part of the Gnome Library.
7 *
8 * The Gnome Library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public License as
10 * published by the Free Software Foundation; either version 2 of the
11 * License, or (at your option) any later version.
12 *
13 * The Gnome Library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 * Library General Public License for more details.
17 *
18 * You should have received a copy of the GNU Library General Public
19 * License along with the Gnome Library; see the file COPYING.LIB.  If not,
20 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
22 */
23/*
24  @NOTATION@
25 */
26
27#ifndef __GNOME_UTIL_H__
28#define __GNOME_UTIL_H__
29
30#include <stdlib.h>
31#include <glib.h>
32#include <libgnome/gnome-init.h>
33#include <libgnome/gnome-program.h>
34
35G_BEGIN_DECLS
36
37/* Return pointer to the character after the last .,
38   or "" if no dot. */
39const char * g_extension_pointer (const char * path);
40
41
42/* pass in a string, and it will add the users home dir ie,
43 * pass in .gnome/bookmarks.html and it will return
44 * /home/imain/.gnome2/bookmarks.html
45 *
46 * Remember to g_free() returned value! */
47#define gnome_util_prepend_user_home(x) (g_build_filename (g_get_home_dir(), (x), NULL))
48
49/* very similar to above, but adds $HOME/.gnome2/ to beginning
50 * This is meant to be the most useful version.
51 */
52#define gnome_util_home_file(afile) (g_strconcat(g_get_home_dir(), "/", GNOME_DOT_GNOME, (afile), NULL))
53
54/* Find the name of the user's shell.  */
55char *gnome_util_user_shell (void);
56
57/* Portable versions of setenv/unsetenv */
58
59/* Note: setenv will leak on some systems (those without setenv) so
60 * do NOT use inside a loop.  Semantics are the same as those in glibc */
61int     gnome_setenv (const char *name, const char *value, gboolean overwrite);
62void    gnome_unsetenv (const char *name);
63void    gnome_clearenv (void);
64
65/* Some deprecated functions macroed to their new equivalents */
66#ifndef GNOME_DISABLE_DEPRECATED
67
68#define g_file_exists(filename)         g_file_test ((filename), G_FILE_TEST_EXISTS)
69#define g_unix_error_string(error_num)  g_strerror ((error_num))
70#define gnome_util_user_home()          g_get_home_dir ()
71#define g_copy_vector(vec)              g_strdupv ((vec))
72#define g_concat_dir_and_file(dir,file) g_build_filename ((dir), (file), NULL)
73
74#define gnome_is_program_in_path(program)       g_find_program_in_path((program))
75
76#define gnome_libdir_file(f)  (gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_LIBDIR,  (f), TRUE, NULL))
77#define gnome_datadir_file(f) (gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_DATADIR, (f), TRUE, NULL))
78#define gnome_sound_file(f)   (gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_SOUND,   (f), TRUE, NULL))
79#define gnome_pixmap_file(f)  (gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP,  (f), TRUE, NULL))
80#define gnome_config_file(f)  (gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_CONFIG,  (f), TRUE, NULL))
81
82#define gnome_unconditional_libdir_file(f)  (gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_LIBDIR,  (f), FALSE, NULL))
83#define gnome_unconditional_datadir_file(f) (gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_DATADIR, (f), FALSE, NULL))
84#define gnome_unconditional_sound_file(f)   (gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_SOUND,   (f), FALSE, NULL))
85#define gnome_unconditional_pixmap_file(f)  (gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP,  (f), FALSE, NULL))
86#define gnome_unconditional_config_file(f)  (gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_CONFIG,  (f), FALSE, NULL))
87
88#endif /* GNOME_DISABLE_DEPRECATED */
89
90
91G_END_DECLS
92
93#endif
Note: See TracBrowser for help on using the repository browser.