summaryrefslogtreecommitdiff
path: root/capplets/common/mate-theme-info.h
blob: 1ef14b377a4e3b6baf72b068ea55690fd73a76fc (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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
/* mate-theme-info.h - MATE Theme information

   Copyright (C) 2002 Jonathan Blandford <jrb@gnome.org>
   All rights reserved.

   This file is part of the Mate Library.

   The Mate Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public License as
   published by the Free Software Foundation; either version 2 of the
   License, or (at your option) any later version.

   The Mate Library 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
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public
   License along with the Mate Library; see the file COPYING.LIB.  If not,
   write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
   Boston, MA 02110-1301, USA.  */

#ifndef MATE_THEME_INFO_H
#define MATE_THEME_INFO_H

#include <glib.h>
#include <gio/gio.h>
#include <gtk/gtk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk/gdk.h>

typedef enum {
	MATE_THEME_TYPE_METATHEME,
	MATE_THEME_TYPE_ICON,
	MATE_THEME_TYPE_CURSOR,
	MATE_THEME_TYPE_REGULAR
} MateThemeType;

typedef enum {
	MATE_THEME_CHANGE_CREATED,
	MATE_THEME_CHANGE_DELETED,
	MATE_THEME_CHANGE_CHANGED
} MateThemeChangeType;

typedef enum {
	MATE_THEME_MARCO = 1 << 0,
	MATE_THEME_GTK_2 = 1 << 1,
	MATE_THEME_GTK_2_KEYBINDING = 1 << 2
} MateThemeElement;

typedef struct _MateThemeCommonInfo MateThemeCommonInfo;
typedef struct _MateThemeCommonInfo MateThemeIconInfo;
struct _MateThemeCommonInfo
{
	MateThemeType type;
	gchar* path;
	gchar* name;
	gchar* readable_name;
	gint priority;
	gboolean hidden;
};

typedef struct _MateThemeInfo MateThemeInfo;
struct _MateThemeInfo
{
	MateThemeType type;
	gchar* path;
	gchar* name;
	gchar* readable_name;
	gint priority;
	gboolean hidden;

	guint has_gtk : 1;
	guint has_keybinding : 1;
	guint has_marco : 1;
};

typedef struct _MateThemeCursorInfo MateThemeCursorInfo;
struct _MateThemeCursorInfo {
	MateThemeType type;
	gchar* path;
	gchar* name;
	gchar* readable_name;
	gint priority;
	gboolean hidden;

	GArray* sizes;
	GdkPixbuf* thumbnail;
};

typedef struct _MateThemeMetaInfo MateThemeMetaInfo;
struct _MateThemeMetaInfo {
	MateThemeType type;
	gchar* path;
	gchar* name;
	gchar* readable_name;
	gint priority;
	gboolean hidden;

	gchar* comment;
	gchar* icon_file;

	gchar* gtk_theme_name;
	gchar* gtk_color_scheme;
	gchar* marco_theme_name;
	gchar* icon_theme_name;
	gchar* notification_theme_name;
	gchar* sound_theme_name;
	gchar* cursor_theme_name;
	guint cursor_size;

	gchar* application_font;
	gchar* documents_font;
	gchar* desktop_font;
	gchar* windowtitle_font;
	gchar* monospace_font;
	gchar* background_image;
};

enum {
	COLOR_FG,
	COLOR_BG,
	COLOR_TEXT,
	COLOR_BASE,
	COLOR_SELECTED_FG,
	COLOR_SELECTED_BG,
	COLOR_TOOLTIP_FG,
	COLOR_TOOLTIP_BG,
	NUM_SYMBOLIC_COLORS
};

typedef void (*ThemeChangedCallback) (MateThemeCommonInfo* theme, MateThemeChangeType change_type, MateThemeElement element_type, gpointer user_data);

#define MATE_THEME_ERROR mate_theme_info_error_quark()

enum {
	MATE_THEME_ERROR_GTK_THEME_NOT_AVAILABLE = 1,
	MATE_THEME_ERROR_WM_THEME_NOT_AVAILABLE,
	MATE_THEME_ERROR_ICON_THEME_NOT_AVAILABLE,
	MATE_THEME_ERROR_GTK_ENGINE_NOT_AVAILABLE,
	MATE_THEME_ERROR_UNKNOWN
};


/* GTK/Marco/keybinding Themes */
MateThemeInfo     *mate_theme_info_new                   (void);
void                mate_theme_info_free                  (MateThemeInfo     *theme_info);
MateThemeInfo     *mate_theme_info_find                  (const gchar        *theme_name);
GList              *mate_theme_info_find_by_type          (guint               elements);
GQuark              mate_theme_info_error_quark           (void);
gchar              *gtk_theme_info_missing_engine          (const gchar *gtk_theme,
                                                            gboolean nameOnly);

/* Icon Themes */
MateThemeIconInfo *mate_theme_icon_info_new              (void);
void                mate_theme_icon_info_free             (MateThemeIconInfo *icon_theme_info);
MateThemeIconInfo *mate_theme_icon_info_find             (const gchar        *icon_theme_name);
GList              *mate_theme_icon_info_find_all         (void);
gint                mate_theme_icon_info_compare          (MateThemeIconInfo *a,
							    MateThemeIconInfo *b);

/* Cursor Themes */
MateThemeCursorInfo *mate_theme_cursor_info_new	   (void);
void                  mate_theme_cursor_info_free	   (MateThemeCursorInfo *info);
MateThemeCursorInfo *mate_theme_cursor_info_find	   (const gchar          *name);
GList                *mate_theme_cursor_info_find_all	   (void);
gint                  mate_theme_cursor_info_compare      (MateThemeCursorInfo *a,
							    MateThemeCursorInfo *b);

/* Meta themes*/
MateThemeMetaInfo *mate_theme_meta_info_new              (void);
void                mate_theme_meta_info_free             (MateThemeMetaInfo *meta_theme_info);
MateThemeMetaInfo *mate_theme_meta_info_find             (const gchar        *meta_theme_name);
GList              *mate_theme_meta_info_find_all         (void);
gint                mate_theme_meta_info_compare          (MateThemeMetaInfo *a,
							    MateThemeMetaInfo *b);
gboolean            mate_theme_meta_info_validate         (const MateThemeMetaInfo *info,
                                                            GError            **error);
MateThemeMetaInfo *mate_theme_read_meta_theme            (GFile              *meta_theme_uri);

/* Other */
void                mate_theme_init                       (void);
void                mate_theme_info_register_theme_change (ThemeChangedCallback func,
							    gpointer             data);

gboolean            mate_theme_color_scheme_parse         (const gchar         *scheme,
							    GdkRGBA             *colors);
gboolean            mate_theme_color_scheme_equal         (const gchar         *s1,
							    const gchar         *s2);

#endif /* MATE_THEME_INFO_H */