2005-06-22 18:20:32 +00:00
|
|
|
/*
|
2005-10-13 14:08:18 +00:00
|
|
|
* mooprefs.h
|
2005-06-22 18:20:32 +00:00
|
|
|
*
|
2006-02-23 14:03:17 +00:00
|
|
|
* Copyright (C) 2004-2006 by Yevgen Muntyan <muntyan@math.tamu.edu>
|
2005-06-22 18:20:32 +00: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.
|
2005-07-24 04:58:57 +00:00
|
|
|
*/
|
2005-06-22 18:20:32 +00:00
|
|
|
|
2005-10-13 14:08:18 +00:00
|
|
|
#ifndef __MOO_PREFS_H__
|
|
|
|
#define __MOO_PREFS_H__
|
2005-06-22 18:20:32 +00:00
|
|
|
|
|
|
|
#include <glib-object.h>
|
|
|
|
#include <gdk/gdkcolor.h>
|
2005-10-13 14:08:18 +00:00
|
|
|
#include <mooutils/moomarkup.h>
|
2005-06-22 18:20:32 +00:00
|
|
|
|
2006-06-20 21:20:58 -05: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-06-22 18:20:32 +00:00
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
|
2006-11-15 01:29:32 -06:00
|
|
|
#define MOO_TYPE_PREFS_TYPE (moo_prefs_type_get_type ())
|
2005-06-22 18:20:32 +00:00
|
|
|
#define MOO_TYPE_PREFS_MATCH_TYPE (moo_prefs_match_type_get_type ())
|
|
|
|
|
|
|
|
|
2006-11-15 01:29:32 -06:00
|
|
|
typedef enum {
|
|
|
|
MOO_PREFS_RC,
|
|
|
|
MOO_PREFS_STATE
|
|
|
|
} MooPrefsType;
|
2005-06-22 18:20:32 +00:00
|
|
|
|
2006-11-15 01:29:32 -06:00
|
|
|
typedef enum {
|
|
|
|
MOO_PREFS_MATCH_KEY = 1 << 0,
|
|
|
|
MOO_PREFS_MATCH_PREFIX = 1 << 1,
|
|
|
|
MOO_PREFS_MATCH_REGEX = 1 << 2
|
|
|
|
} MooPrefsMatchType;
|
2005-06-22 18:20:32 +00:00
|
|
|
|
|
|
|
|
2006-11-15 01:29:32 -06:00
|
|
|
GType moo_prefs_type_get_type (void) G_GNUC_CONST;
|
2005-09-13 15:31:08 +00:00
|
|
|
GType moo_prefs_match_type_get_type (void) G_GNUC_CONST;
|
|
|
|
|
2006-11-15 01:29:32 -06:00
|
|
|
gboolean moo_prefs_load (const char *file_rc,
|
|
|
|
const char *file_state,
|
2005-09-13 15:31:08 +00:00
|
|
|
GError **error);
|
2006-11-15 01:29:32 -06:00
|
|
|
gboolean moo_prefs_save (const char *file_rc,
|
|
|
|
const char *file_state,
|
2005-09-13 15:31:08 +00:00
|
|
|
GError **error);
|
|
|
|
|
2006-11-15 01:29:32 -06:00
|
|
|
MooMarkupDoc *moo_prefs_get_markup (MooPrefsType prefs_type);
|
2005-09-13 15:31:08 +00:00
|
|
|
|
|
|
|
void moo_prefs_new_key (const char *key,
|
|
|
|
GType value_type,
|
2006-11-15 01:29:32 -06:00
|
|
|
const GValue *default_value,
|
|
|
|
MooPrefsType prefs_type);
|
2005-09-13 15:31:08 +00:00
|
|
|
void moo_prefs_delete_key (const char *key);
|
|
|
|
|
2006-02-23 20:43:22 -06:00
|
|
|
char **moo_prefs_list_keys (guint *n_keys);
|
2005-09-13 15:31:08 +00:00
|
|
|
GType moo_prefs_get_key_type (const char *key);
|
|
|
|
gboolean moo_prefs_key_registered(const char *key);
|
|
|
|
|
|
|
|
const GValue *moo_prefs_get (const char *key);
|
|
|
|
const GValue *moo_prefs_get_default (const char *key);
|
|
|
|
void moo_prefs_set (const char *key,
|
|
|
|
const GValue *value);
|
|
|
|
void moo_prefs_set_default (const char *key,
|
|
|
|
const GValue *value);
|
|
|
|
|
|
|
|
void moo_prefs_new_key_bool (const char *key,
|
|
|
|
gboolean default_val);
|
|
|
|
void moo_prefs_new_key_int (const char *key,
|
|
|
|
int default_val);
|
|
|
|
void moo_prefs_new_key_string(const char *key,
|
|
|
|
const char *default_val);
|
|
|
|
void moo_prefs_new_key_color (const char *key,
|
|
|
|
const GdkColor *default_val);
|
|
|
|
void moo_prefs_new_key_enum (const char *key,
|
|
|
|
GType enum_type,
|
|
|
|
int default_val);
|
2006-04-05 01:21:56 -05:00
|
|
|
void moo_prefs_new_key_flags (const char *key,
|
|
|
|
GType flags_type,
|
|
|
|
int default_val);
|
2005-09-13 15:31:08 +00:00
|
|
|
|
2006-11-15 01:29:32 -06:00
|
|
|
void _moo_prefs_new_key_bool_state (const char *key,
|
|
|
|
gboolean default_val);
|
|
|
|
void _moo_prefs_new_key_int_state (const char *key,
|
|
|
|
int default_val);
|
|
|
|
void _moo_prefs_new_key_string_state (const char *key,
|
|
|
|
const char *default_val);
|
|
|
|
|
2005-09-13 15:31:08 +00:00
|
|
|
char *moo_prefs_make_key (const char *first_comp,
|
2006-06-20 21:20:58 -05:00
|
|
|
...) G_GNUC_NULL_TERMINATED;
|
2005-09-13 15:31:08 +00:00
|
|
|
char *moo_prefs_make_keyv (const char *first_comp,
|
|
|
|
va_list var_args);
|
|
|
|
|
|
|
|
const char *moo_prefs_get_string (const char *key);
|
|
|
|
const char *moo_prefs_get_filename (const char *key);
|
|
|
|
gboolean moo_prefs_get_bool (const char *key);
|
2005-09-14 07:06:17 +00:00
|
|
|
gdouble moo_prefs_get_number (const char *key);
|
2005-09-13 15:31:08 +00:00
|
|
|
const GdkColor *moo_prefs_get_color (const char *key);
|
|
|
|
int moo_prefs_get_int (const char *key);
|
|
|
|
int moo_prefs_get_enum (const char *key);
|
2006-04-05 01:21:56 -05:00
|
|
|
int moo_prefs_get_flags (const char *key);
|
2005-09-13 15:31:08 +00:00
|
|
|
|
|
|
|
void moo_prefs_set_string (const char *key,
|
|
|
|
const char *val);
|
|
|
|
void moo_prefs_set_filename (const char *key,
|
|
|
|
const char *val);
|
2005-09-14 07:06:17 +00:00
|
|
|
void moo_prefs_set_number (const char *key,
|
2005-09-13 15:31:08 +00:00
|
|
|
double val);
|
|
|
|
void moo_prefs_set_int (const char *key,
|
|
|
|
int val);
|
|
|
|
void moo_prefs_set_bool (const char *key,
|
|
|
|
gboolean val);
|
|
|
|
void moo_prefs_set_color (const char *key,
|
|
|
|
const GdkColor *val);
|
|
|
|
void moo_prefs_set_enum (const char *key,
|
2006-04-05 01:21:56 -05:00
|
|
|
int val);
|
|
|
|
void moo_prefs_set_flags (const char *key,
|
2005-09-13 15:31:08 +00:00
|
|
|
int val);
|
|
|
|
|
|
|
|
typedef void (*MooPrefsNotify) (const char *key,
|
|
|
|
const GValue *newval,
|
|
|
|
gpointer data);
|
2005-06-22 18:20:32 +00:00
|
|
|
|
|
|
|
guint moo_prefs_notify_connect (const char *pattern,
|
|
|
|
MooPrefsMatchType match_type,
|
|
|
|
MooPrefsNotify callback,
|
2006-02-23 21:27:24 -06:00
|
|
|
gpointer data,
|
|
|
|
GDestroyNotify notify);
|
2005-06-22 18:20:32 +00:00
|
|
|
gboolean moo_prefs_notify_block (guint id);
|
|
|
|
gboolean moo_prefs_notify_unblock (guint id);
|
|
|
|
gboolean moo_prefs_notify_disconnect (guint id);
|
|
|
|
|
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
2005-10-13 14:08:18 +00:00
|
|
|
#endif /* __MOO_PREFS_H__ */
|