Mercurial > pidgin.yaz
annotate pidgin/plugins/webkit.c @ 32663:afd256914830
Destroy the inspector window when a tab is closed. This prevents
a crash if you try to use the inspector without the tab open.
Also, remove an unused variable.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Wed, 21 Sep 2011 21:10:14 +0000 |
parents | d478be29444a |
children |
rev | line source |
---|---|
32617
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
1 /* |
d478be29444a
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. |
d478be29444a
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> |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
4 * |
d478be29444a
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 |
d478be29444a
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 |
d478be29444a
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 |
d478be29444a
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. |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
9 * |
d478be29444a
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, |
d478be29444a
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 |
d478be29444a
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 |
d478be29444a
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. |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
14 * |
d478be29444a
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 |
d478be29444a
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 |
d478be29444a
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. |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
18 */ |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
19 |
d478be29444a
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 |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
21 #include <config.h> |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
22 #endif |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
23 |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
24 #include "internal.h" |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
25 |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
26 #include "version.h" |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
27 |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
28 #include "pidgin.h" |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
29 |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
30 #include "gtkconv.h" |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
31 #include "gtkplugin.h" |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
32 #include "gtkwebview.h" |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
33 |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
34 static WebKitWebView * |
d478be29444a
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, |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
36 WebKitWebView *webview, |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
37 PidginConversation *gtkconv) |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
38 { |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
39 GtkWidget *win; |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
40 GtkWidget *view; |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
41 char *title; |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
42 |
d478be29444a
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); |
d478be29444a
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"), |
d478be29444a
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))); |
d478be29444a
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); |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
47 g_free(title); |
d478be29444a
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); |
32663
afd256914830
Destroy the inspector window when a tab is closed. This prevents
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32617
diff
changeset
|
49 g_signal_connect_swapped(G_OBJECT(gtkconv->tab_cont), "destroy", G_CALLBACK(gtk_widget_destroy), win); |
32617
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
50 |
d478be29444a
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(); |
d478be29444a
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); |
d478be29444a
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); |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
54 |
d478be29444a
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); |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
56 } |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
57 |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
58 static gboolean |
d478be29444a
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, |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
60 GtkWidget *webview) |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
61 { |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
62 GtkWidget *win; |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
63 |
d478be29444a
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"); |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
65 |
d478be29444a
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); |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
67 |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
68 return TRUE; |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
69 } |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
70 |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
71 static void |
d478be29444a
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) |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
73 { |
d478be29444a
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; |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
75 WebKitWebSettings *settings; |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
76 WebKitWebInspector *inspector; |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
77 |
d478be29444a
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)); |
d478be29444a
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)); |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
80 |
d478be29444a
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); |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
82 |
d478be29444a
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", |
d478be29444a
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); |
d478be29444a
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", |
d478be29444a
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); |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
87 } |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
88 |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
89 static void |
d478be29444a
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) |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
91 { |
d478be29444a
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; |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
93 GtkWidget *win; |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
94 WebKitWebSettings *settings; |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
95 |
d478be29444a
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"); |
d478be29444a
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); |
d478be29444a
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); |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
99 |
d478be29444a
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)); |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
101 |
d478be29444a
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); |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
103 } |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
104 |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
105 static void |
d478be29444a
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) |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
107 { |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
108 GtkWidget *inspect = NULL; |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
109 |
d478be29444a
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), |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
111 "inspector-window"); |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
112 if (inspect == NULL) { |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
113 setup_inspector(gtkconv); |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
114 } |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
115 } |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
116 |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
117 static gboolean |
d478be29444a
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) |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
119 { |
d478be29444a
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(); |
d478be29444a
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(); |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
122 |
d478be29444a
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, |
d478be29444a
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); |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
125 |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
126 while (convs) { |
d478be29444a
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; |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
128 |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
129 /* Setup WebKit Inspector */ |
d478be29444a
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)) { |
d478be29444a
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)); |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
132 } |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
133 |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
134 convs = convs->next; |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
135 } |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
136 |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
137 return TRUE; |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
138 } |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
139 |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
140 static gboolean |
d478be29444a
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) |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
142 { |
d478be29444a
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(); |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
144 |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
145 while (convs) { |
d478be29444a
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; |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
147 |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
148 /* Remove WebKit Inspector */ |
d478be29444a
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)) { |
d478be29444a
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)); |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
151 } |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
152 |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
153 convs = convs->next; |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
154 } |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
155 |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
156 return TRUE; |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
157 } |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
158 |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
159 static PurplePluginInfo info = |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
160 { |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
161 PURPLE_PLUGIN_MAGIC, |
d478be29444a
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 */ |
d478be29444a
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 */ |
d478be29444a
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 */ |
d478be29444a
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 */ |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
166 0, /**< flags */ |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
167 NULL, /**< dependencies */ |
d478be29444a
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 */ |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
169 |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
170 "gtkwebkit-inspect", /**< id */ |
d478be29444a
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 */ |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
172 DISPLAY_VERSION, /**< version */ |
d478be29444a
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 */ |
d478be29444a
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 " |
d478be29444a
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 " |
d478be29444a
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 " |
d478be29444a
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 */ |
d478be29444a
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 */ |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
179 PURPLE_WEBSITE, /**< homepage */ |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
180 plugin_load, /**< load */ |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
181 plugin_unload, /**< unload */ |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
182 NULL, /**< destroy */ |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
183 NULL, /**< ui_info */ |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
184 NULL, /**< extra_info */ |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
185 NULL, /**< prefs_info */ |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
186 NULL, /**< actions */ |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
187 |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
188 /* padding */ |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
189 NULL, |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
190 NULL, |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
191 NULL, |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
192 NULL |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
193 }; |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
194 |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
195 static void |
d478be29444a
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) |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
197 { |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
198 } |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
199 |
d478be29444a
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) |
d478be29444a
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
201 |