comparison pidgin/gtkconv-theme.h @ 32779:d72f2f13b60f

merge of 'c8c73eea7431e6f940916315ace40a41c8da3faa' and 'fec428131bde0ae8247941bd6a3d996c984c9189'
author Ethan Blanton <elb@pidgin.im>
date Fri, 21 Oct 2011 14:36:18 +0000
parents 90264301600f
children
comparison
equal deleted inserted replaced
32778:14787acaf9d7 32779:d72f2f13b60f
1 /**
2 * @file gtkconv-theme.h Pidgin Conversation Theme Class API
3 */
4
5 /* pidgin
6 *
7 * Pidgin is the legal property of its developers, whose names are too numerous
8 * to list here. Please refer to the COPYRIGHT file distributed with this
9 * source distribution.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
24 */
25
26 #ifndef PIDGIN_CONV_THEME_H
27 #define PIDGIN_CONV_THEME_H
28
29 #include <glib.h>
30 #include <glib-object.h>
31 #include "conversation.h"
32 #include "theme.h"
33
34 /**
35 * extends PurpleTheme (theme.h)
36 * A pidgin icon theme.
37 * This object represents a Pidgin icon theme.
38 *
39 * PidginConvTheme is a PurpleTheme Object.
40 */
41 typedef struct _PidginConvTheme PidginConvTheme;
42 typedef struct _PidginConvThemeClass PidginConvThemeClass;
43
44 #define PIDGIN_TYPE_CONV_THEME (pidgin_conversation_theme_get_type ())
45 #define PIDGIN_CONV_THEME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIDGIN_TYPE_CONV_THEME, PidginConvTheme))
46 #define PIDGIN_CONV_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PIDGIN_TYPE_CONV_THEME, PidginConvThemeClass))
47 #define PIDGIN_IS_CONV_THEME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIDGIN_TYPE_CONV_THEME))
48 #define PIDGIN_IS_CONV_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PIDGIN_TYPE_CONV_THEME))
49 #define PIDGIN_CONV_THEME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PIDGIN_TYPE_CONV_THEME, PidginConvThemeClass))
50
51 struct _PidginConvTheme
52 {
53 PurpleTheme parent;
54 };
55
56 struct _PidginConvThemeClass
57 {
58 PurpleThemeClass parent_class;
59 };
60
61 typedef enum {
62 PIDGIN_CONVERSATION_THEME_TEMPLATE_MAIN,
63 PIDGIN_CONVERSATION_THEME_TEMPLATE_HEADER,
64 PIDGIN_CONVERSATION_THEME_TEMPLATE_FOOTER,
65 PIDGIN_CONVERSATION_THEME_TEMPLATE_TOPIC,
66 PIDGIN_CONVERSATION_THEME_TEMPLATE_STATUS,
67 PIDGIN_CONVERSATION_THEME_TEMPLATE_CONTENT,
68 PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_CONTENT,
69 PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_NEXT_CONTENT,
70 PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_CONTEXT,
71 PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_NEXT_CONTEXT,
72 PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_CONTENT,
73 PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_NEXT_CONTENT,
74 PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_CONTEXT,
75 PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_NEXT_CONTEXT,
76 PIDGIN_CONVERSATION_THEME_TEMPLATE_BASESTYLE_CSS
77
78 } PidginConvThemeTemplateType;
79
80 /**************************************************************************/
81 /** @name Pidgin Conversation Theme API */
82 /**************************************************************************/
83 G_BEGIN_DECLS
84
85 /**
86 * GObject foo.
87 * @internal.
88 */
89 GType pidgin_conversation_theme_get_type(void);
90
91 /**
92 * Get the Info.plist hash table from a conversation theme.
93 *
94 * @param theme The conversation theme
95 *
96 * @return The hash table. Keys are strings as outlined for message styles,
97 * values are GValue*s. This is an internal structure. Take a ref if
98 * necessary, but don't destroy it yourself.
99 */
100 const GHashTable *pidgin_conversation_theme_get_info(const PidginConvTheme *theme);
101
102 /**
103 * Set the Info.plist hash table for a conversation theme.
104 *
105 * @param theme The conversation theme
106 * @param info The new hash table. The theme will take ownership of this hash
107 * table. Do not use it yourself afterwards with holding a ref.
108 * For key and value specifications, @see pidgin_conversation_theme_get_info.
109 *
110 */
111 void pidgin_conversation_theme_set_info(PidginConvTheme *theme, GHashTable *info);
112
113 /**
114 * Lookup a key in a theme
115 *
116 * @param theme The conversation theme
117 * @param key The key to find
118 * @param specific Whether to search variant-specific keys
119 *
120 * @return The key information. If @a specific is @c TRUE, then keys are first
121 * searched by variant, then by general ones. Otherwise, only general
122 * key values are returned.
123 */
124 const GValue *pidgin_conversation_theme_lookup(PidginConvTheme *theme, const char *key, gboolean specific);
125
126 /**
127 * Get the template data from a conversation theme.
128 *
129 * @param theme The conversation theme
130 * @param type The type of template data
131 *
132 * @return The template data requested. Fallback is made as required by styles.
133 * Subsequent calls to this function will return cached values.
134 */
135 const char *pidgin_conversation_theme_get_template(PidginConvTheme *theme, PidginConvThemeTemplateType type);
136
137 /**
138 * Add an available variant name to a conversation theme.
139 *
140 * @param theme The conversation theme
141 * @param variant The name of the variant
142 *
143 * @Note The conversation theme will take ownership of the variant name string.
144 * This function should normally only be called by the theme loader.
145 */
146 void pidgin_conversation_theme_add_variant(PidginConvTheme *theme, char *variant);
147
148 /**
149 * Get the currently set variant name for a conversation theme.
150 *
151 * @param theme The conversation theme
152 *
153 * @return The current variant name.
154 */
155 const char *pidgin_conversation_theme_get_variant(PidginConvTheme *theme);
156
157 /**
158 * Set the variant name for a conversation theme.
159 *
160 * @param theme The conversation theme
161 * @param variant The name of the variant
162 *
163 */
164 void pidgin_conversation_theme_set_variant(PidginConvTheme *theme, const char *variant);
165
166 /**
167 * Get a list of available variants for a conversation theme.
168 *
169 * @param theme The conversation theme
170 *
171 * @return The list of variants. This GList and the string data are owned by
172 * the theme and should not be freed by the caller.
173 */
174 const GList *pidgin_conversation_theme_get_variants(PidginConvTheme *theme);
175
176 /**
177 * Get the path to the template HTML file.
178 *
179 * @param theme The conversation theme
180 *
181 * @return The path to the HTML file.
182 */
183 char *pidgin_conversation_theme_get_template_path(PidginConvTheme *theme);
184
185 /**
186 * Get the path to the current variant CSS file.
187 *
188 * @param theme The conversation theme
189 *
190 * @return The path to the CSS file.
191 */
192 char *pidgin_conversation_theme_get_css_path(PidginConvTheme *theme);
193
194 G_END_DECLS
195 #endif /* PIDGIN_CONV_THEME_H */
196