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