Mercurial > pidgin.yaz
annotate pidgin/gtkconv-theme.c @ 32658:90264301600f
Apply conversation theme when opening the GTK conversation. All the
parsing stuff was moved out of the theme code and into the conversation
code.
Someone (not me!) needs to check the code I commented out and see if
we really need that stuff (and then port it to WebKit/styling).
We also need to determine where to place Template.html and the rest
of our (not-yet-written) default theme.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Wed, 21 Sep 2011 06:45:26 +0000 |
parents | ceae9fb7ae0b |
children | 3af16402f176 |
rev | line source |
---|---|
32619
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1 /* |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
2 * Conversation Themes for Pidgin |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
3 * |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
4 * Pidgin is the legal property of its developers, whose names are too numerous |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
5 * to list here. Please refer to the COPYRIGHT file distributed with this |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
6 * source distribution. |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
7 * |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
8 * This program is free software; you can redistribute it and/or modify |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
11 * (at your option) any later version. |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
12 * |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
16 * GNU General Public License for more details. |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
17 * |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
19 * along with this program; if not, write to the Free Software |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
21 */ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
22 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
23 #include "gtkconv-theme.h" |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
24 |
32629
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
25 #include "conversation.h" |
32623
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
26 #include "debug.h" |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
27 #include "prefs.h" |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
28 #include "xmlnode.h" |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
29 |
32629
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
30 #include "pidgin.h" |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
31 #include "gtkconv.h" |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
32 #include "gtkwebview.h" |
32619
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
33 |
32623
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
34 #include <stdlib.h> |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
35 #include <string.h> |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
36 |
32619
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
37 #define PIDGIN_CONV_THEME_GET_PRIVATE(Gobject) \ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
38 (G_TYPE_INSTANCE_GET_PRIVATE((Gobject), PIDGIN_TYPE_CONV_THEME, PidginConvThemePrivate)) |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
39 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
40 /****************************************************************************** |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
41 * Structs |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
42 *****************************************************************************/ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
43 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
44 typedef struct { |
32623
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
45 /* current config options */ |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
46 char *variant; /* allowed to be NULL if there are no variants */ |
32645
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
47 GList *variants; |
32623
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
48 |
32630
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
49 /* Info.plist keys/values */ |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
50 GHashTable *info; |
32623
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
51 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
52 /* caches */ |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
53 char *template_html; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
54 char *header_html; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
55 char *footer_html; |
32654
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
56 char *topic_html; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
57 char *status_html; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
58 char *content_html; |
32623
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
59 char *incoming_content_html; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
60 char *outgoing_content_html; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
61 char *incoming_next_content_html; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
62 char *outgoing_next_content_html; |
32654
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
63 char *incoming_context_html; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
64 char *outgoing_context_html; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
65 char *incoming_next_context_html; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
66 char *outgoing_next_context_html; |
32623
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
67 char *basestyle_css; |
32619
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
68 } PidginConvThemePrivate; |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
69 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
70 /****************************************************************************** |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
71 * Globals |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
72 *****************************************************************************/ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
73 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
74 static GObjectClass *parent_class = NULL; |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
75 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
76 /****************************************************************************** |
32630
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
77 * Enums |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
78 *****************************************************************************/ |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
79 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
80 enum { |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
81 PROP_ZERO = 0, |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
82 PROP_INFO, |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
83 }; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
84 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
85 /****************************************************************************** |
32619
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
86 * GObject Stuff |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
87 *****************************************************************************/ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
88 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
89 static void |
32630
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
90 pidgin_conv_theme_get_property(GObject *obj, guint param_id, GValue *value, |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
91 GParamSpec *psec) |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
92 { |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
93 PidginConvTheme *theme = PIDGIN_CONV_THEME(obj); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
94 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
95 switch (param_id) { |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
96 case PROP_INFO: |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
97 g_value_set_boxed(value, (gpointer)pidgin_conversation_theme_get_info(theme)); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
98 break; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
99 default: |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
100 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
101 break; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
102 } |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
103 } |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
104 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
105 static void |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
106 pidgin_conv_theme_set_property(GObject *obj, guint param_id, const GValue *value, |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
107 GParamSpec *psec) |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
108 { |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
109 PidginConvTheme *theme = PIDGIN_CONV_THEME(obj); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
110 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
111 switch (param_id) { |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
112 case PROP_INFO: |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
113 pidgin_conversation_theme_set_info(theme, g_value_get_boxed(value)); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
114 break; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
115 default: |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
116 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
117 break; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
118 } |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
119 } |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
120 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
121 static void |
32619
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
122 pidgin_conv_theme_init(GTypeInstance *instance, |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
123 gpointer klass) |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
124 { |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
125 PidginConvThemePrivate *priv; |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
126 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
127 priv = PIDGIN_CONV_THEME_GET_PRIVATE(instance); |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
128 } |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
129 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
130 static void |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
131 pidgin_conv_theme_finalize(GObject *obj) |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
132 { |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
133 PidginConvThemePrivate *priv; |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
134 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
135 priv = PIDGIN_CONV_THEME_GET_PRIVATE(obj); |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
136 |
32623
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
137 g_free(priv->template_html); |
32654
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
138 g_free(priv->header_html); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
139 g_free(priv->footer_html); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
140 g_free(priv->topic_html); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
141 g_free(priv->status_html); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
142 g_free(priv->content_html); |
32623
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
143 g_free(priv->incoming_content_html); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
144 g_free(priv->outgoing_content_html); |
32654
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
145 g_free(priv->incoming_next_content_html); |
32623
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
146 g_free(priv->outgoing_next_content_html); |
32654
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
147 g_free(priv->incoming_context_html); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
148 g_free(priv->outgoing_context_html); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
149 g_free(priv->incoming_next_context_html); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
150 g_free(priv->outgoing_next_context_html); |
32623
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
151 g_free(priv->basestyle_css); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
152 |
32630
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
153 if (priv->info) |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
154 g_hash_table_destroy(priv->info); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
155 |
32619
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
156 parent_class->finalize(obj); |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
157 } |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
158 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
159 static void |
32622
218a52b8504d
Fix small typo and remove unnecessary include.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
160 pidgin_conv_theme_class_init(PidginConvThemeClass *klass) |
32619
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
161 { |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
162 GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
32630
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
163 GParamSpec *pspec; |
32619
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
164 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
165 parent_class = g_type_class_peek_parent(klass); |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
166 |
32630
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
167 g_type_class_add_private(klass, sizeof(PidginConvThemePrivate)); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
168 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
169 obj_class->get_property = pidgin_conv_theme_get_property; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
170 obj_class->set_property = pidgin_conv_theme_set_property; |
32619
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
171 obj_class->finalize = pidgin_conv_theme_finalize; |
32630
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
172 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
173 /* INFO */ |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
174 pspec = g_param_spec_boxed("info", "Info", |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
175 "The information about this theme", |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
176 G_TYPE_HASH_TABLE, |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
177 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
178 g_object_class_install_property(obj_class, PROP_INFO, pspec); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
179 |
32619
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
180 } |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
181 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
182 GType |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
183 pidgin_conversation_theme_get_type(void) |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
184 { |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
185 static GType type = 0; |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
186 if (type == 0) { |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
187 static const GTypeInfo info = { |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
188 sizeof(PidginConvThemeClass), |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
189 NULL, /* base_init */ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
190 NULL, /* base_finalize */ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
191 (GClassInitFunc)pidgin_conv_theme_class_init, /* class_init */ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
192 NULL, /* class_finalize */ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
193 NULL, /* class_data */ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
194 sizeof(PidginConvTheme), |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
195 0, /* n_preallocs */ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
196 pidgin_conv_theme_init, /* instance_init */ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
197 NULL, /* value table */ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
198 }; |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
199 type = g_type_register_static(PURPLE_TYPE_THEME, |
32630
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
200 "PidginConvTheme", &info, 0); |
32619
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
201 } |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
202 return type; |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
203 } |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
204 |
32629
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
205 /****************************************************************************** |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
206 * Helper Functions |
32619
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
207 *****************************************************************************/ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
208 |
32641
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
209 static const GValue * |
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
210 get_key(PidginConvThemePrivate *priv, const char *key, gboolean specific) |
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
211 { |
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
212 GValue *val = NULL; |
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
213 |
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
214 /* Try variant-specific key */ |
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
215 if (specific && priv->variant) { |
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
216 char *name = g_strdup_printf("%s:%s", key, priv->variant); |
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
217 val = g_hash_table_lookup(priv->info, name); |
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
218 g_free(name); |
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
219 } |
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
220 |
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
221 /* Try generic key */ |
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
222 if (!val) { |
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
223 val = g_hash_table_lookup(priv->info, key); |
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
224 } |
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
225 |
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
226 return val; |
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
227 } |
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
228 |
32629
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
229 static const char * |
32641
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
230 get_template_html(PidginConvThemePrivate *priv, const char *dir) |
32629
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
231 { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
232 char *file; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
233 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
234 if (priv->template_html) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
235 return priv->template_html; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
236 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
237 /* The template path can either come from the theme, or can |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
238 * be stock Template.html that comes with the plugin */ |
32641
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
239 file = g_build_filename(dir, "Contents", "Resources", "Template.html", NULL); |
32629
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
240 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
241 if (!g_file_test(file, G_FILE_TEST_EXISTS)) { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
242 g_free(file); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
243 file = g_build_filename(DATADIR, "pidgin", "webkit", "Template.html", NULL); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
244 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
245 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
246 if (!g_file_get_contents(file, &priv->template_html, NULL, NULL)) { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
247 purple_debug_error("webkit", "Could not locate a Template.html (%s)\n", file); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
248 priv->template_html = g_strdup(""); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
249 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
250 g_free(file); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
251 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
252 return priv->template_html; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
253 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
254 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
255 static const char * |
32641
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
256 get_basestyle_css(PidginConvThemePrivate *priv, const char *dir) |
32629
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
257 { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
258 char *file; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
259 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
260 if (priv->basestyle_css) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
261 return priv->basestyle_css; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
262 |
32641
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
263 file = g_build_filename(dir, "Contents", "Resources", "main.css", NULL); |
32629
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
264 if (!g_file_get_contents(file, &priv->basestyle_css, NULL, NULL)) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
265 priv->basestyle_css = g_strdup(""); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
266 g_free(file); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
267 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
268 return priv->basestyle_css; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
269 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
270 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
271 static const char * |
32641
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
272 get_header_html(PidginConvThemePrivate *priv, const char *dir) |
32629
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
273 { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
274 char *file; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
275 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
276 if (priv->header_html) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
277 return priv->header_html; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
278 |
32641
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
279 file = g_build_filename(dir, "Contents", "Resources", "Header.html", NULL); |
32629
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
280 if (!g_file_get_contents(file, &priv->header_html, NULL, NULL)) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
281 priv->header_html = g_strdup(""); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
282 g_free(file); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
283 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
284 return priv->header_html; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
285 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
286 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
287 static const char * |
32641
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
288 get_footer_html(PidginConvThemePrivate *priv, const char *dir) |
32629
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
289 { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
290 char *file; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
291 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
292 if (priv->footer_html) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
293 return priv->footer_html; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
294 |
32641
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
295 file = g_build_filename(dir, "Contents", "Resources", "Footer.html", NULL); |
32629
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
296 if (!g_file_get_contents(file, &priv->footer_html, NULL, NULL)) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
297 priv->footer_html = g_strdup(""); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
298 g_free(file); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
299 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
300 return priv->footer_html; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
301 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
302 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
303 static const char * |
32654
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
304 get_topic_html(PidginConvThemePrivate *priv, const char *dir) |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
305 { |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
306 char *file; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
307 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
308 if (priv->topic_html) |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
309 return priv->topic_html; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
310 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
311 file = g_build_filename(dir, "Contents", "Resources", "Topic.html", NULL); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
312 if (!g_file_get_contents(file, &priv->topic_html, NULL, NULL)) { |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
313 purple_debug_info("webkit", "%s could not find Resources/Topic.html", dir); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
314 priv->topic_html = g_strdup(""); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
315 } |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
316 g_free(file); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
317 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
318 return priv->topic_html; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
319 } |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
320 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
321 static const char * |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
322 get_status_html(PidginConvThemePrivate *priv, const char *dir) |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
323 { |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
324 char *file; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
325 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
326 if (priv->status_html) |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
327 return priv->status_html; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
328 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
329 file = g_build_filename(dir, "Contents", "Resources", "Status.html", NULL); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
330 if (!g_file_get_contents(file, &priv->status_html, NULL, NULL)) { |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
331 purple_debug_info("webkit", "%s could not find Resources/Status.html", dir); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
332 priv->status_html = g_strdup(""); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
333 } |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
334 g_free(file); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
335 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
336 return priv->status_html; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
337 } |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
338 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
339 static const char * |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
340 get_content_html(PidginConvThemePrivate *priv, const char *dir) |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
341 { |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
342 char *file; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
343 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
344 if (priv->content_html) |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
345 return priv->content_html; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
346 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
347 file = g_build_filename(dir, "Contents", "Resources", "Content.html", NULL); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
348 if (!g_file_get_contents(file, &priv->content_html, NULL, NULL)) { |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
349 purple_debug_info("webkit", "%s did not have a Content.html\n", dir); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
350 priv->content_html = g_strdup(""); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
351 } |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
352 g_free(file); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
353 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
354 return priv->content_html; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
355 } |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
356 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
357 static const char * |
32641
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
358 get_incoming_content_html(PidginConvThemePrivate *priv, const char *dir) |
32629
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
359 { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
360 char *file; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
361 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
362 if (priv->incoming_content_html) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
363 return priv->incoming_content_html; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
364 |
32641
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
365 file = g_build_filename(dir, "Contents", "Resources", "Incoming", "Content.html", NULL); |
32629
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
366 if (!g_file_get_contents(file, &priv->incoming_content_html, NULL, NULL)) { |
32641
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
367 purple_debug_info("webkit", "%s did not have a Incoming/Content.html\n", dir); |
32654
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
368 priv->incoming_content_html = g_strdup(get_content_html(priv, dir)); |
32629
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
369 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
370 g_free(file); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
371 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
372 return priv->incoming_content_html; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
373 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
374 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
375 static const char * |
32641
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
376 get_incoming_next_content_html(PidginConvThemePrivate *priv, const char *dir) |
32629
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
377 { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
378 char *file; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
379 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
380 if (priv->incoming_next_content_html) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
381 return priv->incoming_next_content_html; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
382 |
32641
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
383 file = g_build_filename(dir, "Contents", "Resources", "Incoming", "NextContent.html", NULL); |
32629
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
384 if (!g_file_get_contents(file, &priv->incoming_next_content_html, NULL, NULL)) { |
32654
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
385 priv->incoming_next_content_html = g_strdup(get_incoming_content_html(priv, dir)); |
32629
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
386 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
387 g_free(file); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
388 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
389 return priv->incoming_next_content_html; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
390 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
391 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
392 static const char * |
32654
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
393 get_incoming_context_html(PidginConvThemePrivate *priv, const char *dir) |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
394 { |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
395 char *file; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
396 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
397 if (priv->incoming_context_html) |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
398 return priv->incoming_context_html; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
399 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
400 file = g_build_filename(dir, "Contents", "Resources", "Incoming", "Context.html", NULL); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
401 if (!g_file_get_contents(file, &priv->incoming_context_html, NULL, NULL)) { |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
402 purple_debug_info("webkit", "%s did not have a Incoming/Context.html\n", dir); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
403 priv->incoming_context_html = g_strdup(get_incoming_content_html(priv, dir)); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
404 } |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
405 g_free(file); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
406 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
407 return priv->incoming_context_html; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
408 } |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
409 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
410 static const char * |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
411 get_incoming_next_context_html(PidginConvThemePrivate *priv, const char *dir) |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
412 { |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
413 char *file; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
414 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
415 if (priv->incoming_next_context_html) |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
416 return priv->incoming_next_context_html; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
417 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
418 file = g_build_filename(dir, "Contents", "Resources", "Incoming", "NextContext.html", NULL); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
419 if (!g_file_get_contents(file, &priv->incoming_next_context_html, NULL, NULL)) { |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
420 priv->incoming_next_context_html = g_strdup(get_incoming_context_html(priv, dir)); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
421 } |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
422 g_free(file); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
423 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
424 return priv->incoming_next_context_html; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
425 } |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
426 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
427 static const char * |
32641
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
428 get_outgoing_content_html(PidginConvThemePrivate *priv, const char *dir) |
32629
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
429 { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
430 char *file; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
431 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
432 if (priv->outgoing_content_html) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
433 return priv->outgoing_content_html; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
434 |
32641
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
435 file = g_build_filename(dir, "Contents", "Resources", "Outgoing", "Content.html", NULL); |
32629
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
436 if (!g_file_get_contents(file, &priv->outgoing_content_html, NULL, NULL)) { |
32654
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
437 priv->outgoing_content_html = g_strdup(get_incoming_content_html(priv, dir)); |
32629
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
438 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
439 g_free(file); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
440 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
441 return priv->outgoing_content_html; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
442 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
443 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
444 static const char * |
32641
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
445 get_outgoing_next_content_html(PidginConvThemePrivate *priv, const char *dir) |
32629
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
446 { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
447 char *file; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
448 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
449 if (priv->outgoing_next_content_html) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
450 return priv->outgoing_next_content_html; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
451 |
32641
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
452 file = g_build_filename(dir, "Contents", "Resources", "Outgoing", "NextContent.html", NULL); |
32629
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
453 if (!g_file_get_contents(file, &priv->outgoing_next_content_html, NULL, NULL)) { |
32654
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
454 priv->outgoing_next_content_html = g_strdup(get_outgoing_content_html(priv, dir)); |
32629
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
455 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
456 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
457 return priv->outgoing_next_content_html; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
458 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
459 |
32654
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
460 static const char * |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
461 get_outgoing_context_html(PidginConvThemePrivate *priv, const char *dir) |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
462 { |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
463 char *file; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
464 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
465 if (priv->outgoing_context_html) |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
466 return priv->outgoing_context_html; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
467 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
468 file = g_build_filename(dir, "Contents", "Resources", "Outgoing", "Context.html", NULL); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
469 if (!g_file_get_contents(file, &priv->outgoing_context_html, NULL, NULL)) { |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
470 priv->outgoing_context_html = g_strdup(get_incoming_context_html(priv, dir)); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
471 } |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
472 g_free(file); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
473 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
474 return priv->outgoing_context_html; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
475 } |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
476 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
477 static const char * |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
478 get_outgoing_next_context_html(PidginConvThemePrivate *priv, const char *dir) |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
479 { |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
480 char *file; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
481 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
482 if (priv->outgoing_next_context_html) |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
483 return priv->outgoing_next_context_html; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
484 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
485 file = g_build_filename(dir, "Contents", "Resources", "Outgoing", "NextContext.html", NULL); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
486 if (!g_file_get_contents(file, &priv->outgoing_next_context_html, NULL, NULL)) { |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
487 priv->outgoing_next_context_html = g_strdup(get_outgoing_context_html(priv, dir)); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
488 } |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
489 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
490 return priv->outgoing_next_context_html; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
491 } |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
492 |
32629
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
493 /***************************************************************************** |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
494 * Public API functions |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
495 *****************************************************************************/ |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
496 |
32630
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
497 const GHashTable * |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
498 pidgin_conversation_theme_get_info(const PidginConvTheme *theme) |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
499 { |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
500 PidginConvThemePrivate *priv; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
501 priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
502 return priv->info; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
503 } |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
504 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
505 void |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
506 pidgin_conversation_theme_set_info(PidginConvTheme *theme, GHashTable *info) |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
507 { |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
508 PidginConvThemePrivate *priv; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
509 priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
510 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
511 if (priv->info) |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
512 g_hash_table_destroy(priv->info); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
513 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
514 priv->info = info; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
515 } |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
516 |
32656
79d48418ba0b
Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32654
diff
changeset
|
517 const GValue * |
79d48418ba0b
Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32654
diff
changeset
|
518 pidgin_conversation_theme_lookup(PidginConvTheme *theme, const char *key, gboolean specific) |
79d48418ba0b
Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32654
diff
changeset
|
519 { |
79d48418ba0b
Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32654
diff
changeset
|
520 PidginConvThemePrivate *priv; |
79d48418ba0b
Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32654
diff
changeset
|
521 priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); |
79d48418ba0b
Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32654
diff
changeset
|
522 |
79d48418ba0b
Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32654
diff
changeset
|
523 return get_key(priv, key, specific); |
79d48418ba0b
Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32654
diff
changeset
|
524 } |
79d48418ba0b
Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32654
diff
changeset
|
525 |
32654
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
526 const char * |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
527 pidgin_conversation_theme_get_template(PidginConvTheme *theme, PidginConvThemeTemplateType type) |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
528 { |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
529 PidginConvThemePrivate *priv; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
530 const char *dir; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
531 const char *html; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
532 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
533 priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
534 dir = purple_theme_get_dir(PURPLE_THEME(theme)); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
535 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
536 switch (type) { |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
537 case PIDGIN_CONVERSATION_THEME_TEMPLATE_MAIN: |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
538 html = get_template_html(priv, dir); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
539 break; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
540 case PIDGIN_CONVERSATION_THEME_TEMPLATE_HEADER: |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
541 html = get_header_html(priv, dir); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
542 break; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
543 case PIDGIN_CONVERSATION_THEME_TEMPLATE_FOOTER: |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
544 html = get_footer_html(priv, dir); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
545 break; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
546 case PIDGIN_CONVERSATION_THEME_TEMPLATE_TOPIC: |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
547 html = get_topic_html(priv, dir); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
548 break; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
549 case PIDGIN_CONVERSATION_THEME_TEMPLATE_STATUS: |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
550 html = get_status_html(priv, dir); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
551 break; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
552 case PIDGIN_CONVERSATION_THEME_TEMPLATE_CONTENT: |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
553 html = get_content_html(priv, dir); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
554 break; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
555 case PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_CONTENT: |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
556 html = get_incoming_content_html(priv, dir); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
557 break; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
558 case PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_NEXT_CONTENT: |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
559 html = get_incoming_next_content_html(priv, dir); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
560 break; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
561 case PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_CONTEXT: |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
562 html = get_incoming_context_html(priv, dir); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
563 break; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
564 case PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_NEXT_CONTEXT: |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
565 html = get_incoming_next_context_html(priv, dir); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
566 break; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
567 case PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_CONTENT: |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
568 html = get_outgoing_content_html(priv, dir); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
569 break; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
570 case PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_NEXT_CONTENT: |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
571 html = get_outgoing_next_content_html(priv, dir); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
572 break; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
573 case PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_CONTEXT: |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
574 html = get_outgoing_context_html(priv, dir); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
575 break; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
576 case PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_NEXT_CONTEXT: |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
577 html = get_outgoing_next_context_html(priv, dir); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
578 break; |
32657
ceae9fb7ae0b
Add template lookup for 'basestyle' CSS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32656
diff
changeset
|
579 case PIDGIN_CONVERSATION_THEME_TEMPLATE_BASESTYLE_CSS: |
ceae9fb7ae0b
Add template lookup for 'basestyle' CSS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32656
diff
changeset
|
580 html = get_basestyle_css(priv, dir); |
ceae9fb7ae0b
Add template lookup for 'basestyle' CSS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32656
diff
changeset
|
581 break; |
32654
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
582 default: |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
583 purple_debug_error("gtkconv-theme", |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
584 "Requested invalid template type (%d) for theme %s.\n", |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
585 type, purple_theme_get_name(PURPLE_THEME(theme))); |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
586 html = NULL; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
587 } |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
588 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
589 return html; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
590 } |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
591 |
32623
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
592 void |
32647
3e27c95ab8e6
Fix a leak. pidgin_conversation_theme_add_variant should only be
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32646
diff
changeset
|
593 pidgin_conversation_theme_add_variant(PidginConvTheme *theme, char *variant) |
32645
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
594 { |
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
595 PidginConvThemePrivate *priv; |
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
596 priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); |
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
597 |
32647
3e27c95ab8e6
Fix a leak. pidgin_conversation_theme_add_variant should only be
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32646
diff
changeset
|
598 priv->variants = g_list_prepend(priv->variants, variant); |
32645
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
599 } |
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
600 |
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
601 const char * |
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
602 pidgin_conversation_theme_get_variant(PidginConvTheme *theme) |
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
603 { |
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
604 PidginConvThemePrivate *priv; |
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
605 priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); |
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
606 |
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
607 return g_strdup(priv->variant); |
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
608 } |
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
609 |
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
610 void |
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
611 pidgin_conversation_theme_set_variant(PidginConvTheme *theme, const char *variant) |
32623
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
612 { |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
613 PidginConvThemePrivate *priv; |
32641
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
614 const GValue *val; |
32623
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
615 char *prefname; |
32645
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
616 priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); |
32623
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
617 |
32645
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
618 g_free(priv->variant); |
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
619 priv->variant = g_strdup(variant); |
32623
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
620 |
32641
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
621 val = get_key(priv, "CFBundleIdentifier", FALSE); |
32646
f857a6db3bd9
Use a consistent prefs name. It should be conversation*s* to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32645
diff
changeset
|
622 prefname = g_strdup_printf(PIDGIN_PREFS_ROOT "/conversations/themes/%s/variant", |
32645
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
623 g_value_get_string(val)); |
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
624 purple_prefs_set_string(prefname, variant); |
32623
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
625 g_free(prefname); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
626 } |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
627 |
32645
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
628 const GList * |
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
629 pidgin_conversation_theme_get_variants(PidginConvTheme *theme) |
32623
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
630 { |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
631 PidginConvThemePrivate *priv; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
632 priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
633 |
32645
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
634 return priv->variants; |
32623
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
635 } |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
636 |
32658
90264301600f
Apply conversation theme when opening the GTK conversation. All the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32657
diff
changeset
|
637 char * |
90264301600f
Apply conversation theme when opening the GTK conversation. All the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32657
diff
changeset
|
638 pidgin_conversation_theme_get_template_path(PidginConvTheme *theme) |
32623
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
639 { |
32658
90264301600f
Apply conversation theme when opening the GTK conversation. All the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32657
diff
changeset
|
640 const char *dir; |
90264301600f
Apply conversation theme when opening the GTK conversation. All the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32657
diff
changeset
|
641 char *filename; |
32623
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
642 |
32658
90264301600f
Apply conversation theme when opening the GTK conversation. All the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32657
diff
changeset
|
643 dir = purple_theme_get_dir(PURPLE_THEME(theme)); |
90264301600f
Apply conversation theme when opening the GTK conversation. All the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32657
diff
changeset
|
644 filename = g_build_filename(dir, "Contents", "Resources", "Template.html", NULL); |
32623
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
645 |
32658
90264301600f
Apply conversation theme when opening the GTK conversation. All the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32657
diff
changeset
|
646 if (!g_file_test(filename, G_FILE_TEST_EXISTS)) { |
90264301600f
Apply conversation theme when opening the GTK conversation. All the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32657
diff
changeset
|
647 g_free(filename); |
90264301600f
Apply conversation theme when opening the GTK conversation. All the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32657
diff
changeset
|
648 filename = g_build_filename(DATADIR, "pidgin", "webkit", "Template.html", NULL); |
90264301600f
Apply conversation theme when opening the GTK conversation. All the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32657
diff
changeset
|
649 } |
90264301600f
Apply conversation theme when opening the GTK conversation. All the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32657
diff
changeset
|
650 |
90264301600f
Apply conversation theme when opening the GTK conversation. All the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32657
diff
changeset
|
651 return filename; |
32623
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
652 } |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
653 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
654 char * |
32658
90264301600f
Apply conversation theme when opening the GTK conversation. All the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32657
diff
changeset
|
655 pidgin_conversation_theme_get_css_path(PidginConvTheme *theme) |
32623
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
656 { |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
657 PidginConvThemePrivate *priv; |
32641
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
658 const char *dir; |
32623
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
659 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
660 priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
661 |
32641
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
662 dir = purple_theme_get_dir(PURPLE_THEME(theme)); |
32623
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
663 if (!priv->variant) { |
32641
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
664 return g_build_filename(dir, "Contents", "Resources", "main.css", NULL); |
32623
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
665 } else { |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
666 char *file = g_strdup_printf("%s.css", priv->variant); |
32641
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
667 char *ret = g_build_filename(dir, "Contents", "Resources", "Variants", file, NULL); |
32623
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
668 g_free(file); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
669 return ret; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
670 } |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
671 } |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
672 |