Sat, 28 Apr 2018 02:18:26 -0400
Convert XMPP console display to GtkTextView.
It does not really need much in the way of special formatting or
interactivity that it needs to use a full GtkWebView.
| 15412 | 1 | /* |
| 15884 | 2 | * Purple - XMPP debugging tool |
| 15412 | 3 | * |
| 4 | * Copyright (C) 2002-2003, Sean Egan | |
| 5 | * | |
| 6 | * This program is free software; you can redistribute it and/or modify | |
| 7 | * it under the terms of the GNU General Public License as published by | |
| 8 | * the Free Software Foundation; either version 2 of the License, or | |
| 9 | * (at your option) any later version. | |
| 10 | * | |
| 11 | * This program is distributed in the hope that it will be useful, | |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 | * GNU General Public License for more details. | |
| 15 | * | |
| 16 | * You should have received a copy of the GNU General Public License | |
| 17 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18122
diff
changeset
|
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 15412 | 19 | * |
| 20 | */ | |
| 21 | ||
| 22 | #include "internal.h" | |
| 23 | #include "gtkplugin.h" | |
| 24 | #include "version.h" | |
|
36543
a8c3fecee2d3
Renamed prpl.[ch] to protocol.[ch]
Ankit Vani <a@nevitus.org>
parents:
36459
diff
changeset
|
25 | #include "protocol.h" |
| 15412 | 26 | #include "xmlnode.h" |
| 27 | ||
| 17242 | 28 | #include "gtkutils.h" |
| 15412 | 29 | |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
30 | #include <gdk/gdkkeysyms.h> |
|
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
31 | |
|
33170
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33160
diff
changeset
|
32 | #include "gtk3compat.h" |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33160
diff
changeset
|
33 | |
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
34 | #define PLUGIN_ID "gtk-xmpp" |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
35 | #define PLUGIN_DOMAIN (g_quark_from_static_string(PLUGIN_ID)) |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
36 | |
| 15412 | 37 | typedef struct { |
| 15884 | 38 | PurpleConnection *gc; |
| 15412 | 39 | GtkWidget *window; |
| 40 | GtkWidget *hbox; | |
| 41 | GtkWidget *dropdown; | |
|
39001
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
42 | GtkWidget *view; |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
43 | GtkTextBuffer *buffer; |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
44 | struct { |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
45 | GtkTextTag *info; |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
46 | GtkTextTag *incoming; |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
47 | GtkTextTag *outgoing; |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
48 | GtkTextTag *bracket; |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
49 | GtkTextTag *tag; |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
50 | GtkTextTag *attr; |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
51 | GtkTextTag *value; |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
52 | GtkTextTag *xmlns; |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
53 | } tags; |
| 15412 | 54 | GtkWidget *entry; |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
55 | GtkTextBuffer *entry_buffer; |
| 15412 | 56 | GtkWidget *sw; |
| 57 | int count; | |
| 58 | GList *accounts; | |
| 59 | } XmppConsole; | |
| 60 | ||
| 61 | XmppConsole *console = NULL; | |
| 62 | static void *xmpp_console_handle = NULL; | |
| 63 | ||
|
35310
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
64 | static const gchar *xmpp_prpls[] = { |
|
37248
ef82ac226e4b
jabber: removed explicit Facebook support
James Geboski <jgeboski@gmail.com>
parents:
37109
diff
changeset
|
65 | "prpl-jabber", "prpl-gtalk", NULL |
|
35310
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
66 | }; |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
67 | |
|
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
|
68 | #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
|
69 | "<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
|
70 | "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
|
71 | "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
|
72 | "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
|
73 | "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
|
74 | "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
|
75 | "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
|
76 | "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
|
77 | "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
|
78 | "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
|
79 | "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
|
80 | "</style></head></html>" |
| 15412 | 81 | |
|
35310
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
82 | static gboolean |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
83 | 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
|
84 | { |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
85 | const gchar *prpl_name; |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
86 | int i; |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
87 | |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
88 | 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
|
89 | |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
90 | i = 0; |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
91 | while (xmpp_prpls[i] != NULL) { |
| 38358 | 92 | if (purple_strequal(xmpp_prpls[i], prpl_name)) |
|
35310
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
93 | return TRUE; |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
94 | i++; |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
95 | } |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
96 | |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
97 | return FALSE; |
|
36f94ccd848b
Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34935
diff
changeset
|
98 | } |
| 15412 | 99 | |
|
39001
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
100 | static void |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
101 | purple_xmlnode_append_to_buffer(PurpleXmlNode *node, GtkTextIter *iter, GtkTextTag *tag) |
| 15412 | 102 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
103 | PurpleXmlNode *c; |
| 15412 | 104 | gboolean need_end = FALSE, pretty = TRUE; |
| 105 | ||
|
39001
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
106 | g_return_if_fail(node != NULL); |
| 15412 | 107 | |
|
39001
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
108 | gtk_text_buffer_insert_with_tags(console->buffer, iter, "<", 1, |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
109 | tag, console->tags.bracket, NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
110 | gtk_text_buffer_insert_with_tags(console->buffer, iter, node->name, -1, |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
111 | tag, console->tags.tag, NULL); |
| 15412 | 112 | |
| 113 | if (node->xmlns) { | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
114 | if ((!node->parent || |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
115 | !node->parent->xmlns || |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
116 | !purple_strequal(node->xmlns, node->parent->xmlns)) && |
|
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
117 | !purple_strequal(node->xmlns, "jabber:client")) |
| 15412 | 118 | { |
|
39001
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
119 | gtk_text_buffer_insert_with_tags(console->buffer, iter, " ", 1, |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
120 | tag, NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
121 | gtk_text_buffer_insert_with_tags(console->buffer, iter, "xmlns", 5, |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
122 | tag, console->tags.attr, NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
123 | gtk_text_buffer_insert_with_tags(console->buffer, iter, "='", 2, |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
124 | tag, NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
125 | gtk_text_buffer_insert_with_tags(console->buffer, iter, node->xmlns, -1, |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
126 | tag, console->tags.xmlns, NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
127 | gtk_text_buffer_insert_with_tags(console->buffer, iter, "'", 1, |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
128 | tag, NULL); |
| 15412 | 129 | } |
| 130 | } | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
131 | for (c = node->child; c; c = c->next) |
| 15412 | 132 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
133 | if (c->type == PURPLE_XMLNODE_TYPE_ATTRIB) { |
|
39001
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
134 | gtk_text_buffer_insert_with_tags(console->buffer, iter, " ", 1, |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
135 | tag, NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
136 | gtk_text_buffer_insert_with_tags(console->buffer, iter, c->name, -1, |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
137 | tag, console->tags.attr, NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
138 | gtk_text_buffer_insert_with_tags(console->buffer, iter, "='", 2, |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
139 | tag, NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
140 | gtk_text_buffer_insert_with_tags(console->buffer, iter, c->data, -1, |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
141 | tag, console->tags.value, NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
142 | gtk_text_buffer_insert_with_tags(console->buffer, iter, "'", 1, |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
143 | tag, NULL); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
144 | } 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
|
145 | if (c->type == PURPLE_XMLNODE_TYPE_DATA) |
| 15412 | 146 | pretty = FALSE; |
| 147 | need_end = TRUE; | |
| 148 | } | |
| 149 | } | |
| 150 | ||
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
151 | if (need_end) { |
|
39001
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
152 | gtk_text_buffer_insert_with_tags(console->buffer, iter, ">", 1, |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
153 | tag, console->tags.bracket, NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
154 | if (pretty) { |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
155 | gtk_text_buffer_insert_with_tags(console->buffer, iter, "\n", 1, |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
156 | tag, NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
157 | } |
| 15412 | 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 | need_end = FALSE; |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
160 | for (c = node->child; c; c = c->next) |
| 15412 | 161 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
162 | if (c->type == PURPLE_XMLNODE_TYPE_TAG) { |
|
39001
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
163 | purple_xmlnode_append_to_buffer(c, iter, tag); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
164 | #if 0 |
|
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
|
165 | 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
|
166 | 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
|
167 | 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
|
168 | } |
| 15412 | 169 | text = g_string_append_len(text, esc, esc_len); |
|
39001
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
170 | #endif |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
171 | } else if (c->type == PURPLE_XMLNODE_TYPE_DATA && c->data_sz > 0) { |
|
39001
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
172 | gtk_text_buffer_insert_with_tags(console->buffer, iter, c->data, c->data_sz, |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
173 | tag, NULL); |
| 15412 | 174 | } |
| 175 | } | |
| 176 | ||
|
39001
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
177 | gtk_text_buffer_insert_with_tags(console->buffer, iter, "<", 1, |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
178 | tag, console->tags.bracket, NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
179 | gtk_text_buffer_insert_with_tags(console->buffer, iter, "/", 1, |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
180 | tag, NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
181 | gtk_text_buffer_insert_with_tags(console->buffer, iter, node->name, -1, |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
182 | tag, console->tags.tag, NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
183 | gtk_text_buffer_insert_with_tags(console->buffer, iter, ">", 1, |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
184 | tag, console->tags.bracket, NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
185 | gtk_text_buffer_insert_with_tags(console->buffer, iter, "\n", 1, |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
186 | tag, NULL); |
| 15412 | 187 | } else { |
|
39001
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
188 | gtk_text_buffer_insert_with_tags(console->buffer, iter, "/", 1, |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
189 | tag, NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
190 | gtk_text_buffer_insert_with_tags(console->buffer, iter, ">", 1, |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
191 | tag, console->tags.bracket, NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
192 | gtk_text_buffer_insert_with_tags(console->buffer, iter, "\n", 1, |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
193 | tag, NULL); |
| 15412 | 194 | } |
| 195 | } | |
| 196 | ||
| 197 | static void | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
198 | purple_xmlnode_received_cb(PurpleConnection *gc, PurpleXmlNode **packet, gpointer null) |
| 15412 | 199 | { |
|
39001
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
200 | GtkTextIter iter; |
| 15412 | 201 | |
| 202 | if (!console || console->gc != gc) | |
| 203 | return; | |
|
39001
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
204 | |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
205 | gtk_text_buffer_get_end_iter(console->buffer, &iter); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
206 | purple_xmlnode_append_to_buffer(*packet, &iter, console->tags.incoming); |
| 15412 | 207 | } |
| 208 | ||
| 209 | static void | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
210 | purple_xmlnode_sent_cb(PurpleConnection *gc, char **packet, gpointer null) |
| 15412 | 211 | { |
|
39001
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
212 | GtkTextIter iter; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
213 | PurpleXmlNode *node; |
| 15412 | 214 | |
| 215 | if (!console || console->gc != gc) | |
| 216 | return; | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
217 | 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
|
218 | |
| 15412 | 219 | if (!node) |
| 220 | return; | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
221 | |
|
39001
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
222 | gtk_text_buffer_get_end_iter(console->buffer, &iter); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
223 | purple_xmlnode_append_to_buffer(node, &iter, console->tags.outgoing); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
224 | purple_xmlnode_free(node); |
| 15412 | 225 | } |
| 226 | ||
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
227 | static gboolean |
|
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
228 | message_send_cb(GtkWidget *widget, GdkEventKey *event, gpointer p) |
| 15412 | 229 | { |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
230 | PurpleProtocol *protocol = NULL; |
|
30626
bec413ce77c7
Fix some "Dead nested assignment"s and then kill off some useless
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30010
diff
changeset
|
231 | PurpleConnection *gc; |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
232 | gchar *text; |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
233 | GtkTextIter start, end; |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
234 | |
|
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
235 | 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
|
236 | return FALSE; |
| 15412 | 237 | |
| 238 | 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
|
239 | |
|
5fd44f61d007
Fix a crash when trying to use XMPP console with no XMPP accounts connected
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16749
diff
changeset
|
240 | if (gc) |
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
241 | protocol = purple_connection_get_protocol(gc); |
|
17529
5fd44f61d007
Fix a crash when trying to use XMPP console with no XMPP accounts connected
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16749
diff
changeset
|
242 | |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
243 | gtk_text_buffer_get_bounds(console->entry_buffer, &start, &end); |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
244 | text = gtk_text_buffer_get_text(console->entry_buffer, &start, &end, FALSE); |
|
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
|
245 | |
|
36633
2dcb81a189bd
Refactored pidgin to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36626
diff
changeset
|
246 | if (protocol) |
| 36719 | 247 | purple_protocol_server_iface_send_raw(protocol, gc, text, strlen(text)); |
| 15412 | 248 | |
| 249 | g_free(text); | |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
250 | gtk_text_buffer_set_text(console->entry_buffer, "", 0); |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
251 | |
|
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
252 | return TRUE; |
| 15412 | 253 | } |
| 254 | ||
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
255 | static void |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
256 | entry_changed_cb(GtkTextBuffer *buffer, void *data) |
| 15412 | 257 | { |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
258 | GtkTextIter start, end; |
| 15412 | 259 | char *xmlstr, *str; |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
260 | #if 0 |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
261 | int wrapped_lines; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
262 | int lines; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
263 | GdkRectangle oneline; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
264 | int height; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
265 | 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
|
266 | #endif |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
267 | PurpleXmlNode *node; |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
268 | GtkStyleContext *style; |
| 15412 | 269 | |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
270 | #if 0 |
|
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
271 | /* 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
|
272 | wrapped_lines = 1; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
273 | 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
|
274 | 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
|
275 | 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
|
276 | wrapped_lines++; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
277 | |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
278 | lines = gtk_text_buffer_get_line_count(buffer); |
| 15412 | 279 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
280 | /* 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
|
281 | lines = MIN(lines, 6); |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
282 | wrapped_lines = MIN(wrapped_lines, 6); |
| 15412 | 283 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
284 | 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
|
285 | 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
|
286 | pad_inside = gtk_text_view_get_pixels_inside_wrap(GTK_TEXT_VIEW(console->entry)); |
| 15412 | 287 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
288 | 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
|
289 | height += (oneline.height + pad_inside) * (wrapped_lines - lines); |
| 15412 | 290 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
291 | 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
|
292 | #endif |
| 15412 | 293 | |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
294 | gtk_text_buffer_get_bounds(buffer, &start, &end); |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
295 | str = gtk_text_buffer_get_text(buffer, &start, &end, FALSE); |
| 15412 | 296 | if (!str) |
| 297 | return; | |
| 298 | 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
|
299 | node = purple_xmlnode_from_str(xmlstr, -1); |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
300 | style = gtk_widget_get_style_context(console->entry); |
| 15412 | 301 | if (node) { |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
302 | gtk_style_context_remove_class(style, GTK_STYLE_CLASS_ERROR); |
| 15412 | 303 | } else { |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
304 | gtk_style_context_add_class(style, GTK_STYLE_CLASS_ERROR); |
| 15412 | 305 | } |
| 306 | g_free(str); | |
| 307 | g_free(xmlstr); | |
| 308 | if (node) | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
309 | purple_xmlnode_free(node); |
| 15412 | 310 | } |
| 311 | ||
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
312 | static void |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
313 | load_text_and_set_caret(const gchar *pre_text, const gchar *post_text) |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
314 | { |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
315 | GtkTextIter where; |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
316 | GtkTextMark *mark; |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
317 | |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
318 | gtk_text_buffer_begin_user_action(console->entry_buffer); |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
319 | |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
320 | gtk_text_buffer_set_text(console->entry_buffer, pre_text, -1); |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
321 | |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
322 | gtk_text_buffer_get_end_iter(console->entry_buffer, &where); |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
323 | mark = gtk_text_buffer_create_mark(console->entry_buffer, NULL, &where, TRUE); |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
324 | |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
325 | gtk_text_buffer_insert(console->entry_buffer, &where, post_text, -1); |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
326 | |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
327 | gtk_text_buffer_get_iter_at_mark(console->entry_buffer, &where, mark); |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
328 | gtk_text_buffer_place_cursor(console->entry_buffer, &where); |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
329 | gtk_text_buffer_delete_mark(console->entry_buffer, mark); |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
330 | |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
331 | gtk_text_buffer_end_user_action(console->entry_buffer); |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
332 | } |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
333 | |
| 15412 | 334 | static void iq_clicked_cb(GtkWidget *w, gpointer nul) |
| 335 | { | |
|
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
|
336 | GtkWidget *vbox, *hbox, *to_entry, *label, *type_combo; |
| 15412 | 337 | GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
338 | const gchar *to; |
| 15412 | 339 | int result; |
| 340 | char *stanza; | |
| 341 | ||
| 342 | GtkWidget *dialog = gtk_dialog_new_with_buttons("<iq/>", | |
| 343 | GTK_WINDOW(console->window), | |
| 344 | GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, | |
| 345 | GTK_STOCK_CANCEL, | |
| 346 | GTK_RESPONSE_REJECT, | |
| 347 | GTK_STOCK_OK, | |
| 348 | GTK_RESPONSE_ACCEPT, | |
| 349 | NULL); | |
| 350 | gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); | |
| 351 | 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
|
352 | vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); |
| 15412 | 353 | |
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35500
diff
changeset
|
354 | hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 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
|
355 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 356 | |
| 357 | label = gtk_label_new("To:"); | |
|
38007
3b971d2ecae1
Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37990
diff
changeset
|
358 | gtk_label_set_xalign(GTK_LABEL(label), 0); |
| 15412 | 359 | gtk_size_group_add_widget(sg, label); |
| 360 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 361 | ||
| 362 | to_entry = gtk_entry_new(); | |
| 363 | gtk_entry_set_activates_default (GTK_ENTRY (to_entry), TRUE); | |
| 364 | 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
|
365 | |
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35500
diff
changeset
|
366 | hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 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
|
367 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 368 | label = gtk_label_new("Type:"); |
|
38007
3b971d2ecae1
Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37990
diff
changeset
|
369 | gtk_label_set_xalign(GTK_LABEL(label), 0); |
| 15412 | 370 | |
| 371 | gtk_size_group_add_widget(sg, label); | |
| 372 | 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
|
373 | 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
|
374 | 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
|
375 | 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
|
376 | 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
|
377 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "error"); |
| 15412 | 378 | gtk_combo_box_set_active(GTK_COMBO_BOX(type_combo), 0); |
| 379 | 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
|
380 | |
|
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
|
381 | gtk_widget_show_all(vbox); |
| 15412 | 382 | |
| 383 | result = gtk_dialog_run(GTK_DIALOG(dialog)); | |
| 384 | if (result != GTK_RESPONSE_ACCEPT) { | |
| 385 | gtk_widget_destroy(dialog); | |
| 386 | return; | |
| 387 | } | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
388 | |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
389 | to = gtk_entry_get_text(GTK_ENTRY(to_entry)); |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
390 | stanza = g_strdup_printf("<iq %s%s%s id='console%x' type='%s'>", |
| 15412 | 391 | to && *to ? "to='" : "", |
| 392 | to && *to ? to : "", | |
| 393 | to && *to ? "'" : "", | |
| 394 | 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
|
395 | gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(type_combo))); |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
396 | load_text_and_set_caret(stanza, "</iq>"); |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
397 | gtk_widget_grab_focus(console->entry); |
| 15412 | 398 | g_free(stanza); |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
399 | |
| 15412 | 400 | gtk_widget_destroy(dialog); |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
401 | g_object_unref(sg); |
| 15412 | 402 | } |
| 403 | ||
| 404 | static void presence_clicked_cb(GtkWidget *w, gpointer nul) | |
| 405 | { | |
|
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
|
406 | GtkWidget *vbox; |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
407 | GtkWidget *hbox; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
408 | GtkWidget *to_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
409 | GtkWidget *status_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
410 | GtkWidget *priority_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
411 | GtkWidget *label; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
412 | GtkWidget *show_combo; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
413 | GtkWidget *type_combo; |
| 15412 | 414 | GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
415 | const gchar *to, *status, *priority; |
|
38999
b4b1c5868446
Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38358
diff
changeset
|
416 | gchar *type, *show; |
| 15412 | 417 | int result; |
| 418 | char *stanza; | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
419 | |
| 15412 | 420 | GtkWidget *dialog = gtk_dialog_new_with_buttons("<presence/>", |
| 421 | GTK_WINDOW(console->window), | |
| 422 | GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, | |
| 423 | GTK_STOCK_CANCEL, | |
| 424 | GTK_RESPONSE_REJECT, | |
| 425 | GTK_STOCK_OK, | |
| 426 | GTK_RESPONSE_ACCEPT, | |
| 427 | NULL); | |
| 428 | gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); | |
| 429 | 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
|
430 | vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); |
| 15412 | 431 | |
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35500
diff
changeset
|
432 | hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 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
|
433 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 434 | |
| 435 | label = gtk_label_new("To:"); | |
| 436 | gtk_size_group_add_widget(sg, label); | |
|
38007
3b971d2ecae1
Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37990
diff
changeset
|
437 | gtk_label_set_xalign(GTK_LABEL(label), 0); |
| 15412 | 438 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
| 439 | ||
| 440 | to_entry = gtk_entry_new(); | |
| 441 | gtk_entry_set_activates_default (GTK_ENTRY (to_entry), TRUE); | |
| 442 | 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
|
443 | |
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35500
diff
changeset
|
444 | hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 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
|
445 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 446 | label = gtk_label_new("Type:"); |
|
38007
3b971d2ecae1
Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37990
diff
changeset
|
447 | gtk_label_set_xalign(GTK_LABEL(label), 0); |
| 15412 | 448 | gtk_size_group_add_widget(sg, label); |
| 449 | 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
|
450 | 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
|
451 | 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
|
452 | 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
|
453 | 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
|
454 | 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
|
455 | 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
|
456 | 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
|
457 | 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
|
458 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "error"); |
| 15412 | 459 | gtk_combo_box_set_active(GTK_COMBO_BOX(type_combo), 0); |
| 460 | gtk_box_pack_start(GTK_BOX(hbox), type_combo, FALSE, FALSE, 0); | |
| 461 | ||
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35500
diff
changeset
|
462 | hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 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 | label = gtk_label_new("Show:"); |
|
38007
3b971d2ecae1
Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37990
diff
changeset
|
465 | gtk_label_set_xalign(GTK_LABEL(label), 0); |
| 15412 | 466 | gtk_size_group_add_widget(sg, label); |
| 467 | 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
|
468 | 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
|
469 | 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
|
470 | 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
|
471 | 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
|
472 | 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
|
473 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(show_combo), "chat"); |
| 15412 | 474 | |
| 475 | gtk_combo_box_set_active(GTK_COMBO_BOX(show_combo), 0); | |
| 476 | gtk_box_pack_start(GTK_BOX(hbox), show_combo, FALSE, FALSE, 0); | |
| 477 | ||
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35500
diff
changeset
|
478 | hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 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
|
479 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 480 | |
| 481 | label = gtk_label_new("Status:"); | |
|
38007
3b971d2ecae1
Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37990
diff
changeset
|
482 | gtk_label_set_xalign(GTK_LABEL(label), 0); |
| 15412 | 483 | gtk_size_group_add_widget(sg, label); |
| 484 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 485 | ||
| 486 | status_entry = gtk_entry_new(); | |
| 487 | gtk_entry_set_activates_default (GTK_ENTRY (status_entry), TRUE); | |
| 488 | gtk_box_pack_start(GTK_BOX(hbox), status_entry, FALSE, FALSE, 0); | |
| 489 | ||
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35500
diff
changeset
|
490 | hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 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
|
491 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 492 | |
| 493 | label = gtk_label_new("Priority:"); | |
|
38007
3b971d2ecae1
Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37990
diff
changeset
|
494 | gtk_label_set_xalign(GTK_LABEL(label), 0); |
| 15412 | 495 | gtk_size_group_add_widget(sg, label); |
| 496 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 497 | ||
| 498 | priority_entry = gtk_spin_button_new_with_range(-128, 127, 1); | |
| 499 | gtk_spin_button_set_value(GTK_SPIN_BUTTON(priority_entry), 0); | |
| 500 | gtk_box_pack_start(GTK_BOX(hbox), priority_entry, FALSE, FALSE, 0); | |
| 501 | ||
|
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
|
502 | gtk_widget_show_all(vbox); |
| 15412 | 503 | |
| 504 | result = gtk_dialog_run(GTK_DIALOG(dialog)); | |
| 505 | if (result != GTK_RESPONSE_ACCEPT) { | |
| 506 | gtk_widget_destroy(dialog); | |
| 507 | return; | |
| 508 | } | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
509 | |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
510 | to = gtk_entry_get_text(GTK_ENTRY(to_entry)); |
|
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
|
511 | type = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(type_combo)); |
|
38999
b4b1c5868446
Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38358
diff
changeset
|
512 | if (purple_strequal(type, "default")) { |
|
b4b1c5868446
Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38358
diff
changeset
|
513 | g_free(type); |
|
b4b1c5868446
Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38358
diff
changeset
|
514 | type = g_strdup(""); |
|
b4b1c5868446
Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38358
diff
changeset
|
515 | } |
|
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
|
516 | show = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(show_combo)); |
|
38999
b4b1c5868446
Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38358
diff
changeset
|
517 | if (purple_strequal(show, "default")) { |
|
b4b1c5868446
Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38358
diff
changeset
|
518 | g_free(show); |
|
b4b1c5868446
Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38358
diff
changeset
|
519 | show = g_strdup(""); |
|
b4b1c5868446
Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38358
diff
changeset
|
520 | } |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
521 | status = gtk_entry_get_text(GTK_ENTRY(status_entry)); |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
522 | priority = gtk_entry_get_text(GTK_ENTRY(priority_entry)); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
31321
diff
changeset
|
523 | if (purple_strequal(priority, "0")) |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
524 | priority = ""; |
| 15412 | 525 | |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
526 | stanza = g_strdup_printf("<presence %s%s%s id='console%x' %s%s%s>" |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
527 | "%s%s%s%s%s%s%s%s%s", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
528 | *to ? "to='" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
529 | *to ? to : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
530 | *to ? "'" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
531 | g_random_int(), |
| 15412 | 532 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
533 | *type ? "type='" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
534 | *type ? type : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
535 | *type ? "'" : "", |
| 15412 | 536 | |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
537 | *show ? "<show>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
538 | *show ? show : "", |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
539 | *show ? "</show>" : "", |
| 15412 | 540 | |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
541 | *status ? "<status>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
542 | *status ? status : "", |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
543 | *status ? "</status>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
544 | |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
545 | *priority ? "<priority>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
546 | *priority ? priority : "", |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
547 | *priority ? "</priority>" : ""); |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
548 | |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
549 | load_text_and_set_caret(stanza, "</presence>"); |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
550 | gtk_widget_grab_focus(console->entry); |
| 15412 | 551 | g_free(stanza); |
|
38999
b4b1c5868446
Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38358
diff
changeset
|
552 | g_free(type); |
|
b4b1c5868446
Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38358
diff
changeset
|
553 | g_free(show); |
| 15412 | 554 | |
| 555 | gtk_widget_destroy(dialog); | |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
556 | g_object_unref(sg); |
| 15412 | 557 | } |
| 558 | ||
| 559 | static void message_clicked_cb(GtkWidget *w, gpointer nul) | |
| 560 | { | |
|
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 | GtkWidget *vbox; |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
562 | GtkWidget *hbox; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
563 | GtkWidget *to_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
564 | GtkWidget *body_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
565 | GtkWidget *thread_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
566 | GtkWidget *subject_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
567 | GtkWidget *label; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
568 | GtkWidget *type_combo; |
| 15412 | 569 | GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
570 | const gchar *to, *body, *thread, *subject; |
| 15412 | 571 | char *stanza; |
| 572 | int result; | |
| 573 | ||
| 574 | GtkWidget *dialog = gtk_dialog_new_with_buttons("<message/>", | |
| 575 | GTK_WINDOW(console->window), | |
| 576 | GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, | |
| 577 | GTK_STOCK_CANCEL, | |
| 578 | GTK_RESPONSE_REJECT, | |
| 579 | GTK_STOCK_OK, | |
| 580 | GTK_RESPONSE_ACCEPT, | |
| 581 | NULL); | |
| 582 | gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); | |
| 583 | 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
|
584 | vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); |
| 15412 | 585 | |
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35500
diff
changeset
|
586 | hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 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
|
587 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 588 | |
| 589 | label = gtk_label_new("To:"); | |
|
38007
3b971d2ecae1
Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37990
diff
changeset
|
590 | gtk_label_set_xalign(GTK_LABEL(label), 0); |
| 15412 | 591 | gtk_size_group_add_widget(sg, label); |
| 592 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 593 | ||
| 594 | to_entry = gtk_entry_new(); | |
| 595 | gtk_entry_set_activates_default (GTK_ENTRY (to_entry), TRUE); | |
| 596 | gtk_box_pack_start(GTK_BOX(hbox), to_entry, FALSE, FALSE, 0); | |
| 597 | ||
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35500
diff
changeset
|
598 | hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 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
|
599 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 600 | label = gtk_label_new("Type:"); |
|
38007
3b971d2ecae1
Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37990
diff
changeset
|
601 | gtk_label_set_xalign(GTK_LABEL(label), 0); |
| 15412 | 602 | gtk_size_group_add_widget(sg, label); |
| 603 | 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
|
604 | 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
|
605 | 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
|
606 | 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
|
607 | 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
|
608 | 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
|
609 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "error"); |
| 15412 | 610 | gtk_combo_box_set_active(GTK_COMBO_BOX(type_combo), 0); |
| 611 | gtk_box_pack_start(GTK_BOX(hbox), type_combo, FALSE, FALSE, 0); | |
| 612 | ||
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35500
diff
changeset
|
613 | hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 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
|
614 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 615 | |
| 616 | label = gtk_label_new("Body:"); | |
|
38007
3b971d2ecae1
Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37990
diff
changeset
|
617 | gtk_label_set_xalign(GTK_LABEL(label), 0); |
| 15412 | 618 | gtk_size_group_add_widget(sg, label); |
| 619 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 620 | ||
| 621 | body_entry = gtk_entry_new(); | |
| 622 | gtk_entry_set_activates_default (GTK_ENTRY (body_entry), TRUE); | |
| 623 | gtk_box_pack_start(GTK_BOX(hbox), body_entry, FALSE, FALSE, 0); | |
| 624 | ||
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35500
diff
changeset
|
625 | hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 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
|
626 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 627 | |
| 628 | label = gtk_label_new("Subject:"); | |
|
38007
3b971d2ecae1
Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37990
diff
changeset
|
629 | gtk_label_set_xalign(GTK_LABEL(label), 0); |
| 15412 | 630 | gtk_size_group_add_widget(sg, label); |
| 631 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 632 | ||
| 633 | subject_entry = gtk_entry_new(); | |
| 634 | gtk_entry_set_activates_default (GTK_ENTRY (subject_entry), TRUE); | |
| 635 | gtk_box_pack_start(GTK_BOX(hbox), subject_entry, FALSE, FALSE, 0); | |
| 636 | ||
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35500
diff
changeset
|
637 | hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 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
|
638 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 639 | |
| 640 | label = gtk_label_new("Thread:"); | |
|
38007
3b971d2ecae1
Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37990
diff
changeset
|
641 | gtk_label_set_xalign(GTK_LABEL(label), 0); |
| 15412 | 642 | gtk_size_group_add_widget(sg, label); |
| 643 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 644 | ||
| 645 | thread_entry = gtk_entry_new(); | |
| 646 | gtk_entry_set_activates_default (GTK_ENTRY (thread_entry), TRUE); | |
| 647 | 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
|
648 | |
|
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
|
649 | gtk_widget_show_all(vbox); |
| 15412 | 650 | |
| 651 | result = gtk_dialog_run(GTK_DIALOG(dialog)); | |
| 652 | if (result != GTK_RESPONSE_ACCEPT) { | |
| 653 | gtk_widget_destroy(dialog); | |
| 654 | return; | |
| 655 | } | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
656 | |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
657 | to = gtk_entry_get_text(GTK_ENTRY(to_entry)); |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
658 | body = gtk_entry_get_text(GTK_ENTRY(body_entry)); |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
659 | thread = gtk_entry_get_text(GTK_ENTRY(thread_entry)); |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
660 | subject = gtk_entry_get_text(GTK_ENTRY(subject_entry)); |
| 15412 | 661 | |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
662 | stanza = g_strdup_printf("<message %s%s%s id='console%x' type='%s'>" |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
663 | "%s%s%s%s%s%s%s%s%s", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
664 | |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
665 | *to ? "to='" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
666 | *to ? to : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
667 | *to ? "'" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
668 | 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
|
669 | 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
|
670 | 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
|
671 | |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
672 | *body ? "<body>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
673 | *body ? body : "", |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
674 | *body ? "</body>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
675 | |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
676 | *subject ? "<subject>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
677 | *subject ? subject : "", |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
678 | *subject ? "</subject>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
679 | |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
680 | *thread ? "<thread>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
681 | *thread ? thread : "", |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
682 | *thread ? "</thread>" : ""); |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
683 | |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
684 | load_text_and_set_caret(stanza, "</message>"); |
|
33053
6ba80150e4c3
Fix the buttons in the XMPP Console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33011
diff
changeset
|
685 | gtk_widget_grab_focus(console->entry); |
| 15412 | 686 | g_free(stanza); |
| 687 | ||
| 688 | gtk_widget_destroy(dialog); | |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
689 | g_object_unref(sg); |
| 15412 | 690 | } |
| 691 | ||
| 692 | static void | |
|
29783
96ab389c9181
xmppconsole: Properly catch things before an account is "signed on".
Paul Aurich <darkrain42@pidgin.im>
parents:
29529
diff
changeset
|
693 | signing_on_cb(PurpleConnection *gc) |
| 15412 | 694 | { |
|
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
|
695 | 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
|
696 | |
| 15412 | 697 | if (!console) |
| 698 | return; | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
699 | |
|
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
|
700 | 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
|
701 | 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
|
702 | 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
|
703 | |
|
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
|
704 | 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
|
705 | purple_account_get_username(account)); |
| 15412 | 706 | console->accounts = g_list_append(console->accounts, gc); |
| 707 | console->count++; | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
708 | |
|
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
|
709 | 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
|
710 | console->gc = gc; |
|
39001
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
711 | gtk_text_buffer_set_text(console->buffer, "", 0); |
|
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
|
712 | 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
|
713 | } else |
| 15412 | 714 | gtk_widget_show_all(console->hbox); |
| 715 | } | |
| 716 | ||
| 717 | static void | |
| 15884 | 718 | signed_off_cb(PurpleConnection *gc) |
| 15412 | 719 | { |
| 720 | int i = 0; | |
| 721 | GList *l; | |
| 722 | ||
| 723 | if (!console) | |
| 724 | return; | |
| 725 | ||
| 726 | l = console->accounts; | |
| 727 | while (l) { | |
| 15884 | 728 | PurpleConnection *g = l->data; |
| 15412 | 729 | if (gc == g) |
| 730 | break; | |
| 731 | i++; | |
| 732 | l = l->next; | |
| 733 | } | |
| 734 | ||
| 735 | if (l == NULL) | |
| 736 | return; | |
| 737 | ||
|
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
|
738 | gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(console->dropdown), i); |
| 15412 | 739 | console->accounts = g_list_remove(console->accounts, gc); |
| 740 | console->count--; | |
| 741 | ||
| 742 | if (gc == console->gc) { | |
|
39001
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
743 | GtkTextIter end; |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
744 | gtk_text_buffer_get_end_iter(console->buffer, &end); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
745 | gtk_text_buffer_insert_with_tags(console->buffer, &end, _("Logged out."), -1, |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
746 | console->tags.info, NULL); |
| 15412 | 747 | console->gc = NULL; |
| 748 | } | |
| 749 | } | |
| 750 | ||
| 751 | 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
|
752 | console_destroy(GtkWidget *window, gpointer nul) |
| 15412 | 753 | { |
| 754 | g_list_free(console->accounts); | |
| 755 | g_free(console); | |
| 756 | console = NULL; | |
| 757 | } | |
| 758 | ||
| 759 | static void | |
| 760 | dropdown_changed_cb(GtkComboBox *widget, gpointer nul) | |
| 761 | { | |
| 762 | if (!console) | |
| 763 | return; | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
764 | |
|
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
|
765 | console->gc = g_list_nth_data(console->accounts, gtk_combo_box_get_active(GTK_COMBO_BOX(console->dropdown))); |
|
39001
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
766 | gtk_text_buffer_set_text(console->buffer, "", 0); |
| 15412 | 767 | } |
| 768 | ||
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
769 | static void |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
770 | create_console(PurplePluginAction *action) |
| 15412 | 771 | { |
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35500
diff
changeset
|
772 | GtkWidget *vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6); |
| 15412 | 773 | GtkWidget *label; |
| 774 | GtkWidget *toolbar; | |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
775 | GList *connections; |
| 15412 | 776 | GtkToolItem *button; |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
777 | GtkCssProvider *entry_css; |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
778 | GtkStyleContext *context; |
| 15412 | 779 | |
| 780 | if (console) { | |
| 781 | gtk_window_present(GTK_WINDOW(console->window)); | |
| 782 | return; | |
| 783 | } | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
784 | |
| 15412 | 785 | console = g_new0(XmppConsole, 1); |
| 786 | ||
| 17213 | 787 | console->window = pidgin_create_window(_("XMPP Console"), PIDGIN_HIG_BORDER, NULL, TRUE); |
| 15412 | 788 | g_signal_connect(G_OBJECT(console->window), "destroy", G_CALLBACK(console_destroy), NULL); |
| 789 | gtk_window_set_default_size(GTK_WINDOW(console->window), 580, 400); | |
| 790 | gtk_container_add(GTK_CONTAINER(console->window), vbox); | |
| 791 | ||
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35500
diff
changeset
|
792 | console->hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 3); |
| 15412 | 793 | gtk_box_pack_start(GTK_BOX(vbox), console->hbox, FALSE, FALSE, 0); |
| 794 | label = gtk_label_new(_("Account: ")); | |
|
38007
3b971d2ecae1
Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37990
diff
changeset
|
795 | gtk_label_set_xalign(GTK_LABEL(label), 0.0); |
| 15412 | 796 | 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
|
797 | console->dropdown = gtk_combo_box_text_new(); |
| 15884 | 798 | for (connections = purple_connections_get_all(); connections; connections = connections->next) { |
| 799 | 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
|
800 | if (xmppconsole_is_xmpp_account(purple_connection_get_account(gc))) { |
| 15412 | 801 | console->count++; |
| 802 | 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
|
803 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(console->dropdown), |
| 15884 | 804 | purple_account_get_username(purple_connection_get_account(gc))); |
| 15412 | 805 | if (!console->gc) |
| 806 | console->gc = gc; | |
| 807 | } | |
| 808 | } | |
|
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
|
809 | gtk_combo_box_set_active(GTK_COMBO_BOX(console->dropdown), 0); |
| 15412 | 810 | gtk_box_pack_start(GTK_BOX(console->hbox), console->dropdown, TRUE, TRUE, 0); |
| 811 | g_signal_connect(G_OBJECT(console->dropdown), "changed", G_CALLBACK(dropdown_changed_cb), NULL); | |
| 812 | ||
|
39001
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
813 | console->view = gtk_text_view_new(); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
814 | gtk_text_view_set_editable(GTK_TEXT_VIEW(console->view), FALSE); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
815 | gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(console->view), GTK_WRAP_WORD); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
816 | |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
817 | console->buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(console->view)); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
818 | console->tags.info = gtk_text_buffer_create_tag(console->buffer, "info", |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
819 | "foreground", "#777777", NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
820 | console->tags.incoming = gtk_text_buffer_create_tag(console->buffer, "incoming", |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
821 | "paragraph-background", "#ffcece", NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
822 | console->tags.outgoing = gtk_text_buffer_create_tag(console->buffer, "outgoing", |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
823 | "paragraph-background", "#dcecc4", NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
824 | console->tags.bracket = gtk_text_buffer_create_tag(console->buffer, "bracket", |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
825 | "foreground", "#940f8c", NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
826 | console->tags.tag = gtk_text_buffer_create_tag(console->buffer, "tag", |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
827 | "foreground", "#8b1dab", |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
828 | "weight", PANGO_WEIGHT_BOLD, NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
829 | console->tags.attr = gtk_text_buffer_create_tag(console->buffer, "attr", |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
830 | "foreground", "#a02961", |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
831 | "weight", PANGO_WEIGHT_BOLD, NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
832 | console->tags.value = gtk_text_buffer_create_tag(console->buffer, "value", |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
833 | "foreground", "#324aa4", NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
834 | console->tags.xmlns = gtk_text_buffer_create_tag(console->buffer, "xmlns", |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
835 | "foreground", "#2cb12f", |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
836 | "weight", PANGO_WEIGHT_BOLD, NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
837 | |
|
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 | if (console->count == 0) { |
|
39001
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
839 | GtkTextIter start, end; |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
840 | gtk_text_buffer_set_text(console->buffer, _("Not connected to XMPP"), -1); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
841 | gtk_text_buffer_get_bounds(console->buffer, &start, &end); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
842 | gtk_text_buffer_apply_tag(console->buffer, console->tags.info, &start, &end); |
|
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
|
843 | } |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
31321
diff
changeset
|
844 | gtk_box_pack_start(GTK_BOX(vbox), |
|
39001
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
845 | pidgin_make_scrollable(console->view, 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
|
846 | TRUE, TRUE, 0); |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
847 | |
| 15412 | 848 | toolbar = gtk_toolbar_new(); |
| 849 | 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
|
850 | gtk_tool_item_set_is_important(button, TRUE); |
| 15412 | 851 | g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(iq_clicked_cb), NULL); |
| 852 | gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button)); | |
| 853 | ||
| 854 | 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
|
855 | gtk_tool_item_set_is_important(button, TRUE); |
| 15412 | 856 | g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(presence_clicked_cb), NULL); |
| 857 | gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button)); | |
| 858 | ||
| 859 | 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
|
860 | gtk_tool_item_set_is_important(button, TRUE); |
| 15412 | 861 | g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(message_clicked_cb), NULL); |
| 862 | 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
|
863 | |
| 15412 | 864 | 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
|
865 | |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
866 | console->entry = gtk_text_view_new(); |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
867 | gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(console->entry), GTK_WRAP_WORD); |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
868 | entry_css = gtk_css_provider_new(); |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
869 | gtk_css_provider_load_from_data(entry_css, |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
870 | "textview." GTK_STYLE_CLASS_ERROR " text {background-color:#ffcece;}", |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
871 | -1, NULL); |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
872 | context = gtk_widget_get_style_context(console->entry); |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
873 | gtk_style_context_add_provider(context, GTK_STYLE_PROVIDER(entry_css), |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
874 | GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
875 | console->entry_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(console->entry)); |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
876 | g_signal_connect(G_OBJECT(console->entry),"key-press-event", G_CALLBACK(message_send_cb), console); |
| 15412 | 877 | |
|
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
|
878 | 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
|
879 | gtk_box_pack_start(GTK_BOX(vbox), console->sw, FALSE, FALSE, 0); |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
880 | g_signal_connect(G_OBJECT(console->entry_buffer), "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
|
881 | |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
882 | entry_changed_cb(console->entry_buffer, NULL); |
| 15412 | 883 | |
| 884 | gtk_widget_show_all(console->window); | |
| 885 | if (console->count < 2) | |
| 886 | gtk_widget_hide(console->hbox); | |
| 887 | } | |
| 888 | ||
| 889 | static GList * | |
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
890 | actions(PurplePlugin *plugin) |
| 15412 | 891 | { |
| 892 | GList *l = NULL; | |
| 15884 | 893 | PurplePluginAction *act = NULL; |
| 15412 | 894 | |
| 15884 | 895 | act = purple_plugin_action_new(_("XMPP Console"), create_console); |
| 15412 | 896 | 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
|
897 | |
| 15412 | 898 | return l; |
| 899 | } | |
| 900 | ||
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
901 | static PidginPluginInfo * |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
902 | plugin_query(GError **error) |
| 15412 | 903 | { |
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
904 | const gchar * const authors[] = { |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
905 | "Sean Egan <seanegan@gmail.com>", |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
906 | NULL |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
907 | }; |
| 15412 | 908 | |
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
909 | return pidgin_plugin_info_new( |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
910 | "id", PLUGIN_ID, |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
911 | "name", N_("XMPP Console"), |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
912 | "version", DISPLAY_VERSION, |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
913 | "category", N_("Protocol utility"), |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
914 | "summary", N_("Send and receive raw XMPP stanzas."), |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
915 | "description", N_("This plugin is useful for debugging XMPP servers " |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
916 | "or clients."), |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
917 | "authors", authors, |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
918 | "website", PURPLE_WEBSITE, |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
919 | "abi-version", PURPLE_ABI_VERSION, |
|
36934
e7268aeb3b89
Renamed plugin info callback properties to end with "-cb", and their respective symbols.
Ankit Vani <a@nevitus.org>
parents:
36758
diff
changeset
|
920 | "actions-cb", actions, |
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
921 | NULL |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
922 | ); |
| 15412 | 923 | } |
| 924 | ||
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
925 | static gboolean |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
926 | plugin_load(PurplePlugin *plugin, GError **error) |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
927 | { |
| 37041 | 928 | int i; |
| 929 | gboolean any_registered = FALSE; | |
| 930 | ||
| 931 | xmpp_console_handle = plugin; | |
| 932 | ||
| 933 | i = 0; | |
| 934 | while (xmpp_prpls[i] != NULL) { | |
| 935 | PurpleProtocol *xmpp; | |
| 936 | ||
| 937 | xmpp = purple_protocols_find(xmpp_prpls[i]); | |
| 938 | i++; | |
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
939 | |
| 37041 | 940 | if (!xmpp) |
| 941 | continue; | |
| 942 | any_registered = TRUE; | |
| 943 | ||
| 944 | purple_signal_connect(xmpp, "jabber-receiving-xmlnode", | |
| 945 | xmpp_console_handle, | |
| 946 | PURPLE_CALLBACK(purple_xmlnode_received_cb), NULL); | |
| 947 | purple_signal_connect(xmpp, "jabber-sending-text", | |
| 948 | xmpp_console_handle, | |
| 949 | PURPLE_CALLBACK(purple_xmlnode_sent_cb), NULL); | |
| 950 | } | |
| 951 | ||
| 952 | if (!any_registered) { | |
| 953 | g_set_error(error, PLUGIN_DOMAIN, 0, _("No XMPP protocol is loaded.")); | |
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
954 | return FALSE; |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
955 | } |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
956 | |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
957 | purple_signal_connect(purple_connections_get_handle(), "signing-on", |
| 37041 | 958 | plugin, PURPLE_CALLBACK(signing_on_cb), NULL); |
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
959 | purple_signal_connect(purple_connections_get_handle(), "signed-off", |
| 37041 | 960 | plugin, PURPLE_CALLBACK(signed_off_cb), NULL); |
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
961 | |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
962 | return TRUE; |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
963 | } |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
964 | |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
965 | static gboolean |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
966 | plugin_unload(PurplePlugin *plugin, GError **error) |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
967 | { |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
968 | if (console) |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
969 | gtk_widget_destroy(console->window); |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
970 | return TRUE; |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
971 | } |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
972 | |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
973 | PURPLE_PLUGIN_INIT(xmppconsole, plugin_query, plugin_load, plugin_unload); |