Mercurial > pidgin.yaz
annotate pidgin/gtkconv-theme.c @ 32681:be14cf8a4c91
Make the current variant a property.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sat, 24 Sep 2011 21:15:29 +0000 |
parents | e51f656d74e5 |
children | 5cf6c4a8dcab |
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 |
32681
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
40 static void _set_variant(PidginConvTheme *theme, const char *variant); |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
41 |
32619
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 * Structs |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
44 *****************************************************************************/ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
45 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
46 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
|
47 /* 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
|
48 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
|
49 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
|
50 |
32630
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
51 /* Info.plist keys/values */ |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
52 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
|
53 |
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 /* 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
|
55 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
|
56 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
|
57 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
|
58 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
|
59 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
|
60 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
|
61 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
|
62 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
|
63 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
|
64 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
|
65 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
|
66 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
|
67 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
|
68 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
|
69 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
|
70 } PidginConvThemePrivate; |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
71 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
72 /****************************************************************************** |
32630
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
73 * Enums |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
74 *****************************************************************************/ |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
75 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
76 enum { |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
77 PROP_ZERO = 0, |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
78 PROP_INFO, |
32681
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
79 PROP_VARIANT, |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
80 PROP_LAST |
32630
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
81 }; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
82 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
83 /****************************************************************************** |
32681
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
84 * Globals |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
85 *****************************************************************************/ |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
86 |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
87 static GObjectClass *parent_class = NULL; |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
88 static GParamSpec *properties[PROP_LAST]; |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
89 |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
90 /****************************************************************************** |
32619
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
91 * GObject Stuff |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
92 *****************************************************************************/ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
93 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
94 static void |
32630
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
95 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
|
96 GParamSpec *psec) |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
97 { |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
98 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
|
99 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
100 switch (param_id) { |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
101 case PROP_INFO: |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
102 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
|
103 break; |
32681
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
104 |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
105 case PROP_VARIANT: |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
106 g_value_set_string(value, pidgin_conversation_theme_get_variant(theme)); |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
107 break; |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
108 |
32630
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
109 default: |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
110 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
|
111 break; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
112 } |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
113 } |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
114 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
115 static void |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
116 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
|
117 GParamSpec *psec) |
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 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
|
120 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
121 switch (param_id) { |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
122 case PROP_INFO: |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
123 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
|
124 break; |
32681
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
125 |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
126 case PROP_VARIANT: |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
127 _set_variant(theme, g_value_get_string(value)); |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
128 break; |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
129 |
32630
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
130 default: |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
131 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
|
132 break; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
133 } |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
134 } |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
135 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
136 static void |
32619
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
137 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
|
138 gpointer klass) |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
139 { |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
140 PidginConvThemePrivate *priv; |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
141 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
142 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
|
143 } |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
144 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
145 static void |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
146 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
|
147 { |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
148 PidginConvThemePrivate *priv; |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
149 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
150 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
|
151 |
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
|
152 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
|
153 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
|
154 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
|
155 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
|
156 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
|
157 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
|
158 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
|
159 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
|
160 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
|
161 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
|
162 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
|
163 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
|
164 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
|
165 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
|
166 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
|
167 |
32630
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
168 if (priv->info) |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
169 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
|
170 |
32619
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
171 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
|
172 } |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
173 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
174 static void |
32622
218a52b8504d
Fix small typo and remove unnecessary include.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
175 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
|
176 { |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
177 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
|
178 GParamSpec *pspec; |
32619
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
179 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
180 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
|
181 |
32630
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
182 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
|
183 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
184 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
|
185 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
|
186 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
|
187 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
188 /* INFO */ |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
189 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
|
190 "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
|
191 G_TYPE_HASH_TABLE, |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
192 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
|
193 g_object_class_install_property(obj_class, PROP_INFO, pspec); |
32681
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
194 properties[PROP_INFO] = pspec; |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
195 |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
196 /* VARIANT */ |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
197 pspec = g_param_spec_string("variant", "Variant", |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
198 "The current variant for this theme", |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
199 NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
200 g_object_class_install_property(obj_class, PROP_VARIANT, pspec); |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
201 properties[PROP_VARIANT] = pspec; |
32630
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
202 |
32619
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 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
205 GType |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
206 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
|
207 { |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
208 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
|
209 if (type == 0) { |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
210 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
|
211 sizeof(PidginConvThemeClass), |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
212 NULL, /* base_init */ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
213 NULL, /* base_finalize */ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
214 (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
|
215 NULL, /* class_finalize */ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
216 NULL, /* class_data */ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
217 sizeof(PidginConvTheme), |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
218 0, /* n_preallocs */ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
219 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
|
220 NULL, /* value table */ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
221 }; |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
222 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
|
223 "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
|
224 } |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
225 return type; |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
226 } |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
227 |
32629
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
228 /****************************************************************************** |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
229 * Helper Functions |
32619
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
230 *****************************************************************************/ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
231 |
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
|
232 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
|
233 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
|
234 { |
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
235 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
|
236 |
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
237 /* 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
|
238 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
|
239 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
|
240 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
|
241 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
|
242 } |
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
243 |
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
244 /* 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
|
245 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
|
246 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
|
247 } |
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
248 |
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
249 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
|
250 } |
7219f52cdfa3
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32633
diff
changeset
|
251 |
32629
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
252 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
|
253 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
|
254 { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
255 char *file; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
256 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
257 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
|
258 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
|
259 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
260 /* 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
|
261 * 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
|
262 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
|
263 |
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_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
|
265 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
|
266 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
|
267 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
268 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
269 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
|
270 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
|
271 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
|
272 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
273 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
|
274 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
275 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
|
276 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
277 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
278 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
|
279 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
|
280 { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
281 char *file; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
282 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
283 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
|
284 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
|
285 |
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
|
286 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
|
287 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
|
288 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
|
289 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
|
290 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
291 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
|
292 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
293 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
294 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
|
295 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
|
296 { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
297 char *file; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
298 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
299 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
|
300 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
|
301 |
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
|
302 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
|
303 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
|
304 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
|
305 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
|
306 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
307 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
|
308 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
309 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
310 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
|
311 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
|
312 { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
313 char *file; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
314 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
315 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
|
316 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
|
317 |
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
|
318 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
|
319 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
|
320 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
|
321 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
|
322 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
323 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
|
324 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
325 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
326 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
|
327 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
|
328 { |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
329 char *file; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
330 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
331 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
|
332 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
|
333 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
334 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
|
335 if (!g_file_get_contents(file, &priv->topic_html, NULL, NULL)) { |
32667
7b6ab83622db
Add some missing newlines in debug output.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32659
diff
changeset
|
336 purple_debug_info("webkit", "%s could not find Resources/Topic.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
|
337 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
|
338 } |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
339 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
|
340 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
341 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
|
342 } |
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 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
|
345 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
|
346 { |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
347 char *file; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
348 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
349 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
|
350 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
|
351 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
352 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
|
353 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
|
354 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
|
355 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
|
356 } |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
357 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
|
358 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
359 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
|
360 } |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
361 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
362 static const char * |
32670
e51f656d74e5
Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32667
diff
changeset
|
363 get_status_html(PidginConvThemePrivate *priv, const char *dir) |
e51f656d74e5
Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32667
diff
changeset
|
364 { |
e51f656d74e5
Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32667
diff
changeset
|
365 char *file; |
e51f656d74e5
Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32667
diff
changeset
|
366 |
e51f656d74e5
Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32667
diff
changeset
|
367 if (priv->status_html) |
e51f656d74e5
Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32667
diff
changeset
|
368 return priv->status_html; |
e51f656d74e5
Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32667
diff
changeset
|
369 |
e51f656d74e5
Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32667
diff
changeset
|
370 file = g_build_filename(dir, "Contents", "Resources", "Status.html", NULL); |
e51f656d74e5
Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32667
diff
changeset
|
371 if (!g_file_get_contents(file, &priv->status_html, NULL, NULL)) { |
e51f656d74e5
Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32667
diff
changeset
|
372 purple_debug_info("webkit", "%s could not find Resources/Status.html\n", dir); |
e51f656d74e5
Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32667
diff
changeset
|
373 priv->status_html = g_strdup(get_content_html(priv, dir)); |
e51f656d74e5
Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32667
diff
changeset
|
374 } |
e51f656d74e5
Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32667
diff
changeset
|
375 g_free(file); |
e51f656d74e5
Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32667
diff
changeset
|
376 |
e51f656d74e5
Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32667
diff
changeset
|
377 return priv->status_html; |
e51f656d74e5
Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32667
diff
changeset
|
378 } |
e51f656d74e5
Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32667
diff
changeset
|
379 |
e51f656d74e5
Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32667
diff
changeset
|
380 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
|
381 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
|
382 { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
383 char *file; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
384 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
385 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
|
386 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
|
387 |
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
|
388 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
|
389 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
|
390 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
|
391 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
|
392 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
393 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
|
394 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
395 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
|
396 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
397 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
398 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
|
399 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
|
400 { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
401 char *file; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
402 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
403 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
|
404 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
|
405 |
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
|
406 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
|
407 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
|
408 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
|
409 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
410 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
|
411 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
412 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
|
413 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
414 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
415 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
|
416 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
|
417 { |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
418 char *file; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
419 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
420 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
|
421 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
|
422 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
423 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
|
424 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
|
425 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
|
426 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
|
427 } |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
428 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
|
429 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
430 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
|
431 } |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
432 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
433 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
|
434 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
|
435 { |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
436 char *file; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
437 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
438 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
|
439 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
|
440 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
441 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
|
442 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
|
443 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
|
444 } |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
445 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
|
446 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
447 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
|
448 } |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
449 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
450 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
|
451 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
|
452 { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
453 char *file; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
454 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
455 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
|
456 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
|
457 |
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
|
458 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
|
459 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
|
460 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
|
461 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
462 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
|
463 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
464 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
|
465 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
466 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
467 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
|
468 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
|
469 { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
470 char *file; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
471 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
472 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
|
473 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
|
474 |
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
|
475 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
|
476 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
|
477 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
|
478 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
479 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
480 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
|
481 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
482 |
32654
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
483 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
|
484 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
|
485 { |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
486 char *file; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
487 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
488 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
|
489 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
|
490 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
491 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
|
492 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
|
493 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
|
494 } |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
495 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
|
496 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
497 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
|
498 } |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
499 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
500 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
|
501 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
|
502 { |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
503 char *file; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
504 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
505 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
|
506 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
|
507 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
508 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
|
509 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
|
510 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
|
511 } |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
512 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
513 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
|
514 } |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
515 |
32681
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
516 static void |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
517 _set_variant(PidginConvTheme *theme, const char *variant) |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
518 { |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
519 PidginConvThemePrivate *priv; |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
520 const GValue *val; |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
521 char *prefname; |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
522 |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
523 g_return_if_fail(theme != NULL); |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
524 g_return_if_fail(variant != NULL); |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
525 |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
526 priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
527 |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
528 g_free(priv->variant); |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
529 priv->variant = g_strdup(variant); |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
530 |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
531 val = get_key(priv, "CFBundleIdentifier", FALSE); |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
532 prefname = g_strdup_printf(PIDGIN_PREFS_ROOT "/conversations/themes/%s/variant", |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
533 g_value_get_string(val)); |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
534 purple_prefs_set_string(prefname, variant); |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
535 g_free(prefname); |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
536 } |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
537 |
32629
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
538 /***************************************************************************** |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
539 * 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
|
540 *****************************************************************************/ |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
541 |
32630
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
542 const GHashTable * |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
543 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
|
544 { |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
545 PidginConvThemePrivate *priv; |
32659
3af16402f176
Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32658
diff
changeset
|
546 |
3af16402f176
Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32658
diff
changeset
|
547 g_return_val_if_fail(theme != NULL, NULL); |
3af16402f176
Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32658
diff
changeset
|
548 |
32630
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
549 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
|
550 return priv->info; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
551 } |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
552 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
553 void |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
554 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
|
555 { |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
556 PidginConvThemePrivate *priv; |
32659
3af16402f176
Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32658
diff
changeset
|
557 |
3af16402f176
Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32658
diff
changeset
|
558 g_return_if_fail(theme != NULL); |
3af16402f176
Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32658
diff
changeset
|
559 |
32630
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
560 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
|
561 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
562 if (priv->info) |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
563 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
|
564 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
565 priv->info = info; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
566 } |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
567 |
32656
79d48418ba0b
Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32654
diff
changeset
|
568 const GValue * |
79d48418ba0b
Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32654
diff
changeset
|
569 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
|
570 { |
79d48418ba0b
Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32654
diff
changeset
|
571 PidginConvThemePrivate *priv; |
32659
3af16402f176
Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32658
diff
changeset
|
572 |
3af16402f176
Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32658
diff
changeset
|
573 g_return_val_if_fail(theme != NULL, NULL); |
3af16402f176
Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32658
diff
changeset
|
574 |
32656
79d48418ba0b
Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32654
diff
changeset
|
575 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
|
576 |
79d48418ba0b
Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32654
diff
changeset
|
577 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
|
578 } |
79d48418ba0b
Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32654
diff
changeset
|
579 |
32654
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
580 const char * |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
581 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
|
582 { |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
583 PidginConvThemePrivate *priv; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
584 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
|
585 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
|
586 |
32659
3af16402f176
Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32658
diff
changeset
|
587 g_return_val_if_fail(theme != NULL, NULL); |
3af16402f176
Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32658
diff
changeset
|
588 |
32654
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
589 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
|
590 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
|
591 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
592 switch (type) { |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
593 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
|
594 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
|
595 break; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
596 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
|
597 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
|
598 break; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
599 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
|
600 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
|
601 break; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
602 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
|
603 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
|
604 break; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
605 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
|
606 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
|
607 break; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
608 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
|
609 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
|
610 break; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
611 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
|
612 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
|
613 break; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
614 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
|
615 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
|
616 break; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
617 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
|
618 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
|
619 break; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
620 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
|
621 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
|
622 break; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
623 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
|
624 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
|
625 break; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
626 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
|
627 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
|
628 break; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
629 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
|
630 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
|
631 break; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
632 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
|
633 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
|
634 break; |
32657
ceae9fb7ae0b
Add template lookup for 'basestyle' CSS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32656
diff
changeset
|
635 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
|
636 html = get_basestyle_css(priv, dir); |
ceae9fb7ae0b
Add template lookup for 'basestyle' CSS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32656
diff
changeset
|
637 break; |
32654
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
638 default: |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
639 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
|
640 "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
|
641 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
|
642 html = NULL; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
643 } |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
644 |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
645 return html; |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
646 } |
3294e08d7466
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32649
diff
changeset
|
647 |
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
|
648 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
|
649 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
|
650 { |
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
651 PidginConvThemePrivate *priv; |
32659
3af16402f176
Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32658
diff
changeset
|
652 |
3af16402f176
Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32658
diff
changeset
|
653 g_return_if_fail(theme != NULL); |
3af16402f176
Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32658
diff
changeset
|
654 g_return_if_fail(variant != NULL); |
3af16402f176
Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32658
diff
changeset
|
655 |
32645
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
656 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
|
657 |
32647
3e27c95ab8e6
Fix a leak. pidgin_conversation_theme_add_variant should only be
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32646
diff
changeset
|
658 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
|
659 } |
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
660 |
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
661 const char * |
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
662 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
|
663 { |
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
664 PidginConvThemePrivate *priv; |
32659
3af16402f176
Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32658
diff
changeset
|
665 |
3af16402f176
Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32658
diff
changeset
|
666 g_return_val_if_fail(theme != NULL, NULL); |
3af16402f176
Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32658
diff
changeset
|
667 |
32645
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
668 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
|
669 |
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
670 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
|
671 } |
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
672 |
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
673 void |
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
674 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
|
675 { |
32681
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
676 _set_variant(theme, variant); |
be14cf8a4c91
Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32670
diff
changeset
|
677 g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_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
|
678 } |
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
|
679 |
32645
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
680 const GList * |
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
681 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
|
682 { |
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
|
683 PidginConvThemePrivate *priv; |
32659
3af16402f176
Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32658
diff
changeset
|
684 |
3af16402f176
Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32658
diff
changeset
|
685 g_return_val_if_fail(theme != NULL, NULL); |
3af16402f176
Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32658
diff
changeset
|
686 |
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
|
687 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
|
688 |
32645
a7a6770f26e2
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32644
diff
changeset
|
689 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
|
690 } |
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
|
691 |
32658
90264301600f
Apply conversation theme when opening the GTK conversation. All the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32657
diff
changeset
|
692 char * |
90264301600f
Apply conversation theme when opening the GTK conversation. All the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32657
diff
changeset
|
693 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
|
694 { |
32658
90264301600f
Apply conversation theme when opening the GTK conversation. All the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32657
diff
changeset
|
695 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
|
696 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
|
697 |
32659
3af16402f176
Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32658
diff
changeset
|
698 g_return_val_if_fail(theme != NULL, NULL); |
3af16402f176
Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32658
diff
changeset
|
699 |
32658
90264301600f
Apply conversation theme when opening the GTK conversation. All the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32657
diff
changeset
|
700 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
|
701 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
|
702 |
32658
90264301600f
Apply conversation theme when opening the GTK conversation. All the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32657
diff
changeset
|
703 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
|
704 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
|
705 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
|
706 } |
90264301600f
Apply conversation theme when opening the GTK conversation. All the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32657
diff
changeset
|
707 |
90264301600f
Apply conversation theme when opening the GTK conversation. All the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32657
diff
changeset
|
708 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
|
709 } |
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
|
710 |
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
|
711 char * |
32658
90264301600f
Apply conversation theme when opening the GTK conversation. All the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32657
diff
changeset
|
712 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
|
713 { |
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
|
714 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
|
715 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
|
716 |
32659
3af16402f176
Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32658
diff
changeset
|
717 g_return_val_if_fail(theme != NULL, NULL); |
3af16402f176
Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32658
diff
changeset
|
718 |
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
|
719 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
|
720 |
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
|
721 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
|
722 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
|
723 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
|
724 } 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
|
725 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
|
726 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
|
727 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
|
728 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
|
729 } |
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
|
730 } |
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
|
731 |