pidgin/plugins/webkit.c

Sun, 09 Oct 2011 04:55:33 +0000

author
Elliott Sales de Andrade <qulogic@pidgin.im>
date
Sun, 09 Oct 2011 04:55:33 +0000
branch
cpw.qulogic.gtk3
changeset 32917
ca85d11c17ca
parent 32580
79f9352cc65a
child 32802
2421bb0efb2e
permissions
-rw-r--r--

GDK_DISPLAY has been deprecated, and its replacement has been around
for a long time.

32534
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1 /*
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
2 * WebKit - Open the inspector on any WebKit views.
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
3 * Copyright (C) 2011 Elliott Sales de Andrade <qulogic@pidgin.im>
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
4 *
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
5 * This program is free software; you can redistribute it and/or
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
6 * modify it under the terms of the GNU General Public License
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
7 * as published by the Free Software Foundation; either version 2
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
8 * of the License, or (at your option) any later version.
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
9 *
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
13 * GNU General Public License for more details.
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
14 *
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
16 * along with this program; if not, write to the Free Software
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA.
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
18 */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
19
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
20 #ifdef HAVE_CONFIG_H
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
21 #include <config.h>
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
22 #endif
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
23
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
24 #include "internal.h"
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
25
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
26 #include "version.h"
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
27
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
28 #include "pidgin.h"
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
29
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
30 #include "gtkconv.h"
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
31 #include "gtkplugin.h"
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
32 #include "gtkwebview.h"
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
33
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
34 static WebKitWebView *
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
35 create_gtk_window_around_it(WebKitWebInspector *inspector,
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
36 WebKitWebView *webview,
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
37 PidginConversation *gtkconv)
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
38 {
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
39 GtkWidget *win;
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
40 GtkWidget *view;
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
41 char *title;
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
42
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
43 win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
44 title = g_strdup_printf(_("%s - Inspector"),
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
45 gtk_label_get_text(GTK_LABEL(gtkconv->tab_label)));
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
46 gtk_window_set_title(GTK_WINDOW(win), title);
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
47 g_free(title);
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
48 gtk_window_set_default_size(GTK_WINDOW(win), 600, 400);
32580
79f9352cc65a Destroy the inspector window when a tab is closed. This prevents
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32534
diff changeset
49 g_signal_connect_swapped(G_OBJECT(gtkconv->tab_cont), "destroy", G_CALLBACK(gtk_widget_destroy), win);
32534
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
50
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
51 view = webkit_web_view_new();
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
52 gtk_container_add(GTK_CONTAINER(win), view);
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
53 g_object_set_data(G_OBJECT(webview), "inspector-window", win);
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
54
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
55 return WEBKIT_WEB_VIEW(view);
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
56 }
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
57
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
58 static gboolean
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
59 show_inspector_window(WebKitWebInspector *inspector,
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
60 GtkWidget *webview)
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
61 {
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
62 GtkWidget *win;
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
63
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
64 win = g_object_get_data(G_OBJECT(webview), "inspector-window");
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
65
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
66 gtk_widget_show_all(win);
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
67
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
68 return TRUE;
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
69 }
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
70
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
71 static void
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
72 setup_inspector(PidginConversation *gtkconv)
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
73 {
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
74 GtkWidget *webview = gtkconv->webview;
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
75 WebKitWebSettings *settings;
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
76 WebKitWebInspector *inspector;
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
77
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
78 settings = webkit_web_view_get_settings(WEBKIT_WEB_VIEW(webview));
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
79 inspector = webkit_web_view_get_inspector(WEBKIT_WEB_VIEW(webview));
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
80
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
81 g_object_set(G_OBJECT(settings), "enable-developer-extras", TRUE, NULL);
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
82
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
83 g_signal_connect(G_OBJECT(inspector), "inspect-web-view",
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
84 G_CALLBACK(create_gtk_window_around_it), gtkconv);
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
85 g_signal_connect(G_OBJECT(inspector), "show-window",
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
86 G_CALLBACK(show_inspector_window), webview);
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
87 }
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
88
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
89 static void
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
90 remove_inspector(PidginConversation *gtkconv)
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
91 {
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
92 GtkWidget *webview = gtkconv->webview;
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
93 GtkWidget *win;
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
94 WebKitWebSettings *settings;
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
95
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
96 win = g_object_get_data(G_OBJECT(webview), "inspector-window");
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
97 gtk_widget_destroy(win);
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
98 g_object_set_data(G_OBJECT(webview), "inspector-window", NULL);
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
99
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
100 settings = webkit_web_view_get_settings(WEBKIT_WEB_VIEW(webview));
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
101
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
102 g_object_set(G_OBJECT(settings), "enable-developer-extras", FALSE, NULL);
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
103 }
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
104
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
105 static void
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
106 conversation_displayed_cb(PidginConversation *gtkconv)
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
107 {
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
108 GtkWidget *inspect = NULL;
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
109
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
110 inspect = g_object_get_data(G_OBJECT(gtkconv->webview),
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
111 "inspector-window");
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
112 if (inspect == NULL) {
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
113 setup_inspector(gtkconv);
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
114 }
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
115 }
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
116
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
117 static gboolean
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
118 plugin_load(PurplePlugin *plugin)
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
119 {
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
120 GList *convs = purple_get_conversations();
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
121 void *gtk_conv_handle = pidgin_conversations_get_handle();
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
122
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
123 purple_signal_connect(gtk_conv_handle, "conversation-displayed", plugin,
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
124 PURPLE_CALLBACK(conversation_displayed_cb), NULL);
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
125
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
126 while (convs) {
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
127 PurpleConversation *conv = (PurpleConversation *)convs->data;
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
128
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
129 /* Setup WebKit Inspector */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
130 if (PIDGIN_IS_PIDGIN_CONVERSATION(conv)) {
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
131 setup_inspector(PIDGIN_CONVERSATION(conv));
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
132 }
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
133
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
134 convs = convs->next;
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
135 }
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
136
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
137 return TRUE;
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
138 }
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
139
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
140 static gboolean
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
141 plugin_unload(PurplePlugin *plugin)
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
142 {
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
143 GList *convs = purple_get_conversations();
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
144
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
145 while (convs) {
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
146 PurpleConversation *conv = (PurpleConversation *)convs->data;
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
147
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
148 /* Remove WebKit Inspector */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
149 if (PIDGIN_IS_PIDGIN_CONVERSATION(conv)) {
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
150 remove_inspector(PIDGIN_CONVERSATION(conv));
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
151 }
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
152
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
153 convs = convs->next;
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
154 }
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
155
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
156 return TRUE;
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
157 }
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
158
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
159 static PurplePluginInfo info =
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
160 {
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
161 PURPLE_PLUGIN_MAGIC,
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
162 PURPLE_MAJOR_VERSION, /**< major version */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
163 PURPLE_MINOR_VERSION, /**< minor version */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
164 PURPLE_PLUGIN_STANDARD, /**< type */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
165 PIDGIN_PLUGIN_TYPE, /**< ui_requirement */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
166 0, /**< flags */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
167 NULL, /**< dependencies */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
168 PURPLE_PRIORITY_DEFAULT, /**< priority */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
169
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
170 "gtkwebkit-inspect", /**< id */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
171 N_("WebKit Development"), /**< name */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
172 DISPLAY_VERSION, /**< version */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
173 N_("Enables WebKit Inspector."), /**< summary */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
174 N_("Enables WebKit's built-in inspector in a "
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
175 "conversation window. This may be viewed "
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
176 "by right-clicking a WebKit widget and "
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
177 "selecting 'Inspect Element'."), /**< description */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
178 "Elliott Sales de Andrade <qulogic@pidgin.im>", /**< author */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
179 PURPLE_WEBSITE, /**< homepage */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
180 plugin_load, /**< load */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
181 plugin_unload, /**< unload */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
182 NULL, /**< destroy */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
183 NULL, /**< ui_info */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
184 NULL, /**< extra_info */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
185 NULL, /**< prefs_info */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
186 NULL, /**< actions */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
187
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
188 /* padding */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
189 NULL,
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
190 NULL,
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
191 NULL,
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
192 NULL
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
193 };
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
194
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
195 static void
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
196 init_plugin(PurplePlugin *plugin)
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
197 {
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
198 }
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
199
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
200 PURPLE_INIT_PLUGIN(webkit-devel, init_plugin, info)
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
201

mercurial