2006-05-03 23:40:54 -07:00
|
|
|
/*
|
2005-12-08 00:53:46 -08:00
|
|
|
* mooeditconfig.h
|
|
|
|
*
|
2006-02-23 06:03:17 -08:00
|
|
|
* Copyright (C) 2004-2006 by Yevgen Muntyan <muntyan@math.tamu.edu>
|
2005-12-08 00:53:46 -08:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* See COPYING file that comes with this distribution.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __MOO_EDIT_CONFIG_H__
|
|
|
|
#define __MOO_EDIT_CONFIG_H__
|
|
|
|
|
|
|
|
#include <glib-object.h>
|
|
|
|
|
2006-06-20 19:20:58 -07:00
|
|
|
#ifndef G_GNUC_NULL_TERMINATED
|
|
|
|
#if __GNUC__ >= 4
|
|
|
|
#define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__))
|
|
|
|
#else
|
|
|
|
#define G_GNUC_NULL_TERMINATED
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2005-12-08 00:53:46 -08:00
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
|
|
|
|
#define MOO_TYPE_EDIT_CONFIG (moo_edit_config_get_type ())
|
|
|
|
#define MOO_EDIT_CONFIG(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), MOO_TYPE_EDIT_CONFIG, MooEditConfig))
|
|
|
|
#define MOO_EDIT_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOO_TYPE_EDIT_CONFIG, MooEditConfigClass))
|
|
|
|
#define MOO_IS_EDIT_CONFIG(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), MOO_TYPE_EDIT_CONFIG))
|
|
|
|
#define MOO_IS_EDIT_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_EDIT_CONFIG))
|
|
|
|
#define MOO_EDIT_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_EDIT_CONFIG, MooEditConfigClass))
|
|
|
|
|
|
|
|
typedef struct _MooEditConfig MooEditConfig;
|
|
|
|
typedef struct _MooEditConfigPrivate MooEditConfigPrivate;
|
|
|
|
typedef struct _MooEditConfigClass MooEditConfigClass;
|
|
|
|
|
|
|
|
|
2006-08-19 00:50:56 -07:00
|
|
|
typedef enum
|
|
|
|
{
|
2005-12-08 00:53:46 -08:00
|
|
|
MOO_EDIT_CONFIG_SOURCE_USER = 0,
|
|
|
|
MOO_EDIT_CONFIG_SOURCE_FILE = 10,
|
|
|
|
MOO_EDIT_CONFIG_SOURCE_FILENAME = 20,
|
2006-04-26 21:04:41 -07:00
|
|
|
MOO_EDIT_CONFIG_SOURCE_LANG = 30,
|
2006-07-27 12:39:53 -07:00
|
|
|
MOO_EDIT_CONFIG_SOURCE_AUTO = 40
|
2005-12-08 00:53:46 -08:00
|
|
|
} MooEditConfigSource;
|
|
|
|
|
|
|
|
struct _MooEditConfig
|
|
|
|
{
|
|
|
|
GObject object;
|
|
|
|
MooEditConfigPrivate *priv;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _MooEditConfigClass
|
|
|
|
{
|
|
|
|
GObjectClass object_class;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
GType moo_edit_config_get_type (void) G_GNUC_CONST;
|
|
|
|
|
|
|
|
MooEditConfig *moo_edit_config_new (void);
|
|
|
|
|
|
|
|
const char *moo_edit_config_get_string (MooEditConfig *config,
|
|
|
|
const char *setting);
|
|
|
|
guint moo_edit_config_get_uint (MooEditConfig *config,
|
|
|
|
const char *setting);
|
|
|
|
gboolean moo_edit_config_get_bool (MooEditConfig *config,
|
|
|
|
const char *setting);
|
|
|
|
|
|
|
|
void moo_edit_config_set (MooEditConfig *config,
|
|
|
|
MooEditConfigSource source,
|
2006-07-27 12:39:53 -07:00
|
|
|
const char *first_setting,
|
|
|
|
...) G_GNUC_NULL_TERMINATED; /* setting, value, ... */
|
2005-12-08 00:53:46 -08:00
|
|
|
void moo_edit_config_get (MooEditConfig *config,
|
|
|
|
const char *first_setting,
|
2006-06-17 00:37:47 -07:00
|
|
|
...) G_GNUC_NULL_TERMINATED; /* alias for g_object_get() */
|
2005-12-08 00:53:46 -08:00
|
|
|
|
2006-07-27 12:39:53 -07:00
|
|
|
void moo_edit_config_set_global (MooEditConfigSource source,
|
|
|
|
const char *first_setting,
|
|
|
|
...) G_GNUC_NULL_TERMINATED; /* setting, value, ... */
|
2005-12-08 00:53:46 -08:00
|
|
|
|
2006-05-03 23:40:54 -07:00
|
|
|
void moo_edit_config_parse_one (MooEditConfig *config,
|
2005-12-08 00:53:46 -08:00
|
|
|
const char *setting_name,
|
|
|
|
const char *value,
|
|
|
|
MooEditConfigSource source);
|
2006-05-03 23:40:54 -07:00
|
|
|
void moo_edit_config_parse (MooEditConfig *config,
|
|
|
|
const char *string,
|
|
|
|
MooEditConfigSource source);
|
2005-12-08 00:53:46 -08:00
|
|
|
|
|
|
|
guint moo_edit_config_install_setting (GParamSpec *pspec);
|
2005-12-08 14:46:03 -08:00
|
|
|
void moo_edit_config_install_alias (const char *name,
|
|
|
|
const char *alias);
|
|
|
|
|
2005-12-08 00:53:46 -08:00
|
|
|
guint moo_edit_config_get_setting_id (GParamSpec *pspec);
|
|
|
|
GParamSpec *moo_edit_config_get_spec (guint id);
|
|
|
|
GParamSpec *moo_edit_config_lookup_spec (const char *name,
|
2005-12-08 14:46:03 -08:00
|
|
|
guint *id,
|
|
|
|
gboolean try_alias);
|
2005-12-08 00:53:46 -08:00
|
|
|
|
|
|
|
void moo_edit_config_unset_by_source (MooEditConfig *config,
|
|
|
|
MooEditConfigSource source);
|
|
|
|
|
2005-12-08 16:19:41 -08:00
|
|
|
gboolean moo_edit_config_parse_bool (const char *string,
|
|
|
|
gboolean *value);
|
|
|
|
|
2006-05-03 23:40:54 -07:00
|
|
|
void moo_edit_config_update (MooEditConfig *config,
|
|
|
|
const char *lang_id);
|
2006-04-26 21:04:41 -07:00
|
|
|
|
2005-12-08 00:53:46 -08:00
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __MOO_EDIT_CONFIG_H__ */
|