1 /*
2  *  Copyright (C) 2009 Paul Bellamy <paul.a.bellamy@gmail.com>
3  *  Copyright (C) 2009 Jonathan Matthew <jonathan@d14n.org>
4  *
5  *  This program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 2 of the License, or
8  *  (at your option) any later version.
9  *
10  *  The Rhythmbox authors hereby grant permission for non-GPL compatible
11  *  GStreamer plugins to be used and distributed together with GStreamer
12  *  and Rhythmbox. This permission is above and beyond the permissions granted
13  *  by the GPL license by which Rhythmbox is covered. If you modify this code
14  *  you may extend this exception to your version of the code, but you are not
15  *  obligated to do so. If you do not wish to do so, delete this exception
16  *  statement from your version.
17  *
18  *  This program is distributed in the hope that it will be useful,
19  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  *  GNU General Public License for more details.
22  *
23  *  You should have received a copy of the GNU General Public License
24  *  along with this program; if not, write to the Free Software
25  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA.
26  *
27  */
28 
29 #ifndef RB_SYNC_SETTINGS__H
30 #define RB_SYNC_SETTINGS__H
31 
32 #include <glib-object.h>
33 
34 G_BEGIN_DECLS
35 
36 #define RB_TYPE_SYNC_SETTINGS         (rb_sync_settings_get_type ())
37 #define RB_SYNC_SETTINGS(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), RB_TYPE_SYNC_SETTINGS, RBSyncSettings))
38 #define RB_SYNC_SETTINGS_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), RB_TYPE_SYNC_SETTINGS, RBSyncSettingsClass))
39 #define RB_IS_SYNC_SETTINGS(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), RB_TYPE_SYNC_SETTINGS))
40 #define RB_IS_SYNC_SETTINGS_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), RB_TYPE_SYNC_SETTINGS))
41 #define RB_SYNC_SETTINGS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), RB_TYPE_SYNC_SETTINGS, RBSyncSettingsClass))
42 
43 /* defined sync categories */
44 #define		SYNC_CATEGORY_MUSIC		"music"
45 #define 	SYNC_CATEGORY_PODCAST		"podcast"
46 
47 /* defined sync groups */
48 #define		SYNC_GROUP_ALL_MUSIC		"x-rb-all-music"
49 
50 typedef struct
51 {
52 	GObject parent;
53 } RBSyncSettings;
54 
55 typedef struct
56 {
57 	GObjectClass parent;
58 
59 	/* signals */
60 	void	(*updated) (RBSyncSettings *settings);
61 } RBSyncSettingsClass;
62 
63 GType			rb_sync_settings_get_type (void);
64 
65 RBSyncSettings *	rb_sync_settings_new (const char *keyfile);
66 
67 gboolean		rb_sync_settings_save (RBSyncSettings *settings);
68 
69 /* sync categories */
70 
71 void			rb_sync_settings_set_category (RBSyncSettings *settings,
72 						       const char *category,
73 						       gboolean enabled);
74 gboolean		rb_sync_settings_sync_category (RBSyncSettings *settings,
75 							const char *category);
76 GList *			rb_sync_settings_get_enabled_categories (RBSyncSettings *settings);
77 
78 /* sync category groups */
79 
80 void			rb_sync_settings_set_group (RBSyncSettings *settings,
81 						    const char *category,
82 						    const char *group,
83 						    gboolean enabled);
84 gboolean		rb_sync_settings_group_enabled (RBSyncSettings *settings,
85 							const char *category,
86 							const char *group);
87 gboolean		rb_sync_settings_sync_group (RBSyncSettings *settings,
88 						     const char *category,
89 						     const char *group);
90 gboolean		rb_sync_settings_has_enabled_groups (RBSyncSettings *settings,
91 							     const char *category);
92 GList *			rb_sync_settings_get_enabled_groups (RBSyncSettings *settings,
93 							     const char *category);
94 void			rb_sync_settings_clear_groups (RBSyncSettings *settings,
95 						       const char *category);
96 
97 G_END_DECLS
98 
99 #endif /* RB_SYNC_SETTINGS__H */
100