Tue, 21 Jan 2014 02:37:31 +0530
Update protocol IDs in codebase
| 15412 | 1 | /* |
| 15884 | 2 | * Purple - XMPP debugging tool |
| 15412 | 3 | * |
| 4 | * Copyright (C) 2002-2003, Sean Egan | |
| 5 | * | |
| 6 | * This program is free software; you can redistribute it and/or modify | |
| 7 | * it under the terms of the GNU General Public License as published by | |
| 8 | * the Free Software Foundation; either version 2 of the License, or | |
| 9 | * (at your option) any later version. | |
| 10 | * | |
| 11 | * This program is distributed in the hope that it will be useful, | |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 | * GNU General Public License for more details. | |
| 15 | * | |
| 16 | * You should have received a copy of the GNU General Public License | |
| 17 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18122
diff
changeset
|
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 15412 | 19 | * |
| 20 | */ | |
| 21 | ||
| 22 | #include "internal.h" | |
| 23 | #include "gtkplugin.h" | |
| 24 | #include "version.h" | |
|
36543
a8c3fecee2d3
Renamed prpl.[ch] to protocol.[ch]
Ankit Vani <a@nevitus.org>
parents:
36459
diff
changeset
|
25 | #include "protocol.h" |
| 15412 | 26 | #include "xmlnode.h" |
| 27 | ||
| 28 | #include "gtkimhtml.h" | |
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
29 | #include "gtkwebview.h" |
| 17242 | 30 | #include "gtkutils.h" |
| 15412 | 31 | |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
32 | #include <gdk/gdkkeysyms.h> |
|
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
33 | |
|
33170
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33160
diff
changeset
|
34 | #include "gtk3compat.h" |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33160
diff
changeset
|
35 | |
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
36 | #define PLUGIN_ID "gtk-xmpp" |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
37 | #define PLUGIN_DOMAIN (g_quark_from_static_string(PLUGIN_ID)) |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
38 | |
| 15412 | 39 | typedef struct { |
| 15884 | 40 | PurpleConnection *gc; |
| 15412 | 41 | GtkWidget *window; |
| 42 | GtkWidget *hbox; | |
| 43 | GtkWidget *dropdown; | |
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
44 | GtkWidget *webview; |
| 15412 | 45 | GtkWidget *entry; |
| 46 | GtkWidget *sw; | |
| 47 | int count; | |
| 48 | GList *accounts; | |
| 49 | } XmppConsole; | |
| 50 | ||
| 51 | XmppConsole *console = NULL; | |
| 52 | static void *xmpp_console_handle = NULL; | |
| 53 | ||
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
54 | #define EMPTY_HTML \ |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
55 | "<html><head><style type='text/css'>" \ |
|
32998
ded53a4a9f29
Use 'div's for indent which allows WebKit to do better word-wrapping.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32997
diff
changeset
|
56 | "body { word-wrap: break-word; margin: 0; }" \ |
|
ded53a4a9f29
Use 'div's for indent which allows WebKit to do better word-wrapping.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32997
diff
changeset
|
57 | "div.tab { padding-left: 1em; }" \ |
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
58 | "div.info { color: #777777; }" \ |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
59 | "div.incoming { background-color: #ffcece; }" \ |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
60 | "div.outgoing { background-color: #dcecc4; }" \ |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
61 | "span.bracket { color: #940f8c; }" \ |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
62 | "span.tag { color: #8b1dab; font-weight: bold; }" \ |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
63 | "span.attr { color: #a02961; font-weight: bold; }" \ |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
64 | "span.value { color: #324aa4; }" \ |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
65 | "span.xmlns { color: #2cb12f; font-weight: bold;}" \ |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
66 | "</style></head></html>" |
| 15412 | 67 | |
| 68 | static char * | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
69 | purple_xmlnode_to_pretty_str(PurpleXmlNode *node, int *len) |
| 15412 | 70 | { |
| 71 | GString *text = g_string_new(""); | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
72 | PurpleXmlNode *c; |
|
32998
ded53a4a9f29
Use 'div's for indent which allows WebKit to do better word-wrapping.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32997
diff
changeset
|
73 | char *node_name, *esc, *esc2; |
| 15412 | 74 | gboolean need_end = FALSE, pretty = TRUE; |
| 75 | ||
| 76 | g_return_val_if_fail(node != NULL, NULL); | |
| 77 | ||
| 78 | node_name = g_markup_escape_text(node->name, -1); | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
79 | g_string_append_printf(text, |
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
80 | "<span class=bracket><</span>" |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
81 | "<span class=tag>%s</span>", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
82 | node_name); |
| 15412 | 83 | |
| 84 | if (node->xmlns) { | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
85 | if ((!node->parent || |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
86 | !node->parent->xmlns || |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
87 | strcmp(node->xmlns, node->parent->xmlns)) && |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
88 | strcmp(node->xmlns, "jabber:client")) |
| 15412 | 89 | { |
| 90 | char *xmlns = g_markup_escape_text(node->xmlns, -1); | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
91 | g_string_append_printf(text, |
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
92 | " <span class=attr>xmlns</span>=" |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
93 | "'<span class=xmlns>%s</span>'", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
94 | xmlns); |
| 15412 | 95 | g_free(xmlns); |
| 96 | } | |
| 97 | } | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
98 | for (c = node->child; c; c = c->next) |
| 15412 | 99 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
100 | if (c->type == PURPLE_XMLNODE_TYPE_ATTRIB) { |
| 15412 | 101 | esc = g_markup_escape_text(c->name, -1); |
| 102 | esc2 = g_markup_escape_text(c->data, -1); | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
103 | g_string_append_printf(text, |
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
104 | " <span class=attr>%s</span>=" |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
105 | "'<span class=value>%s</span>'", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
106 | esc, esc2); |
| 15412 | 107 | g_free(esc); |
| 108 | g_free(esc2); | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
109 | } else if (c->type == PURPLE_XMLNODE_TYPE_TAG || c->type == PURPLE_XMLNODE_TYPE_DATA) { |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
110 | if (c->type == PURPLE_XMLNODE_TYPE_DATA) |
| 15412 | 111 | pretty = FALSE; |
| 112 | need_end = TRUE; | |
| 113 | } | |
| 114 | } | |
| 115 | ||
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
116 | if (need_end) { |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
117 | g_string_append_printf(text, |
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
118 | "<span class=bracket>></span>%s", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
119 | pretty ? "<br>" : ""); |
| 15412 | 120 | |
|
32998
ded53a4a9f29
Use 'div's for indent which allows WebKit to do better word-wrapping.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32997
diff
changeset
|
121 | need_end = FALSE; |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
122 | for (c = node->child; c; c = c->next) |
| 15412 | 123 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
124 | if (c->type == PURPLE_XMLNODE_TYPE_TAG) { |
| 15412 | 125 | int esc_len; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
126 | esc = purple_xmlnode_to_pretty_str(c, &esc_len); |
|
32998
ded53a4a9f29
Use 'div's for indent which allows WebKit to do better word-wrapping.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32997
diff
changeset
|
127 | if (!need_end) { |
|
ded53a4a9f29
Use 'div's for indent which allows WebKit to do better word-wrapping.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32997
diff
changeset
|
128 | g_string_append(text, "<div class=tab>"); |
|
ded53a4a9f29
Use 'div's for indent which allows WebKit to do better word-wrapping.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32997
diff
changeset
|
129 | need_end = TRUE; |
|
ded53a4a9f29
Use 'div's for indent which allows WebKit to do better word-wrapping.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32997
diff
changeset
|
130 | } |
| 15412 | 131 | text = g_string_append_len(text, esc, esc_len); |
| 132 | g_free(esc); | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
133 | } else if (c->type == PURPLE_XMLNODE_TYPE_DATA && c->data_sz > 0) { |
| 15412 | 134 | esc = g_markup_escape_text(c->data, c->data_sz); |
| 135 | text = g_string_append(text, esc); | |
| 136 | g_free(esc); | |
| 137 | } | |
| 138 | } | |
| 139 | ||
|
32998
ded53a4a9f29
Use 'div's for indent which allows WebKit to do better word-wrapping.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32997
diff
changeset
|
140 | if (need_end) |
|
ded53a4a9f29
Use 'div's for indent which allows WebKit to do better word-wrapping.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32997
diff
changeset
|
141 | g_string_append(text, "</div>"); |
|
ded53a4a9f29
Use 'div's for indent which allows WebKit to do better word-wrapping.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32997
diff
changeset
|
142 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
143 | g_string_append_printf(text, |
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
144 | "<span class=bracket><</span>/" |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
145 | "<span class=tag>%s</span>" |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
146 | "<span class=bracket>></span><br>", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
147 | node_name); |
| 15412 | 148 | } else { |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
149 | g_string_append_printf(text, |
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
150 | "/<span class=bracket>></span><br>"); |
| 15412 | 151 | } |
| 152 | ||
| 153 | g_free(node_name); | |
| 154 | ||
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
155 | if (len) |
| 15412 | 156 | *len = text->len; |
| 157 | ||
| 158 | return g_string_free(text, FALSE); | |
| 159 | } | |
| 160 | ||
| 161 | static void | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
162 | purple_xmlnode_received_cb(PurpleConnection *gc, PurpleXmlNode **packet, gpointer null) |
| 15412 | 163 | { |
| 164 | char *str, *formatted; | |
| 165 | ||
| 166 | if (!console || console->gc != gc) | |
| 167 | return; | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
168 | str = purple_xmlnode_to_pretty_str(*packet, NULL); |
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
169 | formatted = g_strdup_printf("<div class=incoming>%s</div>", str); |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
170 | gtk_webview_append_html(GTK_WEBVIEW(console->webview), formatted); |
| 15412 | 171 | g_free(formatted); |
| 172 | g_free(str); | |
| 173 | } | |
| 174 | ||
| 175 | static void | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
176 | purple_xmlnode_sent_cb(PurpleConnection *gc, char **packet, gpointer null) |
| 15412 | 177 | { |
| 178 | char *str; | |
| 179 | char *formatted; | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
180 | PurpleXmlNode *node; |
| 15412 | 181 | |
| 182 | if (!console || console->gc != gc) | |
| 183 | return; | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
184 | node = purple_xmlnode_from_str(*packet, -1); |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
185 | |
| 15412 | 186 | if (!node) |
| 187 | return; | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
188 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
189 | str = purple_xmlnode_to_pretty_str(node, NULL); |
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
190 | formatted = g_strdup_printf("<div class=outgoing>%s</div>", str); |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
191 | gtk_webview_append_html(GTK_WEBVIEW(console->webview), formatted); |
| 15412 | 192 | g_free(formatted); |
| 193 | g_free(str); | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
194 | purple_xmlnode_free(node); |
| 15412 | 195 | } |
| 196 | ||
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
197 | static gboolean |
|
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
198 | message_send_cb(GtkWidget *widget, GdkEventKey *event, gpointer p) |
| 15412 | 199 | { |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
200 | PurpleProtocol *protocol = NULL; |
|
30626
bec413ce77c7
Fix some "Dead nested assignment"s and then kill off some useless
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30010
diff
changeset
|
201 | PurpleConnection *gc; |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
202 | gchar *text; |
|
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
203 | |
|
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
204 | if (event->keyval != GDK_KEY_KP_Enter && event->keyval != GDK_KEY_Return) |
|
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
205 | return FALSE; |
| 15412 | 206 | |
| 207 | gc = console->gc; | |
|
17529
5fd44f61d007
Fix a crash when trying to use XMPP console with no XMPP accounts connected
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16749
diff
changeset
|
208 | |
|
5fd44f61d007
Fix a crash when trying to use XMPP console with no XMPP accounts connected
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16749
diff
changeset
|
209 | if (gc) |
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
210 | protocol = purple_connection_get_protocol(gc); |
|
17529
5fd44f61d007
Fix a crash when trying to use XMPP console with no XMPP accounts connected
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16749
diff
changeset
|
211 | |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
212 | text = gtk_webview_get_body_text(GTK_WEBVIEW(widget)); |
|
17529
5fd44f61d007
Fix a crash when trying to use XMPP console with no XMPP accounts connected
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16749
diff
changeset
|
213 | |
|
36633
2dcb81a189bd
Refactored pidgin to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36626
diff
changeset
|
214 | if (protocol) |
| 36719 | 215 | purple_protocol_server_iface_send_raw(protocol, gc, text, strlen(text)); |
| 15412 | 216 | |
| 217 | g_free(text); | |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
218 | gtk_webview_load_html_string(GTK_WEBVIEW(console->entry), ""); |
|
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
219 | |
|
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
220 | return TRUE; |
| 15412 | 221 | } |
| 222 | ||
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
223 | static void |
|
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
224 | entry_changed_cb(GtkWidget *webview, void *data) |
| 15412 | 225 | { |
| 226 | char *xmlstr, *str; | |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
227 | #if 0 |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
228 | int wrapped_lines; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
229 | int lines; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
230 | GdkRectangle oneline; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
231 | int height; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
232 | int pad_top, pad_inside, pad_bottom; |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
233 | #endif |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
234 | PurpleXmlNode *node; |
| 15412 | 235 | |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
236 | #if 0 |
|
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
237 | /* TODO WebKit: Do entry auto-sizing... */ |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
238 | wrapped_lines = 1; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
239 | gtk_text_buffer_get_start_iter(buffer, &iter); |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
240 | gtk_text_view_get_iter_location(GTK_TEXT_VIEW(console->entry), &iter, &oneline); |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
241 | while (gtk_text_view_forward_display_line(GTK_TEXT_VIEW(console->entry), &iter)) |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
242 | wrapped_lines++; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
243 | |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
244 | lines = gtk_text_buffer_get_line_count(buffer); |
| 15412 | 245 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
246 | /* Show a maximum of 64 lines */ |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
247 | lines = MIN(lines, 6); |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
248 | wrapped_lines = MIN(wrapped_lines, 6); |
| 15412 | 249 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
250 | pad_top = gtk_text_view_get_pixels_above_lines(GTK_TEXT_VIEW(console->entry)); |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
251 | pad_bottom = gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(console->entry)); |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
252 | pad_inside = gtk_text_view_get_pixels_inside_wrap(GTK_TEXT_VIEW(console->entry)); |
| 15412 | 253 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
254 | height = (oneline.height + pad_top + pad_bottom) * lines; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
255 | height += (oneline.height + pad_inside) * (wrapped_lines - lines); |
| 15412 | 256 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
257 | gtk_widget_set_size_request(console->sw, -1, height + 6); |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
258 | #endif |
| 15412 | 259 | |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
260 | str = gtk_webview_get_body_text(GTK_WEBVIEW(webview)); |
| 15412 | 261 | if (!str) |
| 262 | return; | |
| 263 | xmlstr = g_strdup_printf("<xml>%s</xml>", str); | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
264 | node = purple_xmlnode_from_str(xmlstr, -1); |
| 15412 | 265 | if (node) { |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
266 | gtk_webview_clear_formatting(GTK_WEBVIEW(console->entry)); |
| 15412 | 267 | } else { |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
268 | gtk_webview_toggle_backcolor(GTK_WEBVIEW(console->entry), "#ffcece"); |
| 15412 | 269 | } |
| 270 | g_free(str); | |
| 271 | g_free(xmlstr); | |
| 272 | if (node) | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
273 | purple_xmlnode_free(node); |
| 15412 | 274 | } |
| 275 | ||
| 276 | static void iq_clicked_cb(GtkWidget *w, gpointer nul) | |
| 277 | { | |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
278 | GtkWidget *vbox, *hbox, *to_entry, *label, *type_combo; |
| 15412 | 279 | GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
280 | char *to; |
| 15412 | 281 | int result; |
| 282 | char *stanza; | |
| 283 | ||
| 284 | GtkWidget *dialog = gtk_dialog_new_with_buttons("<iq/>", | |
| 285 | GTK_WINDOW(console->window), | |
| 286 | GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, | |
| 287 | GTK_STOCK_CANCEL, | |
| 288 | GTK_RESPONSE_REJECT, | |
| 289 | GTK_STOCK_OK, | |
| 290 | GTK_RESPONSE_ACCEPT, | |
| 291 | NULL); | |
|
32912
6f4a4f8ad117
The function gtk_dialog_set_has_separator was removed in GTK+ 2.22.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32624
diff
changeset
|
292 | #if !GTK_CHECK_VERSION(2,22,0) |
| 15412 | 293 | gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); |
|
32912
6f4a4f8ad117
The function gtk_dialog_set_has_separator was removed in GTK+ 2.22.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32624
diff
changeset
|
294 | #endif |
| 15412 | 295 | gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); |
| 296 | gtk_container_set_border_width(GTK_CONTAINER(dialog), 12); | |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
297 | vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); |
| 15412 | 298 | |
| 299 | hbox = gtk_hbox_new(FALSE, 3); | |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
300 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 301 | |
| 302 | label = gtk_label_new("To:"); | |
| 303 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 304 | gtk_size_group_add_widget(sg, label); | |
| 305 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 306 | ||
| 307 | to_entry = gtk_entry_new(); | |
| 308 | gtk_entry_set_activates_default (GTK_ENTRY (to_entry), TRUE); | |
| 309 | gtk_box_pack_start(GTK_BOX(hbox), to_entry, FALSE, FALSE, 0); | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
310 | |
| 15412 | 311 | hbox = gtk_hbox_new(FALSE, 3); |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
312 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 313 | label = gtk_label_new("Type:"); |
| 314 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 315 | ||
| 316 | gtk_size_group_add_widget(sg, label); | |
| 317 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
318 | type_combo = gtk_combo_box_text_new(); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
319 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "get"); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
320 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "set"); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
321 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "result"); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
322 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "error"); |
| 15412 | 323 | gtk_combo_box_set_active(GTK_COMBO_BOX(type_combo), 0); |
| 324 | gtk_box_pack_start(GTK_BOX(hbox), type_combo, FALSE, FALSE, 0); | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
325 | |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
326 | gtk_widget_show_all(vbox); |
| 15412 | 327 | |
| 328 | result = gtk_dialog_run(GTK_DIALOG(dialog)); | |
| 329 | if (result != GTK_RESPONSE_ACCEPT) { | |
| 330 | gtk_widget_destroy(dialog); | |
| 331 | return; | |
| 332 | } | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
333 | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
334 | to = g_markup_escape_text(gtk_entry_get_text(GTK_ENTRY(to_entry)), -1); |
| 15412 | 335 | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
336 | stanza = g_strdup_printf("<iq %s%s%s id='console%x' type='%s'>" |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
337 | "<a id=caret></a>" |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
338 | "</iq>", |
| 15412 | 339 | to && *to ? "to='" : "", |
| 340 | to && *to ? to : "", | |
| 341 | to && *to ? "'" : "", | |
| 342 | g_random_int(), | |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
343 | gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(type_combo))); |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
344 | |
|
33083
e96acbe0e928
Move caret selection into GtkWebView code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33053
diff
changeset
|
345 | gtk_webview_load_html_string_with_selection(GTK_WEBVIEW(console->entry), stanza); |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
346 | gtk_widget_grab_focus(console->entry); |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
347 | g_free(to); |
| 15412 | 348 | g_free(stanza); |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
349 | |
| 15412 | 350 | gtk_widget_destroy(dialog); |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
351 | g_object_unref(sg); |
| 15412 | 352 | } |
| 353 | ||
| 354 | static void presence_clicked_cb(GtkWidget *w, gpointer nul) | |
| 355 | { | |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
356 | GtkWidget *vbox; |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
357 | GtkWidget *hbox; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
358 | GtkWidget *to_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
359 | GtkWidget *status_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
360 | GtkWidget *priority_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
361 | GtkWidget *label; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
362 | GtkWidget *show_combo; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
363 | GtkWidget *type_combo; |
| 15412 | 364 | GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
365 | char *to, *status, *priority; |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
366 | const char *type, *show; |
| 15412 | 367 | int result; |
| 368 | char *stanza; | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
369 | |
| 15412 | 370 | GtkWidget *dialog = gtk_dialog_new_with_buttons("<presence/>", |
| 371 | GTK_WINDOW(console->window), | |
| 372 | GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, | |
| 373 | GTK_STOCK_CANCEL, | |
| 374 | GTK_RESPONSE_REJECT, | |
| 375 | GTK_STOCK_OK, | |
| 376 | GTK_RESPONSE_ACCEPT, | |
| 377 | NULL); | |
|
32912
6f4a4f8ad117
The function gtk_dialog_set_has_separator was removed in GTK+ 2.22.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32624
diff
changeset
|
378 | #if !GTK_CHECK_VERSION(2,22,0) |
| 15412 | 379 | gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); |
|
32912
6f4a4f8ad117
The function gtk_dialog_set_has_separator was removed in GTK+ 2.22.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32624
diff
changeset
|
380 | #endif |
| 15412 | 381 | gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); |
| 382 | gtk_container_set_border_width(GTK_CONTAINER(dialog), 12); | |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
383 | vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); |
| 15412 | 384 | |
| 385 | hbox = gtk_hbox_new(FALSE, 3); | |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
386 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 387 | |
| 388 | label = gtk_label_new("To:"); | |
| 389 | gtk_size_group_add_widget(sg, label); | |
| 390 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 391 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 392 | ||
| 393 | to_entry = gtk_entry_new(); | |
| 394 | gtk_entry_set_activates_default (GTK_ENTRY (to_entry), TRUE); | |
| 395 | gtk_box_pack_start(GTK_BOX(hbox), to_entry, FALSE, FALSE, 0); | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
396 | |
| 15412 | 397 | hbox = gtk_hbox_new(FALSE, 3); |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
398 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 399 | label = gtk_label_new("Type:"); |
| 400 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 401 | gtk_size_group_add_widget(sg, label); | |
| 402 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
403 | type_combo = gtk_combo_box_text_new(); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
404 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "default"); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
405 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "unavailable"); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
406 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "subscribe"); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
407 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "unsubscribe"); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
408 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "subscribed"); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
409 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "unsubscribed"); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
410 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "probe"); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
411 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "error"); |
| 15412 | 412 | gtk_combo_box_set_active(GTK_COMBO_BOX(type_combo), 0); |
| 413 | gtk_box_pack_start(GTK_BOX(hbox), type_combo, FALSE, FALSE, 0); | |
| 414 | ||
| 415 | hbox = gtk_hbox_new(FALSE, 3); | |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
416 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 417 | label = gtk_label_new("Show:"); |
| 418 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 419 | gtk_size_group_add_widget(sg, label); | |
| 420 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
421 | show_combo = gtk_combo_box_text_new(); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
422 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(show_combo), "default"); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
423 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(show_combo), "away"); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
424 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(show_combo), "dnd"); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
425 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(show_combo), "xa"); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
426 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(show_combo), "chat"); |
| 15412 | 427 | |
| 428 | gtk_combo_box_set_active(GTK_COMBO_BOX(show_combo), 0); | |
| 429 | gtk_box_pack_start(GTK_BOX(hbox), show_combo, FALSE, FALSE, 0); | |
| 430 | ||
| 431 | hbox = gtk_hbox_new(FALSE, 3); | |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
432 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 433 | |
| 434 | label = gtk_label_new("Status:"); | |
| 435 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 436 | gtk_size_group_add_widget(sg, label); | |
| 437 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 438 | ||
| 439 | status_entry = gtk_entry_new(); | |
| 440 | gtk_entry_set_activates_default (GTK_ENTRY (status_entry), TRUE); | |
| 441 | gtk_box_pack_start(GTK_BOX(hbox), status_entry, FALSE, FALSE, 0); | |
| 442 | ||
| 443 | hbox = gtk_hbox_new(FALSE, 3); | |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
444 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 445 | |
| 446 | label = gtk_label_new("Priority:"); | |
| 447 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 448 | gtk_size_group_add_widget(sg, label); | |
| 449 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 450 | ||
| 451 | priority_entry = gtk_spin_button_new_with_range(-128, 127, 1); | |
| 452 | gtk_spin_button_set_value(GTK_SPIN_BUTTON(priority_entry), 0); | |
| 453 | gtk_box_pack_start(GTK_BOX(hbox), priority_entry, FALSE, FALSE, 0); | |
| 454 | ||
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
455 | gtk_widget_show_all(vbox); |
| 15412 | 456 | |
| 457 | result = gtk_dialog_run(GTK_DIALOG(dialog)); | |
| 458 | if (result != GTK_RESPONSE_ACCEPT) { | |
| 459 | gtk_widget_destroy(dialog); | |
| 460 | return; | |
| 461 | } | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
462 | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
463 | to = g_markup_escape_text(gtk_entry_get_text(GTK_ENTRY(to_entry)), -1); |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
464 | type = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(type_combo)); |
| 15412 | 465 | if (!strcmp(type, "default")) |
| 466 | type = ""; | |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
467 | show = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(show_combo)); |
| 15412 | 468 | if (!strcmp(show, "default")) |
| 469 | show = ""; | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
470 | status = g_markup_escape_text(gtk_entry_get_text(GTK_ENTRY(status_entry)), -1); |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
471 | priority = g_markup_escape_text(gtk_entry_get_text(GTK_ENTRY(priority_entry)), -1); |
| 15412 | 472 | if (!strcmp(priority, "0")) |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
473 | *priority = '\0'; |
| 15412 | 474 | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
475 | stanza = g_strdup_printf("<presence %s%s%s id='console%x' %s%s%s>" |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
476 | "%s%s%s%s%s%s%s%s%s" |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
477 | "<a id=caret></a>" |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
478 | "</presence>", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
479 | *to ? "to='" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
480 | *to ? to : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
481 | *to ? "'" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
482 | g_random_int(), |
| 15412 | 483 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
484 | *type ? "type='" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
485 | *type ? type : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
486 | *type ? "'" : "", |
| 15412 | 487 | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
488 | *show ? "<show>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
489 | *show ? show : "", |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
490 | *show ? "</show>" : "", |
| 15412 | 491 | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
492 | *status ? "<status>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
493 | *status ? status : "", |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
494 | *status ? "</status>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
495 | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
496 | *priority ? "<priority>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
497 | *priority ? priority : "", |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
498 | *priority ? "</priority>" : ""); |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
499 | |
|
33083
e96acbe0e928
Move caret selection into GtkWebView code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33053
diff
changeset
|
500 | gtk_webview_load_html_string_with_selection(GTK_WEBVIEW(console->entry), stanza); |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
501 | gtk_widget_grab_focus(console->entry); |
| 15412 | 502 | g_free(stanza); |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
503 | g_free(to); |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
504 | g_free(status); |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
505 | g_free(priority); |
| 15412 | 506 | |
| 507 | gtk_widget_destroy(dialog); | |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
508 | g_object_unref(sg); |
| 15412 | 509 | } |
| 510 | ||
| 511 | static void message_clicked_cb(GtkWidget *w, gpointer nul) | |
| 512 | { | |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
513 | GtkWidget *vbox; |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
514 | GtkWidget *hbox; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
515 | GtkWidget *to_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
516 | GtkWidget *body_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
517 | GtkWidget *thread_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
518 | GtkWidget *subject_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
519 | GtkWidget *label; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
520 | GtkWidget *type_combo; |
| 15412 | 521 | GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
522 | char *to, *body, *thread, *subject; |
| 15412 | 523 | char *stanza; |
| 524 | int result; | |
| 525 | ||
| 526 | GtkWidget *dialog = gtk_dialog_new_with_buttons("<message/>", | |
| 527 | GTK_WINDOW(console->window), | |
| 528 | GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, | |
| 529 | GTK_STOCK_CANCEL, | |
| 530 | GTK_RESPONSE_REJECT, | |
| 531 | GTK_STOCK_OK, | |
| 532 | GTK_RESPONSE_ACCEPT, | |
| 533 | NULL); | |
|
32912
6f4a4f8ad117
The function gtk_dialog_set_has_separator was removed in GTK+ 2.22.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32624
diff
changeset
|
534 | #if !GTK_CHECK_VERSION(2,22,0) |
| 15412 | 535 | gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); |
|
32912
6f4a4f8ad117
The function gtk_dialog_set_has_separator was removed in GTK+ 2.22.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32624
diff
changeset
|
536 | #endif |
| 15412 | 537 | gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); |
| 538 | gtk_container_set_border_width(GTK_CONTAINER(dialog), 12); | |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
539 | vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); |
| 15412 | 540 | |
| 541 | hbox = gtk_hbox_new(FALSE, 3); | |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
542 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 543 | |
| 544 | label = gtk_label_new("To:"); | |
| 545 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 546 | gtk_size_group_add_widget(sg, label); | |
| 547 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 548 | ||
| 549 | to_entry = gtk_entry_new(); | |
| 550 | gtk_entry_set_activates_default (GTK_ENTRY (to_entry), TRUE); | |
| 551 | gtk_box_pack_start(GTK_BOX(hbox), to_entry, FALSE, FALSE, 0); | |
| 552 | ||
| 553 | hbox = gtk_hbox_new(FALSE, 3); | |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
554 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 555 | label = gtk_label_new("Type:"); |
| 556 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 557 | gtk_size_group_add_widget(sg, label); | |
| 558 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
559 | type_combo = gtk_combo_box_text_new(); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
560 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "chat"); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
561 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "headline"); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
562 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "groupchat"); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
563 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "normal"); |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
564 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "error"); |
| 15412 | 565 | gtk_combo_box_set_active(GTK_COMBO_BOX(type_combo), 0); |
| 566 | gtk_box_pack_start(GTK_BOX(hbox), type_combo, FALSE, FALSE, 0); | |
| 567 | ||
| 568 | hbox = gtk_hbox_new(FALSE, 3); | |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
569 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 570 | |
| 571 | label = gtk_label_new("Body:"); | |
| 572 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 573 | gtk_size_group_add_widget(sg, label); | |
| 574 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 575 | ||
| 576 | body_entry = gtk_entry_new(); | |
| 577 | gtk_entry_set_activates_default (GTK_ENTRY (body_entry), TRUE); | |
| 578 | gtk_box_pack_start(GTK_BOX(hbox), body_entry, FALSE, FALSE, 0); | |
| 579 | ||
| 580 | hbox = gtk_hbox_new(FALSE, 3); | |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
581 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 582 | |
| 583 | label = gtk_label_new("Subject:"); | |
| 584 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 585 | gtk_size_group_add_widget(sg, label); | |
| 586 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 587 | ||
| 588 | subject_entry = gtk_entry_new(); | |
| 589 | gtk_entry_set_activates_default (GTK_ENTRY (subject_entry), TRUE); | |
| 590 | gtk_box_pack_start(GTK_BOX(hbox), subject_entry, FALSE, FALSE, 0); | |
| 591 | ||
| 592 | hbox = gtk_hbox_new(FALSE, 3); | |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
593 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 594 | |
| 595 | label = gtk_label_new("Thread:"); | |
| 596 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 597 | gtk_size_group_add_widget(sg, label); | |
| 598 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 599 | ||
| 600 | thread_entry = gtk_entry_new(); | |
| 601 | gtk_entry_set_activates_default (GTK_ENTRY (thread_entry), TRUE); | |
| 602 | gtk_box_pack_start(GTK_BOX(hbox), thread_entry, FALSE, FALSE, 0); | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
603 | |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
604 | gtk_widget_show_all(vbox); |
| 15412 | 605 | |
| 606 | result = gtk_dialog_run(GTK_DIALOG(dialog)); | |
| 607 | if (result != GTK_RESPONSE_ACCEPT) { | |
| 608 | gtk_widget_destroy(dialog); | |
| 609 | return; | |
| 610 | } | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
611 | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
612 | to = g_markup_escape_text(gtk_entry_get_text(GTK_ENTRY(to_entry)), -1); |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
613 | body = g_markup_escape_text(gtk_entry_get_text(GTK_ENTRY(body_entry)), -1); |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
614 | thread = g_markup_escape_text(gtk_entry_get_text(GTK_ENTRY(thread_entry)), -1); |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
615 | subject = g_markup_escape_text(gtk_entry_get_text(GTK_ENTRY(subject_entry)), -1); |
| 15412 | 616 | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
617 | stanza = g_strdup_printf("<message %s%s%s id='console%x' type='%s'>" |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
618 | "%s%s%s%s%s%s%s%s%s" |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
619 | "<a id=caret></a>" |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
620 | "</message>", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
621 | |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
622 | *to ? "to='" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
623 | *to ? to : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
624 | *to ? "'" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
625 | g_random_int(), |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
626 | gtk_combo_box_text_get_active_text( |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
627 | GTK_COMBO_BOX_TEXT(type_combo)), |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
628 | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
629 | *body ? "<body>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
630 | *body ? body : "", |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
631 | *body ? "</body>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
632 | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
633 | *subject ? "<subject>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
634 | *subject ? subject : "", |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
635 | *subject ? "</subject>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
636 | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
637 | *thread ? "<thread>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
638 | *thread ? thread : "", |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
639 | *thread ? "</thread>" : ""); |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
640 | |
|
33083
e96acbe0e928
Move caret selection into GtkWebView code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33053
diff
changeset
|
641 | gtk_webview_load_html_string_with_selection(GTK_WEBVIEW(console->entry), stanza); |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
642 | gtk_widget_grab_focus(console->entry); |
| 15412 | 643 | g_free(stanza); |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
644 | g_free(to); |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
645 | g_free(body); |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
646 | g_free(thread); |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
647 | g_free(subject); |
| 15412 | 648 | |
| 649 | gtk_widget_destroy(dialog); | |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
650 | g_object_unref(sg); |
| 15412 | 651 | } |
| 652 | ||
| 653 | static void | |
|
29783
96ab389c9181
xmppconsole: Properly catch things before an account is "signed on".
Paul Aurich <darkrain42@pidgin.im>
parents:
29529
diff
changeset
|
654 | signing_on_cb(PurpleConnection *gc) |
| 15412 | 655 | { |
|
32996
65221079a957
The XMPP Console incorrectly shows non-XMPP accounts that sign on after opening.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32995
diff
changeset
|
656 | PurpleAccount *account; |
|
65221079a957
The XMPP Console incorrectly shows non-XMPP accounts that sign on after opening.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32995
diff
changeset
|
657 | |
| 15412 | 658 | if (!console) |
| 659 | return; | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
660 | |
|
32996
65221079a957
The XMPP Console incorrectly shows non-XMPP accounts that sign on after opening.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32995
diff
changeset
|
661 | account = purple_connection_get_account(gc); |
|
37005
702a601fc2ca
Update protocol IDs in codebase
Ankit Vani <a@nevitus.org>
parents:
36934
diff
changeset
|
662 | if (strcmp(purple_account_get_protocol_id(account), "prpl-jabber")) |
|
32996
65221079a957
The XMPP Console incorrectly shows non-XMPP accounts that sign on after opening.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32995
diff
changeset
|
663 | return; |
|
65221079a957
The XMPP Console incorrectly shows non-XMPP accounts that sign on after opening.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32995
diff
changeset
|
664 | |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
665 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(console->dropdown), |
|
33146
1f729ff8cab4
propagate from branch 'im.pidgin.pidgin' (head 83f9edc4c976eefa029bc8591603c404e7c6a53a)
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
666 | purple_account_get_username(account)); |
| 15412 | 667 | console->accounts = g_list_append(console->accounts, gc); |
| 668 | console->count++; | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
669 | |
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
670 | if (console->count == 1) { |
|
29783
96ab389c9181
xmppconsole: Properly catch things before an account is "signed on".
Paul Aurich <darkrain42@pidgin.im>
parents:
29529
diff
changeset
|
671 | console->gc = gc; |
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
672 | gtk_webview_load_html_string(GTK_WEBVIEW(console->webview), EMPTY_HTML); |
|
32996
65221079a957
The XMPP Console incorrectly shows non-XMPP accounts that sign on after opening.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32995
diff
changeset
|
673 | gtk_combo_box_set_active(GTK_COMBO_BOX(console->dropdown), 0); |
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
674 | } else |
| 15412 | 675 | gtk_widget_show_all(console->hbox); |
| 676 | } | |
| 677 | ||
| 678 | static void | |
| 15884 | 679 | signed_off_cb(PurpleConnection *gc) |
| 15412 | 680 | { |
| 681 | int i = 0; | |
| 682 | GList *l; | |
| 683 | ||
| 684 | if (!console) | |
| 685 | return; | |
| 686 | ||
| 687 | l = console->accounts; | |
| 688 | while (l) { | |
| 15884 | 689 | PurpleConnection *g = l->data; |
| 15412 | 690 | if (gc == g) |
| 691 | break; | |
| 692 | i++; | |
| 693 | l = l->next; | |
| 694 | } | |
| 695 | ||
| 696 | if (l == NULL) | |
| 697 | return; | |
| 698 | ||
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
699 | gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(console->dropdown), i); |
| 15412 | 700 | console->accounts = g_list_remove(console->accounts, gc); |
| 701 | console->count--; | |
| 702 | ||
| 703 | if (gc == console->gc) { | |
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
704 | char *tmp = g_strdup_printf("<div class=info>%s</div>", |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
705 | _("Logged out.")); |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
706 | gtk_webview_append_html(GTK_WEBVIEW(console->webview), tmp); |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
707 | g_free(tmp); |
| 15412 | 708 | console->gc = NULL; |
| 709 | } | |
| 710 | } | |
| 711 | ||
| 712 | static void | |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
713 | console_destroy(GtkWidget *window, gpointer nul) |
| 15412 | 714 | { |
| 715 | g_list_free(console->accounts); | |
| 716 | g_free(console); | |
| 717 | console = NULL; | |
| 718 | } | |
| 719 | ||
| 720 | static void | |
| 721 | dropdown_changed_cb(GtkComboBox *widget, gpointer nul) | |
| 722 | { | |
| 723 | if (!console) | |
| 724 | return; | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
725 | |
|
32997
39bfe55ac9f4
No need to search for accounts when we already have a list of them.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32996
diff
changeset
|
726 | console->gc = g_list_nth_data(console->accounts, gtk_combo_box_get_active(GTK_COMBO_BOX(console->dropdown))); |
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
727 | gtk_webview_load_html_string(GTK_WEBVIEW(console->webview), EMPTY_HTML); |
| 15412 | 728 | } |
| 729 | ||
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
730 | static void |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
731 | create_console(PurplePluginAction *action) |
| 15412 | 732 | { |
| 733 | GtkWidget *vbox = gtk_vbox_new(FALSE, 6); | |
| 734 | GtkWidget *label; | |
| 735 | GtkWidget *toolbar; | |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
736 | GList *connections; |
| 15412 | 737 | GtkToolItem *button; |
| 738 | ||
| 739 | if (console) { | |
| 740 | gtk_window_present(GTK_WINDOW(console->window)); | |
| 741 | return; | |
| 742 | } | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
743 | |
| 15412 | 744 | console = g_new0(XmppConsole, 1); |
| 745 | ||
| 17213 | 746 | console->window = pidgin_create_window(_("XMPP Console"), PIDGIN_HIG_BORDER, NULL, TRUE); |
| 15412 | 747 | g_signal_connect(G_OBJECT(console->window), "destroy", G_CALLBACK(console_destroy), NULL); |
| 748 | gtk_window_set_default_size(GTK_WINDOW(console->window), 580, 400); | |
| 749 | gtk_container_add(GTK_CONTAINER(console->window), vbox); | |
| 750 | ||
| 751 | console->hbox = gtk_hbox_new(FALSE, 3); | |
| 752 | gtk_box_pack_start(GTK_BOX(vbox), console->hbox, FALSE, FALSE, 0); | |
| 753 | label = gtk_label_new(_("Account: ")); | |
| 754 | gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); | |
| 755 | gtk_box_pack_start(GTK_BOX(console->hbox), label, FALSE, FALSE, 0); | |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
756 | console->dropdown = gtk_combo_box_text_new(); |
| 15884 | 757 | for (connections = purple_connections_get_all(); connections; connections = connections->next) { |
| 758 | PurpleConnection *gc = connections->data; | |
|
37005
702a601fc2ca
Update protocol IDs in codebase
Ankit Vani <a@nevitus.org>
parents:
36934
diff
changeset
|
759 | if (!strcmp(purple_account_get_protocol_id(purple_connection_get_account(gc)), "prpl-jabber")) { |
| 15412 | 760 | console->count++; |
| 761 | console->accounts = g_list_append(console->accounts, gc); | |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30626
diff
changeset
|
762 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(console->dropdown), |
| 15884 | 763 | purple_account_get_username(purple_connection_get_account(gc))); |
| 15412 | 764 | if (!console->gc) |
| 765 | console->gc = gc; | |
| 766 | } | |
| 767 | } | |
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
768 | gtk_combo_box_set_active(GTK_COMBO_BOX(console->dropdown), 0); |
| 15412 | 769 | gtk_box_pack_start(GTK_BOX(console->hbox), console->dropdown, TRUE, TRUE, 0); |
| 770 | g_signal_connect(G_OBJECT(console->dropdown), "changed", G_CALLBACK(dropdown_changed_cb), NULL); | |
| 771 | ||
|
34276
2b602f67f875
Make editable-ness a construct-only property of the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33683
diff
changeset
|
772 | console->webview = gtk_webview_new(FALSE); |
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
773 | gtk_webview_load_html_string(GTK_WEBVIEW(console->webview), EMPTY_HTML); |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
774 | if (console->count == 0) { |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
775 | char *tmp = g_strdup_printf("<div class=info>%s</div>", |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
776 | _("Not connected to XMPP")); |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
777 | gtk_webview_append_html(GTK_WEBVIEW(console->webview), tmp); |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
778 | g_free(tmp); |
|
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
779 | } |
|
31321
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
30626
diff
changeset
|
780 | gtk_box_pack_start(GTK_BOX(vbox), |
|
32995
416f017698b1
Use a webview instead of an imhtml in the XMPP Console viewer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32923
diff
changeset
|
781 | pidgin_make_scrollable(console->webview, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_ETCHED_IN, -1, -1), |
|
31321
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
30626
diff
changeset
|
782 | TRUE, TRUE, 0); |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
783 | |
| 15412 | 784 | toolbar = gtk_toolbar_new(); |
| 785 | button = gtk_tool_button_new(NULL, "<iq/>"); | |
|
32694
4a2399bc6148
Set the XMPP Console's toolbar buttons to be 'important', or else they
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32678
diff
changeset
|
786 | gtk_tool_item_set_is_important(button, TRUE); |
| 15412 | 787 | g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(iq_clicked_cb), NULL); |
| 788 | gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button)); | |
| 789 | ||
| 790 | button = gtk_tool_button_new(NULL, "<presence/>"); | |
|
32694
4a2399bc6148
Set the XMPP Console's toolbar buttons to be 'important', or else they
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32678
diff
changeset
|
791 | gtk_tool_item_set_is_important(button, TRUE); |
| 15412 | 792 | g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(presence_clicked_cb), NULL); |
| 793 | gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button)); | |
| 794 | ||
| 795 | button = gtk_tool_button_new(NULL, "<message/>"); | |
|
32694
4a2399bc6148
Set the XMPP Console's toolbar buttons to be 'important', or else they
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32678
diff
changeset
|
796 | gtk_tool_item_set_is_important(button, TRUE); |
| 15412 | 797 | g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(message_clicked_cb), NULL); |
| 798 | gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button)); | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
799 | |
| 15412 | 800 | gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0); |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
801 | |
|
34276
2b602f67f875
Make editable-ness a construct-only property of the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33683
diff
changeset
|
802 | console->entry = gtk_webview_new(TRUE); |
|
2b602f67f875
Make editable-ness a construct-only property of the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33683
diff
changeset
|
803 | gtk_webview_hide_toolbar(GTK_WEBVIEW(console->entry)); |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
804 | gtk_webview_set_whole_buffer_formatting_only(GTK_WEBVIEW(console->entry), TRUE); |
|
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
805 | g_signal_connect(G_OBJECT(console->entry),"key-press-event", G_CALLBACK(message_send_cb), console); |
| 15412 | 806 | |
|
31321
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
30626
diff
changeset
|
807 | console->sw = pidgin_make_scrollable(console->entry, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_ETCHED_IN, -1, -1); |
|
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
30626
diff
changeset
|
808 | gtk_box_pack_start(GTK_BOX(vbox), console->sw, FALSE, FALSE, 0); |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
809 | g_signal_connect(G_OBJECT(console->entry), "changed", G_CALLBACK(entry_changed_cb), NULL); |
|
31321
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
30626
diff
changeset
|
810 | |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
811 | entry_changed_cb(console->entry, NULL); |
| 15412 | 812 | |
| 813 | gtk_widget_show_all(console->window); | |
| 814 | if (console->count < 2) | |
| 815 | gtk_widget_hide(console->hbox); | |
| 816 | } | |
| 817 | ||
| 818 | static GList * | |
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
819 | actions(PurplePlugin *plugin) |
| 15412 | 820 | { |
| 821 | GList *l = NULL; | |
| 15884 | 822 | PurplePluginAction *act = NULL; |
| 15412 | 823 | |
| 15884 | 824 | act = purple_plugin_action_new(_("XMPP Console"), create_console); |
| 15412 | 825 | l = g_list_append(l, act); |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
826 | |
| 15412 | 827 | return l; |
| 828 | } | |
| 829 | ||
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
830 | static PidginPluginInfo * |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
831 | plugin_query(GError **error) |
| 15412 | 832 | { |
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
833 | const gchar * const authors[] = { |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
834 | "Sean Egan <seanegan@gmail.com>", |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
835 | NULL |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
836 | }; |
| 15412 | 837 | |
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
838 | return pidgin_plugin_info_new( |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
839 | "id", PLUGIN_ID, |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
840 | "name", N_("XMPP Console"), |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
841 | "version", DISPLAY_VERSION, |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
842 | "category", N_("Protocol utility"), |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
843 | "summary", N_("Send and receive raw XMPP stanzas."), |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
844 | "description", N_("This plugin is useful for debugging XMPP servers " |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
845 | "or clients."), |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
846 | "authors", authors, |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
847 | "website", PURPLE_WEBSITE, |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
848 | "abi-version", PURPLE_ABI_VERSION, |
|
36934
e7268aeb3b89
Renamed plugin info callback properties to end with "-cb", and their respective symbols.
Ankit Vani <a@nevitus.org>
parents:
36758
diff
changeset
|
849 | "actions-cb", actions, |
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
850 | NULL |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
851 | ); |
| 15412 | 852 | } |
| 853 | ||
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
854 | static gboolean |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
855 | plugin_load(PurplePlugin *plugin, GError **error) |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
856 | { |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
857 | PurpleProtocol *jabber; |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
858 | |
|
37005
702a601fc2ca
Update protocol IDs in codebase
Ankit Vani <a@nevitus.org>
parents:
36934
diff
changeset
|
859 | jabber = purple_protocols_find("prpl-jabber"); |
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
860 | if (!jabber) { |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
861 | g_set_error(error, PLUGIN_DOMAIN, 0, _("XMPP protocol is not loaded.")); |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
862 | return FALSE; |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
863 | } |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
864 | |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
865 | xmpp_console_handle = plugin; |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
866 | purple_signal_connect(jabber, "jabber-receiving-xmlnode", xmpp_console_handle, |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
867 | PURPLE_CALLBACK(purple_xmlnode_received_cb), NULL); |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
868 | purple_signal_connect(jabber, "jabber-sending-text", xmpp_console_handle, |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
869 | PURPLE_CALLBACK(purple_xmlnode_sent_cb), NULL); |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
870 | purple_signal_connect(purple_connections_get_handle(), "signing-on", |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
871 | plugin, PURPLE_CALLBACK(signing_on_cb), NULL); |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
872 | purple_signal_connect(purple_connections_get_handle(), "signed-off", |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
873 | plugin, PURPLE_CALLBACK(signed_off_cb), NULL); |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
874 | |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
875 | return TRUE; |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
876 | } |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
877 | |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
878 | static gboolean |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
879 | plugin_unload(PurplePlugin *plugin, GError **error) |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
880 | { |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
881 | if (console) |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
882 | gtk_widget_destroy(console->window); |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
883 | return TRUE; |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
884 | } |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
885 | |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
886 | PURPLE_PLUGIN_INIT(xmppconsole, plugin_query, plugin_load, plugin_unload); |