mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-02 09:16:17 +01:00
Add a parser for desktop entries and similar files with a .ini-like
2004-10-23 Matthias Clasen <mclasen@redhat.com> * glib/gkeyfile.h: * glib/gkeyfile.c: Add a parser for desktop entries and similar files with a .ini-like syntax. (#139974, Ray Strode) * glib/glib.h: Include gkeyfile.h * glib/Makefile.am (libglib_2_0_la_SOURCES): Add gkeyfile.c (glibsubinclude_HEADERS): Add gkeyfile.h * glib/gutils.c (_g_compute_locale_variants): Make this non-static and use it in gkeyfile.c
This commit is contained in:
parent
8df27c8dd5
commit
bfa8a37a9e
14
ChangeLog
14
ChangeLog
@ -1,3 +1,17 @@
|
|||||||
|
2004-10-23 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* glib/gkeyfile.h:
|
||||||
|
* glib/gkeyfile.c: Add a parser for desktop entries and
|
||||||
|
similar files with a .ini-like syntax. (#139974, Ray Strode)
|
||||||
|
|
||||||
|
* glib/glib.h: Include gkeyfile.h
|
||||||
|
|
||||||
|
* glib/Makefile.am (libglib_2_0_la_SOURCES): Add gkeyfile.c
|
||||||
|
(glibsubinclude_HEADERS): Add gkeyfile.h
|
||||||
|
|
||||||
|
* glib/gutils.c (_g_compute_locale_variants): Make this
|
||||||
|
non-static and use it in gkeyfile.c
|
||||||
|
|
||||||
2004-10-22 Matthias Clasen <mclasen@redhat.com>
|
2004-10-22 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* tests/uri-test.c (run_uri_list_tests): Add some
|
* tests/uri-test.c (run_uri_list_tests): Add some
|
||||||
|
@ -1,3 +1,17 @@
|
|||||||
|
2004-10-23 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* glib/gkeyfile.h:
|
||||||
|
* glib/gkeyfile.c: Add a parser for desktop entries and
|
||||||
|
similar files with a .ini-like syntax. (#139974, Ray Strode)
|
||||||
|
|
||||||
|
* glib/glib.h: Include gkeyfile.h
|
||||||
|
|
||||||
|
* glib/Makefile.am (libglib_2_0_la_SOURCES): Add gkeyfile.c
|
||||||
|
(glibsubinclude_HEADERS): Add gkeyfile.h
|
||||||
|
|
||||||
|
* glib/gutils.c (_g_compute_locale_variants): Make this
|
||||||
|
non-static and use it in gkeyfile.c
|
||||||
|
|
||||||
2004-10-22 Matthias Clasen <mclasen@redhat.com>
|
2004-10-22 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* tests/uri-test.c (run_uri_list_tests): Add some
|
* tests/uri-test.c (run_uri_list_tests): Add some
|
||||||
|
@ -1,3 +1,17 @@
|
|||||||
|
2004-10-23 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* glib/gkeyfile.h:
|
||||||
|
* glib/gkeyfile.c: Add a parser for desktop entries and
|
||||||
|
similar files with a .ini-like syntax. (#139974, Ray Strode)
|
||||||
|
|
||||||
|
* glib/glib.h: Include gkeyfile.h
|
||||||
|
|
||||||
|
* glib/Makefile.am (libglib_2_0_la_SOURCES): Add gkeyfile.c
|
||||||
|
(glibsubinclude_HEADERS): Add gkeyfile.h
|
||||||
|
|
||||||
|
* glib/gutils.c (_g_compute_locale_variants): Make this
|
||||||
|
non-static and use it in gkeyfile.c
|
||||||
|
|
||||||
2004-10-22 Matthias Clasen <mclasen@redhat.com>
|
2004-10-22 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* tests/uri-test.c (run_uri_list_tests): Add some
|
* tests/uri-test.c (run_uri_list_tests): Add some
|
||||||
|
@ -1,3 +1,17 @@
|
|||||||
|
2004-10-23 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* glib/gkeyfile.h:
|
||||||
|
* glib/gkeyfile.c: Add a parser for desktop entries and
|
||||||
|
similar files with a .ini-like syntax. (#139974, Ray Strode)
|
||||||
|
|
||||||
|
* glib/glib.h: Include gkeyfile.h
|
||||||
|
|
||||||
|
* glib/Makefile.am (libglib_2_0_la_SOURCES): Add gkeyfile.c
|
||||||
|
(glibsubinclude_HEADERS): Add gkeyfile.h
|
||||||
|
|
||||||
|
* glib/gutils.c (_g_compute_locale_variants): Make this
|
||||||
|
non-static and use it in gkeyfile.c
|
||||||
|
|
||||||
2004-10-22 Matthias Clasen <mclasen@redhat.com>
|
2004-10-22 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* tests/uri-test.c (run_uri_list_tests): Add some
|
* tests/uri-test.c (run_uri_list_tests): Add some
|
||||||
|
@ -1,3 +1,17 @@
|
|||||||
|
2004-10-23 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* glib/gkeyfile.h:
|
||||||
|
* glib/gkeyfile.c: Add a parser for desktop entries and
|
||||||
|
similar files with a .ini-like syntax. (#139974, Ray Strode)
|
||||||
|
|
||||||
|
* glib/glib.h: Include gkeyfile.h
|
||||||
|
|
||||||
|
* glib/Makefile.am (libglib_2_0_la_SOURCES): Add gkeyfile.c
|
||||||
|
(glibsubinclude_HEADERS): Add gkeyfile.h
|
||||||
|
|
||||||
|
* glib/gutils.c (_g_compute_locale_variants): Make this
|
||||||
|
non-static and use it in gkeyfile.c
|
||||||
|
|
||||||
2004-10-22 Matthias Clasen <mclasen@redhat.com>
|
2004-10-22 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* tests/uri-test.c (run_uri_list_tests): Add some
|
* tests/uri-test.c (run_uri_list_tests): Add some
|
||||||
|
@ -72,6 +72,7 @@ libglib_2_0_la_SOURCES = \
|
|||||||
ghash.c \
|
ghash.c \
|
||||||
ghook.c \
|
ghook.c \
|
||||||
giochannel.c \
|
giochannel.c \
|
||||||
|
gkeyfile.c \
|
||||||
glibintl.h \
|
glibintl.h \
|
||||||
glist.c \
|
glist.c \
|
||||||
gmain.c \
|
gmain.c \
|
||||||
@ -143,6 +144,7 @@ glibsubinclude_HEADERS = \
|
|||||||
gi18n.h \
|
gi18n.h \
|
||||||
gi18n-lib.h \
|
gi18n-lib.h \
|
||||||
giochannel.h \
|
giochannel.h \
|
||||||
|
gkeyfile.h \
|
||||||
glist.h \
|
glist.h \
|
||||||
gmacros.h \
|
gmacros.h \
|
||||||
gmain.h \
|
gmain.h \
|
||||||
|
2602
glib/gkeyfile.c
Normal file
2602
glib/gkeyfile.c
Normal file
File diff suppressed because it is too large
Load Diff
181
glib/gkeyfile.h
Normal file
181
glib/gkeyfile.h
Normal file
@ -0,0 +1,181 @@
|
|||||||
|
/* gkeyfile.h - desktop entry file parser
|
||||||
|
*
|
||||||
|
* Copyright 2004 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* Ray Strode <halfline@hawaii.rr.com>
|
||||||
|
*
|
||||||
|
* GLib is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Lesser General Public License as
|
||||||
|
* published by the Free Software Foundation; either version 2 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLib is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with GLib; see the file COPYING.LIB. If not,
|
||||||
|
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __G_KEY_FILE_H__
|
||||||
|
#define __G_KEY_FILE_H__
|
||||||
|
|
||||||
|
#include <glib/gerror.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
G_KEY_FILE_ERROR_UNKNOWN_ENCODING,
|
||||||
|
G_KEY_FILE_ERROR_PARSE,
|
||||||
|
G_KEY_FILE_ERROR_NOT_FOUND,
|
||||||
|
G_KEY_FILE_ERROR_KEY_NOT_FOUND,
|
||||||
|
G_KEY_FILE_ERROR_GROUP_NOT_FOUND,
|
||||||
|
G_KEY_FILE_ERROR_INVALID_VALUE
|
||||||
|
} GKeyFileError;
|
||||||
|
|
||||||
|
#define G_KEY_FILE_ERROR g_key_file_error_quark()
|
||||||
|
|
||||||
|
GQuark g_key_file_error_quark (void);
|
||||||
|
|
||||||
|
typedef struct _GKeyFile GKeyFile;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
G_KEY_FILE_NONE = 0,
|
||||||
|
G_KEY_FILE_KEEP_COMMENTS = 1 << 0,
|
||||||
|
G_KEY_FILE_KEEP_TRANSLATIONS = 1 << 1
|
||||||
|
} GKeyFileFlags;
|
||||||
|
|
||||||
|
GKeyFile *g_key_file_new (void);
|
||||||
|
void g_key_file_free (GKeyFile *key_file);
|
||||||
|
void g_key_file_set_list_separator (GKeyFile *key_file,
|
||||||
|
gchar separator);
|
||||||
|
void g_key_file_load_from_file (GKeyFile *key_file,
|
||||||
|
const gchar *file,
|
||||||
|
GKeyFileFlags flags,
|
||||||
|
GError **error);
|
||||||
|
void g_key_file_load_from_data (GKeyFile *key_file,
|
||||||
|
const gchar *data,
|
||||||
|
gsize length,
|
||||||
|
GKeyFileFlags flags,
|
||||||
|
GError **error);
|
||||||
|
void g_key_file_load_from_data_dirs (GKeyFile *key_file,
|
||||||
|
const gchar *file,
|
||||||
|
gchar **full_path,
|
||||||
|
GKeyFileFlags flags,
|
||||||
|
GError **error);
|
||||||
|
gchar *g_key_file_to_data (GKeyFile *key_file,
|
||||||
|
gsize *length,
|
||||||
|
GError **error);
|
||||||
|
gchar *g_key_file_get_start_group (GKeyFile *key_file);
|
||||||
|
gchar **g_key_file_get_groups (GKeyFile *key_file,
|
||||||
|
gsize *length);
|
||||||
|
gchar **g_key_file_get_keys (GKeyFile *key_file,
|
||||||
|
const gchar *group_name,
|
||||||
|
gsize *length,
|
||||||
|
GError **error);
|
||||||
|
gboolean g_key_file_has_group (GKeyFile *key_file,
|
||||||
|
const gchar *group_name);
|
||||||
|
gboolean g_key_file_has_key (GKeyFile *key_file,
|
||||||
|
const gchar *group_name,
|
||||||
|
const gchar *key,
|
||||||
|
GError **error);
|
||||||
|
gchar *g_key_file_get_value (GKeyFile *key_file,
|
||||||
|
const gchar *group_name,
|
||||||
|
const gchar *key,
|
||||||
|
GError **error);
|
||||||
|
void g_key_file_set_value (GKeyFile *key_file,
|
||||||
|
const gchar *group_name,
|
||||||
|
const gchar *key,
|
||||||
|
const gchar *value);
|
||||||
|
gchar *g_key_file_get_string (GKeyFile *key_file,
|
||||||
|
const gchar *group_name,
|
||||||
|
const gchar *key,
|
||||||
|
GError **error);
|
||||||
|
void g_key_file_set_string (GKeyFile *key_file,
|
||||||
|
const gchar *group_name,
|
||||||
|
const gchar *key,
|
||||||
|
const gchar *string);
|
||||||
|
gchar *g_key_file_get_locale_string (GKeyFile *key_file,
|
||||||
|
const gchar *group_name,
|
||||||
|
const gchar *key,
|
||||||
|
const gchar *locale,
|
||||||
|
GError **error);
|
||||||
|
void g_key_file_set_locale_string (GKeyFile *key_file,
|
||||||
|
const gchar *group_name,
|
||||||
|
const gchar *key,
|
||||||
|
const gchar *locale,
|
||||||
|
const gchar *string);
|
||||||
|
gboolean g_key_file_get_boolean (GKeyFile *key_file,
|
||||||
|
const gchar *group_name,
|
||||||
|
const gchar *key,
|
||||||
|
GError **error);
|
||||||
|
void g_key_file_set_boolean (GKeyFile *key_file,
|
||||||
|
const gchar *group_name,
|
||||||
|
const gchar *key,
|
||||||
|
gboolean boolean);
|
||||||
|
gint g_key_file_get_integer (GKeyFile *key_file,
|
||||||
|
const gchar *group_name,
|
||||||
|
const gchar *key,
|
||||||
|
GError **error);
|
||||||
|
void g_key_file_set_integer (GKeyFile *key_file,
|
||||||
|
const gchar *group_name,
|
||||||
|
const gchar *key,
|
||||||
|
gint integer);
|
||||||
|
gchar **g_key_file_get_string_list (GKeyFile *key_file,
|
||||||
|
const gchar *group_name,
|
||||||
|
const gchar *key,
|
||||||
|
gsize *length,
|
||||||
|
GError **error);
|
||||||
|
void g_key_file_set_string_list (GKeyFile *key_file,
|
||||||
|
const gchar *group_name,
|
||||||
|
const gchar *key,
|
||||||
|
const gchar * const list[],
|
||||||
|
gsize length);
|
||||||
|
gchar **g_key_file_get_locale_string_list (GKeyFile *key_file,
|
||||||
|
const gchar *group_name,
|
||||||
|
const gchar *key,
|
||||||
|
const gchar *locale,
|
||||||
|
gsize *length,
|
||||||
|
GError **error);
|
||||||
|
void g_key_file_set_locale_string_list (GKeyFile *key_file,
|
||||||
|
const gchar *group_name,
|
||||||
|
const gchar *key,
|
||||||
|
const gchar *locale,
|
||||||
|
const gchar * const list[],
|
||||||
|
gsize length);
|
||||||
|
gboolean *g_key_file_get_boolean_list (GKeyFile *key_file,
|
||||||
|
const gchar *group_name,
|
||||||
|
const gchar *key,
|
||||||
|
gsize *length,
|
||||||
|
GError **error);
|
||||||
|
void g_key_file_set_boolean_list (GKeyFile *key_file,
|
||||||
|
const gchar *group_name,
|
||||||
|
const gchar *key,
|
||||||
|
gboolean list[],
|
||||||
|
gsize length);
|
||||||
|
gint *g_key_file_get_integer_list (GKeyFile *key_file,
|
||||||
|
const gchar *group_name,
|
||||||
|
const gchar *key,
|
||||||
|
gsize *length,
|
||||||
|
GError **error);
|
||||||
|
void g_key_file_set_integer_list (GKeyFile *key_file,
|
||||||
|
const gchar *group_name,
|
||||||
|
const gchar *key,
|
||||||
|
gint list[],
|
||||||
|
gsize length);
|
||||||
|
void g_key_file_remove_key (GKeyFile *key_file,
|
||||||
|
const gchar *group_name,
|
||||||
|
const gchar *key,
|
||||||
|
GError **error);
|
||||||
|
void g_key_file_remove_group (GKeyFile *key_file,
|
||||||
|
const gchar *group_name,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* __G_KEY_FILE_H__ */
|
@ -43,6 +43,7 @@
|
|||||||
#include <glib/ghash.h>
|
#include <glib/ghash.h>
|
||||||
#include <glib/ghook.h>
|
#include <glib/ghook.h>
|
||||||
#include <glib/giochannel.h>
|
#include <glib/giochannel.h>
|
||||||
|
#include <glib/gkeyfile.h>
|
||||||
#include <glib/glist.h>
|
#include <glib/glist.h>
|
||||||
#include <glib/gmacros.h>
|
#include <glib/gmacros.h>
|
||||||
#include <glib/gmain.h>
|
#include <glib/gmain.h>
|
||||||
|
@ -1660,8 +1660,8 @@ explode_locale (const gchar *locale,
|
|||||||
* but it is big, ugly, and complicated, so I'm reluctant
|
* but it is big, ugly, and complicated, so I'm reluctant
|
||||||
* to do so when this should handle 99% of the time...
|
* to do so when this should handle 99% of the time...
|
||||||
*/
|
*/
|
||||||
static GSList *
|
GSList *
|
||||||
compute_locale_variants (const gchar *locale)
|
_g_compute_locale_variants (const gchar *locale)
|
||||||
{
|
{
|
||||||
GSList *retval = NULL;
|
GSList *retval = NULL;
|
||||||
|
|
||||||
@ -1793,7 +1793,7 @@ g_get_language_names ()
|
|||||||
for (a = alist; *a; a++)
|
for (a = alist; *a; a++)
|
||||||
{
|
{
|
||||||
gchar *b = unalias_lang (*a);
|
gchar *b = unalias_lang (*a);
|
||||||
list = g_slist_concat (list, compute_locale_variants (b));
|
list = g_slist_concat (list, _g_compute_locale_variants (b));
|
||||||
}
|
}
|
||||||
g_strfreev (alist);
|
g_strfreev (alist);
|
||||||
list = g_slist_append (list, "C");
|
list = g_slist_append (list, "C");
|
||||||
|
Loading…
Reference in New Issue
Block a user