Mercurial > pidgin
annotate pidgin/plugins/adiumthemes/webkit.c @ 32106:285db86fcf99
load the default variant. Bring back basestyle.css.
author | tdrhq@soc.pidgin.im |
---|---|
date | Fri, 14 Aug 2009 04:47:16 +0000 |
parents | 59f433824040 |
children | 5281f3b3ef4c |
rev | line source |
---|---|
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
1 /* |
32073
0bac73a6a536
Changed the Author added copyright, etc.
tdrhq@soc.pidgin.im
parents:
32072
diff
changeset
|
2 * Adium Message Styles |
0bac73a6a536
Changed the Author added copyright, etc.
tdrhq@soc.pidgin.im
parents:
32072
diff
changeset
|
3 * Copyright (C) 2009 Arnold Noronha <arnstein87@gmail.com> |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
4 * Copyright (C) 2007 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
5 * |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
6 * This program is free software; you can redistribute it and/or |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
7 * modify it under the terms of the GNU General Public License as |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
8 * published by the Free Software Foundation; either version 2 of the |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
9 * License, or (at your option) any later version. |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
10 * |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
11 * This program is distributed in the hope that it will be useful, but |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
12 * WITHOUT ANY WARRANTY; without even the implied warranty of |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
14 * General Public License for more details. |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
15 * |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
16 * You should have received a copy of the GNU General Public License |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
17 * along with this program; if not, write to the Free Software |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
19 * 02111-1307, USA. |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
20 */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
21 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
22 #define PLUGIN_ID "gtk-webview-adium-ims" |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
23 #define PLUGIN_NAME "webview-adium-ims" |
32073
0bac73a6a536
Changed the Author added copyright, etc.
tdrhq@soc.pidgin.im
parents:
32072
diff
changeset
|
24 |
0bac73a6a536
Changed the Author added copyright, etc.
tdrhq@soc.pidgin.im
parents:
32072
diff
changeset
|
25 /* |
0bac73a6a536
Changed the Author added copyright, etc.
tdrhq@soc.pidgin.im
parents:
32072
diff
changeset
|
26 * A lot of this was originally written by Sean Egan, but I think I've |
0bac73a6a536
Changed the Author added copyright, etc.
tdrhq@soc.pidgin.im
parents:
32072
diff
changeset
|
27 * rewrote enough to replace the author for now. |
0bac73a6a536
Changed the Author added copyright, etc.
tdrhq@soc.pidgin.im
parents:
32072
diff
changeset
|
28 */ |
0bac73a6a536
Changed the Author added copyright, etc.
tdrhq@soc.pidgin.im
parents:
32072
diff
changeset
|
29 #define PLUGIN_AUTHOR "Arnold Noronha <arnstein87@gmail.com>" |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
30 #define PURPLE_PLUGINS "Hell yeah" |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
31 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
32 /* System headers */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
33 #include <string.h> |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
34 #include <gdk/gdk.h> |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
35 #include <gtk/gtk.h> |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
36 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
37 #include <webkit/webkit.h> |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
38 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
39 /* Purple headers */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
40 #include <conversation.h> |
32086 | 41 #include <debug.h> |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
42 #include <notify.h> |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
43 #include <util.h> |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
44 #include <version.h> |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
45 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
46 /* Pidgin headers */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
47 #include <gtkconv.h> |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
48 #include <gtkplugin.h> |
32071
32d7d3c4163c
* removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents:
32070
diff
changeset
|
49 #include <gtkwebview.h> |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
50 #include <smileyparser.h> |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
51 |
32098 | 52 #include <libxml/xmlreader.h> |
32105
59f433824040
Separated the MessageStyle loading code from the actual rendering code.
tdrhq@soc.pidgin.im
parents:
32104
diff
changeset
|
53 |
59f433824040
Separated the MessageStyle loading code from the actual rendering code.
tdrhq@soc.pidgin.im
parents:
32104
diff
changeset
|
54 #include "message-style.h" |
32077
3b1a130f7e88
more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents:
32076
diff
changeset
|
55 /* GObject data keys */ |
3b1a130f7e88
more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents:
32076
diff
changeset
|
56 #define MESSAGE_STYLE_KEY "message-style" |
3b1a130f7e88
more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents:
32076
diff
changeset
|
57 |
32076
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
58 static char *cur_style_dir = NULL; |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
59 static void *handle = NULL; |
32074 | 60 |
32092 | 61 static inline char* get_absolute_path (const char *path) |
62 { | |
63 if (g_path_is_absolute (path)) return g_strdup (path); | |
64 else { | |
65 char* cwd = g_get_current_dir (), *ret; | |
66 ret = g_build_filename (cwd, path, NULL); | |
67 g_free (cwd); | |
68 return ret; | |
69 } | |
70 } | |
71 | |
32098 | 72 static void |
32105
59f433824040
Separated the MessageStyle loading code from the actual rendering code.
tdrhq@soc.pidgin.im
parents:
32104
diff
changeset
|
73 glist_free_all_string (GList *list) |
32074 | 74 { |
32105
59f433824040
Separated the MessageStyle loading code from the actual rendering code.
tdrhq@soc.pidgin.im
parents:
32104
diff
changeset
|
75 GList *first = list; |
59f433824040
Separated the MessageStyle loading code from the actual rendering code.
tdrhq@soc.pidgin.im
parents:
32104
diff
changeset
|
76 for (; list; list = g_list_next (list)) |
59f433824040
Separated the MessageStyle loading code from the actual rendering code.
tdrhq@soc.pidgin.im
parents:
32104
diff
changeset
|
77 g_free (list->data); |
59f433824040
Separated the MessageStyle loading code from the actual rendering code.
tdrhq@soc.pidgin.im
parents:
32104
diff
changeset
|
78 g_list_free (first); |
32100 | 79 } |
80 | |
32079
7b92a2b852db
Cleanly handle webkit destroy events.
tdrhq@soc.pidgin.im
parents:
32078
diff
changeset
|
81 static void webkit_on_webview_destroy (GtkObject* obj, gpointer data); |
32078
7194ddfc8158
woo, fixed the bug. Now things are looking wonderfully stable.
tdrhq@soc.pidgin.im
parents:
32077
diff
changeset
|
82 |
32068
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32064
diff
changeset
|
83 static void* webkit_plugin_get_handle () |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32064
diff
changeset
|
84 { |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32064
diff
changeset
|
85 if (handle) return handle; |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32064
diff
changeset
|
86 else return (handle = g_malloc (1)); |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32064
diff
changeset
|
87 } |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32064
diff
changeset
|
88 |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32064
diff
changeset
|
89 static void webkit_plugin_free_handle () |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32064
diff
changeset
|
90 { |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32064
diff
changeset
|
91 purple_signals_disconnect_by_handle (handle); |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32064
diff
changeset
|
92 g_free (handle); |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32064
diff
changeset
|
93 } |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32064
diff
changeset
|
94 |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
95 static char * |
32076
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
96 replace_message_tokens( |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
97 char *text, |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
98 gsize len, |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
99 PurpleConversation *conv, |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
100 const char *name, |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
101 const char *alias, |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
102 const char *message, |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
103 PurpleMessageFlags flags, |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
104 time_t mtime) |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
105 { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
106 GString *str = g_string_new_len(NULL, len); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
107 char *cur = text; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
108 char *prev = cur; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
109 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
110 while ((cur = strchr(cur, '%'))) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
111 const char *replace = NULL; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
112 char *fin = NULL; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
113 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
114 if (!strncmp(cur, "%message%", strlen("%message%"))) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
115 replace = message; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
116 } else if (!strncmp(cur, "%messageClasses%", strlen("%messageClasses%"))) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
117 replace = flags & PURPLE_MESSAGE_SEND ? "outgoing" : |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
118 flags & PURPLE_MESSAGE_RECV ? "incoming" : "event"; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
119 } else if (!strncmp(cur, "%time", strlen("%time"))) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
120 char *format = NULL; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
121 if (*(cur + strlen("%time")) == '{') { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
122 char *start = cur + strlen("%time") + 1; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
123 char *end = strstr(start, "}%"); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
124 if (!end) /* Invalid string */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
125 continue; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
126 format = g_strndup(start, end - start); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
127 fin = end + 1; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
128 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
129 replace = purple_utf8_strftime(format ? format : "%X", NULL); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
130 g_free(format); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
131 } else if (!strncmp(cur, "%userIconPath%", strlen("%userIconPath%"))) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
132 if (flags & PURPLE_MESSAGE_SEND) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
133 if (purple_account_get_bool(conv->account, "use-global-buddyicon", TRUE)) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
134 replace = purple_prefs_get_path(PIDGIN_PREFS_ROOT "/accounts/buddyicon"); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
135 } else { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
136 PurpleStoredImage *img = purple_buddy_icons_find_account_icon(conv->account); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
137 replace = purple_imgstore_get_filename(img); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
138 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
139 if (replace == NULL || !g_file_test(replace, G_FILE_TEST_EXISTS)) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
140 replace = g_build_filename("Outgoing", "buddy_icon.png", NULL); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
141 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
142 } else if (flags & PURPLE_MESSAGE_RECV) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
143 PurpleBuddyIcon *icon = purple_conv_im_get_icon(PURPLE_CONV_IM(conv)); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
144 replace = purple_buddy_icon_get_full_path(icon); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
145 if (replace == NULL || !g_file_test(replace, G_FILE_TEST_EXISTS)) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
146 replace = g_build_filename("Incoming", "buddy_icon.png", NULL); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
147 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
148 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
149 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
150 } else if (!strncmp(cur, "%senderScreenName%", strlen("%senderScreenName%"))) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
151 replace = name; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
152 } else if (!strncmp(cur, "%sender%", strlen("%sender%"))) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
153 replace = alias; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
154 } else if (!strncmp(cur, "%service%", strlen("%service%"))) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
155 replace = purple_account_get_protocol_name(conv->account); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
156 } else { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
157 cur++; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
158 continue; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
159 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
160 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
161 /* Here we have a replacement to make */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
162 g_string_append_len(str, prev, cur - prev); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
163 g_string_append(str, replace); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
164 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
165 /* And update the pointers */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
166 if (fin) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
167 prev = cur = fin + 1; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
168 } else { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
169 prev = cur = strchr(cur + 1, '%') + 1; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
170 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
171 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
172 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
173 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
174 /* And wrap it up */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
175 g_string_append(str, prev); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
176 return g_string_free(str, FALSE); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
177 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
178 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
179 static char * |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
180 replace_header_tokens(char *text, gsize len, PurpleConversation *conv) |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
181 { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
182 GString *str = g_string_new_len(NULL, len); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
183 char *cur = text; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
184 char *prev = cur; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
185 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
186 if (text == NULL) |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
187 return NULL; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
188 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
189 while ((cur = strchr(cur, '%'))) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
190 const char *replace = NULL; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
191 char *fin = NULL; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
192 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
193 if (!strncmp(cur, "%chatName%", strlen("%chatName%"))) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
194 replace = conv->name; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
195 } else if (!strncmp(cur, "%sourceName%", strlen("%sourceName%"))) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
196 replace = purple_account_get_alias(conv->account); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
197 if (replace == NULL) |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
198 replace = purple_account_get_username(conv->account); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
199 } else if (!strncmp(cur, "%destinationName%", strlen("%destinationName%"))) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
200 PurpleBuddy *buddy = purple_find_buddy(conv->account, conv->name); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
201 if (buddy) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
202 replace = purple_buddy_get_alias(buddy); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
203 } else { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
204 replace = conv->name; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
205 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
206 } else if (!strncmp(cur, "%incomingIconPath%", strlen("%incomingIconPath%"))) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
207 PurpleBuddyIcon *icon = purple_conv_im_get_icon(PURPLE_CONV_IM(conv)); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
208 replace = purple_buddy_icon_get_full_path(icon); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
209 } else if (!strncmp(cur, "%outgoingIconPath%", strlen("%outgoingIconPath%"))) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
210 } else if (!strncmp(cur, "%timeOpened", strlen("%timeOpened"))) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
211 char *format = NULL; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
212 if (*(cur + strlen("%timeOpened")) == '{') { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
213 char *start = cur + strlen("%timeOpened") + 1; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
214 char *end = strstr(start, "}%"); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
215 if (!end) /* Invalid string */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
216 continue; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
217 format = g_strndup(start, end - start); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
218 fin = end + 1; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
219 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
220 replace = purple_utf8_strftime(format ? format : "%X", NULL); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
221 g_free(format); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
222 } else { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
223 continue; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
224 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
225 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
226 /* Here we have a replacement to make */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
227 g_string_append_len(str, prev, cur - prev); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
228 g_string_append(str, replace); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
229 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
230 /* And update the pointers */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
231 if (fin) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
232 prev = cur = fin + 1; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
233 } else { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
234 prev = cur = strchr(cur + 1, '%') + 1; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
235 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
236 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
237 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
238 /* And wrap it up */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
239 g_string_append(str, prev); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
240 return g_string_free(str, FALSE); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
241 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
242 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
243 static char * |
32076
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
244 replace_template_tokens(PidginMessageStyle *style, char *text, int len, char *header, char *footer) { |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
245 GString *str = g_string_new_len(NULL, len); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
246 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
247 char **ms = g_strsplit(text, "%@", 6); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
248 char *base = NULL; |
32100 | 249 char *csspath = pidgin_message_style_get_css (style); |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
250 if (ms[0] == NULL || ms[1] == NULL || ms[2] == NULL || ms[3] == NULL || ms[4] == NULL || ms[5] == NULL) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
251 g_strfreev(ms); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
252 g_string_free(str, TRUE); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
253 return NULL; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
254 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
255 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
256 g_string_append(str, ms[0]); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
257 g_string_append(str, "file://"); |
32076
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
258 base = g_build_filename (style->style_dir, "Contents", "Resources", "Template.html", NULL); |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
259 g_string_append(str, base); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
260 g_free (base); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
261 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
262 g_string_append(str, ms[1]); |
32100 | 263 |
32106
285db86fcf99
load the default variant. Bring back basestyle.css.
tdrhq@soc.pidgin.im
parents:
32105
diff
changeset
|
264 g_string_append(str, style->basestyle_css); |
32100 | 265 |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
266 g_string_append(str, ms[2]); |
32100 | 267 |
268 g_string_append(str, "file://"); | |
269 g_string_append(str, csspath); | |
270 | |
271 | |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
272 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
273 g_string_append(str, ms[3]); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
274 if (header) |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
275 g_string_append(str, header); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
276 g_string_append(str, ms[4]); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
277 if (footer) |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
278 g_string_append(str, footer); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
279 g_string_append(str, ms[5]); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
280 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
281 g_strfreev(ms); |
32100 | 282 g_free (csspath); |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
283 return g_string_free (str, FALSE); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
284 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
285 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
286 static GtkWidget * |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
287 get_webkit(PurpleConversation *conv) |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
288 { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
289 PidginConversation *gtkconv; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
290 gtkconv = PIDGIN_CONVERSATION(conv); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
291 if (!gtkconv) |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
292 return NULL; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
293 else |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
294 return gtkconv->webview; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
295 } |
32070 | 296 |
32104
53735be6950a
apparent code for webkit transparency that might not be working.
tdrhq@soc.pidgin.im
parents:
32102
diff
changeset
|
297 static void set_theme_webkit_settings (WebKitWebView *webview, PidginMessageStyle *style) |
32102
c0cc4d60ac5c
hmm, fonts and font sizes from Info.plist.
tdrhq@soc.pidgin.im
parents:
32101
diff
changeset
|
298 { |
c0cc4d60ac5c
hmm, fonts and font sizes from Info.plist.
tdrhq@soc.pidgin.im
parents:
32101
diff
changeset
|
299 WebKitWebSettings *settings; |
c0cc4d60ac5c
hmm, fonts and font sizes from Info.plist.
tdrhq@soc.pidgin.im
parents:
32101
diff
changeset
|
300 |
c0cc4d60ac5c
hmm, fonts and font sizes from Info.plist.
tdrhq@soc.pidgin.im
parents:
32101
diff
changeset
|
301 g_object_get (G_OBJECT(webview), "settings", &settings, NULL); |
c0cc4d60ac5c
hmm, fonts and font sizes from Info.plist.
tdrhq@soc.pidgin.im
parents:
32101
diff
changeset
|
302 if (style->default_font_family) |
c0cc4d60ac5c
hmm, fonts and font sizes from Info.plist.
tdrhq@soc.pidgin.im
parents:
32101
diff
changeset
|
303 g_object_set (G_OBJECT (settings), "default-font-family", style->default_font_family, NULL); |
c0cc4d60ac5c
hmm, fonts and font sizes from Info.plist.
tdrhq@soc.pidgin.im
parents:
32101
diff
changeset
|
304 |
c0cc4d60ac5c
hmm, fonts and font sizes from Info.plist.
tdrhq@soc.pidgin.im
parents:
32101
diff
changeset
|
305 if (style->default_font_size) |
c0cc4d60ac5c
hmm, fonts and font sizes from Info.plist.
tdrhq@soc.pidgin.im
parents:
32101
diff
changeset
|
306 g_object_set (G_OBJECT (settings), "default-font-size", GINT_TO_POINTER (style->default_font_size), NULL); |
32104
53735be6950a
apparent code for webkit transparency that might not be working.
tdrhq@soc.pidgin.im
parents:
32102
diff
changeset
|
307 |
53735be6950a
apparent code for webkit transparency that might not be working.
tdrhq@soc.pidgin.im
parents:
32102
diff
changeset
|
308 /* this does not work :( */ |
53735be6950a
apparent code for webkit transparency that might not be working.
tdrhq@soc.pidgin.im
parents:
32102
diff
changeset
|
309 webkit_web_view_set_transparent (webview, style->default_background_is_transparent); |
32102
c0cc4d60ac5c
hmm, fonts and font sizes from Info.plist.
tdrhq@soc.pidgin.im
parents:
32101
diff
changeset
|
310 } |
c0cc4d60ac5c
hmm, fonts and font sizes from Info.plist.
tdrhq@soc.pidgin.im
parents:
32101
diff
changeset
|
311 |
c0cc4d60ac5c
hmm, fonts and font sizes from Info.plist.
tdrhq@soc.pidgin.im
parents:
32101
diff
changeset
|
312 |
32070 | 313 /** |
314 * Called when either a new PurpleConversation is created | |
315 * or when a PidginConversation changes its active PurpleConversation | |
32078
7194ddfc8158
woo, fixed the bug. Now things are looking wonderfully stable.
tdrhq@soc.pidgin.im
parents:
32077
diff
changeset
|
316 * This will not change the theme if the theme is already set. |
7194ddfc8158
woo, fixed the bug. Now things are looking wonderfully stable.
tdrhq@soc.pidgin.im
parents:
32077
diff
changeset
|
317 * (This is to prevent accidental theme changes if a new |
7194ddfc8158
woo, fixed the bug. Now things are looking wonderfully stable.
tdrhq@soc.pidgin.im
parents:
32077
diff
changeset
|
318 * PurpleConversation gets added. |
32070 | 319 * |
320 * FIXME: it's not at all clear to me as to how | |
321 * Adium themes handle the case when the PurpleConversation | |
322 * changes. | |
323 */ | |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
324 static void |
32076
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
325 init_theme_for_webkit (PurpleConversation *conv, char *style_dir) |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
326 { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
327 GtkWidget *webkit = PIDGIN_CONVERSATION(conv)->webview; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
328 char *header, *footer; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
329 char *template; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
330 |
32076
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
331 char* basedir; |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
332 char* baseuri; |
32077
3b1a130f7e88
more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents:
32076
diff
changeset
|
333 PidginMessageStyle *style, *oldStyle; |
3b1a130f7e88
more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents:
32076
diff
changeset
|
334 oldStyle = g_object_get_data (G_OBJECT(webkit), MESSAGE_STYLE_KEY); |
32078
7194ddfc8158
woo, fixed the bug. Now things are looking wonderfully stable.
tdrhq@soc.pidgin.im
parents:
32077
diff
changeset
|
335 |
32077
3b1a130f7e88
more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents:
32076
diff
changeset
|
336 if (oldStyle) return; |
3b1a130f7e88
more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents:
32076
diff
changeset
|
337 |
32090 | 338 purple_debug_info ("webkit", "loading %s\n", style_dir); |
32076
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
339 style = pidgin_message_style_load (style_dir); |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
340 g_assert (style); |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
341 |
32076
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
342 basedir = g_build_filename (style->style_dir, "Contents", "Resources", "Template.html", NULL); |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
343 baseuri = g_strdup_printf ("file://%s", basedir); |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
344 header = replace_header_tokens(style->header_html, strlen(style->header_html), conv); |
32088
7d8f8c6ebae2
some code for style_changed and also default any empty file to "" rather than NULL.
tdrhq@soc.pidgin.im
parents:
32087
diff
changeset
|
345 g_assert (style); |
32076
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
346 footer = replace_header_tokens(style->footer_html, strlen(style->footer_html), conv); |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
347 template = replace_template_tokens(style, style->template_html, strlen(style->template_html) + strlen(style->header_html), header, footer); |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
348 |
32091 | 349 g_assert(template); |
32101 | 350 |
351 purple_debug_info ("webkit", "template: %s\n", template); | |
32102
c0cc4d60ac5c
hmm, fonts and font sizes from Info.plist.
tdrhq@soc.pidgin.im
parents:
32101
diff
changeset
|
352 |
32104
53735be6950a
apparent code for webkit transparency that might not be working.
tdrhq@soc.pidgin.im
parents:
32102
diff
changeset
|
353 set_theme_webkit_settings (WEBKIT_WEB_VIEW(webkit), style); |
32077
3b1a130f7e88
more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents:
32076
diff
changeset
|
354 webkit_web_view_load_string(WEBKIT_WEB_VIEW(webkit), template, "text/html", "UTF-8", baseuri); |
32078
7194ddfc8158
woo, fixed the bug. Now things are looking wonderfully stable.
tdrhq@soc.pidgin.im
parents:
32077
diff
changeset
|
355 |
32077
3b1a130f7e88
more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents:
32076
diff
changeset
|
356 g_object_set_data (G_OBJECT(webkit), MESSAGE_STYLE_KEY, style); |
3b1a130f7e88
more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents:
32076
diff
changeset
|
357 |
32079
7b92a2b852db
Cleanly handle webkit destroy events.
tdrhq@soc.pidgin.im
parents:
32078
diff
changeset
|
358 /* I need to unref this style when the webkit object destroys */ |
7b92a2b852db
Cleanly handle webkit destroy events.
tdrhq@soc.pidgin.im
parents:
32078
diff
changeset
|
359 g_signal_connect (G_OBJECT(webkit), "destroy", G_CALLBACK(webkit_on_webview_destroy), style); |
32070 | 360 |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
361 g_free (basedir); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
362 g_free (baseuri); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
363 g_free (header); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
364 g_free (footer); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
365 g_free (template); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
366 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
367 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
368 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
369 /* restore the non theme version of the conversation window */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
370 static void |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
371 finalize_theme_for_webkit (PurpleConversation *conv) |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
372 { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
373 GtkWidget *webview = PIDGIN_CONVERSATION(conv)->webview; |
32077
3b1a130f7e88
more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents:
32076
diff
changeset
|
374 PidginMessageStyle *style = g_object_get_data (G_OBJECT(webview), MESSAGE_STYLE_KEY); |
32076
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
375 |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
376 webkit_web_view_load_string(WEBKIT_WEB_VIEW(webview), "", "text/html", "UTF-8", ""); |
32077
3b1a130f7e88
more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents:
32076
diff
changeset
|
377 |
3b1a130f7e88
more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents:
32076
diff
changeset
|
378 g_object_set_data (G_OBJECT(webview), MESSAGE_STYLE_KEY, NULL); |
32076
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
379 pidgin_message_style_unref (style); |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
380 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
381 |
32079
7b92a2b852db
Cleanly handle webkit destroy events.
tdrhq@soc.pidgin.im
parents:
32078
diff
changeset
|
382 static void |
7b92a2b852db
Cleanly handle webkit destroy events.
tdrhq@soc.pidgin.im
parents:
32078
diff
changeset
|
383 webkit_on_webview_destroy (GtkObject *object, gpointer data) |
7b92a2b852db
Cleanly handle webkit destroy events.
tdrhq@soc.pidgin.im
parents:
32078
diff
changeset
|
384 { |
7b92a2b852db
Cleanly handle webkit destroy events.
tdrhq@soc.pidgin.im
parents:
32078
diff
changeset
|
385 pidgin_message_style_unref ((PidginMessageStyle*) data); |
7b92a2b852db
Cleanly handle webkit destroy events.
tdrhq@soc.pidgin.im
parents:
32078
diff
changeset
|
386 g_object_set_data (G_OBJECT(object), MESSAGE_STYLE_KEY, NULL); |
7b92a2b852db
Cleanly handle webkit destroy events.
tdrhq@soc.pidgin.im
parents:
32078
diff
changeset
|
387 } |
7b92a2b852db
Cleanly handle webkit destroy events.
tdrhq@soc.pidgin.im
parents:
32078
diff
changeset
|
388 |
32072 | 389 static gboolean webkit_on_displaying_im_msg (PurpleAccount *account, |
32068
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32064
diff
changeset
|
390 const char* name, |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32064
diff
changeset
|
391 char **pmessage, |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32064
diff
changeset
|
392 PurpleConversation *conv, |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32064
diff
changeset
|
393 PurpleMessageFlags flags, |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32064
diff
changeset
|
394 gpointer data) |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
395 { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
396 GtkWidget *webkit; |
32068
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32064
diff
changeset
|
397 char *message = *pmessage; |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32064
diff
changeset
|
398 const char *alias = name; /* FIXME: signal doesn't give me alias */ |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
399 char *stripped; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
400 char *message_html; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
401 char *msg; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
402 char *escape; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
403 char *script; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
404 char *func = "appendMessage"; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
405 char *smileyed; |
32068
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32064
diff
changeset
|
406 time_t mtime = time (NULL); /* FIXME: this should come from the write_conv calback, but the signal doesn't pass this to me */ |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32064
diff
changeset
|
407 |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
408 PurpleMessageFlags old_flags = GPOINTER_TO_INT(purple_conversation_get_data(conv, "webkit-lastflags")); |
32076
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
409 PidginMessageStyle *style; |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
410 |
32071
32d7d3c4163c
* removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents:
32070
diff
changeset
|
411 fprintf (stderr, "hmm.. here %s %s\n", name, message); |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
412 webkit = get_webkit(conv); |
32068
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32064
diff
changeset
|
413 stripped = g_strdup(message); |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
414 |
32077
3b1a130f7e88
more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents:
32076
diff
changeset
|
415 style = g_object_get_data (G_OBJECT (webkit), MESSAGE_STYLE_KEY); |
32078
7194ddfc8158
woo, fixed the bug. Now things are looking wonderfully stable.
tdrhq@soc.pidgin.im
parents:
32077
diff
changeset
|
416 g_assert (style); |
32076
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
417 |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
418 if (flags & PURPLE_MESSAGE_SEND && old_flags & PURPLE_MESSAGE_SEND) { |
32076
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
419 message_html = style->outgoing_next_content_html; |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
420 func = "appendNextMessage"; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
421 } else if (flags & PURPLE_MESSAGE_SEND) { |
32076
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
422 message_html = style->outgoing_content_html; |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
423 } else if (flags & PURPLE_MESSAGE_RECV && old_flags & PURPLE_MESSAGE_RECV) { |
32076
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
424 message_html = style->incoming_next_content_html; |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
425 func = "appendNextMessage"; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
426 } else if (flags & PURPLE_MESSAGE_RECV) { |
32076
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
427 message_html = style->incoming_content_html; |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
428 } else { |
32076
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
429 message_html = style->status_html; |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
430 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
431 purple_conversation_set_data(conv, "webkit-lastflags", GINT_TO_POINTER(flags)); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
432 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
433 smileyed = smiley_parse_markup(stripped, conv->account->protocol_id); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
434 msg = replace_message_tokens(message_html, 0, conv, name, alias, smileyed, flags, mtime); |
32071
32d7d3c4163c
* removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents:
32070
diff
changeset
|
435 escape = gtk_webview_quote_js_string (msg); |
32d7d3c4163c
* removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents:
32070
diff
changeset
|
436 script = g_strdup_printf("%s(%s)", func, escape); |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
437 |
32101 | 438 purple_debug_info ("webkit", "JS: %s\n", script); |
32081
3bd8fb942ea4
Yep, tested, and changed some code from previous commit. This is a hard
tdrhq@soc.pidgin.im
parents:
32080
diff
changeset
|
439 gtk_webview_safe_execute_script (GTK_WEBVIEW (webkit), script); |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
440 |
32081
3bd8fb942ea4
Yep, tested, and changed some code from previous commit. This is a hard
tdrhq@soc.pidgin.im
parents:
32080
diff
changeset
|
441 g_free(script); |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
442 g_free(smileyed); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
443 g_free(msg); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
444 g_free(stripped); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
445 g_free(escape); |
32068
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32064
diff
changeset
|
446 |
32078
7194ddfc8158
woo, fixed the bug. Now things are looking wonderfully stable.
tdrhq@soc.pidgin.im
parents:
32077
diff
changeset
|
447 return TRUE; /* GtkConv should not handle this IM */ |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
448 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
449 |
32072 | 450 static gboolean webkit_on_displaying_chat_msg (PurpleAccount *account, |
451 const char *who, | |
452 char **message, | |
453 PurpleConversation *conv, | |
454 PurpleMessageFlags flags, | |
455 gpointer userdata) | |
456 { | |
32078
7194ddfc8158
woo, fixed the bug. Now things are looking wonderfully stable.
tdrhq@soc.pidgin.im
parents:
32077
diff
changeset
|
457 /* handle exactly like an IM message for now */ |
32072 | 458 return webkit_on_displaying_im_msg (account, who, message, conv, flags, NULL); |
459 } | |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
460 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
461 static void |
32078
7194ddfc8158
woo, fixed the bug. Now things are looking wonderfully stable.
tdrhq@soc.pidgin.im
parents:
32077
diff
changeset
|
462 webkit_on_conversation_displayed (PidginConversation *gtkconv, gpointer data) |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
463 { |
32076
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
464 init_theme_for_webkit (gtkconv->active_conv, cur_style_dir); |
32070 | 465 } |
466 | |
467 static void | |
468 webkit_on_conversation_switched (PurpleConversation *conv, gpointer data) | |
469 { | |
32076
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
470 init_theme_for_webkit (conv, cur_style_dir); |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
471 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
472 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
473 static void |
32071
32d7d3c4163c
* removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents:
32070
diff
changeset
|
474 webkit_on_conversation_hiding (PidginConversation *gtkconv, gpointer data) |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
475 { |
32071
32d7d3c4163c
* removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents:
32070
diff
changeset
|
476 /* |
32d7d3c4163c
* removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents:
32070
diff
changeset
|
477 * I'm not sure if I need to do anything here, but let's keep |
32085 | 478 * this anyway. |
32071
32d7d3c4163c
* removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents:
32070
diff
changeset
|
479 */ |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
480 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
481 |
32084
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
482 static GList* |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
483 get_dir_dir_list (const char* dirname) |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
484 { |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
485 GList *ret = NULL; |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
486 GDir *dir = g_dir_open (dirname, 0, NULL); |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
487 const char* subdir; |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
488 |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
489 if (!dir) return NULL; |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
490 while ((subdir = g_dir_read_name (dir))) { |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
491 ret = g_list_append (ret, g_build_filename (dirname, subdir, NULL)); |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
492 } |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
493 |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
494 g_dir_close (dir); |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
495 return ret; |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
496 } |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
497 |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
498 /** |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
499 * Get me a list of all the available themes specified by their |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
500 * directories. I don't guarrantee that these are valid themes, just |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
501 * that they are in the directories for themes. |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
502 */ |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
503 static GList* |
32086 | 504 get_style_directory_list () |
32084
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
505 { |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
506 char *user_dir, *user_style_dir, *global_style_dir; |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
507 GList *list1, *list2; |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
508 |
32092 | 509 user_dir = get_absolute_path (purple_user_dir ()); |
32084
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
510 |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
511 user_style_dir = g_build_filename (user_dir, "styles", NULL); |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
512 global_style_dir = g_build_filename (DATADIR, "pidgin", "styles", NULL); |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
513 |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
514 list1 = get_dir_dir_list (user_style_dir); |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
515 list2 = get_dir_dir_list (global_style_dir); |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
516 |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
517 g_free (global_style_dir); |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
518 g_free (user_style_dir); |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
519 g_free (user_dir); |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
520 |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
521 return g_list_concat (list1, list2); |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
522 } |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
523 |
32086 | 524 /** |
525 * use heuristics or previous user options to figure out what | |
526 * theme to use as default in this Pidgin instance. | |
527 */ | |
528 static void | |
529 style_set_default () | |
530 { | |
531 GList* styles = get_style_directory_list (), *iter; | |
532 const char *stylepath = purple_prefs_get_string ("/plugins/gtk/adiumthemes/stylepath"); | |
533 g_assert (cur_style_dir == NULL); | |
534 | |
535 if (stylepath) | |
536 styles = g_list_prepend (styles, g_strdup (stylepath)); | |
537 | |
538 /* pick any one that works. Note that we have first preference | |
539 * for the one in the userdir */ | |
540 for (iter = styles; iter; iter = g_list_next (iter)) { | |
541 PidginMessageStyle *style = pidgin_message_style_load (iter->data); | |
542 if (style) { | |
543 cur_style_dir = (char*) g_strdup (iter->data); | |
544 pidgin_message_style_unref (style); | |
545 break; | |
546 } | |
547 purple_debug_info ("webkit", "Style %s is invalid\n", (char*) iter->data); | |
548 } | |
549 | |
550 for (iter = styles; iter; iter = g_list_next (iter)) | |
551 g_free (iter->data); | |
552 g_list_free (styles); | |
553 } | |
32084
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
554 |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
555 static gboolean |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
556 plugin_load(PurplePlugin *plugin) |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
557 { |
32086 | 558 style_set_default (); |
559 if (!cur_style_dir) return FALSE; /* couldn't find a style */ | |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
560 |
32068
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32064
diff
changeset
|
561 purple_signal_connect (pidgin_conversations_get_handle (), |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32064
diff
changeset
|
562 "displaying-im-msg", |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32064
diff
changeset
|
563 webkit_plugin_get_handle (), |
32072 | 564 PURPLE_CALLBACK(webkit_on_displaying_im_msg), |
32068
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32064
diff
changeset
|
565 NULL); |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32064
diff
changeset
|
566 |
32070 | 567 purple_signal_connect (pidgin_conversations_get_handle (), |
32072 | 568 "displaying-chat-msg", |
569 webkit_plugin_get_handle (), | |
570 PURPLE_CALLBACK(webkit_on_displaying_chat_msg), | |
571 NULL); | |
572 | |
573 purple_signal_connect (pidgin_conversations_get_handle (), | |
32070 | 574 "conversation-displayed", |
575 webkit_plugin_get_handle (), | |
32078
7194ddfc8158
woo, fixed the bug. Now things are looking wonderfully stable.
tdrhq@soc.pidgin.im
parents:
32077
diff
changeset
|
576 PURPLE_CALLBACK(webkit_on_conversation_displayed), |
32070 | 577 NULL); |
578 | |
579 purple_signal_connect (pidgin_conversations_get_handle (), | |
580 "conversation-switched", | |
581 webkit_plugin_get_handle (), | |
582 PURPLE_CALLBACK(webkit_on_conversation_switched), | |
583 NULL); | |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
584 |
32071
32d7d3c4163c
* removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents:
32070
diff
changeset
|
585 purple_signal_connect (pidgin_conversations_get_handle (), |
32d7d3c4163c
* removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents:
32070
diff
changeset
|
586 "conversation-hiding", |
32d7d3c4163c
* removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents:
32070
diff
changeset
|
587 webkit_plugin_get_handle (), |
32d7d3c4163c
* removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents:
32070
diff
changeset
|
588 PURPLE_CALLBACK(webkit_on_conversation_hiding), |
32d7d3c4163c
* removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents:
32070
diff
changeset
|
589 NULL); |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
590 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
591 /* finally update each of the existing conversation windows */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
592 { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
593 GList* list = purple_get_conversations (); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
594 for (;list; list = g_list_next(list)) |
32076
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
595 init_theme_for_webkit (list->data, cur_style_dir); |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
596 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
597 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
598 return TRUE; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
599 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
600 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
601 static gboolean |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
602 plugin_unload(PurplePlugin *plugin) |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
603 { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
604 GList *list; |
32068
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32064
diff
changeset
|
605 |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32064
diff
changeset
|
606 webkit_plugin_free_handle (); |
32089 | 607 cur_style_dir = NULL; |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
608 list = purple_get_conversations (); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
609 while (list) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
610 finalize_theme_for_webkit(list->data); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
611 list = g_list_next(list); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
612 } |
32068
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32064
diff
changeset
|
613 |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
614 return TRUE; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
615 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
616 |
32100 | 617 /* |
618 * UI config code | |
619 */ | |
620 | |
32088
7d8f8c6ebae2
some code for style_changed and also default any empty file to "" rather than NULL.
tdrhq@soc.pidgin.im
parents:
32087
diff
changeset
|
621 static void |
7d8f8c6ebae2
some code for style_changed and also default any empty file to "" rather than NULL.
tdrhq@soc.pidgin.im
parents:
32087
diff
changeset
|
622 style_changed (GtkWidget* combobox, gpointer null) |
7d8f8c6ebae2
some code for style_changed and also default any empty file to "" rather than NULL.
tdrhq@soc.pidgin.im
parents:
32087
diff
changeset
|
623 { |
7d8f8c6ebae2
some code for style_changed and also default any empty file to "" rather than NULL.
tdrhq@soc.pidgin.im
parents:
32087
diff
changeset
|
624 char *name = gtk_combo_box_get_active_text (GTK_COMBO_BOX(combobox)); |
32093
a6d6b0867cd3
Inform the user about how the theme change takes effect.
tdrhq@soc.pidgin.im
parents:
32092
diff
changeset
|
625 GtkWidget *dialog; |
32096
d5b2b5021851
Show only the MessageStyle name and not the entire path.
tdrhq@soc.pidgin.im
parents:
32095
diff
changeset
|
626 GList *styles = get_style_directory_list (), *iter; |
32088
7d8f8c6ebae2
some code for style_changed and also default any empty file to "" rather than NULL.
tdrhq@soc.pidgin.im
parents:
32087
diff
changeset
|
627 |
32096
d5b2b5021851
Show only the MessageStyle name and not the entire path.
tdrhq@soc.pidgin.im
parents:
32095
diff
changeset
|
628 /* find the full path for this name, I wish I could store this info in the combobox itself. :( */ |
d5b2b5021851
Show only the MessageStyle name and not the entire path.
tdrhq@soc.pidgin.im
parents:
32095
diff
changeset
|
629 for (iter = styles; iter; iter = g_list_next(iter)) { |
d5b2b5021851
Show only the MessageStyle name and not the entire path.
tdrhq@soc.pidgin.im
parents:
32095
diff
changeset
|
630 char* basename = g_path_get_basename (iter->data); |
d5b2b5021851
Show only the MessageStyle name and not the entire path.
tdrhq@soc.pidgin.im
parents:
32095
diff
changeset
|
631 if (g_str_equal (basename, name)) { |
d5b2b5021851
Show only the MessageStyle name and not the entire path.
tdrhq@soc.pidgin.im
parents:
32095
diff
changeset
|
632 g_free (basename); |
d5b2b5021851
Show only the MessageStyle name and not the entire path.
tdrhq@soc.pidgin.im
parents:
32095
diff
changeset
|
633 break; |
d5b2b5021851
Show only the MessageStyle name and not the entire path.
tdrhq@soc.pidgin.im
parents:
32095
diff
changeset
|
634 } |
d5b2b5021851
Show only the MessageStyle name and not the entire path.
tdrhq@soc.pidgin.im
parents:
32095
diff
changeset
|
635 g_free (basename); |
d5b2b5021851
Show only the MessageStyle name and not the entire path.
tdrhq@soc.pidgin.im
parents:
32095
diff
changeset
|
636 } |
d5b2b5021851
Show only the MessageStyle name and not the entire path.
tdrhq@soc.pidgin.im
parents:
32095
diff
changeset
|
637 |
d5b2b5021851
Show only the MessageStyle name and not the entire path.
tdrhq@soc.pidgin.im
parents:
32095
diff
changeset
|
638 g_assert (iter); |
d5b2b5021851
Show only the MessageStyle name and not the entire path.
tdrhq@soc.pidgin.im
parents:
32095
diff
changeset
|
639 g_free (name); |
32088
7d8f8c6ebae2
some code for style_changed and also default any empty file to "" rather than NULL.
tdrhq@soc.pidgin.im
parents:
32087
diff
changeset
|
640 g_free (cur_style_dir); |
32096
d5b2b5021851
Show only the MessageStyle name and not the entire path.
tdrhq@soc.pidgin.im
parents:
32095
diff
changeset
|
641 cur_style_dir = g_strdup (iter->data);; |
32093
a6d6b0867cd3
Inform the user about how the theme change takes effect.
tdrhq@soc.pidgin.im
parents:
32092
diff
changeset
|
642 |
a6d6b0867cd3
Inform the user about how the theme change takes effect.
tdrhq@soc.pidgin.im
parents:
32092
diff
changeset
|
643 /* inform the user that existing conversations haven't changed */ |
a6d6b0867cd3
Inform the user about how the theme change takes effect.
tdrhq@soc.pidgin.im
parents:
32092
diff
changeset
|
644 dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, "The style for existing conversations have not been changed. Please close and re-open the conversation for the changes to take effect."); |
a6d6b0867cd3
Inform the user about how the theme change takes effect.
tdrhq@soc.pidgin.im
parents:
32092
diff
changeset
|
645 g_assert (dialog); |
a6d6b0867cd3
Inform the user about how the theme change takes effect.
tdrhq@soc.pidgin.im
parents:
32092
diff
changeset
|
646 gtk_widget_show (dialog); |
a6d6b0867cd3
Inform the user about how the theme change takes effect.
tdrhq@soc.pidgin.im
parents:
32092
diff
changeset
|
647 g_signal_connect_swapped (dialog, "response", G_CALLBACK(gtk_widget_destroy), dialog); |
32088
7d8f8c6ebae2
some code for style_changed and also default any empty file to "" rather than NULL.
tdrhq@soc.pidgin.im
parents:
32087
diff
changeset
|
648 } |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
649 |
32087
1c84e102c8ee
some code to get a list of styles and blah blah.
tdrhq@soc.pidgin.im
parents:
32086
diff
changeset
|
650 static GtkWidget* |
1c84e102c8ee
some code to get a list of styles and blah blah.
tdrhq@soc.pidgin.im
parents:
32086
diff
changeset
|
651 get_style_config_frame () |
1c84e102c8ee
some code to get a list of styles and blah blah.
tdrhq@soc.pidgin.im
parents:
32086
diff
changeset
|
652 { |
1c84e102c8ee
some code to get a list of styles and blah blah.
tdrhq@soc.pidgin.im
parents:
32086
diff
changeset
|
653 GtkWidget *combobox = gtk_combo_box_new_text (); |
1c84e102c8ee
some code to get a list of styles and blah blah.
tdrhq@soc.pidgin.im
parents:
32086
diff
changeset
|
654 GList *styles = get_style_directory_list (), *iter; |
1c84e102c8ee
some code to get a list of styles and blah blah.
tdrhq@soc.pidgin.im
parents:
32086
diff
changeset
|
655 int index = 0, selected = 0; |
1c84e102c8ee
some code to get a list of styles and blah blah.
tdrhq@soc.pidgin.im
parents:
32086
diff
changeset
|
656 |
32093
a6d6b0867cd3
Inform the user about how the theme change takes effect.
tdrhq@soc.pidgin.im
parents:
32092
diff
changeset
|
657 for (iter = styles; iter; iter = g_list_next (iter)) { |
32087
1c84e102c8ee
some code to get a list of styles and blah blah.
tdrhq@soc.pidgin.im
parents:
32086
diff
changeset
|
658 PidginMessageStyle *style = pidgin_message_style_load (iter->data); |
1c84e102c8ee
some code to get a list of styles and blah blah.
tdrhq@soc.pidgin.im
parents:
32086
diff
changeset
|
659 |
1c84e102c8ee
some code to get a list of styles and blah blah.
tdrhq@soc.pidgin.im
parents:
32086
diff
changeset
|
660 if (style) { |
32096
d5b2b5021851
Show only the MessageStyle name and not the entire path.
tdrhq@soc.pidgin.im
parents:
32095
diff
changeset
|
661 char *text = g_path_get_basename (iter->data); |
d5b2b5021851
Show only the MessageStyle name and not the entire path.
tdrhq@soc.pidgin.im
parents:
32095
diff
changeset
|
662 gtk_combo_box_append_text (GTK_COMBO_BOX(combobox), text); |
d5b2b5021851
Show only the MessageStyle name and not the entire path.
tdrhq@soc.pidgin.im
parents:
32095
diff
changeset
|
663 g_free (text); |
d5b2b5021851
Show only the MessageStyle name and not the entire path.
tdrhq@soc.pidgin.im
parents:
32095
diff
changeset
|
664 |
32087
1c84e102c8ee
some code to get a list of styles and blah blah.
tdrhq@soc.pidgin.im
parents:
32086
diff
changeset
|
665 if (g_str_equal (iter->data, cur_style_dir)) |
1c84e102c8ee
some code to get a list of styles and blah blah.
tdrhq@soc.pidgin.im
parents:
32086
diff
changeset
|
666 selected = index; |
32093
a6d6b0867cd3
Inform the user about how the theme change takes effect.
tdrhq@soc.pidgin.im
parents:
32092
diff
changeset
|
667 index++; |
32087
1c84e102c8ee
some code to get a list of styles and blah blah.
tdrhq@soc.pidgin.im
parents:
32086
diff
changeset
|
668 pidgin_message_style_unref (style); |
1c84e102c8ee
some code to get a list of styles and blah blah.
tdrhq@soc.pidgin.im
parents:
32086
diff
changeset
|
669 } |
1c84e102c8ee
some code to get a list of styles and blah blah.
tdrhq@soc.pidgin.im
parents:
32086
diff
changeset
|
670 } |
1c84e102c8ee
some code to get a list of styles and blah blah.
tdrhq@soc.pidgin.im
parents:
32086
diff
changeset
|
671 gtk_combo_box_set_active (GTK_COMBO_BOX(combobox), selected); |
32095
d25e6f4a239a
Reset the list of variants when the MessageStyle is changed.
tdrhq@soc.pidgin.im
parents:
32094
diff
changeset
|
672 g_signal_connect_after (G_OBJECT(combobox), "changed", G_CALLBACK(style_changed), NULL); |
32087
1c84e102c8ee
some code to get a list of styles and blah blah.
tdrhq@soc.pidgin.im
parents:
32086
diff
changeset
|
673 return combobox; |
1c84e102c8ee
some code to get a list of styles and blah blah.
tdrhq@soc.pidgin.im
parents:
32086
diff
changeset
|
674 } |
1c84e102c8ee
some code to get a list of styles and blah blah.
tdrhq@soc.pidgin.im
parents:
32086
diff
changeset
|
675 |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
676 static void |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
677 variant_update_conversation (PurpleConversation *conv) |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
678 { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
679 PidginConversation *gtkconv = PIDGIN_CONVERSATION (conv); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
680 WebKitWebView *webview = WEBKIT_WEB_VIEW (gtkconv->webview); |
32077
3b1a130f7e88
more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents:
32076
diff
changeset
|
681 PidginMessageStyle *style = (PidginMessageStyle*) g_object_get_data (G_OBJECT(webview), MESSAGE_STYLE_KEY); |
3b1a130f7e88
more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents:
32076
diff
changeset
|
682 char *script; |
32076
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
683 |
32100 | 684 g_assert (style); |
32077
3b1a130f7e88
more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents:
32076
diff
changeset
|
685 |
32100 | 686 script = g_strdup_printf ("setStylesheet(\"mainStyle\",\"%s\")", pidgin_message_style_get_css (style)); |
32081
3bd8fb942ea4
Yep, tested, and changed some code from previous commit. This is a hard
tdrhq@soc.pidgin.im
parents:
32080
diff
changeset
|
687 gtk_webview_safe_execute_script (GTK_WEBVIEW(webview), script); |
32102
c0cc4d60ac5c
hmm, fonts and font sizes from Info.plist.
tdrhq@soc.pidgin.im
parents:
32101
diff
changeset
|
688 |
32104
53735be6950a
apparent code for webkit transparency that might not be working.
tdrhq@soc.pidgin.im
parents:
32102
diff
changeset
|
689 set_theme_webkit_settings (WEBKIT_WEB_VIEW (gtkconv->webview), style); |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
690 g_free (script); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
691 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
692 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
693 static void |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
694 variant_changed (GtkWidget* combobox, gpointer null) |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
695 { |
32100 | 696 char *name; |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
697 GList *list; |
32076
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
698 PidginMessageStyle *style = pidgin_message_style_load (cur_style_dir); |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
699 |
32076
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
700 g_assert (style); |
32100 | 701 name = gtk_combo_box_get_active_text (GTK_COMBO_BOX (combobox)); |
702 pidgin_message_style_set_variant (style, name); | |
32076
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
703 |
32100 | 704 /* update conversations */ |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
705 list = purple_get_conversations (); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
706 while (list) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
707 variant_update_conversation (list->data); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
708 list = g_list_next(list); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
709 } |
32076
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
710 |
32100 | 711 g_free (name); |
32076
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
712 pidgin_message_style_unref (style); |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
713 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
714 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
715 static GtkWidget * |
32084
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
716 get_variant_config_frame() |
32076
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
717 { |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
718 PidginMessageStyle *style = pidgin_message_style_load (cur_style_dir); |
32100 | 719 GList *variants = pidgin_message_style_get_variants (style), *iter; |
720 char *cur_variant = pidgin_message_style_get_variant (style); | |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
721 GtkWidget *combobox = gtk_combo_box_new_text(); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
722 int def = -1, index = 0; |
32076
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
723 |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32075
diff
changeset
|
724 pidgin_message_style_unref (style); |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
725 |
32097 | 726 for (iter = variants; iter; iter = g_list_next (iter)) { |
32100 | 727 gtk_combo_box_append_text (GTK_COMBO_BOX(combobox), iter->data); |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
728 |
32100 | 729 if (g_str_equal (cur_variant, iter->data)) |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
730 def = index; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
731 index ++; |
32077
3b1a130f7e88
more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents:
32076
diff
changeset
|
732 |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
733 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
734 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
735 gtk_combo_box_set_active (GTK_COMBO_BOX(combobox), def); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
736 g_signal_connect (G_OBJECT(combobox), "changed", G_CALLBACK(variant_changed), NULL); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
737 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
738 return combobox; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
739 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
740 |
32095
d25e6f4a239a
Reset the list of variants when the MessageStyle is changed.
tdrhq@soc.pidgin.im
parents:
32094
diff
changeset
|
741 static void |
d25e6f4a239a
Reset the list of variants when the MessageStyle is changed.
tdrhq@soc.pidgin.im
parents:
32094
diff
changeset
|
742 style_changed_reset_variants (GtkWidget* combobox, gpointer table) |
d25e6f4a239a
Reset the list of variants when the MessageStyle is changed.
tdrhq@soc.pidgin.im
parents:
32094
diff
changeset
|
743 { |
d25e6f4a239a
Reset the list of variants when the MessageStyle is changed.
tdrhq@soc.pidgin.im
parents:
32094
diff
changeset
|
744 /* I hate to do this, I swear. But I don't know how to cleanly clean an existing combobox */ |
d25e6f4a239a
Reset the list of variants when the MessageStyle is changed.
tdrhq@soc.pidgin.im
parents:
32094
diff
changeset
|
745 GtkWidget* variants = g_object_get_data (G_OBJECT(table), "variants-cbox"); |
d25e6f4a239a
Reset the list of variants when the MessageStyle is changed.
tdrhq@soc.pidgin.im
parents:
32094
diff
changeset
|
746 gtk_widget_destroy (variants); |
d25e6f4a239a
Reset the list of variants when the MessageStyle is changed.
tdrhq@soc.pidgin.im
parents:
32094
diff
changeset
|
747 variants = get_variant_config_frame (); |
d25e6f4a239a
Reset the list of variants when the MessageStyle is changed.
tdrhq@soc.pidgin.im
parents:
32094
diff
changeset
|
748 gtk_table_attach_defaults (GTK_TABLE (table), variants, 1, 2, 1, 2); |
d25e6f4a239a
Reset the list of variants when the MessageStyle is changed.
tdrhq@soc.pidgin.im
parents:
32094
diff
changeset
|
749 gtk_widget_show_all (GTK_WIDGET(table)); |
d25e6f4a239a
Reset the list of variants when the MessageStyle is changed.
tdrhq@soc.pidgin.im
parents:
32094
diff
changeset
|
750 |
d25e6f4a239a
Reset the list of variants when the MessageStyle is changed.
tdrhq@soc.pidgin.im
parents:
32094
diff
changeset
|
751 g_object_set_data (G_OBJECT(table), "variants-cbox", variants); |
d25e6f4a239a
Reset the list of variants when the MessageStyle is changed.
tdrhq@soc.pidgin.im
parents:
32094
diff
changeset
|
752 } |
d25e6f4a239a
Reset the list of variants when the MessageStyle is changed.
tdrhq@soc.pidgin.im
parents:
32094
diff
changeset
|
753 |
32084
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
754 static GtkWidget* |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
755 get_config_frame(PurplePlugin* plugin) |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
756 { |
32094
d1ed820fa416
use a table to display the options neatly.
tdrhq@soc.pidgin.im
parents:
32093
diff
changeset
|
757 GtkWidget *table = gtk_table_new (2, 2, FALSE); |
32095
d25e6f4a239a
Reset the list of variants when the MessageStyle is changed.
tdrhq@soc.pidgin.im
parents:
32094
diff
changeset
|
758 GtkWidget *style_config = get_style_config_frame (); |
d25e6f4a239a
Reset the list of variants when the MessageStyle is changed.
tdrhq@soc.pidgin.im
parents:
32094
diff
changeset
|
759 GtkWidget *variant_config = get_variant_config_frame (); |
d25e6f4a239a
Reset the list of variants when the MessageStyle is changed.
tdrhq@soc.pidgin.im
parents:
32094
diff
changeset
|
760 |
32094
d1ed820fa416
use a table to display the options neatly.
tdrhq@soc.pidgin.im
parents:
32093
diff
changeset
|
761 gtk_table_attach_defaults (GTK_TABLE(table), gtk_label_new ("Message Style"), 0, 1, 0, 1); |
32095
d25e6f4a239a
Reset the list of variants when the MessageStyle is changed.
tdrhq@soc.pidgin.im
parents:
32094
diff
changeset
|
762 gtk_table_attach_defaults (GTK_TABLE(table), style_config, 1, 2, 0, 1); |
32094
d1ed820fa416
use a table to display the options neatly.
tdrhq@soc.pidgin.im
parents:
32093
diff
changeset
|
763 gtk_table_attach_defaults (GTK_TABLE(table), gtk_label_new ("Style Variant"), 0, 1, 1, 2); |
32095
d25e6f4a239a
Reset the list of variants when the MessageStyle is changed.
tdrhq@soc.pidgin.im
parents:
32094
diff
changeset
|
764 gtk_table_attach_defaults (GTK_TABLE(table), variant_config, 1, 2, 1, 2); |
d25e6f4a239a
Reset the list of variants when the MessageStyle is changed.
tdrhq@soc.pidgin.im
parents:
32094
diff
changeset
|
765 |
d25e6f4a239a
Reset the list of variants when the MessageStyle is changed.
tdrhq@soc.pidgin.im
parents:
32094
diff
changeset
|
766 |
d25e6f4a239a
Reset the list of variants when the MessageStyle is changed.
tdrhq@soc.pidgin.im
parents:
32094
diff
changeset
|
767 g_object_set_data (G_OBJECT(table), "variants-cbox", variant_config); |
d25e6f4a239a
Reset the list of variants when the MessageStyle is changed.
tdrhq@soc.pidgin.im
parents:
32094
diff
changeset
|
768 /* to clarify, this is a second signal connected on style config */ |
d25e6f4a239a
Reset the list of variants when the MessageStyle is changed.
tdrhq@soc.pidgin.im
parents:
32094
diff
changeset
|
769 g_signal_connect_after (G_OBJECT(style_config), "changed", G_CALLBACK(style_changed_reset_variants), table); |
d25e6f4a239a
Reset the list of variants when the MessageStyle is changed.
tdrhq@soc.pidgin.im
parents:
32094
diff
changeset
|
770 |
32094
d1ed820fa416
use a table to display the options neatly.
tdrhq@soc.pidgin.im
parents:
32093
diff
changeset
|
771 return table; |
32084
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
772 } |
d60517f63f99
partial work towards theme selection.
tdrhq@soc.pidgin.im
parents:
32083
diff
changeset
|
773 |
32064
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
774 PidginPluginUiInfo ui_info = |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
775 { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
776 get_config_frame, |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
777 0, /* page_num (Reserved) */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
778 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
779 /* padding */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
780 NULL, |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
781 NULL, |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
782 NULL, |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
783 NULL |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
784 }; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
785 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
786 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
787 static PurplePluginInfo info = |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
788 { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
789 PURPLE_PLUGIN_MAGIC, /* Magic */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
790 PURPLE_MAJOR_VERSION, /* Purple Major Version */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
791 PURPLE_MINOR_VERSION, /* Purple Minor Version */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
792 PURPLE_PLUGIN_STANDARD, /* plugin type */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
793 PIDGIN_PLUGIN_TYPE, /* ui requirement */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
794 0, /* flags */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
795 NULL, /* dependencies */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
796 PURPLE_PRIORITY_DEFAULT, /* priority */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
797 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
798 PLUGIN_ID, /* plugin id */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
799 NULL, /* name */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
800 "0.1", /* version */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
801 NULL, /* summary */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
802 NULL, /* description */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
803 PLUGIN_AUTHOR, /* author */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
804 "http://pidgin.im", /* website */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
805 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
806 plugin_load, /* load */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
807 plugin_unload, /* unload */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
808 NULL, /* destroy */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
809 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
810 &ui_info, /* ui_info */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
811 NULL, /* extra_info */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
812 NULL, /* prefs_info */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
813 NULL, /* actions */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
814 NULL, /* reserved 1 */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
815 NULL, /* reserved 2 */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
816 NULL, /* reserved 3 */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
817 NULL /* reserved 4 */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
818 }; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
819 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
820 static void |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
821 init_plugin(PurplePlugin *plugin) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
822 info.name = "Adium IMs"; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
823 info.summary = "Adium-like IMs with Pidgin"; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
824 info.description = "You can chat in Pidgin using Adium's WebKit view."; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
825 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
826 purple_prefs_add_none ("/plugins"); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
827 purple_prefs_add_none ("/plugins/gtk"); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
828 purple_prefs_add_none ("/plugins/gtk/adiumthemes"); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
829 purple_prefs_add_string ("/plugins/gtk/adiumthemes/csspath", ""); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
830 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
831 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
832 PURPLE_INIT_PLUGIN(webkit, init_plugin, info) |