Fri, 31 Jan 2014 13:35:50 +0100
Fix xmpp console plugin to work with all xmpp prpls
| 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" | |
| 25 | #include "prpl.h" | |
| 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 | |
| 15412 | 36 | typedef struct { |
| 15884 | 37 | PurpleConnection *gc; |
| 15412 | 38 | GtkWidget *window; |
| 39 | GtkWidget *hbox; | |
| 40 | 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
|
41 | GtkWidget *webview; |
| 15412 | 42 | GtkWidget *entry; |
| 43 | GtkWidget *sw; | |
| 44 | int count; | |
| 45 | GList *accounts; | |
| 46 | } XmppConsole; | |
| 47 | ||
| 48 | XmppConsole *console = NULL; | |
| 49 | static void *xmpp_console_handle = NULL; | |
| 50 | ||
|
35310
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
51 | static const gchar *xmpp_prpls[] = { |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
52 | "prpl-jabber", "prpl-gtalk", "prpl-facebook-xmpp", NULL |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
53 | }; |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
54 | |
|
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
|
55 | #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
|
56 | "<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
|
57 | "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
|
58 | "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
|
59 | "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
|
60 | "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
|
61 | "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
|
62 | "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
|
63 | "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
|
64 | "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
|
65 | "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
|
66 | "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
|
67 | "</style></head></html>" |
| 15412 | 68 | |
|
35310
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
69 | static gboolean |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
70 | xmppconsole_is_xmpp_account(PurpleAccount *account) |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
71 | { |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
72 | const gchar *prpl_name; |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
73 | int i; |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
74 | |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
75 | prpl_name = purple_account_get_protocol_id(account); |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
76 | |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
77 | i = 0; |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
78 | while (xmpp_prpls[i] != NULL) { |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
79 | if (g_strcmp0(xmpp_prpls[i], prpl_name) == 0) |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
80 | return TRUE; |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
81 | i++; |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
82 | } |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
83 | |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
84 | return FALSE; |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
85 | } |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
86 | |
| 15412 | 87 | static char * |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
88 | purple_xmlnode_to_pretty_str(PurpleXmlNode *node, int *len) |
| 15412 | 89 | { |
| 90 | 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
|
91 | 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
|
92 | char *node_name, *esc, *esc2; |
| 15412 | 93 | gboolean need_end = FALSE, pretty = TRUE; |
| 94 | ||
| 95 | g_return_val_if_fail(node != NULL, NULL); | |
| 96 | ||
| 97 | 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
|
98 | 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
|
99 | "<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
|
100 | "<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
|
101 | node_name); |
| 15412 | 102 | |
| 103 | if (node->xmlns) { | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
104 | if ((!node->parent || |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
105 | !node->parent->xmlns || |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
106 | 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
|
107 | strcmp(node->xmlns, "jabber:client")) |
| 15412 | 108 | { |
| 109 | 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
|
110 | 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
|
111 | " <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
|
112 | "'<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
|
113 | xmlns); |
| 15412 | 114 | g_free(xmlns); |
| 115 | } | |
| 116 | } | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
117 | for (c = node->child; c; c = c->next) |
| 15412 | 118 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
119 | if (c->type == PURPLE_XMLNODE_TYPE_ATTRIB) { |
| 15412 | 120 | esc = g_markup_escape_text(c->name, -1); |
| 121 | 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
|
122 | 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
|
123 | " <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
|
124 | "'<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
|
125 | esc, esc2); |
| 15412 | 126 | g_free(esc); |
| 127 | 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
|
128 | } 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
|
129 | if (c->type == PURPLE_XMLNODE_TYPE_DATA) |
| 15412 | 130 | pretty = FALSE; |
| 131 | need_end = TRUE; | |
| 132 | } | |
| 133 | } | |
| 134 | ||
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
135 | if (need_end) { |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
136 | 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
|
137 | "<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
|
138 | pretty ? "<br>" : ""); |
| 15412 | 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 | need_end = FALSE; |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
141 | for (c = node->child; c; c = c->next) |
| 15412 | 142 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
143 | if (c->type == PURPLE_XMLNODE_TYPE_TAG) { |
| 15412 | 144 | 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
|
145 | 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
|
146 | 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
|
147 | 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
|
148 | 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
|
149 | } |
| 15412 | 150 | text = g_string_append_len(text, esc, esc_len); |
| 151 | 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
|
152 | } else if (c->type == PURPLE_XMLNODE_TYPE_DATA && c->data_sz > 0) { |
| 15412 | 153 | esc = g_markup_escape_text(c->data, c->data_sz); |
| 154 | text = g_string_append(text, esc); | |
| 155 | g_free(esc); | |
| 156 | } | |
| 157 | } | |
| 158 | ||
|
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
|
159 | 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
|
160 | 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
|
161 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
162 | 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
|
163 | "<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
|
164 | "<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
|
165 | "<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
|
166 | node_name); |
| 15412 | 167 | } else { |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
168 | 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
|
169 | "/<span class=bracket>></span><br>"); |
| 15412 | 170 | } |
| 171 | ||
| 172 | g_free(node_name); | |
| 173 | ||
|
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
|
174 | if (len) |
| 15412 | 175 | *len = text->len; |
| 176 | ||
| 177 | return g_string_free(text, FALSE); | |
| 178 | } | |
| 179 | ||
| 180 | static void | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
181 | purple_xmlnode_received_cb(PurpleConnection *gc, PurpleXmlNode **packet, gpointer null) |
| 15412 | 182 | { |
| 183 | char *str, *formatted; | |
| 184 | ||
| 185 | if (!console || console->gc != gc) | |
| 186 | return; | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
187 | 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
|
188 | 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
|
189 | gtk_webview_append_html(GTK_WEBVIEW(console->webview), formatted); |
| 15412 | 190 | g_free(formatted); |
| 191 | g_free(str); | |
| 192 | } | |
| 193 | ||
| 194 | static void | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
195 | purple_xmlnode_sent_cb(PurpleConnection *gc, char **packet, gpointer null) |
| 15412 | 196 | { |
| 197 | char *str; | |
| 198 | char *formatted; | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
199 | PurpleXmlNode *node; |
| 15412 | 200 | |
| 201 | if (!console || console->gc != gc) | |
| 202 | return; | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
203 | 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
|
204 | |
| 15412 | 205 | if (!node) |
| 206 | return; | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
207 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
208 | 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
|
209 | 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
|
210 | gtk_webview_append_html(GTK_WEBVIEW(console->webview), formatted); |
| 15412 | 211 | g_free(formatted); |
| 212 | 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
|
213 | purple_xmlnode_free(node); |
| 15412 | 214 | } |
| 215 | ||
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
216 | static gboolean |
|
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
217 | message_send_cb(GtkWidget *widget, GdkEventKey *event, gpointer p) |
| 15412 | 218 | { |
| 15884 | 219 | PurplePluginProtocolInfo *prpl_info = 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
|
220 | PurpleConnection *gc; |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
221 | gchar *text; |
|
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
222 | |
|
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
223 | 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
|
224 | return FALSE; |
| 15412 | 225 | |
| 226 | 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
|
227 | |
|
5fd44f61d007
Fix a crash when trying to use XMPP console with no XMPP accounts connected
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16749
diff
changeset
|
228 | if (gc) |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32624
diff
changeset
|
229 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(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
|
230 | |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
231 | 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
|
232 | |
|
5fd44f61d007
Fix a crash when trying to use XMPP console with no XMPP accounts connected
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16749
diff
changeset
|
233 | if (prpl_info && prpl_info->send_raw != NULL) |
| 15412 | 234 | prpl_info->send_raw(gc, text, strlen(text)); |
| 235 | ||
| 236 | g_free(text); | |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
237 | 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
|
238 | |
|
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
239 | return TRUE; |
| 15412 | 240 | } |
| 241 | ||
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
242 | static void |
|
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
243 | entry_changed_cb(GtkWidget *webview, void *data) |
| 15412 | 244 | { |
| 245 | char *xmlstr, *str; | |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
246 | #if 0 |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
247 | int wrapped_lines; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
248 | int lines; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
249 | GdkRectangle oneline; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
250 | int height; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
251 | 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
|
252 | #endif |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
253 | PurpleXmlNode *node; |
| 15412 | 254 | |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
255 | #if 0 |
|
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
256 | /* 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
|
257 | wrapped_lines = 1; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
258 | 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
|
259 | 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
|
260 | 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
|
261 | wrapped_lines++; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
262 | |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
263 | lines = gtk_text_buffer_get_line_count(buffer); |
| 15412 | 264 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
265 | /* 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
|
266 | lines = MIN(lines, 6); |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
267 | wrapped_lines = MIN(wrapped_lines, 6); |
| 15412 | 268 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
269 | 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
|
270 | 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
|
271 | pad_inside = gtk_text_view_get_pixels_inside_wrap(GTK_TEXT_VIEW(console->entry)); |
| 15412 | 272 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
273 | 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
|
274 | height += (oneline.height + pad_inside) * (wrapped_lines - lines); |
| 15412 | 275 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
276 | 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
|
277 | #endif |
| 15412 | 278 | |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
279 | str = gtk_webview_get_body_text(GTK_WEBVIEW(webview)); |
| 15412 | 280 | if (!str) |
| 281 | return; | |
| 282 | 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
|
283 | node = purple_xmlnode_from_str(xmlstr, -1); |
| 15412 | 284 | if (node) { |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
285 | gtk_webview_clear_formatting(GTK_WEBVIEW(console->entry)); |
| 15412 | 286 | } else { |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
287 | gtk_webview_toggle_backcolor(GTK_WEBVIEW(console->entry), "#ffcece"); |
| 15412 | 288 | } |
| 289 | g_free(str); | |
| 290 | g_free(xmlstr); | |
| 291 | if (node) | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
292 | purple_xmlnode_free(node); |
| 15412 | 293 | } |
| 294 | ||
| 295 | static void iq_clicked_cb(GtkWidget *w, gpointer nul) | |
| 296 | { | |
|
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 | GtkWidget *vbox, *hbox, *to_entry, *label, *type_combo; |
| 15412 | 298 | 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
|
299 | char *to; |
| 15412 | 300 | int result; |
| 301 | char *stanza; | |
| 302 | ||
| 303 | GtkWidget *dialog = gtk_dialog_new_with_buttons("<iq/>", | |
| 304 | GTK_WINDOW(console->window), | |
| 305 | GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, | |
| 306 | GTK_STOCK_CANCEL, | |
| 307 | GTK_RESPONSE_REJECT, | |
| 308 | GTK_STOCK_OK, | |
| 309 | GTK_RESPONSE_ACCEPT, | |
| 310 | 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
|
311 | #if !GTK_CHECK_VERSION(2,22,0) |
| 15412 | 312 | 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
|
313 | #endif |
| 15412 | 314 | gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); |
| 315 | 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
|
316 | vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); |
| 15412 | 317 | |
| 318 | 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
|
319 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 320 | |
| 321 | label = gtk_label_new("To:"); | |
| 322 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 323 | gtk_size_group_add_widget(sg, label); | |
| 324 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 325 | ||
| 326 | to_entry = gtk_entry_new(); | |
| 327 | gtk_entry_set_activates_default (GTK_ENTRY (to_entry), TRUE); | |
| 328 | 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
|
329 | |
| 15412 | 330 | 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
|
331 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 332 | label = gtk_label_new("Type:"); |
| 333 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 334 | ||
| 335 | gtk_size_group_add_widget(sg, label); | |
| 336 | 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
|
337 | 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
|
338 | 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
|
339 | 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
|
340 | 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
|
341 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "error"); |
| 15412 | 342 | gtk_combo_box_set_active(GTK_COMBO_BOX(type_combo), 0); |
| 343 | 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
|
344 | |
|
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
|
345 | gtk_widget_show_all(vbox); |
| 15412 | 346 | |
| 347 | result = gtk_dialog_run(GTK_DIALOG(dialog)); | |
| 348 | if (result != GTK_RESPONSE_ACCEPT) { | |
| 349 | gtk_widget_destroy(dialog); | |
| 350 | return; | |
| 351 | } | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
352 | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
353 | to = g_markup_escape_text(gtk_entry_get_text(GTK_ENTRY(to_entry)), -1); |
| 15412 | 354 | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
355 | 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
|
356 | "<a id=caret></a>" |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
357 | "</iq>", |
| 15412 | 358 | to && *to ? "to='" : "", |
| 359 | to && *to ? to : "", | |
| 360 | to && *to ? "'" : "", | |
| 361 | 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
|
362 | 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
|
363 | |
|
33083
e96acbe0e928
Move caret selection into GtkWebView code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33053
diff
changeset
|
364 | 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
|
365 | 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
|
366 | g_free(to); |
| 15412 | 367 | g_free(stanza); |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
368 | |
| 15412 | 369 | gtk_widget_destroy(dialog); |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
370 | g_object_unref(sg); |
| 15412 | 371 | } |
| 372 | ||
| 373 | static void presence_clicked_cb(GtkWidget *w, gpointer nul) | |
| 374 | { | |
|
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
|
375 | GtkWidget *vbox; |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
376 | GtkWidget *hbox; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
377 | GtkWidget *to_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
378 | GtkWidget *status_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
379 | GtkWidget *priority_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
380 | GtkWidget *label; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
381 | GtkWidget *show_combo; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
382 | GtkWidget *type_combo; |
| 15412 | 383 | 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
|
384 | char *to, *status, *priority; |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
385 | const char *type, *show; |
| 15412 | 386 | int result; |
| 387 | char *stanza; | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
388 | |
| 15412 | 389 | GtkWidget *dialog = gtk_dialog_new_with_buttons("<presence/>", |
| 390 | GTK_WINDOW(console->window), | |
| 391 | GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, | |
| 392 | GTK_STOCK_CANCEL, | |
| 393 | GTK_RESPONSE_REJECT, | |
| 394 | GTK_STOCK_OK, | |
| 395 | GTK_RESPONSE_ACCEPT, | |
| 396 | 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
|
397 | #if !GTK_CHECK_VERSION(2,22,0) |
| 15412 | 398 | 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
|
399 | #endif |
| 15412 | 400 | gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); |
| 401 | 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
|
402 | vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); |
| 15412 | 403 | |
| 404 | 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
|
405 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 406 | |
| 407 | label = gtk_label_new("To:"); | |
| 408 | gtk_size_group_add_widget(sg, label); | |
| 409 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 410 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 411 | ||
| 412 | to_entry = gtk_entry_new(); | |
| 413 | gtk_entry_set_activates_default (GTK_ENTRY (to_entry), TRUE); | |
| 414 | 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
|
415 | |
| 15412 | 416 | 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
|
417 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 418 | label = gtk_label_new("Type:"); |
| 419 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 420 | gtk_size_group_add_widget(sg, label); | |
| 421 | 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
|
422 | 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
|
423 | 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
|
424 | 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
|
425 | 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
|
426 | 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
|
427 | 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
|
428 | 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
|
429 | 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
|
430 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "error"); |
| 15412 | 431 | gtk_combo_box_set_active(GTK_COMBO_BOX(type_combo), 0); |
| 432 | gtk_box_pack_start(GTK_BOX(hbox), type_combo, FALSE, FALSE, 0); | |
| 433 | ||
| 434 | 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
|
435 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 436 | label = gtk_label_new("Show:"); |
| 437 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 438 | gtk_size_group_add_widget(sg, label); | |
| 439 | 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
|
440 | 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
|
441 | 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
|
442 | 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
|
443 | 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
|
444 | 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
|
445 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(show_combo), "chat"); |
| 15412 | 446 | |
| 447 | gtk_combo_box_set_active(GTK_COMBO_BOX(show_combo), 0); | |
| 448 | gtk_box_pack_start(GTK_BOX(hbox), show_combo, FALSE, FALSE, 0); | |
| 449 | ||
| 450 | 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
|
451 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 452 | |
| 453 | label = gtk_label_new("Status:"); | |
| 454 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 455 | gtk_size_group_add_widget(sg, label); | |
| 456 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 457 | ||
| 458 | status_entry = gtk_entry_new(); | |
| 459 | gtk_entry_set_activates_default (GTK_ENTRY (status_entry), TRUE); | |
| 460 | gtk_box_pack_start(GTK_BOX(hbox), status_entry, FALSE, FALSE, 0); | |
| 461 | ||
| 462 | 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
|
463 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 464 | |
| 465 | label = gtk_label_new("Priority:"); | |
| 466 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 467 | gtk_size_group_add_widget(sg, label); | |
| 468 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 469 | ||
| 470 | priority_entry = gtk_spin_button_new_with_range(-128, 127, 1); | |
| 471 | gtk_spin_button_set_value(GTK_SPIN_BUTTON(priority_entry), 0); | |
| 472 | gtk_box_pack_start(GTK_BOX(hbox), priority_entry, FALSE, FALSE, 0); | |
| 473 | ||
|
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
|
474 | gtk_widget_show_all(vbox); |
| 15412 | 475 | |
| 476 | result = gtk_dialog_run(GTK_DIALOG(dialog)); | |
| 477 | if (result != GTK_RESPONSE_ACCEPT) { | |
| 478 | gtk_widget_destroy(dialog); | |
| 479 | return; | |
| 480 | } | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
481 | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
482 | 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
|
483 | type = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(type_combo)); |
| 15412 | 484 | if (!strcmp(type, "default")) |
| 485 | 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
|
486 | show = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(show_combo)); |
| 15412 | 487 | if (!strcmp(show, "default")) |
| 488 | show = ""; | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
489 | 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
|
490 | priority = g_markup_escape_text(gtk_entry_get_text(GTK_ENTRY(priority_entry)), -1); |
| 15412 | 491 | 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
|
492 | *priority = '\0'; |
| 15412 | 493 | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
494 | 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
|
495 | "%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
|
496 | "<a id=caret></a>" |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
497 | "</presence>", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
498 | *to ? "to='" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
499 | *to ? to : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
500 | *to ? "'" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
501 | g_random_int(), |
| 15412 | 502 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
503 | *type ? "type='" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
504 | *type ? type : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
505 | *type ? "'" : "", |
| 15412 | 506 | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
507 | *show ? "<show>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
508 | *show ? show : "", |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
509 | *show ? "</show>" : "", |
| 15412 | 510 | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
511 | *status ? "<status>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
512 | *status ? status : "", |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
513 | *status ? "</status>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
514 | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
515 | *priority ? "<priority>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
516 | *priority ? priority : "", |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
517 | *priority ? "</priority>" : ""); |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
518 | |
|
33083
e96acbe0e928
Move caret selection into GtkWebView code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33053
diff
changeset
|
519 | 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
|
520 | gtk_widget_grab_focus(console->entry); |
| 15412 | 521 | g_free(stanza); |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
522 | g_free(to); |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
523 | g_free(status); |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
524 | g_free(priority); |
| 15412 | 525 | |
| 526 | gtk_widget_destroy(dialog); | |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
527 | g_object_unref(sg); |
| 15412 | 528 | } |
| 529 | ||
| 530 | static void message_clicked_cb(GtkWidget *w, gpointer nul) | |
| 531 | { | |
|
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
|
532 | GtkWidget *vbox; |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
533 | GtkWidget *hbox; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
534 | GtkWidget *to_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
535 | GtkWidget *body_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
536 | GtkWidget *thread_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
537 | GtkWidget *subject_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
538 | GtkWidget *label; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
539 | GtkWidget *type_combo; |
| 15412 | 540 | 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
|
541 | char *to, *body, *thread, *subject; |
| 15412 | 542 | char *stanza; |
| 543 | int result; | |
| 544 | ||
| 545 | GtkWidget *dialog = gtk_dialog_new_with_buttons("<message/>", | |
| 546 | GTK_WINDOW(console->window), | |
| 547 | GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, | |
| 548 | GTK_STOCK_CANCEL, | |
| 549 | GTK_RESPONSE_REJECT, | |
| 550 | GTK_STOCK_OK, | |
| 551 | GTK_RESPONSE_ACCEPT, | |
| 552 | 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
|
553 | #if !GTK_CHECK_VERSION(2,22,0) |
| 15412 | 554 | 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
|
555 | #endif |
| 15412 | 556 | gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); |
| 557 | 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
|
558 | vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); |
| 15412 | 559 | |
| 560 | 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
|
561 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 562 | |
| 563 | label = gtk_label_new("To:"); | |
| 564 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 565 | gtk_size_group_add_widget(sg, label); | |
| 566 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 567 | ||
| 568 | to_entry = gtk_entry_new(); | |
| 569 | gtk_entry_set_activates_default (GTK_ENTRY (to_entry), TRUE); | |
| 570 | gtk_box_pack_start(GTK_BOX(hbox), to_entry, FALSE, FALSE, 0); | |
| 571 | ||
| 572 | 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
|
573 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 574 | label = gtk_label_new("Type:"); |
| 575 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 576 | gtk_size_group_add_widget(sg, label); | |
| 577 | 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
|
578 | 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
|
579 | 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
|
580 | 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
|
581 | 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
|
582 | 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
|
583 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "error"); |
| 15412 | 584 | gtk_combo_box_set_active(GTK_COMBO_BOX(type_combo), 0); |
| 585 | gtk_box_pack_start(GTK_BOX(hbox), type_combo, FALSE, FALSE, 0); | |
| 586 | ||
| 587 | 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
|
588 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 589 | |
| 590 | label = gtk_label_new("Body:"); | |
| 591 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 592 | gtk_size_group_add_widget(sg, label); | |
| 593 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 594 | ||
| 595 | body_entry = gtk_entry_new(); | |
| 596 | gtk_entry_set_activates_default (GTK_ENTRY (body_entry), TRUE); | |
| 597 | gtk_box_pack_start(GTK_BOX(hbox), body_entry, FALSE, FALSE, 0); | |
| 598 | ||
| 599 | 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
|
600 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 601 | |
| 602 | label = gtk_label_new("Subject:"); | |
| 603 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 604 | gtk_size_group_add_widget(sg, label); | |
| 605 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 606 | ||
| 607 | subject_entry = gtk_entry_new(); | |
| 608 | gtk_entry_set_activates_default (GTK_ENTRY (subject_entry), TRUE); | |
| 609 | gtk_box_pack_start(GTK_BOX(hbox), subject_entry, FALSE, FALSE, 0); | |
| 610 | ||
| 611 | 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
|
612 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 613 | |
| 614 | label = gtk_label_new("Thread:"); | |
| 615 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| 616 | gtk_size_group_add_widget(sg, label); | |
| 617 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 618 | ||
| 619 | thread_entry = gtk_entry_new(); | |
| 620 | gtk_entry_set_activates_default (GTK_ENTRY (thread_entry), TRUE); | |
| 621 | 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
|
622 | |
|
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
|
623 | gtk_widget_show_all(vbox); |
| 15412 | 624 | |
| 625 | result = gtk_dialog_run(GTK_DIALOG(dialog)); | |
| 626 | if (result != GTK_RESPONSE_ACCEPT) { | |
| 627 | gtk_widget_destroy(dialog); | |
| 628 | return; | |
| 629 | } | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
630 | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
631 | 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
|
632 | 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
|
633 | 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
|
634 | subject = g_markup_escape_text(gtk_entry_get_text(GTK_ENTRY(subject_entry)), -1); |
| 15412 | 635 | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
636 | 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
|
637 | "%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
|
638 | "<a id=caret></a>" |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
639 | "</message>", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
640 | |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
641 | *to ? "to='" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
642 | *to ? to : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
643 | *to ? "'" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
644 | 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
|
645 | 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
|
646 | 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
|
647 | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
648 | *body ? "<body>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
649 | *body ? body : "", |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
650 | *body ? "</body>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
651 | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
652 | *subject ? "<subject>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
653 | *subject ? subject : "", |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
654 | *subject ? "</subject>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
655 | |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
656 | *thread ? "<thread>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
657 | *thread ? thread : "", |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
658 | *thread ? "</thread>" : ""); |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
659 | |
|
33083
e96acbe0e928
Move caret selection into GtkWebView code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33053
diff
changeset
|
660 | 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
|
661 | gtk_widget_grab_focus(console->entry); |
| 15412 | 662 | g_free(stanza); |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
663 | g_free(to); |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
664 | g_free(body); |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
665 | g_free(thread); |
|
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
666 | g_free(subject); |
| 15412 | 667 | |
| 668 | gtk_widget_destroy(dialog); | |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
669 | g_object_unref(sg); |
| 15412 | 670 | } |
| 671 | ||
| 672 | static void | |
|
29783
96ab389c9181
xmppconsole: Properly catch things before an account is "signed on".
Paul Aurich <darkrain42@pidgin.im>
parents:
29529
diff
changeset
|
673 | signing_on_cb(PurpleConnection *gc) |
| 15412 | 674 | { |
|
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
|
675 | 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
|
676 | |
| 15412 | 677 | if (!console) |
| 678 | return; | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
679 | |
|
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
|
680 | account = purple_connection_get_account(gc); |
|
35310
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
681 | if (!xmppconsole_is_xmpp_account(account)) |
|
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
|
682 | 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
|
683 | |
|
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
|
684 | 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
|
685 | purple_account_get_username(account)); |
| 15412 | 686 | console->accounts = g_list_append(console->accounts, gc); |
| 687 | console->count++; | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
688 | |
|
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
|
689 | 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
|
690 | 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
|
691 | 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
|
692 | 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
|
693 | } else |
| 15412 | 694 | gtk_widget_show_all(console->hbox); |
| 695 | } | |
| 696 | ||
| 697 | static void | |
| 15884 | 698 | signed_off_cb(PurpleConnection *gc) |
| 15412 | 699 | { |
| 700 | int i = 0; | |
| 701 | GList *l; | |
| 702 | ||
| 703 | if (!console) | |
| 704 | return; | |
| 705 | ||
| 706 | l = console->accounts; | |
| 707 | while (l) { | |
| 15884 | 708 | PurpleConnection *g = l->data; |
| 15412 | 709 | if (gc == g) |
| 710 | break; | |
| 711 | i++; | |
| 712 | l = l->next; | |
| 713 | } | |
| 714 | ||
| 715 | if (l == NULL) | |
| 716 | return; | |
| 717 | ||
|
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
|
718 | gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(console->dropdown), i); |
| 15412 | 719 | console->accounts = g_list_remove(console->accounts, gc); |
| 720 | console->count--; | |
| 721 | ||
| 722 | 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
|
723 | 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
|
724 | _("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
|
725 | 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
|
726 | g_free(tmp); |
| 15412 | 727 | console->gc = NULL; |
| 728 | } | |
| 729 | } | |
| 730 | ||
| 731 | static gboolean | |
| 15884 | 732 | plugin_load(PurplePlugin *plugin) |
| 15412 | 733 | { |
|
35310
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
734 | int i; |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
735 | gboolean any_registered = FALSE; |
| 15412 | 736 | |
| 737 | xmpp_console_handle = plugin; | |
|
35310
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
738 | |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
739 | i = 0; |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
740 | while (xmpp_prpls[i] != NULL) { |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
741 | PurplePlugin *xmpp; |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
742 | |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
743 | xmpp = purple_find_prpl(xmpp_prpls[i]); |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
744 | i++; |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
745 | |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
746 | if (!xmpp) |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
747 | continue; |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
748 | any_registered = TRUE; |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
749 | |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
750 | purple_signal_connect(xmpp, "jabber-receiving-xmlnode", |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
751 | xmpp_console_handle, |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
752 | PURPLE_CALLBACK(purple_xmlnode_received_cb), NULL); |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
753 | purple_signal_connect(xmpp, "jabber-sending-text", |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
754 | xmpp_console_handle, |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
755 | PURPLE_CALLBACK(purple_xmlnode_sent_cb), NULL); |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
756 | } |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
757 | |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
758 | if (!any_registered) |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
759 | return FALSE; |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
760 | |
|
29783
96ab389c9181
xmppconsole: Properly catch things before an account is "signed on".
Paul Aurich <darkrain42@pidgin.im>
parents:
29529
diff
changeset
|
761 | purple_signal_connect(purple_connections_get_handle(), "signing-on", |
|
35310
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
762 | plugin, PURPLE_CALLBACK(signing_on_cb), NULL); |
| 15884 | 763 | purple_signal_connect(purple_connections_get_handle(), "signed-off", |
|
35310
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
764 | plugin, PURPLE_CALLBACK(signed_off_cb), NULL); |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
765 | |
| 15412 | 766 | return TRUE; |
| 767 | } | |
| 768 | ||
| 769 | static gboolean | |
| 15884 | 770 | plugin_unload(PurplePlugin *plugin) |
| 15412 | 771 | { |
| 15414 | 772 | if (console) |
| 773 | gtk_widget_destroy(console->window); | |
| 15412 | 774 | return TRUE; |
| 775 | } | |
| 776 | ||
| 777 | 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
|
778 | console_destroy(GtkWidget *window, gpointer nul) |
| 15412 | 779 | { |
| 780 | g_list_free(console->accounts); | |
| 781 | g_free(console); | |
| 782 | console = NULL; | |
| 783 | } | |
| 784 | ||
| 785 | static void | |
| 786 | dropdown_changed_cb(GtkComboBox *widget, gpointer nul) | |
| 787 | { | |
| 788 | if (!console) | |
| 789 | return; | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
790 | |
|
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
|
791 | 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
|
792 | gtk_webview_load_html_string(GTK_WEBVIEW(console->webview), EMPTY_HTML); |
| 15412 | 793 | } |
| 794 | ||
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
795 | static void |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
796 | create_console(PurplePluginAction *action) |
| 15412 | 797 | { |
| 798 | GtkWidget *vbox = gtk_vbox_new(FALSE, 6); | |
| 799 | GtkWidget *label; | |
| 800 | GtkWidget *toolbar; | |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
801 | GList *connections; |
| 15412 | 802 | GtkToolItem *button; |
| 803 | ||
| 804 | if (console) { | |
| 805 | gtk_window_present(GTK_WINDOW(console->window)); | |
| 806 | return; | |
| 807 | } | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
808 | |
| 15412 | 809 | console = g_new0(XmppConsole, 1); |
| 810 | ||
| 17213 | 811 | console->window = pidgin_create_window(_("XMPP Console"), PIDGIN_HIG_BORDER, NULL, TRUE); |
| 15412 | 812 | g_signal_connect(G_OBJECT(console->window), "destroy", G_CALLBACK(console_destroy), NULL); |
| 813 | gtk_window_set_default_size(GTK_WINDOW(console->window), 580, 400); | |
| 814 | gtk_container_add(GTK_CONTAINER(console->window), vbox); | |
| 815 | ||
| 816 | console->hbox = gtk_hbox_new(FALSE, 3); | |
| 817 | gtk_box_pack_start(GTK_BOX(vbox), console->hbox, FALSE, FALSE, 0); | |
| 818 | label = gtk_label_new(_("Account: ")); | |
| 819 | gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); | |
| 820 | 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
|
821 | console->dropdown = gtk_combo_box_text_new(); |
| 15884 | 822 | for (connections = purple_connections_get_all(); connections; connections = connections->next) { |
| 823 | PurpleConnection *gc = connections->data; | |
|
35310
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
824 | if (xmppconsole_is_xmpp_account(purple_connection_get_account(gc))) { |
| 15412 | 825 | console->count++; |
| 826 | 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
|
827 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(console->dropdown), |
| 15884 | 828 | purple_account_get_username(purple_connection_get_account(gc))); |
| 15412 | 829 | if (!console->gc) |
| 830 | console->gc = gc; | |
| 831 | } | |
| 832 | } | |
|
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
|
833 | gtk_combo_box_set_active(GTK_COMBO_BOX(console->dropdown), 0); |
| 15412 | 834 | gtk_box_pack_start(GTK_BOX(console->hbox), console->dropdown, TRUE, TRUE, 0); |
| 835 | g_signal_connect(G_OBJECT(console->dropdown), "changed", G_CALLBACK(dropdown_changed_cb), NULL); | |
| 836 | ||
|
34276
2b602f67f875
Make editable-ness a construct-only property of the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33683
diff
changeset
|
837 | 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
|
838 | 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
|
839 | 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
|
840 | 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
|
841 | _("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
|
842 | 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
|
843 | 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
|
844 | } |
|
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
|
845 | 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
|
846 | 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
|
847 | TRUE, TRUE, 0); |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
848 | |
| 15412 | 849 | toolbar = gtk_toolbar_new(); |
| 850 | 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
|
851 | gtk_tool_item_set_is_important(button, TRUE); |
| 15412 | 852 | g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(iq_clicked_cb), NULL); |
| 853 | gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button)); | |
| 854 | ||
| 855 | 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
|
856 | gtk_tool_item_set_is_important(button, TRUE); |
| 15412 | 857 | g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(presence_clicked_cb), NULL); |
| 858 | gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button)); | |
| 859 | ||
| 860 | 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
|
861 | gtk_tool_item_set_is_important(button, TRUE); |
| 15412 | 862 | g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(message_clicked_cb), NULL); |
| 863 | 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
|
864 | |
| 15412 | 865 | 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
|
866 | |
|
34276
2b602f67f875
Make editable-ness a construct-only property of the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33683
diff
changeset
|
867 | 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
|
868 | 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
|
869 | 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
|
870 | g_signal_connect(G_OBJECT(console->entry),"key-press-event", G_CALLBACK(message_send_cb), console); |
| 15412 | 871 | |
|
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
|
872 | 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
|
873 | 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
|
874 | 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
|
875 | |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
876 | entry_changed_cb(console->entry, NULL); |
| 15412 | 877 | |
| 878 | gtk_widget_show_all(console->window); | |
| 879 | if (console->count < 2) | |
| 880 | gtk_widget_hide(console->hbox); | |
| 881 | } | |
| 882 | ||
| 883 | static GList * | |
| 15884 | 884 | actions(PurplePlugin *plugin, gpointer context) |
| 15412 | 885 | { |
| 886 | GList *l = NULL; | |
| 15884 | 887 | PurplePluginAction *act = NULL; |
| 15412 | 888 | |
| 15884 | 889 | act = purple_plugin_action_new(_("XMPP Console"), create_console); |
| 15412 | 890 | 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
|
891 | |
| 15412 | 892 | return l; |
| 893 | } | |
| 894 | ||
| 895 | ||
| 15884 | 896 | static PurplePluginInfo info = |
| 15412 | 897 | { |
| 15884 | 898 | PURPLE_PLUGIN_MAGIC, |
| 899 | PURPLE_MAJOR_VERSION, | |
| 900 | PURPLE_MINOR_VERSION, | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
901 | PURPLE_PLUGIN_STANDARD, /**< type */ |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
902 | PIDGIN_PLUGIN_TYPE, /**< ui_requirement */ |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
903 | 0, /**< flags */ |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
904 | NULL, /**< dependencies */ |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
905 | PURPLE_PRIORITY_DEFAULT, /**< priority */ |
| 15412 | 906 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
907 | "gtk-xmpp", /**< id */ |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
908 | N_("XMPP Console"), /**< name */ |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
909 | DISPLAY_VERSION, /**< version */ |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
910 | /** summary */ |
| 15412 | 911 | N_("Send and receive raw XMPP stanzas."), |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
912 | /** description */ |
|
29876
f233c73823f2
I don't think 'debug' spouts an extra 'b' when adding the '-ing'.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29783
diff
changeset
|
913 | N_("This plugin is useful for debugging XMPP servers or clients."), |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
914 | "Sean Egan <seanegan@gmail.com>", /**< author */ |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
915 | PURPLE_WEBSITE, /**< homepage */ |
| 15412 | 916 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
917 | plugin_load, /**< load */ |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
918 | plugin_unload, /**< unload */ |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
919 | NULL, /**< destroy */ |
| 15412 | 920 | |
| 921 | NULL, /**< ui_info */ | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
922 | NULL, /**< extra_info */ |
| 15412 | 923 | NULL, |
|
16749
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16290
diff
changeset
|
924 | actions, |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16290
diff
changeset
|
925 | |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16290
diff
changeset
|
926 | /* padding */ |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16290
diff
changeset
|
927 | NULL, |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16290
diff
changeset
|
928 | NULL, |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16290
diff
changeset
|
929 | NULL, |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
16290
diff
changeset
|
930 | NULL |
| 15412 | 931 | }; |
| 932 | ||
| 933 | static void | |
| 15884 | 934 | init_plugin(PurplePlugin *plugin) |
| 15412 | 935 | { |
| 936 | } | |
| 937 | ||
|
25625
52d3e1e45ebf
albertz noticed the XMPP Console was identifying itself as interval. Hooray
Paul Aurich <darkrain42@pidgin.im>
parents:
22108
diff
changeset
|
938 | PURPLE_INIT_PLUGIN(xmppconsole, init_plugin, info) |