Wed, 21 Sep 2011 03:14:57 +0000
Add template lookup for 'basestyle' CSS.
|
32536
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1 | /* |
|
91b09760ab0c
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 |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
3 | * |
|
91b09760ab0c
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 |
|
91b09760ab0c
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 |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
6 | * source distribution. |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
7 | * |
|
91b09760ab0c
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 |
|
91b09760ab0c
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 |
|
91b09760ab0c
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 |
|
91b09760ab0c
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. |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
12 | * |
|
91b09760ab0c
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, |
|
91b09760ab0c
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 |
|
91b09760ab0c
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 |
|
91b09760ab0c
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. |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
17 | * |
|
91b09760ab0c
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 |
|
91b09760ab0c
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 |
|
91b09760ab0c
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 |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
21 | */ |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
22 | |
|
91b09760ab0c
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" |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
24 | |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
25 | #include "conversation.h" |
|
32540
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
26 | #include "debug.h" |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
27 | #include "prefs.h" |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
28 | #include "xmlnode.h" |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
29 | |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
30 | #include "pidgin.h" |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
31 | #include "gtkconv.h" |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
32 | #include "gtkwebview.h" |
|
32536
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
33 | |
|
32540
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
34 | #include <stdlib.h> |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
35 | #include <string.h> |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
36 | |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
37 | /* GObject data keys - this will probably go away soon... */ |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
38 | #define MESSAGE_STYLE_KEY "message-style" |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
39 | |
|
32536
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
40 | #define PIDGIN_CONV_THEME_GET_PRIVATE(Gobject) \ |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
41 | (G_TYPE_INSTANCE_GET_PRIVATE((Gobject), PIDGIN_TYPE_CONV_THEME, PidginConvThemePrivate)) |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
42 | |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
43 | /****************************************************************************** |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
44 | * Structs |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
45 | *****************************************************************************/ |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
46 | |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
47 | typedef struct { |
|
32540
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
48 | /* current config options */ |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
49 | char *variant; /* allowed to be NULL if there are no variants */ |
|
32562
9c094ffe9333
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32561
diff
changeset
|
50 | GList *variants; |
|
32540
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
51 | |
|
32545
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
52 | /* Info.plist keys/values */ |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
53 | GHashTable *info; |
|
32540
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
54 | |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
55 | /* caches */ |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
56 | char *template_html; |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
57 | char *header_html; |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
58 | char *footer_html; |
|
32571
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
59 | char *topic_html; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
60 | char *status_html; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
61 | char *content_html; |
|
32540
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
62 | char *incoming_content_html; |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
63 | char *outgoing_content_html; |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
64 | char *incoming_next_content_html; |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
65 | char *outgoing_next_content_html; |
|
32571
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
66 | char *incoming_context_html; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
67 | char *outgoing_context_html; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
68 | char *incoming_next_context_html; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
69 | char *outgoing_next_context_html; |
|
32540
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
70 | char *basestyle_css; |
|
32536
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
71 | } PidginConvThemePrivate; |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
72 | |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
73 | /****************************************************************************** |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
74 | * Globals |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
75 | *****************************************************************************/ |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
76 | |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
77 | static GObjectClass *parent_class = NULL; |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
78 | |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
79 | /****************************************************************************** |
|
32545
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
80 | * Enums |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
81 | *****************************************************************************/ |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
82 | |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
83 | enum { |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
84 | PROP_ZERO = 0, |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
85 | PROP_INFO, |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
86 | }; |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
87 | |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
88 | /****************************************************************************** |
|
32536
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
89 | * GObject Stuff |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
90 | *****************************************************************************/ |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
91 | |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
92 | static void |
|
32545
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
93 | pidgin_conv_theme_get_property(GObject *obj, guint param_id, GValue *value, |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
94 | GParamSpec *psec) |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
95 | { |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
96 | PidginConvTheme *theme = PIDGIN_CONV_THEME(obj); |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
97 | |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
98 | switch (param_id) { |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
99 | case PROP_INFO: |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
100 | g_value_set_boxed(value, (gpointer)pidgin_conversation_theme_get_info(theme)); |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
101 | break; |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
102 | default: |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
103 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec); |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
104 | break; |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
105 | } |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
106 | } |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
107 | |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
108 | static void |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
109 | pidgin_conv_theme_set_property(GObject *obj, guint param_id, const GValue *value, |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
110 | GParamSpec *psec) |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
111 | { |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
112 | PidginConvTheme *theme = PIDGIN_CONV_THEME(obj); |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
113 | |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
114 | switch (param_id) { |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
115 | case PROP_INFO: |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
116 | pidgin_conversation_theme_set_info(theme, g_value_get_boxed(value)); |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
117 | break; |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
118 | default: |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
119 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec); |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
120 | break; |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
121 | } |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
122 | } |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
123 | |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
124 | static void |
|
32536
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
125 | pidgin_conv_theme_init(GTypeInstance *instance, |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
126 | gpointer klass) |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
127 | { |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
128 | PidginConvThemePrivate *priv; |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
129 | |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
130 | priv = PIDGIN_CONV_THEME_GET_PRIVATE(instance); |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
131 | } |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
132 | |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
133 | static void |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
134 | pidgin_conv_theme_finalize(GObject *obj) |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
135 | { |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
136 | PidginConvThemePrivate *priv; |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
137 | |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
138 | priv = PIDGIN_CONV_THEME_GET_PRIVATE(obj); |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
139 | |
|
32540
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
140 | g_free(priv->template_html); |
|
32571
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
141 | g_free(priv->header_html); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
142 | g_free(priv->footer_html); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
143 | g_free(priv->topic_html); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
144 | g_free(priv->status_html); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
145 | g_free(priv->content_html); |
|
32540
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
146 | g_free(priv->incoming_content_html); |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
147 | g_free(priv->outgoing_content_html); |
|
32571
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
148 | g_free(priv->incoming_next_content_html); |
|
32540
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
149 | g_free(priv->outgoing_next_content_html); |
|
32571
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
150 | g_free(priv->incoming_context_html); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
151 | g_free(priv->outgoing_context_html); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
152 | g_free(priv->incoming_next_context_html); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
153 | g_free(priv->outgoing_next_context_html); |
|
32540
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
154 | g_free(priv->basestyle_css); |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
155 | |
|
32545
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
156 | if (priv->info) |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
157 | g_hash_table_destroy(priv->info); |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
158 | |
|
32536
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
159 | parent_class->finalize(obj); |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
160 | } |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
161 | |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
162 | static void |
|
32539
51187ea89034
Fix small typo and remove unnecessary include.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32536
diff
changeset
|
163 | pidgin_conv_theme_class_init(PidginConvThemeClass *klass) |
|
32536
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
164 | { |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
165 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
32545
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
166 | GParamSpec *pspec; |
|
32536
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
167 | |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
168 | parent_class = g_type_class_peek_parent(klass); |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
169 | |
|
32545
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
170 | g_type_class_add_private(klass, sizeof(PidginConvThemePrivate)); |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
171 | |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
172 | obj_class->get_property = pidgin_conv_theme_get_property; |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
173 | obj_class->set_property = pidgin_conv_theme_set_property; |
|
32536
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
174 | obj_class->finalize = pidgin_conv_theme_finalize; |
|
32545
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
175 | |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
176 | /* INFO */ |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
177 | pspec = g_param_spec_boxed("info", "Info", |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
178 | "The information about this theme", |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
179 | G_TYPE_HASH_TABLE, |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
180 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
181 | g_object_class_install_property(obj_class, PROP_INFO, pspec); |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
182 | |
|
32536
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
183 | } |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
184 | |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
185 | GType |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
186 | pidgin_conversation_theme_get_type(void) |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
187 | { |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
188 | static GType type = 0; |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
189 | if (type == 0) { |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
190 | static const GTypeInfo info = { |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
191 | sizeof(PidginConvThemeClass), |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
192 | NULL, /* base_init */ |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
193 | NULL, /* base_finalize */ |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
194 | (GClassInitFunc)pidgin_conv_theme_class_init, /* class_init */ |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
195 | NULL, /* class_finalize */ |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
196 | NULL, /* class_data */ |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
197 | sizeof(PidginConvTheme), |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
198 | 0, /* n_preallocs */ |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
199 | pidgin_conv_theme_init, /* instance_init */ |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
200 | NULL, /* value table */ |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
201 | }; |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
202 | type = g_type_register_static(PURPLE_TYPE_THEME, |
|
32545
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
203 | "PidginConvTheme", &info, 0); |
|
32536
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
204 | } |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
205 | return type; |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
206 | } |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
207 | |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
208 | /****************************************************************************** |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
209 | * Helper Functions |
|
32536
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
210 | *****************************************************************************/ |
|
91b09760ab0c
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
211 | |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
212 | static const GValue * |
|
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
213 | get_key(PidginConvThemePrivate *priv, const char *key, gboolean specific) |
|
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
214 | { |
|
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
215 | GValue *val = NULL; |
|
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
216 | |
|
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
217 | /* Try variant-specific key */ |
|
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
218 | if (specific && priv->variant) { |
|
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
219 | char *name = g_strdup_printf("%s:%s", key, priv->variant); |
|
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
220 | val = g_hash_table_lookup(priv->info, name); |
|
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
221 | g_free(name); |
|
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
222 | } |
|
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
223 | |
|
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
224 | /* Try generic key */ |
|
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
225 | if (!val) { |
|
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
226 | val = g_hash_table_lookup(priv->info, key); |
|
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
227 | } |
|
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
228 | |
|
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
229 | return val; |
|
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
230 | } |
|
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
231 | |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
232 | static const char * |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
233 | get_template_html(PidginConvThemePrivate *priv, const char *dir) |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
234 | { |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
235 | char *file; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
236 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
237 | if (priv->template_html) |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
238 | return priv->template_html; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
239 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
240 | /* The template path can either come from the theme, or can |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
241 | * be stock Template.html that comes with the plugin */ |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
242 | file = g_build_filename(dir, "Contents", "Resources", "Template.html", NULL); |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
243 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
244 | if (!g_file_test(file, G_FILE_TEST_EXISTS)) { |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
245 | g_free(file); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
246 | file = g_build_filename(DATADIR, "pidgin", "webkit", "Template.html", NULL); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
247 | } |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
248 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
249 | if (!g_file_get_contents(file, &priv->template_html, NULL, NULL)) { |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
250 | purple_debug_error("webkit", "Could not locate a Template.html (%s)\n", file); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
251 | priv->template_html = g_strdup(""); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
252 | } |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
253 | g_free(file); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
254 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
255 | return priv->template_html; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
256 | } |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
257 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
258 | static const char * |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
259 | get_basestyle_css(PidginConvThemePrivate *priv, const char *dir) |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
260 | { |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
261 | char *file; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
262 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
263 | if (priv->basestyle_css) |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
264 | return priv->basestyle_css; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
265 | |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
266 | file = g_build_filename(dir, "Contents", "Resources", "main.css", NULL); |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
267 | if (!g_file_get_contents(file, &priv->basestyle_css, NULL, NULL)) |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
268 | priv->basestyle_css = g_strdup(""); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
269 | g_free(file); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
270 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
271 | return priv->basestyle_css; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
272 | } |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
273 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
274 | static const char * |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
275 | get_header_html(PidginConvThemePrivate *priv, const char *dir) |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
276 | { |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
277 | char *file; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
278 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
279 | if (priv->header_html) |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
280 | return priv->header_html; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
281 | |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
282 | file = g_build_filename(dir, "Contents", "Resources", "Header.html", NULL); |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
283 | if (!g_file_get_contents(file, &priv->header_html, NULL, NULL)) |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
284 | priv->header_html = g_strdup(""); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
285 | g_free(file); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
286 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
287 | return priv->header_html; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
288 | } |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
289 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
290 | static const char * |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
291 | get_footer_html(PidginConvThemePrivate *priv, const char *dir) |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
292 | { |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
293 | char *file; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
294 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
295 | if (priv->footer_html) |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
296 | return priv->footer_html; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
297 | |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
298 | file = g_build_filename(dir, "Contents", "Resources", "Footer.html", NULL); |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
299 | if (!g_file_get_contents(file, &priv->footer_html, NULL, NULL)) |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
300 | priv->footer_html = g_strdup(""); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
301 | g_free(file); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
302 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
303 | return priv->footer_html; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
304 | } |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
305 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
306 | static const char * |
|
32571
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
307 | get_topic_html(PidginConvThemePrivate *priv, const char *dir) |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
308 | { |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
309 | char *file; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
310 | |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
311 | if (priv->topic_html) |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
312 | return priv->topic_html; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
313 | |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
314 | file = g_build_filename(dir, "Contents", "Resources", "Topic.html", NULL); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
315 | if (!g_file_get_contents(file, &priv->topic_html, NULL, NULL)) { |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
316 | purple_debug_info("webkit", "%s could not find Resources/Topic.html", dir); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
317 | priv->topic_html = g_strdup(""); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
318 | } |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
319 | g_free(file); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
320 | |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
321 | return priv->topic_html; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
322 | } |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
323 | |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
324 | static const char * |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
325 | get_status_html(PidginConvThemePrivate *priv, const char *dir) |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
326 | { |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
327 | char *file; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
328 | |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
329 | if (priv->status_html) |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
330 | return priv->status_html; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
331 | |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
332 | file = g_build_filename(dir, "Contents", "Resources", "Status.html", NULL); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
333 | if (!g_file_get_contents(file, &priv->status_html, NULL, NULL)) { |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
334 | purple_debug_info("webkit", "%s could not find Resources/Status.html", dir); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
335 | priv->status_html = g_strdup(""); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
336 | } |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
337 | g_free(file); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
338 | |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
339 | return priv->status_html; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
340 | } |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
341 | |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
342 | static const char * |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
343 | get_content_html(PidginConvThemePrivate *priv, const char *dir) |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
344 | { |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
345 | char *file; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
346 | |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
347 | if (priv->content_html) |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
348 | return priv->content_html; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
349 | |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
350 | file = g_build_filename(dir, "Contents", "Resources", "Content.html", NULL); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
351 | if (!g_file_get_contents(file, &priv->content_html, NULL, NULL)) { |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
352 | purple_debug_info("webkit", "%s did not have a Content.html\n", dir); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
353 | priv->content_html = g_strdup(""); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
354 | } |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
355 | g_free(file); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
356 | |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
357 | return priv->content_html; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
358 | } |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
359 | |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
360 | static const char * |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
361 | get_incoming_content_html(PidginConvThemePrivate *priv, const char *dir) |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
362 | { |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
363 | char *file; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
364 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
365 | if (priv->incoming_content_html) |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
366 | return priv->incoming_content_html; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
367 | |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
368 | file = g_build_filename(dir, "Contents", "Resources", "Incoming", "Content.html", NULL); |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
369 | if (!g_file_get_contents(file, &priv->incoming_content_html, NULL, NULL)) { |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
370 | purple_debug_info("webkit", "%s did not have a Incoming/Content.html\n", dir); |
|
32571
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
371 | priv->incoming_content_html = g_strdup(get_content_html(priv, dir)); |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
372 | } |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
373 | g_free(file); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
374 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
375 | return priv->incoming_content_html; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
376 | } |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
377 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
378 | static const char * |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
379 | get_incoming_next_content_html(PidginConvThemePrivate *priv, const char *dir) |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
380 | { |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
381 | char *file; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
382 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
383 | if (priv->incoming_next_content_html) |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
384 | return priv->incoming_next_content_html; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
385 | |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
386 | file = g_build_filename(dir, "Contents", "Resources", "Incoming", "NextContent.html", NULL); |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
387 | if (!g_file_get_contents(file, &priv->incoming_next_content_html, NULL, NULL)) { |
|
32571
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
388 | priv->incoming_next_content_html = g_strdup(get_incoming_content_html(priv, dir)); |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
389 | } |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
390 | g_free(file); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
391 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
392 | return priv->incoming_next_content_html; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
393 | } |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
394 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
395 | static const char * |
|
32571
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
396 | get_incoming_context_html(PidginConvThemePrivate *priv, const char *dir) |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
397 | { |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
398 | char *file; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
399 | |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
400 | if (priv->incoming_context_html) |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
401 | return priv->incoming_context_html; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
402 | |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
403 | file = g_build_filename(dir, "Contents", "Resources", "Incoming", "Context.html", NULL); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
404 | if (!g_file_get_contents(file, &priv->incoming_context_html, NULL, NULL)) { |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
405 | purple_debug_info("webkit", "%s did not have a Incoming/Context.html\n", dir); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
406 | priv->incoming_context_html = g_strdup(get_incoming_content_html(priv, dir)); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
407 | } |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
408 | g_free(file); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
409 | |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
410 | return priv->incoming_context_html; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
411 | } |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
412 | |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
413 | static const char * |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
414 | get_incoming_next_context_html(PidginConvThemePrivate *priv, const char *dir) |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
415 | { |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
416 | char *file; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
417 | |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
418 | if (priv->incoming_next_context_html) |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
419 | return priv->incoming_next_context_html; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
420 | |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
421 | file = g_build_filename(dir, "Contents", "Resources", "Incoming", "NextContext.html", NULL); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
422 | if (!g_file_get_contents(file, &priv->incoming_next_context_html, NULL, NULL)) { |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
423 | priv->incoming_next_context_html = g_strdup(get_incoming_context_html(priv, dir)); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
424 | } |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
425 | g_free(file); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
426 | |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
427 | return priv->incoming_next_context_html; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
428 | } |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
429 | |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
430 | static const char * |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
431 | get_outgoing_content_html(PidginConvThemePrivate *priv, const char *dir) |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
432 | { |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
433 | char *file; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
434 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
435 | if (priv->outgoing_content_html) |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
436 | return priv->outgoing_content_html; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
437 | |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
438 | file = g_build_filename(dir, "Contents", "Resources", "Outgoing", "Content.html", NULL); |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
439 | if (!g_file_get_contents(file, &priv->outgoing_content_html, NULL, NULL)) { |
|
32571
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
440 | priv->outgoing_content_html = g_strdup(get_incoming_content_html(priv, dir)); |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
441 | } |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
442 | g_free(file); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
443 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
444 | return priv->outgoing_content_html; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
445 | } |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
446 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
447 | static const char * |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
448 | get_outgoing_next_content_html(PidginConvThemePrivate *priv, const char *dir) |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
449 | { |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
450 | char *file; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
451 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
452 | if (priv->outgoing_next_content_html) |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
453 | return priv->outgoing_next_content_html; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
454 | |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
455 | file = g_build_filename(dir, "Contents", "Resources", "Outgoing", "NextContent.html", NULL); |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
456 | if (!g_file_get_contents(file, &priv->outgoing_next_content_html, NULL, NULL)) { |
|
32571
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
457 | priv->outgoing_next_content_html = g_strdup(get_outgoing_content_html(priv, dir)); |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
458 | } |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
459 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
460 | return priv->outgoing_next_content_html; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
461 | } |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
462 | |
|
32571
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
463 | static const char * |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
464 | get_outgoing_context_html(PidginConvThemePrivate *priv, const char *dir) |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
465 | { |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
466 | char *file; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
467 | |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
468 | if (priv->outgoing_context_html) |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
469 | return priv->outgoing_context_html; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
470 | |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
471 | file = g_build_filename(dir, "Contents", "Resources", "Outgoing", "Context.html", NULL); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
472 | if (!g_file_get_contents(file, &priv->outgoing_context_html, NULL, NULL)) { |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
473 | priv->outgoing_context_html = g_strdup(get_incoming_context_html(priv, dir)); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
474 | } |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
475 | g_free(file); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
476 | |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
477 | return priv->outgoing_context_html; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
478 | } |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
479 | |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
480 | static const char * |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
481 | get_outgoing_next_context_html(PidginConvThemePrivate *priv, const char *dir) |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
482 | { |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
483 | char *file; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
484 | |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
485 | if (priv->outgoing_next_context_html) |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
486 | return priv->outgoing_next_context_html; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
487 | |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
488 | file = g_build_filename(dir, "Contents", "Resources", "Outgoing", "NextContext.html", NULL); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
489 | if (!g_file_get_contents(file, &priv->outgoing_next_context_html, NULL, NULL)) { |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
490 | priv->outgoing_next_context_html = g_strdup(get_outgoing_context_html(priv, dir)); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
491 | } |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
492 | |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
493 | return priv->outgoing_next_context_html; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
494 | } |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
495 | |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
496 | static char * |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
497 | replace_header_tokens(const char *text, PurpleConversation *conv) |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
498 | { |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
499 | GString *str = g_string_new(NULL); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
500 | const char *cur = text; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
501 | const char *prev = cur; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
502 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
503 | if (text == NULL) |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
504 | return NULL; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
505 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
506 | while ((cur = strchr(cur, '%'))) { |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
507 | const char *replace = NULL; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
508 | char *fin = NULL; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
509 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
510 | if (!strncmp(cur, "%chatName%", strlen("%chatName%"))) { |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
511 | replace = conv->name; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
512 | } else if (!strncmp(cur, "%sourceName%", strlen("%sourceName%"))) { |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
513 | replace = purple_account_get_alias(conv->account); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
514 | if (replace == NULL) |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
515 | replace = purple_account_get_username(conv->account); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
516 | } else if (!strncmp(cur, "%destinationName%", strlen("%destinationName%"))) { |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
517 | PurpleBuddy *buddy = purple_find_buddy(conv->account, conv->name); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
518 | if (buddy) { |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
519 | replace = purple_buddy_get_alias(buddy); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
520 | } else { |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
521 | replace = conv->name; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
522 | } |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
523 | } else if (!strncmp(cur, "%incomingIconPath%", strlen("%incomingIconPath%"))) { |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
524 | PurpleBuddyIcon *icon = purple_conv_im_get_icon(PURPLE_CONV_IM(conv)); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
525 | replace = purple_buddy_icon_get_full_path(icon); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
526 | } else if (!strncmp(cur, "%outgoingIconPath%", strlen("%outgoingIconPath%"))) { |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
527 | } else if (!strncmp(cur, "%timeOpened", strlen("%timeOpened"))) { |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
528 | char *format = NULL; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
529 | if (*(cur + strlen("%timeOpened")) == '{') { |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
530 | const char *start = cur + strlen("%timeOpened") + 1; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
531 | char *end = strstr(start, "}%"); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
532 | if (!end) /* Invalid string */ |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
533 | continue; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
534 | format = g_strndup(start, end - start); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
535 | fin = end + 1; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
536 | } |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
537 | replace = purple_utf8_strftime(format ? format : "%X", NULL); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
538 | g_free(format); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
539 | } else { |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
540 | continue; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
541 | } |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
542 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
543 | /* Here we have a replacement to make */ |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
544 | g_string_append_len(str, prev, cur - prev); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
545 | g_string_append(str, replace); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
546 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
547 | /* And update the pointers */ |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
548 | if (fin) { |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
549 | prev = cur = fin + 1; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
550 | } else { |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
551 | prev = cur = strchr(cur + 1, '%') + 1; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
552 | } |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
553 | } |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
554 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
555 | /* And wrap it up */ |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
556 | g_string_append(str, prev); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
557 | return g_string_free(str, FALSE); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
558 | } |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
559 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
560 | static char * |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
561 | replace_template_tokens(PidginConvTheme *theme, const char *text, const char *header, const char *footer) |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
562 | { |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
563 | PidginConvThemePrivate *priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
564 | GString *str = g_string_new(NULL); |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
565 | const char *themedir; |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
566 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
567 | char **ms = g_strsplit(text, "%@", 6); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
568 | char *base = NULL; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
569 | char *csspath = pidgin_conversation_theme_get_css(theme); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
570 | if (ms[0] == NULL || ms[1] == NULL || ms[2] == NULL || ms[3] == NULL || ms[4] == NULL || ms[5] == NULL) { |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
571 | g_strfreev(ms); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
572 | g_string_free(str, TRUE); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
573 | return NULL; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
574 | } |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
575 | |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
576 | themedir = purple_theme_get_dir(PURPLE_THEME(theme)); |
|
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
577 | |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
578 | g_string_append(str, ms[0]); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
579 | g_string_append(str, "file://"); |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
580 | base = g_build_filename(themedir, "Contents", "Resources", "Template.html", NULL); |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
581 | g_string_append(str, base); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
582 | g_free(base); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
583 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
584 | g_string_append(str, ms[1]); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
585 | |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
586 | g_string_append(str, get_basestyle_css(priv, themedir)); |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
587 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
588 | g_string_append(str, ms[2]); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
589 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
590 | g_string_append(str, "file://"); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
591 | g_string_append(str, csspath); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
592 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
593 | g_string_append(str, ms[3]); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
594 | if (header) |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
595 | g_string_append(str, header); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
596 | g_string_append(str, ms[4]); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
597 | if (footer) |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
598 | g_string_append(str, footer); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
599 | g_string_append(str, ms[5]); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
600 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
601 | g_strfreev(ms); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
602 | g_free(csspath); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
603 | return g_string_free(str, FALSE); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
604 | } |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
605 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
606 | static void |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
607 | set_theme_webkit_settings(WebKitWebView *webview, PidginConvTheme *theme) |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
608 | { |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
609 | PidginConvThemePrivate *priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
610 | WebKitWebSettings *settings; |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
611 | const GValue *val; |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
612 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
613 | g_object_get(G_OBJECT(webview), "settings", &settings, NULL); |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
614 | |
|
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
615 | val = get_key(priv, "DefaultFontFamily", TRUE); |
|
32566
05644bb1aec2
Be a bit stricter about types in Info.plist.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32564
diff
changeset
|
616 | if (val && G_VALUE_HOLDS_STRING(val)) |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
617 | g_object_set(G_OBJECT(settings), "default-font-family", g_value_get_string(val), NULL); |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
618 | |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
619 | val = get_key(priv, "DefaultFontSize", TRUE); |
|
32566
05644bb1aec2
Be a bit stricter about types in Info.plist.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32564
diff
changeset
|
620 | if (val && G_VALUE_HOLDS_INT(val)) |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
621 | g_object_set(G_OBJECT(settings), "default-font-size", GINT_TO_POINTER(g_value_get_int(val)), NULL); |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
622 | |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
623 | val = get_key(priv, "DefaultBackgroundIsTransparent", TRUE); |
|
32566
05644bb1aec2
Be a bit stricter about types in Info.plist.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32564
diff
changeset
|
624 | if (val && G_VALUE_HOLDS_BOOLEAN(val)) |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
625 | /* this does not work :( */ |
|
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
626 | webkit_web_view_set_transparent(webview, g_value_get_boolean(val)); |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
627 | } |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
628 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
629 | /* |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
630 | * The style specification says that if the conversation is a group |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
631 | * chat then the <div id="Chat"> element will be given a class |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
632 | * 'groupchat'. I can't add another '%@' in Template.html because |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
633 | * that breaks style-specific Template.html's. I have to either use libxml |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
634 | * or conveniently play with WebKit's javascript engine. The javascript |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
635 | * engine should work, but it's not an identical behavior. |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
636 | */ |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
637 | static void |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
638 | webkit_set_groupchat(GtkWebView *webview) |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
639 | { |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
640 | gtk_webview_safe_execute_script(webview, "document.getElementById('Chat').className = 'groupchat'"); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
641 | } |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
642 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
643 | static void |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
644 | webkit_on_webview_destroy(GtkObject *object, gpointer data) |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
645 | { |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
646 | g_object_unref(G_OBJECT(data)); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
647 | g_object_set_data(G_OBJECT(object), MESSAGE_STYLE_KEY, NULL); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
648 | } |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
649 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
650 | /***************************************************************************** |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
651 | * Public API functions |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
652 | *****************************************************************************/ |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
653 | |
|
32545
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
654 | const GHashTable * |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
655 | pidgin_conversation_theme_get_info(const PidginConvTheme *theme) |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
656 | { |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
657 | PidginConvThemePrivate *priv; |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
658 | priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
659 | return priv->info; |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
660 | } |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
661 | |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
662 | void |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
663 | pidgin_conversation_theme_set_info(PidginConvTheme *theme, GHashTable *info) |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
664 | { |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
665 | PidginConvThemePrivate *priv; |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
666 | priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
667 | |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
668 | if (priv->info) |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
669 | g_hash_table_destroy(priv->info); |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
670 | |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
671 | priv->info = info; |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
672 | } |
|
1b21192ab58a
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32544
diff
changeset
|
673 | |
|
32573
83bf257530d0
Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32571
diff
changeset
|
674 | const GValue * |
|
83bf257530d0
Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32571
diff
changeset
|
675 | pidgin_conversation_theme_lookup(PidginConvTheme *theme, const char *key, gboolean specific) |
|
83bf257530d0
Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32571
diff
changeset
|
676 | { |
|
83bf257530d0
Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32571
diff
changeset
|
677 | PidginConvThemePrivate *priv; |
|
83bf257530d0
Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32571
diff
changeset
|
678 | priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); |
|
83bf257530d0
Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32571
diff
changeset
|
679 | |
|
83bf257530d0
Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32571
diff
changeset
|
680 | return get_key(priv, key, specific); |
|
83bf257530d0
Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32571
diff
changeset
|
681 | } |
|
83bf257530d0
Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32571
diff
changeset
|
682 | |
|
32571
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
683 | const char * |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
684 | pidgin_conversation_theme_get_template(PidginConvTheme *theme, PidginConvThemeTemplateType type) |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
685 | { |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
686 | PidginConvThemePrivate *priv; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
687 | const char *dir; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
688 | const char *html; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
689 | |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
690 | priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
691 | dir = purple_theme_get_dir(PURPLE_THEME(theme)); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
692 | |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
693 | switch (type) { |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
694 | case PIDGIN_CONVERSATION_THEME_TEMPLATE_MAIN: |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
695 | html = get_template_html(priv, dir); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
696 | break; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
697 | case PIDGIN_CONVERSATION_THEME_TEMPLATE_HEADER: |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
698 | html = get_header_html(priv, dir); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
699 | break; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
700 | case PIDGIN_CONVERSATION_THEME_TEMPLATE_FOOTER: |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
701 | html = get_footer_html(priv, dir); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
702 | break; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
703 | case PIDGIN_CONVERSATION_THEME_TEMPLATE_TOPIC: |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
704 | html = get_topic_html(priv, dir); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
705 | break; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
706 | case PIDGIN_CONVERSATION_THEME_TEMPLATE_STATUS: |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
707 | html = get_status_html(priv, dir); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
708 | break; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
709 | case PIDGIN_CONVERSATION_THEME_TEMPLATE_CONTENT: |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
710 | html = get_content_html(priv, dir); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
711 | break; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
712 | case PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_CONTENT: |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
713 | html = get_incoming_content_html(priv, dir); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
714 | break; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
715 | case PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_NEXT_CONTENT: |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
716 | html = get_incoming_next_content_html(priv, dir); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
717 | break; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
718 | case PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_CONTEXT: |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
719 | html = get_incoming_context_html(priv, dir); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
720 | break; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
721 | case PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_NEXT_CONTEXT: |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
722 | html = get_incoming_next_context_html(priv, dir); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
723 | break; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
724 | case PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_CONTENT: |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
725 | html = get_outgoing_content_html(priv, dir); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
726 | break; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
727 | case PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_NEXT_CONTENT: |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
728 | html = get_outgoing_next_content_html(priv, dir); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
729 | break; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
730 | case PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_CONTEXT: |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
731 | html = get_outgoing_context_html(priv, dir); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
732 | break; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
733 | case PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_NEXT_CONTEXT: |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
734 | html = get_outgoing_next_context_html(priv, dir); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
735 | break; |
|
32574
56dc04a81f4b
Add template lookup for 'basestyle' CSS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32573
diff
changeset
|
736 | case PIDGIN_CONVERSATION_THEME_TEMPLATE_BASESTYLE_CSS: |
|
56dc04a81f4b
Add template lookup for 'basestyle' CSS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32573
diff
changeset
|
737 | html = get_basestyle_css(priv, dir); |
|
56dc04a81f4b
Add template lookup for 'basestyle' CSS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32573
diff
changeset
|
738 | break; |
|
32571
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
739 | default: |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
740 | purple_debug_error("gtkconv-theme", |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
741 | "Requested invalid template type (%d) for theme %s.\n", |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
742 | type, purple_theme_get_name(PURPLE_THEME(theme))); |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
743 | html = NULL; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
744 | } |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
745 | |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
746 | return html; |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
747 | } |
|
04b564092222
Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32566
diff
changeset
|
748 | |
|
32540
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
749 | void |
|
32564
b711e92242da
Fix a leak. pidgin_conversation_theme_add_variant should only be
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32563
diff
changeset
|
750 | pidgin_conversation_theme_add_variant(PidginConvTheme *theme, char *variant) |
|
32562
9c094ffe9333
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32561
diff
changeset
|
751 | { |
|
9c094ffe9333
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32561
diff
changeset
|
752 | PidginConvThemePrivate *priv; |
|
9c094ffe9333
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32561
diff
changeset
|
753 | priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); |
|
9c094ffe9333
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32561
diff
changeset
|
754 | |
|
32564
b711e92242da
Fix a leak. pidgin_conversation_theme_add_variant should only be
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32563
diff
changeset
|
755 | priv->variants = g_list_prepend(priv->variants, variant); |
|
32562
9c094ffe9333
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32561
diff
changeset
|
756 | } |
|
9c094ffe9333
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32561
diff
changeset
|
757 | |
|
9c094ffe9333
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32561
diff
changeset
|
758 | const char * |
|
9c094ffe9333
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32561
diff
changeset
|
759 | pidgin_conversation_theme_get_variant(PidginConvTheme *theme) |
|
9c094ffe9333
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32561
diff
changeset
|
760 | { |
|
9c094ffe9333
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32561
diff
changeset
|
761 | PidginConvThemePrivate *priv; |
|
9c094ffe9333
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32561
diff
changeset
|
762 | priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); |
|
9c094ffe9333
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32561
diff
changeset
|
763 | |
|
9c094ffe9333
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32561
diff
changeset
|
764 | return g_strdup(priv->variant); |
|
9c094ffe9333
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32561
diff
changeset
|
765 | } |
|
9c094ffe9333
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32561
diff
changeset
|
766 | |
|
9c094ffe9333
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32561
diff
changeset
|
767 | void |
|
9c094ffe9333
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32561
diff
changeset
|
768 | pidgin_conversation_theme_set_variant(PidginConvTheme *theme, const char *variant) |
|
32540
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
769 | { |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
770 | PidginConvThemePrivate *priv; |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
771 | const GValue *val; |
|
32540
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
772 | char *prefname; |
|
32562
9c094ffe9333
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32561
diff
changeset
|
773 | priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); |
|
32540
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
774 | |
|
32562
9c094ffe9333
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32561
diff
changeset
|
775 | g_free(priv->variant); |
|
9c094ffe9333
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32561
diff
changeset
|
776 | priv->variant = g_strdup(variant); |
|
32540
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
777 | |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
778 | val = get_key(priv, "CFBundleIdentifier", FALSE); |
|
32563
27024ee86815
Use a consistent prefs name. It should be conversation*s* to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32562
diff
changeset
|
779 | prefname = g_strdup_printf(PIDGIN_PREFS_ROOT "/conversations/themes/%s/variant", |
|
32562
9c094ffe9333
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32561
diff
changeset
|
780 | g_value_get_string(val)); |
|
9c094ffe9333
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32561
diff
changeset
|
781 | purple_prefs_set_string(prefname, variant); |
|
32540
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
782 | g_free(prefname); |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
783 | } |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
784 | |
|
32562
9c094ffe9333
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32561
diff
changeset
|
785 | const GList * |
|
9c094ffe9333
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32561
diff
changeset
|
786 | pidgin_conversation_theme_get_variants(PidginConvTheme *theme) |
|
32540
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
787 | { |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
788 | PidginConvThemePrivate *priv; |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
789 | priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
790 | |
|
32562
9c094ffe9333
Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32561
diff
changeset
|
791 | return priv->variants; |
|
32540
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
792 | } |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
793 | |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
794 | PidginConvTheme * |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
795 | pidgin_conversation_theme_copy(const PidginConvTheme *theme) |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
796 | { |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
797 | PidginConvTheme *ret; |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
798 | PidginConvThemePrivate *old, *new; |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
799 | |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
800 | old = PIDGIN_CONV_THEME_GET_PRIVATE(theme); |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
801 | ret = g_object_new(PIDGIN_TYPE_CONV_THEME, "directory", purple_theme_get_dir(PURPLE_THEME(theme)), NULL); |
|
32540
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
802 | new = PIDGIN_CONV_THEME_GET_PRIVATE(ret); |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
803 | |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
804 | new->variant = g_strdup(old->variant); |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
805 | |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
806 | new->template_html = g_strdup(old->template_html); |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
807 | new->header_html = g_strdup(old->header_html); |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
808 | new->footer_html = g_strdup(old->footer_html); |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
809 | new->incoming_content_html = g_strdup(old->incoming_content_html); |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
810 | new->outgoing_content_html = g_strdup(old->outgoing_content_html); |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
811 | new->incoming_next_content_html = g_strdup(old->incoming_next_content_html); |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
812 | new->outgoing_next_content_html = g_strdup(old->outgoing_next_content_html); |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
813 | new->status_html = g_strdup(old->status_html); |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
814 | new->basestyle_css = g_strdup(old->basestyle_css); |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
815 | |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
816 | return ret; |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
817 | } |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
818 | |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
819 | char * |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
820 | pidgin_conversation_theme_get_css(PidginConvTheme *theme) |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
821 | { |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
822 | PidginConvThemePrivate *priv; |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
823 | const char *dir; |
|
32540
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
824 | |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
825 | priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
826 | |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
827 | dir = purple_theme_get_dir(PURPLE_THEME(theme)); |
|
32540
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
828 | if (!priv->variant) { |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
829 | return g_build_filename(dir, "Contents", "Resources", "main.css", NULL); |
|
32540
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
830 | } else { |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
831 | char *file = g_strdup_printf("%s.css", priv->variant); |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
832 | char *ret = g_build_filename(dir, "Contents", "Resources", "Variants", file, NULL); |
|
32540
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
833 | g_free(file); |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
834 | return ret; |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
835 | } |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
836 | } |
|
1e50f90abb9b
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32539
diff
changeset
|
837 | |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
838 | /** |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
839 | * Called when either a new PurpleConversation is created |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
840 | * or when a PidginConversation changes its active PurpleConversation |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
841 | * This will not change the theme if the theme is already set. |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
842 | * (This is to prevent accidental theme changes if a new |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
843 | * PurpleConversation gets added. |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
844 | * |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
845 | * FIXME: it's not at all clear to me as to how |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
846 | * Adium themes handle the case when the PurpleConversation |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
847 | * changes. |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
848 | */ |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
849 | void |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
850 | pidgin_conversation_theme_apply(PidginConvTheme *theme, PurpleConversation *conv) |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
851 | { |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
852 | GtkWidget *webkit = PIDGIN_CONVERSATION(conv)->webview; |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
853 | const char *themedir; |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
854 | char *header, *footer; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
855 | char *template; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
856 | char *basedir; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
857 | char *baseuri; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
858 | PidginConvTheme *oldTheme; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
859 | PidginConvTheme *copy; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
860 | PidginConvThemePrivate *priv; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
861 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
862 | priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
863 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
864 | oldTheme = g_object_get_data(G_OBJECT(webkit), MESSAGE_STYLE_KEY); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
865 | if (oldTheme) |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
866 | return; |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
867 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
868 | g_assert(theme); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
869 | |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
870 | themedir = purple_theme_get_dir(PURPLE_THEME(theme)); |
|
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
871 | |
|
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
872 | header = replace_header_tokens(get_header_html(priv, themedir), conv); |
|
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
873 | footer = replace_header_tokens(get_footer_html(priv, themedir), conv); |
|
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
874 | template = replace_template_tokens(theme, get_template_html(priv, themedir), header, footer); |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
875 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
876 | g_assert(template); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
877 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
878 | purple_debug_info("webkit", "template: %s\n", template); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
879 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
880 | set_theme_webkit_settings(WEBKIT_WEB_VIEW(webkit), theme); |
|
32558
e9065eebef24
Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32549
diff
changeset
|
881 | basedir = g_build_filename(themedir, "Contents", "Resources", "Template.html", NULL); |
|
32544
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
882 | baseuri = g_strdup_printf("file://%s", basedir); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
883 | webkit_web_view_load_string(WEBKIT_WEB_VIEW(webkit), template, "text/html", "UTF-8", baseuri); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
884 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
885 | copy = pidgin_conversation_theme_copy(theme); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
886 | g_object_set_data(G_OBJECT(webkit), MESSAGE_STYLE_KEY, copy); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
887 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
888 | g_object_unref(G_OBJECT(theme)); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
889 | /* I need to unref this style when the webkit object destroys */ |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
890 | g_signal_connect(G_OBJECT(webkit), "destroy", G_CALLBACK(webkit_on_webview_destroy), copy); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
891 | |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
892 | if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
893 | webkit_set_groupchat(GTK_WEBVIEW(webkit)); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
894 | g_free(basedir); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
895 | g_free(baseuri); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
896 | g_free(header); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
897 | g_free(footer); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
898 | g_free(template); |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
899 | } |
|
4cf095ee82e3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32540
diff
changeset
|
900 |