summaryrefslogtreecommitdiff
path: root/capplets/common/mateconf-property-editor.h
blob: ff43dfc64feab8f1fd755758e512a517cac750a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
/* -*- mode: c; style: linux -*- */

/* mateconf-property-editor.h
 * Copyright (C) 2001 Ximian, Inc.
 *
 * Written by Bradford Hovinen <hovinen@ximian.com>
 *
 * 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, or (at your option)
 * any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301, USA.
 */

#ifndef __MATECONF_PROPERTY_EDITOR_H
#define __MATECONF_PROPERTY_EDITOR_H

#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <mateconf/mateconf-client.h>
#include <mateconf/mateconf-changeset.h>

#ifdef __cplusplus
extern "C" {
#endif

#define MATECONF_PROPERTY_EDITOR(obj)          G_TYPE_CHECK_INSTANCE_CAST (obj, mateconf_property_editor_get_type (), MateConfPropertyEditor)
#define MATECONF_PROPERTY_EDITOR_CLASS(klass)  G_TYPE_CHECK_CLASS_CAST (klass, mateconf_property_editor_get_type (), MateConfPropertyEditorClass)
#define IS_MATECONF_PROPERTY_EDITOR(obj)       G_TYPE_CHECK_INSTANCE_TYPE (obj, mateconf_property_editor_get_type ())

typedef struct _MateConfPropertyEditor MateConfPropertyEditor;
typedef struct _MateConfPropertyEditorClass MateConfPropertyEditorClass;
typedef struct _MateConfPropertyEditorPrivate MateConfPropertyEditorPrivate;

typedef MateConfValue *(*MateConfPEditorValueConvFn) (MateConfPropertyEditor *peditor, const MateConfValue *);
typedef int	    (*MateConfPEditorGetValueFn)  (MateConfPropertyEditor *peditor, gpointer data);

struct _MateConfPropertyEditor
{
	GObject parent;

	MateConfPropertyEditorPrivate *p;
};

struct _MateConfPropertyEditorClass
{
	GObjectClass g_object_class;

	void (*value_changed) (MateConfPropertyEditor *peditor, gchar *key, const MateConfValue *value);
};

GType mateconf_property_editor_get_type    (void);

const gchar *mateconf_property_editor_get_key        (MateConfPropertyEditor  *peditor);
GObject     *mateconf_property_editor_get_ui_control (MateConfPropertyEditor  *peditor);

GObject *mateconf_peditor_new_boolean      (MateConfChangeSet          *changeset,
					 const gchar             *key,
					 GtkWidget               *checkbox,
					 const gchar             *first_property_name,
					 ...);

GObject *mateconf_peditor_new_enum_toggle  (MateConfChangeSet 	 *changeset,
					 const gchar		 *key,
					 GtkWidget		 *checkbox,
					 GType			 enum_type,
					 MateConfPEditorGetValueFn  val_true_fn,
					 guint			 val_false,
					 gboolean	 	 use_nick,
					 gpointer		 data,
					 const gchar 		 *first_property_name,
					 ...);

GObject *mateconf_peditor_new_integer      (MateConfChangeSet          *changeset,
					 const gchar             *key,
					 GtkWidget               *entry,
					 const gchar             *first_property_name,
					 ...);
GObject *mateconf_peditor_new_string       (MateConfChangeSet          *changeset,
					 const gchar             *key,
					 GtkWidget               *entry,
					 const gchar             *first_property_name,
					 ...);
GObject *mateconf_peditor_new_color        (MateConfChangeSet          *changeset,
					 const gchar             *key,
					 GtkWidget               *color_entry,
					 const gchar             *first_property_name,
					 ...);

GObject *mateconf_peditor_new_combo_box	(MateConfChangeSet *changeset,
					 const gchar 	*key,
					 GtkWidget      *combo_box,
					 const gchar    *first_property_name,
					 ...);

GObject *mateconf_peditor_new_combo_box_with_enum	(MateConfChangeSet *changeset,
						 const gchar 	*key,
						 GtkWidget      *combo_box,
						 GType          enum_type,
						 gboolean  	use_nick,
						 const gchar    *first_property_name,
						 ...);

GObject *mateconf_peditor_new_select_radio (MateConfChangeSet          *changeset,
					 const gchar             *key,
					 GSList                  *radio_group,
					 const gchar             *first_property_name,
					 ...);

GObject *mateconf_peditor_new_select_radio_with_enum	 (MateConfChangeSet *changeset,
							  const gchar	 *key,
							  GSList 	 *radio_group,
							  GType 	 enum_type,
							  gboolean	 use_nick,
							  const gchar    *first_property_name,
							  ...);

GObject *mateconf_peditor_new_numeric_range (MateConfChangeSet          *changeset,
					  const gchar             *key,
					  GtkWidget               *range,
					  const gchar             *first_property_name,
					  ...);

GObject *mateconf_peditor_new_font          (MateConfChangeSet          *changeset,
					  const gchar             *key,
					  GtkWidget               *font_button,
					  const gchar             *first_property_name,
					  ...);

GObject *mateconf_peditor_new_image	 (MateConfChangeSet	  *changeset,
					  const gchar		  *key,
					  GtkWidget		  *button,
					  const gchar		  *first_property,
					  ...);

GObject *mateconf_peditor_new_tree_view	(MateConfChangeSet *changeset,
					 const gchar 	*key,
					 GtkWidget      *tree_view,
					 const gchar    *first_property_name,
					 ...);

void mateconf_peditor_widget_set_guard     (MateConfPropertyEditor     *peditor,
					 GtkWidget               *widget);

/* some convenience callbacks to map int <-> float */
MateConfValue *mateconf_value_int_to_float    (MateConfPropertyEditor *ignored, MateConfValue const *value);
MateConfValue *mateconf_value_float_to_int    (MateConfPropertyEditor *ignored, MateConfValue const *value);

#ifdef __cplusplus
}
#endif

#endif /* __MATECONF_PROPERTY_EDITOR_H */