Mercurial > pidgin.yaz
annotate pidgin/gtkconv-theme.c @ 32633:57304bbd826c
This shouldn't be here. I wonder why it compiled before.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sun, 18 Sep 2011 18:55:17 +0000 |
parents | 2ca29cd62db8 |
children | 7219f52cdfa3 |
rev | line source |
---|---|
32619
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1 /* |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
2 * Conversation Themes for Pidgin |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
3 * |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
4 * Pidgin is the legal property of its developers, whose names are too numerous |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
5 * to list here. Please refer to the COPYRIGHT file distributed with this |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
6 * source distribution. |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
7 * |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
8 * This program is free software; you can redistribute it and/or modify |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
11 * (at your option) any later version. |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
12 * |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
16 * GNU General Public License for more details. |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
17 * |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
19 * along with this program; if not, write to the Free Software |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
21 */ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
22 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
23 #include "gtkconv-theme.h" |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
24 |
32629
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
25 #include "conversation.h" |
32623
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
26 #include "debug.h" |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
27 #include "prefs.h" |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
28 #include "xmlnode.h" |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
29 |
32629
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
30 #include "pidgin.h" |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
31 #include "gtkconv.h" |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
32 #include "gtkwebview.h" |
32619
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
33 |
32623
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
34 #include <stdlib.h> |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
35 #include <string.h> |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
36 |
32629
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
37 /* GObject data keys - this will probably go away soon... */ |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
38 #define MESSAGE_STYLE_KEY "message-style" |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
39 |
32619
17c27a527004
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) \ |
17c27a527004
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)) |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
42 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
43 /****************************************************************************** |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
44 * Structs |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
45 *****************************************************************************/ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
46 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
47 typedef struct { |
32623
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
48 /* current config options */ |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
49 char *variant; /* allowed to be NULL if there are no variants */ |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
50 |
32630
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
51 /* Info.plist keys/values */ |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
52 GHashTable *info; |
32623
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
53 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
54 /* Static Info.plist keys */ |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
55 int message_view_version; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
56 char *cf_bundle_name; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
57 char *cf_bundle_identifier; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
58 char *cf_bundle_get_info_string; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
59 char *default_font_family; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
60 int default_font_size; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
61 gboolean shows_user_icons; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
62 gboolean disable_combine_consecutive; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
63 gboolean default_background_is_transparent; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
64 gboolean disable_custom_background; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
65 char *default_background_color; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
66 gboolean allow_text_colors; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
67 char *image_mask; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
68 char *default_variant; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
69 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
70 /* paths */ |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
71 char *style_dir; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
72 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
73 /* caches */ |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
74 char *template_html; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
75 char *header_html; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
76 char *footer_html; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
77 char *incoming_content_html; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
78 char *outgoing_content_html; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
79 char *incoming_next_content_html; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
80 char *outgoing_next_content_html; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
81 char *status_html; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
82 char *basestyle_css; |
32619
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
83 } PidginConvThemePrivate; |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
84 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
85 /****************************************************************************** |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
86 * Globals |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
87 *****************************************************************************/ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
88 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
89 static GObjectClass *parent_class = NULL; |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
90 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
91 /****************************************************************************** |
32630
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
92 * Enums |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
93 *****************************************************************************/ |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
94 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
95 enum { |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
96 PROP_ZERO = 0, |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
97 PROP_INFO, |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
98 }; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
99 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
100 /****************************************************************************** |
32619
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
101 * GObject Stuff |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
102 *****************************************************************************/ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
103 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
104 static void |
32630
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
105 pidgin_conv_theme_get_property(GObject *obj, guint param_id, GValue *value, |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
106 GParamSpec *psec) |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
107 { |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
108 PidginConvTheme *theme = PIDGIN_CONV_THEME(obj); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
109 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
110 switch (param_id) { |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
111 case PROP_INFO: |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
112 g_value_set_boxed(value, (gpointer)pidgin_conversation_theme_get_info(theme)); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
113 break; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
114 default: |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
115 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
116 break; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
117 } |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
118 } |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
119 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
120 static void |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
121 pidgin_conv_theme_set_property(GObject *obj, guint param_id, const GValue *value, |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
122 GParamSpec *psec) |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
123 { |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
124 PidginConvTheme *theme = PIDGIN_CONV_THEME(obj); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
125 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
126 switch (param_id) { |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
127 case PROP_INFO: |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
128 pidgin_conversation_theme_set_info(theme, g_value_get_boxed(value)); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
129 break; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
130 default: |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
131 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
132 break; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
133 } |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
134 } |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
135 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
136 static void |
32619
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
137 pidgin_conv_theme_init(GTypeInstance *instance, |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
138 gpointer klass) |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
139 { |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
140 PidginConvThemePrivate *priv; |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
141 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
142 priv = PIDGIN_CONV_THEME_GET_PRIVATE(instance); |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
143 } |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
144 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
145 static void |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
146 pidgin_conv_theme_finalize(GObject *obj) |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
147 { |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
148 PidginConvThemePrivate *priv; |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
149 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
150 priv = PIDGIN_CONV_THEME_GET_PRIVATE(obj); |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
151 |
32623
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
152 g_free(priv->cf_bundle_name); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
153 g_free(priv->cf_bundle_identifier); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
154 g_free(priv->cf_bundle_get_info_string); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
155 g_free(priv->default_font_family); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
156 g_free(priv->default_background_color); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
157 g_free(priv->image_mask); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
158 g_free(priv->default_variant); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
159 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
160 g_free(priv->style_dir); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
161 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
162 g_free(priv->template_html); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
163 g_free(priv->incoming_content_html); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
164 g_free(priv->outgoing_content_html); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
165 g_free(priv->outgoing_next_content_html); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
166 g_free(priv->status_html); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
167 g_free(priv->basestyle_css); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
168 |
32630
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
169 if (priv->info) |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
170 g_hash_table_destroy(priv->info); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
171 |
32619
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
172 parent_class->finalize(obj); |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
173 } |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
174 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
175 static void |
32622
218a52b8504d
Fix small typo and remove unnecessary include.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
176 pidgin_conv_theme_class_init(PidginConvThemeClass *klass) |
32619
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
177 { |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
178 GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
32630
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
179 GParamSpec *pspec; |
32619
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
180 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
181 parent_class = g_type_class_peek_parent(klass); |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
182 |
32630
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
183 g_type_class_add_private(klass, sizeof(PidginConvThemePrivate)); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
184 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
185 obj_class->get_property = pidgin_conv_theme_get_property; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
186 obj_class->set_property = pidgin_conv_theme_set_property; |
32619
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
187 obj_class->finalize = pidgin_conv_theme_finalize; |
32630
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
188 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
189 /* INFO */ |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
190 pspec = g_param_spec_boxed("info", "Info", |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
191 "The information about this theme", |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
192 G_TYPE_HASH_TABLE, |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
193 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
194 g_object_class_install_property(obj_class, PROP_INFO, pspec); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
195 |
32619
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
196 } |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
197 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
198 GType |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
199 pidgin_conversation_theme_get_type(void) |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
200 { |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
201 static GType type = 0; |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
202 if (type == 0) { |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
203 static const GTypeInfo info = { |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
204 sizeof(PidginConvThemeClass), |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
205 NULL, /* base_init */ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
206 NULL, /* base_finalize */ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
207 (GClassInitFunc)pidgin_conv_theme_class_init, /* class_init */ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
208 NULL, /* class_finalize */ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
209 NULL, /* class_data */ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
210 sizeof(PidginConvTheme), |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
211 0, /* n_preallocs */ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
212 pidgin_conv_theme_init, /* instance_init */ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
213 NULL, /* value table */ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
214 }; |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
215 type = g_type_register_static(PURPLE_TYPE_THEME, |
32630
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
216 "PidginConvTheme", &info, 0); |
32619
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
217 } |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
218 return type; |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
219 } |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
220 |
32629
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
221 /****************************************************************************** |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
222 * Helper Functions |
32619
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
223 *****************************************************************************/ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
224 |
32629
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
225 static const char * |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
226 get_template_html(PidginConvThemePrivate *priv) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
227 { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
228 char *file; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
229 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
230 if (priv->template_html) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
231 return priv->template_html; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
232 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
233 /* The template path can either come from the theme, or can |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
234 * be stock Template.html that comes with the plugin */ |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
235 file = g_build_filename(priv->style_dir, "Contents", "Resources", "Template.html", NULL); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
236 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
237 if (!g_file_test(file, G_FILE_TEST_EXISTS)) { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
238 g_free(file); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
239 file = g_build_filename(DATADIR, "pidgin", "webkit", "Template.html", NULL); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
240 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
241 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
242 if (!g_file_get_contents(file, &priv->template_html, NULL, NULL)) { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
243 purple_debug_error("webkit", "Could not locate a Template.html (%s)\n", file); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
244 priv->template_html = g_strdup(""); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
245 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
246 g_free(file); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
247 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
248 return priv->template_html; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
249 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
250 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
251 static const char * |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
252 get_status_html(PidginConvThemePrivate *priv) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
253 { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
254 char *file; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
255 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
256 if (priv->status_html) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
257 return priv->status_html; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
258 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
259 file = g_build_filename(priv->style_dir, "Contents", "Resources", "Status.html", NULL); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
260 if (!g_file_get_contents(file, &priv->status_html, NULL, NULL)) { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
261 purple_debug_info("webkit", "%s could not find Resources/Status.html", priv->style_dir); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
262 priv->status_html = g_strdup(""); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
263 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
264 g_free(file); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
265 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
266 return priv->status_html; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
267 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
268 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
269 static const char * |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
270 get_basestyle_css(PidginConvThemePrivate *priv) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
271 { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
272 char *file; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
273 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
274 if (priv->basestyle_css) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
275 return priv->basestyle_css; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
276 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
277 file = g_build_filename(priv->style_dir, "Contents", "Resources", "main.css", NULL); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
278 if (!g_file_get_contents(file, &priv->basestyle_css, NULL, NULL)) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
279 priv->basestyle_css = g_strdup(""); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
280 g_free(file); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
281 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
282 return priv->basestyle_css; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
283 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
284 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
285 static const char * |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
286 get_header_html(PidginConvThemePrivate *priv) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
287 { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
288 char *file; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
289 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
290 if (priv->header_html) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
291 return priv->header_html; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
292 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
293 file = g_build_filename(priv->style_dir, "Contents", "Resources", "Header.html", NULL); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
294 if (!g_file_get_contents(file, &priv->header_html, NULL, NULL)) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
295 priv->header_html = g_strdup(""); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
296 g_free(file); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
297 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
298 return priv->header_html; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
299 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
300 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
301 static const char * |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
302 get_footer_html(PidginConvThemePrivate *priv) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
303 { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
304 char *file; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
305 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
306 if (priv->footer_html) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
307 return priv->footer_html; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
308 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
309 file = g_build_filename(priv->style_dir, "Contents", "Resources", "Footer.html", NULL); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
310 if (!g_file_get_contents(file, &priv->footer_html, NULL, NULL)) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
311 priv->footer_html = g_strdup(""); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
312 g_free(file); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
313 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
314 return priv->footer_html; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
315 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
316 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
317 static const char * |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
318 get_incoming_content_html(PidginConvThemePrivate *priv) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
319 { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
320 char *file; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
321 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
322 if (priv->incoming_content_html) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
323 return priv->incoming_content_html; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
324 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
325 file = g_build_filename(priv->style_dir, "Contents", "Resources", "Incoming", "Content.html", NULL); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
326 if (!g_file_get_contents(file, &priv->incoming_content_html, NULL, NULL)) { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
327 purple_debug_info("webkit", "%s did not have a Incoming/Content.html\n", priv->style_dir); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
328 priv->incoming_content_html = g_strdup(""); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
329 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
330 g_free(file); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
331 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
332 return priv->incoming_content_html; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
333 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
334 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
335 static const char * |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
336 get_incoming_next_content_html(PidginConvThemePrivate *priv) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
337 { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
338 char *file; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
339 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
340 if (priv->incoming_next_content_html) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
341 return priv->incoming_next_content_html; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
342 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
343 file = g_build_filename(priv->style_dir, "Contents", "Resources", "Incoming", "NextContent.html", NULL); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
344 if (!g_file_get_contents(file, &priv->incoming_next_content_html, NULL, NULL)) { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
345 priv->incoming_next_content_html = g_strdup(priv->incoming_content_html); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
346 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
347 g_free(file); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
348 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
349 return priv->incoming_next_content_html; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
350 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
351 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
352 static const char * |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
353 get_outgoing_content_html(PidginConvThemePrivate *priv) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
354 { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
355 char *file; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
356 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
357 if (priv->outgoing_content_html) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
358 return priv->outgoing_content_html; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
359 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
360 file = g_build_filename(priv->style_dir, "Contents", "Resources", "Outgoing", "Content.html", NULL); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
361 if (!g_file_get_contents(file, &priv->outgoing_content_html, NULL, NULL)) { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
362 priv->outgoing_content_html = g_strdup(priv->incoming_content_html); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
363 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
364 g_free(file); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
365 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
366 return priv->outgoing_content_html; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
367 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
368 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
369 static const char * |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
370 get_outgoing_next_content_html(PidginConvThemePrivate *priv) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
371 { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
372 char *file; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
373 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
374 if (priv->outgoing_next_content_html) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
375 return priv->outgoing_next_content_html; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
376 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
377 file = g_build_filename(priv->style_dir, "Contents", "Resources", "Outgoing", "NextContent.html", NULL); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
378 if (!g_file_get_contents(file, &priv->outgoing_next_content_html, NULL, NULL)) { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
379 priv->outgoing_next_content_html = g_strdup(priv->outgoing_content_html); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
380 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
381 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
382 return priv->outgoing_next_content_html; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
383 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
384 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
385 static char * |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
386 replace_header_tokens(const char *text, PurpleConversation *conv) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
387 { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
388 GString *str = g_string_new(NULL); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
389 const char *cur = text; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
390 const char *prev = cur; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
391 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
392 if (text == NULL) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
393 return NULL; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
394 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
395 while ((cur = strchr(cur, '%'))) { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
396 const char *replace = NULL; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
397 char *fin = NULL; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
398 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
399 if (!strncmp(cur, "%chatName%", strlen("%chatName%"))) { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
400 replace = conv->name; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
401 } else if (!strncmp(cur, "%sourceName%", strlen("%sourceName%"))) { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
402 replace = purple_account_get_alias(conv->account); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
403 if (replace == NULL) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
404 replace = purple_account_get_username(conv->account); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
405 } else if (!strncmp(cur, "%destinationName%", strlen("%destinationName%"))) { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
406 PurpleBuddy *buddy = purple_find_buddy(conv->account, conv->name); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
407 if (buddy) { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
408 replace = purple_buddy_get_alias(buddy); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
409 } else { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
410 replace = conv->name; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
411 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
412 } else if (!strncmp(cur, "%incomingIconPath%", strlen("%incomingIconPath%"))) { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
413 PurpleBuddyIcon *icon = purple_conv_im_get_icon(PURPLE_CONV_IM(conv)); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
414 replace = purple_buddy_icon_get_full_path(icon); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
415 } else if (!strncmp(cur, "%outgoingIconPath%", strlen("%outgoingIconPath%"))) { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
416 } else if (!strncmp(cur, "%timeOpened", strlen("%timeOpened"))) { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
417 char *format = NULL; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
418 if (*(cur + strlen("%timeOpened")) == '{') { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
419 const char *start = cur + strlen("%timeOpened") + 1; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
420 char *end = strstr(start, "}%"); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
421 if (!end) /* Invalid string */ |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
422 continue; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
423 format = g_strndup(start, end - start); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
424 fin = end + 1; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
425 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
426 replace = purple_utf8_strftime(format ? format : "%X", NULL); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
427 g_free(format); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
428 } else { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
429 continue; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
430 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
431 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
432 /* Here we have a replacement to make */ |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
433 g_string_append_len(str, prev, cur - prev); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
434 g_string_append(str, replace); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
435 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
436 /* And update the pointers */ |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
437 if (fin) { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
438 prev = cur = fin + 1; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
439 } else { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
440 prev = cur = strchr(cur + 1, '%') + 1; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
441 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
442 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
443 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
444 /* And wrap it up */ |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
445 g_string_append(str, prev); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
446 return g_string_free(str, FALSE); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
447 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
448 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
449 static char * |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
450 replace_template_tokens(PidginConvTheme *theme, const char *text, const char *header, const char *footer) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
451 { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
452 PidginConvThemePrivate *priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
453 GString *str = g_string_new(NULL); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
454 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
455 char **ms = g_strsplit(text, "%@", 6); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
456 char *base = NULL; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
457 char *csspath = pidgin_conversation_theme_get_css(theme); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
458 if (ms[0] == NULL || ms[1] == NULL || ms[2] == NULL || ms[3] == NULL || ms[4] == NULL || ms[5] == NULL) { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
459 g_strfreev(ms); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
460 g_string_free(str, TRUE); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
461 return NULL; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
462 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
463 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
464 g_string_append(str, ms[0]); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
465 g_string_append(str, "file://"); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
466 base = g_build_filename(priv->style_dir, "Contents", "Resources", "Template.html", NULL); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
467 g_string_append(str, base); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
468 g_free(base); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
469 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
470 g_string_append(str, ms[1]); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
471 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
472 g_string_append(str, get_basestyle_css(priv)); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
473 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
474 g_string_append(str, ms[2]); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
475 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
476 g_string_append(str, "file://"); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
477 g_string_append(str, csspath); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
478 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
479 g_string_append(str, ms[3]); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
480 if (header) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
481 g_string_append(str, header); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
482 g_string_append(str, ms[4]); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
483 if (footer) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
484 g_string_append(str, footer); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
485 g_string_append(str, ms[5]); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
486 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
487 g_strfreev(ms); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
488 g_free(csspath); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
489 return g_string_free(str, FALSE); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
490 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
491 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
492 static void |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
493 set_theme_webkit_settings(WebKitWebView *webview, PidginConvTheme *theme) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
494 { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
495 PidginConvThemePrivate *priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
496 WebKitWebSettings *settings; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
497 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
498 g_object_get(G_OBJECT(webview), "settings", &settings, NULL); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
499 if (priv->default_font_family) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
500 g_object_set(G_OBJECT(settings), "default-font-family", priv->default_font_family, NULL); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
501 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
502 if (priv->default_font_size) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
503 g_object_set(G_OBJECT(settings), "default-font-size", GINT_TO_POINTER(priv->default_font_size), NULL); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
504 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
505 /* this does not work :( */ |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
506 webkit_web_view_set_transparent(webview, priv->default_background_is_transparent); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
507 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
508 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
509 /* |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
510 * The style specification says that if the conversation is a group |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
511 * chat then the <div id="Chat"> element will be given a class |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
512 * 'groupchat'. I can't add another '%@' in Template.html because |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
513 * that breaks style-specific Template.html's. I have to either use libxml |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
514 * or conveniently play with WebKit's javascript engine. The javascript |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
515 * engine should work, but it's not an identical behavior. |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
516 */ |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
517 static void |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
518 webkit_set_groupchat(GtkWebView *webview) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
519 { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
520 gtk_webview_safe_execute_script(webview, "document.getElementById('Chat').className = 'groupchat'"); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
521 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
522 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
523 static void |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
524 webkit_on_webview_destroy(GtkObject *object, gpointer data) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
525 { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
526 g_object_unref(G_OBJECT(data)); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
527 g_object_set_data(G_OBJECT(object), MESSAGE_STYLE_KEY, NULL); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
528 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
529 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
530 /***************************************************************************** |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
531 * Public API functions |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
532 *****************************************************************************/ |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
533 |
32630
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
534 const GHashTable * |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
535 pidgin_conversation_theme_get_info(const PidginConvTheme *theme) |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
536 { |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
537 PidginConvThemePrivate *priv; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
538 priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
539 return priv->info; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
540 } |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
541 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
542 void |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
543 pidgin_conversation_theme_set_info(PidginConvTheme *theme, GHashTable *info) |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
544 { |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
545 PidginConvThemePrivate *priv; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
546 priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
547 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
548 if (priv->info) |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
549 g_hash_table_destroy(priv->info); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
550 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
551 priv->info = info; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
552 } |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
553 |
32623
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
554 void |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
555 pidgin_conversation_theme_save_state(const PidginConvTheme *theme) |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
556 { |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
557 PidginConvThemePrivate *priv; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
558 char *prefname; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
559 char *variant; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
560 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
561 priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
562 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
563 prefname = g_strdup_printf("/plugins/gtk/adiumthemes/%s", priv->cf_bundle_identifier); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
564 variant = g_strdup_printf("%s/variant", prefname); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
565 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
566 purple_debug_info("webkit", "saving state with variant %s\n", priv->variant); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
567 purple_prefs_add_none(prefname); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
568 purple_prefs_add_string(variant, ""); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
569 purple_prefs_set_string(variant, priv->variant); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
570 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
571 g_free(prefname); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
572 g_free(variant); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
573 } |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
574 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
575 static void |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
576 pidgin_conversation_theme_load_state(PidginConvTheme *theme) |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
577 { |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
578 PidginConvThemePrivate *priv; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
579 char *prefname; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
580 char *variant; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
581 const char* value; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
582 gboolean changed; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
583 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
584 priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
585 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
586 prefname = g_strdup_printf("/plugins/gtk/adiumthemes/%s", priv->cf_bundle_identifier); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
587 variant = g_strdup_printf("%s/variant", prefname); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
588 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
589 value = purple_prefs_get_string(variant); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
590 changed = !priv->variant || !g_str_equal(priv->variant, value); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
591 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
592 g_free(priv->variant); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
593 priv->variant = g_strdup(value); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
594 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
595 g_free(prefname); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
596 g_free(variant); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
597 } |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
598 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
599 PidginConvTheme * |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
600 pidgin_conversation_theme_copy(const PidginConvTheme *theme) |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
601 { |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
602 PidginConvTheme *ret; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
603 PidginConvThemePrivate *old, *new; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
604 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
605 old = PIDGIN_CONV_THEME_GET_PRIVATE(theme); |
32630
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32629
diff
changeset
|
606 ret = g_object_new(PIDGIN_TYPE_CONV_THEME, "directory", old->style_dir, NULL); |
32623
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
607 new = PIDGIN_CONV_THEME_GET_PRIVATE(ret); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
608 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
609 new->variant = g_strdup(old->variant); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
610 new->message_view_version = old->message_view_version; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
611 new->cf_bundle_name = g_strdup(old->cf_bundle_name); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
612 new->cf_bundle_identifier = g_strdup(old->cf_bundle_identifier); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
613 new->cf_bundle_get_info_string = g_strdup(old->cf_bundle_get_info_string); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
614 new->default_font_family = g_strdup(old->default_font_family); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
615 new->default_font_size = old->default_font_size; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
616 new->shows_user_icons = old->shows_user_icons; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
617 new->disable_combine_consecutive = old->disable_combine_consecutive; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
618 new->default_background_is_transparent = old->default_background_is_transparent; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
619 new->disable_custom_background = old->disable_custom_background; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
620 new->default_background_color = g_strdup(old->default_background_color); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
621 new->allow_text_colors = old->allow_text_colors; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
622 new->image_mask = g_strdup(old->image_mask); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
623 new->default_variant = g_strdup(old->default_variant); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
624 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
625 new->template_html = g_strdup(old->template_html); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
626 new->header_html = g_strdup(old->header_html); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
627 new->footer_html = g_strdup(old->footer_html); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
628 new->incoming_content_html = g_strdup(old->incoming_content_html); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
629 new->outgoing_content_html = g_strdup(old->outgoing_content_html); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
630 new->incoming_next_content_html = g_strdup(old->incoming_next_content_html); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
631 new->outgoing_next_content_html = g_strdup(old->outgoing_next_content_html); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
632 new->status_html = g_strdup(old->status_html); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
633 new->basestyle_css = g_strdup(old->basestyle_css); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
634 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
635 return ret; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
636 } |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
637 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
638 void |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
639 pidgin_conversation_theme_set_variant(PidginConvTheme *theme, const char *variant) |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
640 { |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
641 PidginConvThemePrivate *priv; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
642 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
643 priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
644 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
645 /* I'm not going to test whether this variant is valid! */ |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
646 g_free(priv->variant); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
647 priv->variant = g_strdup(variant); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
648 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
649 /* todo, the style has "changed". Ideally, I would like to use signals at this point. */ |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
650 } |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
651 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
652 char * |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
653 pidgin_conversation_theme_get_variant(PidginConvTheme *theme) |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
654 { |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
655 PidginConvThemePrivate *priv; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
656 priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
657 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
658 return g_strdup(priv->variant); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
659 } |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
660 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
661 /** |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
662 * Get a list of variants supported by the style. |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
663 */ |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
664 GList * |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
665 pidgin_conversation_theme_get_variants(PidginConvTheme *theme) |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
666 { |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
667 PidginConvThemePrivate *priv; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
668 GList *ret = NULL; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
669 GDir *variants; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
670 const char *css_file; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
671 char *css; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
672 char *variant_dir; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
673 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
674 priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
675 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
676 g_assert(priv->style_dir); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
677 variant_dir = g_build_filename(priv->style_dir, "Contents", "Resources", "Variants", NULL); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
678 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
679 variants = g_dir_open(variant_dir, 0, NULL); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
680 if (!variants) |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
681 return NULL; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
682 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
683 while ((css_file = g_dir_read_name(variants)) != NULL) { |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
684 if (!g_str_has_suffix(css_file, ".css")) |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
685 continue; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
686 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
687 css = g_strndup(css_file, strlen(css_file) - 4); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
688 ret = g_list_append(ret, css); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
689 } |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
690 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
691 g_dir_close(variants); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
692 g_free(variant_dir); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
693 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
694 ret = g_list_sort(ret, (GCompareFunc)g_strcmp0); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
695 return ret; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
696 } |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
697 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
698 char * |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
699 pidgin_conversation_theme_get_css(PidginConvTheme *theme) |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
700 { |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
701 PidginConvThemePrivate *priv; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
702 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
703 priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
704 |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
705 if (!priv->variant) { |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
706 return g_build_filename(priv->style_dir, "Contents", "Resources", "main.css", NULL); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
707 } else { |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
708 char *file = g_strdup_printf("%s.css", priv->variant); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
709 char *ret = g_build_filename(priv->style_dir, "Contents", "Resources", "Variants", file, NULL); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
710 g_free(file); |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
711 return ret; |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
712 } |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
713 } |
2e8c905a5e74
Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32622
diff
changeset
|
714 |
32629
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
715 /** |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
716 * Called when either a new PurpleConversation is created |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
717 * or when a PidginConversation changes its active PurpleConversation |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
718 * This will not change the theme if the theme is already set. |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
719 * (This is to prevent accidental theme changes if a new |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
720 * PurpleConversation gets added. |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
721 * |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
722 * FIXME: it's not at all clear to me as to how |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
723 * Adium themes handle the case when the PurpleConversation |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
724 * changes. |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
725 */ |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
726 void |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
727 pidgin_conversation_theme_apply(PidginConvTheme *theme, PurpleConversation *conv) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
728 { |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
729 GtkWidget *webkit = PIDGIN_CONVERSATION(conv)->webview; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
730 char *header, *footer; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
731 char *template; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
732 char *basedir; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
733 char *baseuri; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
734 PidginConvTheme *oldTheme; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
735 PidginConvTheme *copy; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
736 PidginConvThemePrivate *priv; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
737 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
738 priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
739 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
740 oldTheme = g_object_get_data(G_OBJECT(webkit), MESSAGE_STYLE_KEY); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
741 if (oldTheme) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
742 return; |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
743 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
744 g_assert(theme); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
745 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
746 header = replace_header_tokens(get_header_html(priv), conv); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
747 footer = replace_header_tokens(get_footer_html(priv), conv); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
748 template = replace_template_tokens(theme, get_template_html(priv), header, footer); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
749 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
750 g_assert(template); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
751 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
752 purple_debug_info("webkit", "template: %s\n", template); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
753 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
754 set_theme_webkit_settings(WEBKIT_WEB_VIEW(webkit), theme); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
755 basedir = g_build_filename(priv->style_dir, "Contents", "Resources", "Template.html", NULL); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
756 baseuri = g_strdup_printf("file://%s", basedir); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
757 webkit_web_view_load_string(WEBKIT_WEB_VIEW(webkit), template, "text/html", "UTF-8", baseuri); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
758 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
759 copy = pidgin_conversation_theme_copy(theme); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
760 g_object_set_data(G_OBJECT(webkit), MESSAGE_STYLE_KEY, copy); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
761 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
762 g_object_unref(G_OBJECT(theme)); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
763 /* I need to unref this style when the webkit object destroys */ |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
764 g_signal_connect(G_OBJECT(webkit), "destroy", G_CALLBACK(webkit_on_webview_destroy), copy); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
765 |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
766 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
767 webkit_set_groupchat(GTK_WEBVIEW(webkit)); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
768 g_free(basedir); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
769 g_free(baseuri); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
770 g_free(header); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
771 g_free(footer); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
772 g_free(template); |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
773 } |
dc835fb3dcd3
Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32623
diff
changeset
|
774 |