pidgin/plugins/webkit.c

Thu, 27 Jun 2013 04:18:40 +0530

author
Ankit Vani <a@nevitus.org>
date
Thu, 27 Jun 2013 04:18:40 +0530
branch
soc.2013.gobjectification
changeset 34655
6a939719ea98
parent 34622
753f46dd000f
child 34883
7d9d0d7b7b62
permissions
-rw-r--r--

Replaced purple_conversations_get() with purple_conversations_get_all(), similar to other purple entities

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 #include "internal.h"
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
21
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
22 #include "version.h"
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 "pidgin.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 "gtkconv.h"
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
27 #include "gtkplugin.h"
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
28 #include "gtkwebview.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 static WebKitWebView *
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
31 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
32 WebKitWebView *webview,
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
33 PidginConversation *gtkconv)
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
34 {
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
35 GtkWidget *win;
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
36 GtkWidget *view;
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
37 char *title;
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 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
40 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
41 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
42 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
43 g_free(title);
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
44 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
45 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
46
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
47 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
48 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
49 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
50
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
51 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
52 }
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
53
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
54 static gboolean
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
55 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
56 GtkWidget *webview)
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 GtkWidget *win;
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
59
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
60 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
61
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
62 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
63
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
64 return TRUE;
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
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
67 static void
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
68 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
69 {
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
70 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
71 WebKitWebSettings *settings;
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
72 WebKitWebInspector *inspector;
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 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
75 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
76
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
77 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
78
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
79 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
80 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
81 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
82 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
83 }
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
84
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
85 static void
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
86 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
87 {
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
88 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
89 GtkWidget *win;
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
90 WebKitWebSettings *settings;
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 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
93 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
94 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
95
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
96 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
97
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(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
99 }
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
100
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
101 static void
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
102 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
103 {
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
104 GtkWidget *inspect = NULL;
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
105
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
106 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
107 "inspector-window");
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
108 if (inspect == NULL) {
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
109 setup_inspector(gtkconv);
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
110 }
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
111 }
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
112
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
113 static gboolean
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
114 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
115 {
34655
6a939719ea98 Replaced purple_conversations_get() with purple_conversations_get_all(), similar to other purple entities
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
116 GList *convs = purple_conversations_get_all();
32534
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
117 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
118
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
119 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
120 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
121
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
122 while (convs) {
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
123 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
124
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
125 /* Setup WebKit Inspector */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
126 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
127 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
128 }
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
129
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
130 convs = convs->next;
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
131 }
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 return TRUE;
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
134 }
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 static gboolean
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
137 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
138 {
34655
6a939719ea98 Replaced purple_conversations_get() with purple_conversations_get_all(), similar to other purple entities
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
139 GList *convs = purple_conversations_get_all();
32534
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
140
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
141 while (convs) {
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
142 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
143
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
144 /* Remove WebKit Inspector */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
145 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
146 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
147 }
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
148
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
149 convs = convs->next;
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
150 }
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 return TRUE;
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
153 }
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 static PurplePluginInfo info =
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
156 {
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
157 PURPLE_PLUGIN_MAGIC,
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
158 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
159 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
160 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
161 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
162 0, /**< flags */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
163 NULL, /**< dependencies */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
164 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
165
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
166 "gtkwebkit-inspect", /**< id */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
167 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
168 DISPLAY_VERSION, /**< version */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
169 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
170 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
171 "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
172 "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
173 "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
174 "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
175 PURPLE_WEBSITE, /**< homepage */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
176 plugin_load, /**< load */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
177 plugin_unload, /**< unload */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
178 NULL, /**< destroy */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
179 NULL, /**< ui_info */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
180 NULL, /**< extra_info */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
181 NULL, /**< prefs_info */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
182 NULL, /**< actions */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
183
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
184 /* padding */
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
185 NULL,
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
186 NULL,
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
187 NULL,
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
188 NULL
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
189 };
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
190
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
191 static void
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
192 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
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
0fb9ddb72e3e Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
196 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
197

mercurial