Wed, 21 Sep 2011 06:45:26 +0000
Apply conversation theme when opening the GTK conversation. All the
parsing stuff was moved out of the theme code and into the conversation
code.
Someone (not me!) needs to check the code I commented out and see if
we really need that stuff (and then port it to WebKit/styling).
We also need to determine where to place Template.html and the rest
of our (not-yet-written) default theme.
|
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); |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
49 | |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
50 | 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
|
51 | 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
|
52 | 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
|
53 | |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
54 | 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
|
55 | } |
|
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 | static gboolean |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
58 | 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
|
59 | GtkWidget *webview) |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
60 | { |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
61 | GtkWidget *win; |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
62 | |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
63 | 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
|
64 | |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
65 | 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
|
66 | |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
67 | return TRUE; |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
68 | } |
|
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 | static void |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
71 | 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
|
72 | { |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
73 | 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
|
74 | WebKitWebSettings *settings; |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
75 | WebKitWebInspector *inspector; |
|
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 | 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
|
78 | 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
|
79 | |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
80 | 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
|
81 | |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
82 | 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
|
83 | 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
|
84 | 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
|
85 | 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
|
86 | } |
|
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 | static void |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
89 | 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
|
90 | { |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
91 | 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
|
92 | GtkWidget *win; |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
93 | WebKitWebSettings *settings; |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
94 | WebKitWebInspector *inspector; |
|
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 | 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
|
102 | |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
103 | 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
|
104 | } |
|
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 | static void |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
107 | 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
|
108 | { |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
109 | GtkWidget *inspect = NULL; |
|
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 | 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
|
112 | "inspector-window"); |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
113 | if (inspect == NULL) { |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
114 | setup_inspector(gtkconv); |
|
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 | |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
118 | static gboolean |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
119 | 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
|
120 | { |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
121 | 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
|
122 | 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
|
123 | |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
124 | 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
|
125 | 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
|
126 | |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
127 | while (convs) { |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
128 | 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
|
129 | |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
130 | /* Setup WebKit Inspector */ |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
131 | 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
|
132 | 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
|
133 | } |
|
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 | convs = convs->next; |
|
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 | |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
138 | return TRUE; |
|
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 | |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
141 | static gboolean |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
142 | 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
|
143 | { |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
144 | 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
|
145 | |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
146 | while (convs) { |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
147 | 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
|
148 | |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
149 | /* Remove WebKit Inspector */ |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
150 | 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
|
151 | 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
|
152 | } |
|
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 | convs = convs->next; |
|
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 | |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
157 | return TRUE; |
|
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 | |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
160 | static PurplePluginInfo info = |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
161 | { |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
162 | PURPLE_PLUGIN_MAGIC, |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
163 | 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
|
164 | 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
|
165 | 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
|
166 | 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
|
167 | 0, /**< flags */ |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
168 | NULL, /**< dependencies */ |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
169 | 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
|
170 | |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
171 | "gtkwebkit-inspect", /**< id */ |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
172 | 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
|
173 | DISPLAY_VERSION, /**< version */ |
|
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 Inspector."), /**< summary */ |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
175 | 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
|
176 | "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
|
177 | "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
|
178 | "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
|
179 | "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
|
180 | PURPLE_WEBSITE, /**< homepage */ |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
181 | plugin_load, /**< load */ |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
182 | plugin_unload, /**< unload */ |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
183 | NULL, /**< destroy */ |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
184 | NULL, /**< ui_info */ |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
185 | NULL, /**< extra_info */ |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
186 | NULL, /**< prefs_info */ |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
187 | NULL, /**< actions */ |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
188 | |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
189 | /* padding */ |
|
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 | NULL |
|
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 | static void |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
197 | 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
|
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 | |
|
0fb9ddb72e3e
Add a WebKit Development plugin, that allows opening the builtin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
201 | 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
|
202 |