| 185 |
185 |
| 186 static gboolean update_send_to_selection(PidginWindow *win); |
186 static gboolean update_send_to_selection(PidginWindow *win); |
| 187 static void generate_send_to_items(PidginWindow *win); |
187 static void generate_send_to_items(PidginWindow *win); |
| 188 |
188 |
| 189 /* Prototypes. <-- because Paco-Paco hates this comment. */ |
189 /* Prototypes. <-- because Paco-Paco hates this comment. */ |
| |
190 static void load_conv_theme(PidginConversation *gtkconv); |
| 190 static gboolean infopane_entry_activate(PidginConversation *gtkconv); |
191 static gboolean infopane_entry_activate(PidginConversation *gtkconv); |
| 191 static void got_typing_keypress(PidginConversation *gtkconv, gboolean first); |
192 static void got_typing_keypress(PidginConversation *gtkconv, gboolean first); |
| 192 static void gray_stuff_out(PidginConversation *gtkconv); |
193 static void gray_stuff_out(PidginConversation *gtkconv); |
| 193 static void add_chat_buddy_common(PurpleConversation *conv, PurpleConvChatBuddy *cb, const char *old_name); |
194 static void add_chat_buddy_common(PurpleConversation *conv, PurpleConvChatBuddy *cb, const char *old_name); |
| 194 static gboolean tab_complete(PurpleConversation *conv); |
195 static gboolean tab_complete(PurpleConversation *conv); |
| 438 } |
439 } |
| 439 |
440 |
| 440 static void clear_conversation_scrollback_cb(PurpleConversation *conv, |
441 static void clear_conversation_scrollback_cb(PurpleConversation *conv, |
| 441 void *data) |
442 void *data) |
| 442 { |
443 { |
| 443 PidginConversation *gtkconv = NULL; |
444 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); |
| 444 |
445 |
| 445 gtkconv = PIDGIN_CONVERSATION(conv); |
446 if (PIDGIN_CONVERSATION(conv)) { |
| 446 |
447 load_conv_theme(gtkconv); |
| 447 if (PIDGIN_CONVERSATION(conv)) |
448 gtkconv->last_flags = 0; |
| 448 webkit_web_view_load_html_string(WEBKIT_WEB_VIEW(gtkconv->webview), "", ""); |
449 } |
| 449 } |
450 } |
| 450 |
451 |
| 451 static PurpleCmdRet |
452 static PurpleCmdRet |
| 452 clear_command_cb(PurpleConversation *conv, |
453 clear_command_cb(PurpleConversation *conv, |
| 453 const char *cmd, char **args, char **error, void *data) |
454 const char *cmd, char **args, char **error, void *data) |
| 5202 g_free(path); |
5203 g_free(path); |
| 5203 gtk_webview_safe_execute_script(GTK_WEBVIEW(gtkconv->webview), js); |
5204 gtk_webview_safe_execute_script(GTK_WEBVIEW(gtkconv->webview), js); |
| 5204 g_free(js); |
5205 g_free(js); |
| 5205 } |
5206 } |
| 5206 |
5207 |
| |
5208 static void |
| |
5209 load_conv_theme(PidginConversation *gtkconv) |
| |
5210 { |
| |
5211 char *header, *footer; |
| |
5212 char *template; |
| |
5213 char *basedir, *baseuri; |
| |
5214 |
| |
5215 header = replace_header_tokens(gtkconv->active_conv, |
| |
5216 pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_HEADER)); |
| |
5217 footer = replace_header_tokens(gtkconv->active_conv, |
| |
5218 pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_FOOTER)); |
| |
5219 template = replace_template_tokens(gtkconv->theme, header, footer); |
| |
5220 g_free(header); |
| |
5221 g_free(footer); |
| |
5222 |
| |
5223 if (template == NULL) |
| |
5224 return; |
| |
5225 |
| |
5226 set_theme_webkit_settings(WEBKIT_WEB_VIEW(gtkconv->webview), gtkconv->theme); |
| |
5227 |
| |
5228 basedir = pidgin_conversation_theme_get_template_path(gtkconv->theme); |
| |
5229 baseuri = g_strdup_printf("file://%s", basedir); |
| |
5230 webkit_web_view_load_string(WEBKIT_WEB_VIEW(gtkconv->webview), template, |
| |
5231 "text/html", "UTF-8", baseuri); |
| |
5232 |
| |
5233 if (purple_conversation_get_type(gtkconv->active_conv) == PURPLE_CONV_TYPE_CHAT) |
| |
5234 gtk_webview_safe_execute_script(GTK_WEBVIEW(gtkconv->webview), |
| |
5235 "document.getElementById('Chat').className = 'groupchat'"); |
| |
5236 |
| |
5237 g_signal_connect(G_OBJECT(gtkconv->theme), "notify::variant", |
| |
5238 G_CALLBACK(conv_variant_changed_cb), gtkconv); |
| |
5239 |
| |
5240 g_free(basedir); |
| |
5241 g_free(baseuri); |
| |
5242 g_free(template); |
| |
5243 } |
| |
5244 |
| 5207 static GtkWidget * |
5245 static GtkWidget * |
| 5208 setup_common_pane(PidginConversation *gtkconv) |
5246 setup_common_pane(PidginConversation *gtkconv) |
| 5209 { |
5247 { |
| 5210 GtkWidget *vbox, *frame, *webview_sw, *event_box; |
5248 GtkWidget *vbox, *frame, *webview_sw, *event_box; |
| 5211 GtkCellRenderer *rend; |
5249 GtkCellRenderer *rend; |
| 5212 GtkTreePath *path; |
5250 GtkTreePath *path; |
| 5213 PurpleConversation *conv = gtkconv->active_conv; |
5251 PurpleConversation *conv = gtkconv->active_conv; |
| 5214 PurpleBuddy *buddy; |
5252 PurpleBuddy *buddy; |
| 5215 gboolean chat = (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT); |
5253 gboolean chat = (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT); |
| 5216 int buddyicon_size = 0; |
5254 int buddyicon_size = 0; |
| 5217 char *header, *footer; |
|
| 5218 char *template; |
|
| 5219 |
5255 |
| 5220 /* Setup the top part of the pane */ |
5256 /* Setup the top part of the pane */ |
| 5221 vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
5257 vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
| 5222 gtk_widget_show(vbox); |
5258 gtk_widget_show(vbox); |
| 5223 |
5259 |
| 5307 |
5343 |
| 5308 /* Setup the webkit widget */ |
5344 /* Setup the webkit widget */ |
| 5309 frame = pidgin_create_webview(FALSE, >kconv->webview, NULL, &webview_sw); |
5345 frame = pidgin_create_webview(FALSE, >kconv->webview, NULL, &webview_sw); |
| 5310 gtk_widget_set_size_request(gtkconv->webview, -1, 0); |
5346 gtk_widget_set_size_request(gtkconv->webview, -1, 0); |
| 5311 |
5347 |
| 5312 header = replace_header_tokens(conv, |
5348 load_conv_theme(gtkconv); |
| 5313 pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_HEADER)); |
|
| 5314 footer = replace_header_tokens(conv, |
|
| 5315 pidgin_conversation_theme_get_template(gtkconv->theme, PIDGIN_CONVERSATION_THEME_TEMPLATE_FOOTER)); |
|
| 5316 template = replace_template_tokens(gtkconv->theme, header, footer); |
|
| 5317 g_free(header); |
|
| 5318 g_free(footer); |
|
| 5319 |
|
| 5320 if (template != NULL) { |
|
| 5321 char *basedir; |
|
| 5322 char *baseuri; |
|
| 5323 |
|
| 5324 purple_debug_info("webkit", "template: %s\n", template); |
|
| 5325 |
|
| 5326 set_theme_webkit_settings(WEBKIT_WEB_VIEW(gtkconv->webview), gtkconv->theme); |
|
| 5327 |
|
| 5328 basedir = pidgin_conversation_theme_get_template_path(gtkconv->theme); |
|
| 5329 baseuri = g_strdup_printf("file://%s", basedir); |
|
| 5330 webkit_web_view_load_string(WEBKIT_WEB_VIEW(gtkconv->webview), template, "text/html", "UTF-8", baseuri); |
|
| 5331 |
|
| 5332 if (chat) |
|
| 5333 gtk_webview_safe_execute_script(GTK_WEBVIEW(gtkconv->webview), "document.getElementById('Chat').className = 'groupchat'"); |
|
| 5334 |
|
| 5335 g_signal_connect(G_OBJECT(gtkconv->theme), "notify::variant", |
|
| 5336 G_CALLBACK(conv_variant_changed_cb), gtkconv); |
|
| 5337 |
|
| 5338 g_free(basedir); |
|
| 5339 g_free(baseuri); |
|
| 5340 g_free(template); |
|
| 5341 } |
|
| 5342 |
5349 |
| 5343 if (chat) { |
5350 if (chat) { |
| 5344 GtkWidget *hpaned; |
5351 GtkWidget *hpaned; |
| 5345 |
5352 |
| 5346 /* Add the topic */ |
5353 /* Add the topic */ |