Fri, 09 Aug 2019 00:41:13 -0400
Split pidgin_account_option_menu into its own files.
| 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 |
|
39003
37b2e13b2cfa
Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39002
diff
changeset
|
101 | purple_xmlnode_append_to_buffer(PurpleXmlNode *node, gint indent_level, 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; |
|
39003
37b2e13b2cfa
Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39002
diff
changeset
|
105 | gint i; |
| 15412 | 106 | |
|
39001
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
107 | g_return_if_fail(node != NULL); |
| 15412 | 108 | |
|
39003
37b2e13b2cfa
Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39002
diff
changeset
|
109 | for (i = 0; i < indent_level; i++) { |
|
37b2e13b2cfa
Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39002
diff
changeset
|
110 | gtk_text_buffer_insert_with_tags(console->buffer, iter, "\t", 1, tag, NULL); |
|
37b2e13b2cfa
Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39002
diff
changeset
|
111 | } |
|
37b2e13b2cfa
Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39002
diff
changeset
|
112 | |
|
39001
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
113 | 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
|
114 | tag, console->tags.bracket, NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
115 | 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
|
116 | tag, console->tags.tag, NULL); |
| 15412 | 117 | |
| 118 | if (node->xmlns) { | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
119 | if ((!node->parent || |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
120 | !node->parent->xmlns || |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
121 | !purple_strequal(node->xmlns, node->parent->xmlns)) && |
|
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
122 | !purple_strequal(node->xmlns, "jabber:client")) |
| 15412 | 123 | { |
|
39001
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
124 | 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
|
125 | tag, NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
126 | 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
|
127 | tag, console->tags.attr, NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
128 | 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
|
129 | tag, NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
130 | 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
|
131 | tag, console->tags.xmlns, NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
132 | 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
|
133 | tag, NULL); |
| 15412 | 134 | } |
| 135 | } | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
136 | for (c = node->child; c; c = c->next) |
| 15412 | 137 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
138 | 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
|
139 | 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
|
140 | tag, NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
141 | 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
|
142 | tag, console->tags.attr, NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
143 | 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
|
144 | tag, NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
145 | 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
|
146 | tag, console->tags.value, NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
147 | 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
|
148 | tag, NULL); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
149 | } 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
|
150 | if (c->type == PURPLE_XMLNODE_TYPE_DATA) |
| 15412 | 151 | pretty = FALSE; |
| 152 | need_end = TRUE; | |
| 153 | } | |
| 154 | } | |
| 155 | ||
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
156 | if (need_end) { |
|
39001
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
157 | 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
|
158 | tag, console->tags.bracket, NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
159 | if (pretty) { |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
160 | 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
|
161 | tag, NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
162 | } |
| 15412 | 163 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
164 | for (c = node->child; c; c = c->next) |
| 15412 | 165 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
166 | if (c->type == PURPLE_XMLNODE_TYPE_TAG) { |
|
39003
37b2e13b2cfa
Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39002
diff
changeset
|
167 | purple_xmlnode_append_to_buffer(c, indent_level + 1, iter, tag); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
168 | } 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
|
169 | 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
|
170 | tag, NULL); |
| 15412 | 171 | } |
| 172 | } | |
| 173 | ||
|
39003
37b2e13b2cfa
Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39002
diff
changeset
|
174 | if (pretty) { |
|
37b2e13b2cfa
Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39002
diff
changeset
|
175 | for (i = 0; i < indent_level; i++) { |
|
37b2e13b2cfa
Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39002
diff
changeset
|
176 | gtk_text_buffer_insert_with_tags(console->buffer, iter, "\t", 1, tag, NULL); |
|
37b2e13b2cfa
Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39002
diff
changeset
|
177 | } |
|
37b2e13b2cfa
Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39002
diff
changeset
|
178 | } |
|
39001
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, console->tags.bracket, 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, "/", 1, |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
182 | 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, node->name, -1, |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
184 | tag, console->tags.tag, 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, ">", 1, |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
186 | tag, console->tags.bracket, NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
187 | 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
|
188 | tag, NULL); |
| 15412 | 189 | } else { |
|
39001
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, 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, ">", 1, |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
193 | tag, console->tags.bracket, NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
194 | 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
|
195 | tag, NULL); |
| 15412 | 196 | } |
| 197 | } | |
| 198 | ||
| 199 | static void | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
200 | purple_xmlnode_received_cb(PurpleConnection *gc, PurpleXmlNode **packet, gpointer null) |
| 15412 | 201 | { |
|
39001
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
202 | GtkTextIter iter; |
| 15412 | 203 | |
| 204 | if (!console || console->gc != gc) | |
| 205 | return; | |
|
39001
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
206 | |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
207 | gtk_text_buffer_get_end_iter(console->buffer, &iter); |
|
39003
37b2e13b2cfa
Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39002
diff
changeset
|
208 | purple_xmlnode_append_to_buffer(*packet, 0, &iter, console->tags.incoming); |
| 15412 | 209 | } |
| 210 | ||
| 211 | static void | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
212 | purple_xmlnode_sent_cb(PurpleConnection *gc, char **packet, gpointer null) |
| 15412 | 213 | { |
|
39001
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
214 | GtkTextIter iter; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
215 | PurpleXmlNode *node; |
| 15412 | 216 | |
| 217 | if (!console || console->gc != gc) | |
| 218 | return; | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
219 | 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
|
220 | |
| 15412 | 221 | if (!node) |
| 222 | return; | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
223 | |
|
39001
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
224 | gtk_text_buffer_get_end_iter(console->buffer, &iter); |
|
39003
37b2e13b2cfa
Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39002
diff
changeset
|
225 | purple_xmlnode_append_to_buffer(node, 0, &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
|
226 | purple_xmlnode_free(node); |
| 15412 | 227 | } |
| 228 | ||
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
229 | static gboolean |
|
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
230 | message_send_cb(GtkWidget *widget, GdkEventKey *event, gpointer p) |
| 15412 | 231 | { |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
232 | 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
|
233 | PurpleConnection *gc; |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
234 | gchar *text; |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
235 | GtkTextIter start, end; |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
236 | |
|
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
237 | 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
|
238 | return FALSE; |
| 15412 | 239 | |
| 240 | 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
|
241 | |
|
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 | if (gc) |
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
243 | 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
|
244 | |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
245 | 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
|
246 | 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
|
247 | |
|
36633
2dcb81a189bd
Refactored pidgin to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36626
diff
changeset
|
248 | if (protocol) |
| 36719 | 249 | purple_protocol_server_iface_send_raw(protocol, gc, text, strlen(text)); |
| 15412 | 250 | |
| 251 | g_free(text); | |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
252 | 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
|
253 | |
|
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
254 | return TRUE; |
| 15412 | 255 | } |
| 256 | ||
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
257 | static void |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
258 | entry_changed_cb(GtkTextBuffer *buffer, void *data) |
| 15412 | 259 | { |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
260 | GtkTextIter start, end; |
| 15412 | 261 | char *xmlstr, *str; |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
262 | #if 0 |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
263 | int wrapped_lines; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
264 | int lines; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
265 | GdkRectangle oneline; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
266 | int height; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
267 | 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
|
268 | #endif |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
269 | PurpleXmlNode *node; |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
270 | GtkStyleContext *style; |
| 15412 | 271 | |
|
33011
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
272 | #if 0 |
|
861a290f5464
Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32998
diff
changeset
|
273 | /* 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
|
274 | wrapped_lines = 1; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
275 | 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
|
276 | 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
|
277 | 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
|
278 | wrapped_lines++; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
279 | |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
280 | lines = gtk_text_buffer_get_line_count(buffer); |
| 15412 | 281 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
282 | /* 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
|
283 | lines = MIN(lines, 6); |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
284 | wrapped_lines = MIN(wrapped_lines, 6); |
| 15412 | 285 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
286 | 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
|
287 | 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
|
288 | pad_inside = gtk_text_view_get_pixels_inside_wrap(GTK_TEXT_VIEW(console->entry)); |
| 15412 | 289 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
290 | 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
|
291 | height += (oneline.height + pad_inside) * (wrapped_lines - lines); |
| 15412 | 292 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
293 | 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
|
294 | #endif |
| 15412 | 295 | |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
296 | 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
|
297 | str = gtk_text_buffer_get_text(buffer, &start, &end, FALSE); |
| 15412 | 298 | if (!str) |
| 299 | return; | |
| 300 | 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
|
301 | 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
|
302 | style = gtk_widget_get_style_context(console->entry); |
| 15412 | 303 | if (node) { |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
304 | gtk_style_context_remove_class(style, GTK_STYLE_CLASS_ERROR); |
| 15412 | 305 | } else { |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
306 | gtk_style_context_add_class(style, GTK_STYLE_CLASS_ERROR); |
| 15412 | 307 | } |
| 308 | g_free(str); | |
| 309 | g_free(xmlstr); | |
| 310 | if (node) | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34276
diff
changeset
|
311 | purple_xmlnode_free(node); |
| 15412 | 312 | } |
| 313 | ||
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
314 | static void |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
315 | 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
|
316 | { |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
317 | GtkTextIter where; |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
318 | GtkTextMark *mark; |
|
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_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
|
321 | |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
322 | 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
|
323 | |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
324 | 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
|
325 | 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
|
326 | |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
327 | 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
|
328 | |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
329 | 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
|
330 | 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
|
331 | 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
|
332 | |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
333 | 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
|
334 | } |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
335 | |
| 15412 | 336 | static void iq_clicked_cb(GtkWidget *w, gpointer nul) |
| 337 | { | |
|
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
|
338 | GtkWidget *vbox, *hbox, *to_entry, *label, *type_combo; |
| 15412 | 339 | 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
|
340 | const gchar *to; |
| 15412 | 341 | int result; |
| 342 | char *stanza; | |
| 343 | ||
| 344 | GtkWidget *dialog = gtk_dialog_new_with_buttons("<iq/>", | |
| 345 | GTK_WINDOW(console->window), | |
| 346 | GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, | |
|
39002
b97726e20bed
Remove deprecated stock icons from XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39001
diff
changeset
|
347 | _("_Cancel"), |
| 15412 | 348 | GTK_RESPONSE_REJECT, |
|
39002
b97726e20bed
Remove deprecated stock icons from XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39001
diff
changeset
|
349 | _("_OK"), |
| 15412 | 350 | GTK_RESPONSE_ACCEPT, |
| 351 | NULL); | |
| 352 | gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); | |
| 353 | 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
|
354 | vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); |
| 15412 | 355 | |
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35500
diff
changeset
|
356 | 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
|
357 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 358 | |
| 359 | 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
|
360 | gtk_label_set_xalign(GTK_LABEL(label), 0); |
| 15412 | 361 | gtk_size_group_add_widget(sg, label); |
| 362 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 363 | ||
| 364 | to_entry = gtk_entry_new(); | |
| 365 | gtk_entry_set_activates_default (GTK_ENTRY (to_entry), TRUE); | |
| 366 | 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
|
367 | |
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35500
diff
changeset
|
368 | 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
|
369 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 370 | 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
|
371 | gtk_label_set_xalign(GTK_LABEL(label), 0); |
| 15412 | 372 | |
| 373 | gtk_size_group_add_widget(sg, label); | |
| 374 | 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
|
375 | 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
|
376 | 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
|
377 | 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
|
378 | 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
|
379 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "error"); |
| 15412 | 380 | gtk_combo_box_set_active(GTK_COMBO_BOX(type_combo), 0); |
| 381 | 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
|
382 | |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29876
diff
changeset
|
383 | gtk_widget_show_all(vbox); |
| 15412 | 384 | |
| 385 | result = gtk_dialog_run(GTK_DIALOG(dialog)); | |
| 386 | if (result != GTK_RESPONSE_ACCEPT) { | |
| 387 | gtk_widget_destroy(dialog); | |
| 388 | return; | |
| 389 | } | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
390 | |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
391 | 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
|
392 | stanza = g_strdup_printf("<iq %s%s%s id='console%x' type='%s'>", |
| 15412 | 393 | to && *to ? "to='" : "", |
| 394 | to && *to ? to : "", | |
| 395 | to && *to ? "'" : "", | |
| 396 | 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
|
397 | 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
|
398 | 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
|
399 | gtk_widget_grab_focus(console->entry); |
| 15412 | 400 | g_free(stanza); |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
401 | |
| 15412 | 402 | gtk_widget_destroy(dialog); |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
403 | g_object_unref(sg); |
| 15412 | 404 | } |
| 405 | ||
| 406 | static void presence_clicked_cb(GtkWidget *w, gpointer nul) | |
| 407 | { | |
|
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
|
408 | GtkWidget *vbox; |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
409 | GtkWidget *hbox; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
410 | GtkWidget *to_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
411 | GtkWidget *status_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
412 | GtkWidget *priority_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
413 | GtkWidget *label; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
414 | GtkWidget *show_combo; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
415 | GtkWidget *type_combo; |
| 15412 | 416 | 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
|
417 | 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
|
418 | gchar *type, *show; |
| 15412 | 419 | int result; |
| 420 | char *stanza; | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
421 | |
| 15412 | 422 | GtkWidget *dialog = gtk_dialog_new_with_buttons("<presence/>", |
| 423 | GTK_WINDOW(console->window), | |
| 424 | GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, | |
|
39002
b97726e20bed
Remove deprecated stock icons from XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39001
diff
changeset
|
425 | _("_Cancel"), |
| 15412 | 426 | GTK_RESPONSE_REJECT, |
|
39002
b97726e20bed
Remove deprecated stock icons from XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39001
diff
changeset
|
427 | _("_OK"), |
| 15412 | 428 | GTK_RESPONSE_ACCEPT, |
| 429 | NULL); | |
| 430 | gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); | |
| 431 | 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
|
432 | vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); |
| 15412 | 433 | |
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35500
diff
changeset
|
434 | 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
|
435 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 436 | |
| 437 | label = gtk_label_new("To:"); | |
| 438 | 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
|
439 | gtk_label_set_xalign(GTK_LABEL(label), 0); |
| 15412 | 440 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
| 441 | ||
| 442 | to_entry = gtk_entry_new(); | |
| 443 | gtk_entry_set_activates_default (GTK_ENTRY (to_entry), TRUE); | |
| 444 | 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
|
445 | |
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35500
diff
changeset
|
446 | 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
|
447 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 448 | 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
|
449 | gtk_label_set_xalign(GTK_LABEL(label), 0); |
| 15412 | 450 | gtk_size_group_add_widget(sg, label); |
| 451 | 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
|
452 | 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
|
453 | 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
|
454 | 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
|
455 | 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
|
456 | 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
|
457 | 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
|
458 | 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
|
459 | 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
|
460 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "error"); |
| 15412 | 461 | gtk_combo_box_set_active(GTK_COMBO_BOX(type_combo), 0); |
| 462 | gtk_box_pack_start(GTK_BOX(hbox), type_combo, FALSE, FALSE, 0); | |
| 463 | ||
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35500
diff
changeset
|
464 | 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
|
465 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 466 | 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
|
467 | gtk_label_set_xalign(GTK_LABEL(label), 0); |
| 15412 | 468 | gtk_size_group_add_widget(sg, label); |
| 469 | 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
|
470 | 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
|
471 | 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
|
472 | 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
|
473 | 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
|
474 | 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
|
475 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(show_combo), "chat"); |
| 15412 | 476 | |
| 477 | gtk_combo_box_set_active(GTK_COMBO_BOX(show_combo), 0); | |
| 478 | gtk_box_pack_start(GTK_BOX(hbox), show_combo, FALSE, FALSE, 0); | |
| 479 | ||
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35500
diff
changeset
|
480 | 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
|
481 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 482 | |
| 483 | 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
|
484 | gtk_label_set_xalign(GTK_LABEL(label), 0); |
| 15412 | 485 | gtk_size_group_add_widget(sg, label); |
| 486 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 487 | ||
| 488 | status_entry = gtk_entry_new(); | |
| 489 | gtk_entry_set_activates_default (GTK_ENTRY (status_entry), TRUE); | |
| 490 | gtk_box_pack_start(GTK_BOX(hbox), status_entry, FALSE, FALSE, 0); | |
| 491 | ||
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35500
diff
changeset
|
492 | 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
|
493 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 494 | |
| 495 | 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
|
496 | gtk_label_set_xalign(GTK_LABEL(label), 0); |
| 15412 | 497 | gtk_size_group_add_widget(sg, label); |
| 498 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 499 | ||
| 500 | priority_entry = gtk_spin_button_new_with_range(-128, 127, 1); | |
| 501 | gtk_spin_button_set_value(GTK_SPIN_BUTTON(priority_entry), 0); | |
| 502 | gtk_box_pack_start(GTK_BOX(hbox), priority_entry, FALSE, FALSE, 0); | |
| 503 | ||
|
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
|
504 | gtk_widget_show_all(vbox); |
| 15412 | 505 | |
| 506 | result = gtk_dialog_run(GTK_DIALOG(dialog)); | |
| 507 | if (result != GTK_RESPONSE_ACCEPT) { | |
| 508 | gtk_widget_destroy(dialog); | |
| 509 | return; | |
| 510 | } | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
511 | |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
512 | 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
|
513 | 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
|
514 | 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
|
515 | g_free(type); |
|
b4b1c5868446
Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38358
diff
changeset
|
516 | type = g_strdup(""); |
|
b4b1c5868446
Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38358
diff
changeset
|
517 | } |
|
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
|
518 | 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
|
519 | 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
|
520 | g_free(show); |
|
b4b1c5868446
Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38358
diff
changeset
|
521 | show = g_strdup(""); |
|
b4b1c5868446
Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38358
diff
changeset
|
522 | } |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
523 | 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
|
524 | priority = gtk_entry_get_text(GTK_ENTRY(priority_entry)); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
31321
diff
changeset
|
525 | 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
|
526 | priority = ""; |
| 15412 | 527 | |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
528 | 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
|
529 | "%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
|
530 | *to ? "to='" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
531 | *to ? to : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
532 | *to ? "'" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
533 | g_random_int(), |
| 15412 | 534 | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
535 | *type ? "type='" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
536 | *type ? type : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
537 | *type ? "'" : "", |
| 15412 | 538 | |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
539 | *show ? "<show>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
540 | *show ? show : "", |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
541 | *show ? "</show>" : "", |
| 15412 | 542 | |
|
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 | *status ? status : "", |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
545 | *status ? "</status>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
546 | |
|
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 | *priority ? priority : "", |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
549 | *priority ? "</priority>" : ""); |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
550 | |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
551 | 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
|
552 | gtk_widget_grab_focus(console->entry); |
| 15412 | 553 | g_free(stanza); |
|
38999
b4b1c5868446
Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38358
diff
changeset
|
554 | g_free(type); |
|
b4b1c5868446
Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38358
diff
changeset
|
555 | g_free(show); |
| 15412 | 556 | |
| 557 | gtk_widget_destroy(dialog); | |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
558 | g_object_unref(sg); |
| 15412 | 559 | } |
| 560 | ||
| 561 | static void message_clicked_cb(GtkWidget *w, gpointer nul) | |
| 562 | { | |
|
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
|
563 | GtkWidget *vbox; |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
564 | GtkWidget *hbox; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
565 | GtkWidget *to_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
566 | GtkWidget *body_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
567 | GtkWidget *thread_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
568 | GtkWidget *subject_entry; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
569 | GtkWidget *label; |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
570 | GtkWidget *type_combo; |
| 15412 | 571 | 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
|
572 | const gchar *to, *body, *thread, *subject; |
| 15412 | 573 | char *stanza; |
| 574 | int result; | |
| 575 | ||
| 576 | GtkWidget *dialog = gtk_dialog_new_with_buttons("<message/>", | |
| 577 | GTK_WINDOW(console->window), | |
| 578 | GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, | |
|
39002
b97726e20bed
Remove deprecated stock icons from XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39001
diff
changeset
|
579 | _("_Cancel"), |
| 15412 | 580 | GTK_RESPONSE_REJECT, |
|
39002
b97726e20bed
Remove deprecated stock icons from XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39001
diff
changeset
|
581 | _("_OK"), |
| 15412 | 582 | GTK_RESPONSE_ACCEPT, |
| 583 | NULL); | |
| 584 | gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); | |
| 585 | 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
|
586 | vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); |
| 15412 | 587 | |
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35500
diff
changeset
|
588 | 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
|
589 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 590 | |
| 591 | 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
|
592 | gtk_label_set_xalign(GTK_LABEL(label), 0); |
| 15412 | 593 | gtk_size_group_add_widget(sg, label); |
| 594 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 595 | ||
| 596 | to_entry = gtk_entry_new(); | |
| 597 | gtk_entry_set_activates_default (GTK_ENTRY (to_entry), TRUE); | |
| 598 | gtk_box_pack_start(GTK_BOX(hbox), to_entry, FALSE, FALSE, 0); | |
| 599 | ||
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35500
diff
changeset
|
600 | 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
|
601 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 602 | 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
|
603 | gtk_label_set_xalign(GTK_LABEL(label), 0); |
| 15412 | 604 | gtk_size_group_add_widget(sg, label); |
| 605 | 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
|
606 | 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
|
607 | 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
|
608 | 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
|
609 | 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
|
610 | 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
|
611 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_combo), "error"); |
| 15412 | 612 | gtk_combo_box_set_active(GTK_COMBO_BOX(type_combo), 0); |
| 613 | gtk_box_pack_start(GTK_BOX(hbox), type_combo, FALSE, FALSE, 0); | |
| 614 | ||
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35500
diff
changeset
|
615 | 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
|
616 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 617 | |
| 618 | 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
|
619 | gtk_label_set_xalign(GTK_LABEL(label), 0); |
| 15412 | 620 | gtk_size_group_add_widget(sg, label); |
| 621 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 622 | ||
| 623 | body_entry = gtk_entry_new(); | |
| 624 | gtk_entry_set_activates_default (GTK_ENTRY (body_entry), TRUE); | |
| 625 | gtk_box_pack_start(GTK_BOX(hbox), body_entry, FALSE, FALSE, 0); | |
| 626 | ||
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35500
diff
changeset
|
627 | 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
|
628 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 629 | |
| 630 | 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
|
631 | gtk_label_set_xalign(GTK_LABEL(label), 0); |
| 15412 | 632 | gtk_size_group_add_widget(sg, label); |
| 633 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 634 | ||
| 635 | subject_entry = gtk_entry_new(); | |
| 636 | gtk_entry_set_activates_default (GTK_ENTRY (subject_entry), TRUE); | |
| 637 | gtk_box_pack_start(GTK_BOX(hbox), subject_entry, FALSE, FALSE, 0); | |
| 638 | ||
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35500
diff
changeset
|
639 | 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
|
640 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 15412 | 641 | |
| 642 | 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
|
643 | gtk_label_set_xalign(GTK_LABEL(label), 0); |
| 15412 | 644 | gtk_size_group_add_widget(sg, label); |
| 645 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 646 | ||
| 647 | thread_entry = gtk_entry_new(); | |
| 648 | gtk_entry_set_activates_default (GTK_ENTRY (thread_entry), TRUE); | |
| 649 | 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
|
650 | |
|
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
|
651 | gtk_widget_show_all(vbox); |
| 15412 | 652 | |
| 653 | result = gtk_dialog_run(GTK_DIALOG(dialog)); | |
| 654 | if (result != GTK_RESPONSE_ACCEPT) { | |
| 655 | gtk_widget_destroy(dialog); | |
| 656 | return; | |
| 657 | } | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
658 | |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
659 | 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
|
660 | 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
|
661 | 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
|
662 | subject = gtk_entry_get_text(GTK_ENTRY(subject_entry)); |
| 15412 | 663 | |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
664 | 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
|
665 | "%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
|
666 | |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
667 | *to ? "to='" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
668 | *to ? to : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
669 | *to ? "'" : "", |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
670 | 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
|
671 | 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
|
672 | 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
|
673 | |
|
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 | *body ? body : "", |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
676 | *body ? "</body>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
677 | |
|
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 | *subject ? subject : "", |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
680 | *subject ? "</subject>" : "", |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
681 | |
|
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 | *thread ? thread : "", |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
684 | *thread ? "</thread>" : ""); |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
685 | |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
686 | 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
|
687 | gtk_widget_grab_focus(console->entry); |
| 15412 | 688 | g_free(stanza); |
| 689 | ||
| 690 | gtk_widget_destroy(dialog); | |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20288
diff
changeset
|
691 | g_object_unref(sg); |
| 15412 | 692 | } |
| 693 | ||
| 694 | static void | |
|
29783
96ab389c9181
xmppconsole: Properly catch things before an account is "signed on".
Paul Aurich <darkrain42@pidgin.im>
parents:
29529
diff
changeset
|
695 | signing_on_cb(PurpleConnection *gc) |
| 15412 | 696 | { |
|
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
|
697 | 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
|
698 | |
| 15412 | 699 | if (!console) |
| 700 | return; | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
701 | |
|
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 | 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
|
703 | 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
|
704 | 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
|
705 | |
|
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
|
706 | 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
|
707 | purple_account_get_username(account)); |
| 15412 | 708 | console->accounts = g_list_append(console->accounts, gc); |
| 709 | console->count++; | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
710 | |
|
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
|
711 | 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
|
712 | console->gc = gc; |
|
39001
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
713 | 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
|
714 | 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
|
715 | } else |
| 15412 | 716 | gtk_widget_show_all(console->hbox); |
| 717 | } | |
| 718 | ||
| 719 | static void | |
| 15884 | 720 | signed_off_cb(PurpleConnection *gc) |
| 15412 | 721 | { |
| 722 | int i = 0; | |
| 723 | GList *l; | |
| 724 | ||
| 725 | if (!console) | |
| 726 | return; | |
| 727 | ||
| 728 | l = console->accounts; | |
| 729 | while (l) { | |
| 15884 | 730 | PurpleConnection *g = l->data; |
| 15412 | 731 | if (gc == g) |
| 732 | break; | |
| 733 | i++; | |
| 734 | l = l->next; | |
| 735 | } | |
| 736 | ||
| 737 | if (l == NULL) | |
| 738 | return; | |
| 739 | ||
|
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
|
740 | gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(console->dropdown), i); |
| 15412 | 741 | console->accounts = g_list_remove(console->accounts, gc); |
| 742 | console->count--; | |
| 743 | ||
| 744 | if (gc == console->gc) { | |
|
39001
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
745 | GtkTextIter end; |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
746 | 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
|
747 | 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
|
748 | console->tags.info, NULL); |
| 15412 | 749 | console->gc = NULL; |
| 750 | } | |
| 751 | } | |
| 752 | ||
| 753 | 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
|
754 | console_destroy(GtkWidget *window, gpointer nul) |
| 15412 | 755 | { |
| 756 | g_list_free(console->accounts); | |
| 757 | g_free(console); | |
| 758 | console = NULL; | |
| 759 | } | |
| 760 | ||
| 761 | static void | |
| 762 | dropdown_changed_cb(GtkComboBox *widget, gpointer nul) | |
| 763 | { | |
| 764 | if (!console) | |
| 765 | return; | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
766 | |
|
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
|
767 | 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
|
768 | gtk_text_buffer_set_text(console->buffer, "", 0); |
| 15412 | 769 | } |
| 770 | ||
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
771 | static void |
|
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
772 | create_console(PurplePluginAction *action) |
| 15412 | 773 | { |
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35500
diff
changeset
|
774 | GtkWidget *vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6); |
| 15412 | 775 | GtkWidget *label; |
| 776 | GtkWidget *toolbar; | |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
777 | GList *connections; |
| 15412 | 778 | GtkToolItem *button; |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
779 | GtkCssProvider *entry_css; |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
780 | GtkStyleContext *context; |
| 15412 | 781 | |
| 782 | if (console) { | |
| 783 | gtk_window_present(GTK_WINDOW(console->window)); | |
| 784 | return; | |
| 785 | } | |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
786 | |
| 15412 | 787 | console = g_new0(XmppConsole, 1); |
| 788 | ||
| 17213 | 789 | console->window = pidgin_create_window(_("XMPP Console"), PIDGIN_HIG_BORDER, NULL, TRUE); |
| 15412 | 790 | g_signal_connect(G_OBJECT(console->window), "destroy", G_CALLBACK(console_destroy), NULL); |
| 791 | gtk_window_set_default_size(GTK_WINDOW(console->window), 580, 400); | |
| 792 | gtk_container_add(GTK_CONTAINER(console->window), vbox); | |
| 793 | ||
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35500
diff
changeset
|
794 | console->hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 3); |
| 15412 | 795 | gtk_box_pack_start(GTK_BOX(vbox), console->hbox, FALSE, FALSE, 0); |
| 796 | 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
|
797 | gtk_label_set_xalign(GTK_LABEL(label), 0.0); |
| 15412 | 798 | 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
|
799 | console->dropdown = gtk_combo_box_text_new(); |
| 15884 | 800 | for (connections = purple_connections_get_all(); connections; connections = connections->next) { |
| 801 | 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
|
802 | if (xmppconsole_is_xmpp_account(purple_connection_get_account(gc))) { |
| 15412 | 803 | console->count++; |
| 804 | 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
|
805 | gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(console->dropdown), |
| 15884 | 806 | purple_account_get_username(purple_connection_get_account(gc))); |
| 15412 | 807 | if (!console->gc) |
| 808 | console->gc = gc; | |
| 809 | } | |
| 810 | } | |
|
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
|
811 | gtk_combo_box_set_active(GTK_COMBO_BOX(console->dropdown), 0); |
| 15412 | 812 | gtk_box_pack_start(GTK_BOX(console->hbox), console->dropdown, TRUE, TRUE, 0); |
| 813 | g_signal_connect(G_OBJECT(console->dropdown), "changed", G_CALLBACK(dropdown_changed_cb), NULL); | |
| 814 | ||
|
39001
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
815 | 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
|
816 | 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
|
817 | 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
|
818 | |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
819 | 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
|
820 | 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
|
821 | "foreground", "#777777", NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
822 | 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
|
823 | "paragraph-background", "#ffcece", NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
824 | 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
|
825 | "paragraph-background", "#dcecc4", NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
826 | 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
|
827 | "foreground", "#940f8c", NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
828 | 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
|
829 | "foreground", "#8b1dab", |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
830 | "weight", PANGO_WEIGHT_BOLD, NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
831 | 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
|
832 | "foreground", "#a02961", |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
833 | "weight", PANGO_WEIGHT_BOLD, NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
834 | 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
|
835 | "foreground", "#324aa4", NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
836 | 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
|
837 | "foreground", "#2cb12f", |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
838 | "weight", PANGO_WEIGHT_BOLD, NULL); |
|
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
839 | |
|
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
|
840 | if (console->count == 0) { |
|
39001
d4f73745a8ab
Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
39000
diff
changeset
|
841 | GtkTextIter 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_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
|
843 | 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
|
844 | 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
|
845 | } |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
31321
diff
changeset
|
846 | 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
|
847 | 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
|
848 | TRUE, TRUE, 0); |
|
27264
ff58193d8ead
Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25625
diff
changeset
|
849 | |
| 15412 | 850 | toolbar = gtk_toolbar_new(); |
| 851 | 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
|
852 | gtk_tool_item_set_is_important(button, TRUE); |
| 15412 | 853 | g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(iq_clicked_cb), NULL); |
| 854 | gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button)); | |
| 855 | ||
| 856 | 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
|
857 | gtk_tool_item_set_is_important(button, TRUE); |
| 15412 | 858 | g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(presence_clicked_cb), NULL); |
| 859 | gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button)); | |
| 860 | ||
| 861 | 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
|
862 | gtk_tool_item_set_is_important(button, TRUE); |
| 15412 | 863 | g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(message_clicked_cb), NULL); |
| 864 | 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
|
865 | |
| 15412 | 866 | 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
|
867 | |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
868 | 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
|
869 | 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
|
870 | 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
|
871 | 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
|
872 | "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
|
873 | -1, NULL); |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
874 | 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
|
875 | 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
|
876 | GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); |
|
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
877 | 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
|
878 | g_signal_connect(G_OBJECT(console->entry),"key-press-event", G_CALLBACK(message_send_cb), console); |
| 15412 | 879 | |
|
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
|
880 | 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
|
881 | 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
|
882 | 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
|
883 | |
|
39000
1a77494777cb
Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38999
diff
changeset
|
884 | entry_changed_cb(console->entry_buffer, NULL); |
| 15412 | 885 | |
| 886 | gtk_widget_show_all(console->window); | |
| 887 | if (console->count < 2) | |
| 888 | gtk_widget_hide(console->hbox); | |
| 889 | } | |
| 890 | ||
| 891 | static GList * | |
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
892 | actions(PurplePlugin *plugin) |
| 15412 | 893 | { |
| 894 | GList *l = NULL; | |
| 15884 | 895 | PurplePluginAction *act = NULL; |
| 15412 | 896 | |
| 15884 | 897 | act = purple_plugin_action_new(_("XMPP Console"), create_console); |
| 15412 | 898 | 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
|
899 | |
| 15412 | 900 | return l; |
| 901 | } | |
| 902 | ||
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
903 | static PidginPluginInfo * |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
904 | plugin_query(GError **error) |
| 15412 | 905 | { |
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
906 | const gchar * const authors[] = { |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
907 | "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
|
908 | NULL |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
909 | }; |
| 15412 | 910 | |
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
911 | 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
|
912 | "id", PLUGIN_ID, |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
913 | "name", N_("XMPP Console"), |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
914 | "version", DISPLAY_VERSION, |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
915 | "category", N_("Protocol utility"), |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
916 | "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
|
917 | "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
|
918 | "or clients."), |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
919 | "authors", authors, |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
920 | "website", PURPLE_WEBSITE, |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
921 | "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
|
922 | "actions-cb", actions, |
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
923 | NULL |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
924 | ); |
| 15412 | 925 | } |
| 926 | ||
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
927 | static gboolean |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
928 | 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
|
929 | { |
| 37041 | 930 | int i; |
| 931 | gboolean any_registered = FALSE; | |
| 932 | ||
| 933 | xmpp_console_handle = plugin; | |
| 934 | ||
| 935 | i = 0; | |
| 936 | while (xmpp_prpls[i] != NULL) { | |
| 937 | PurpleProtocol *xmpp; | |
| 938 | ||
| 939 | xmpp = purple_protocols_find(xmpp_prpls[i]); | |
| 940 | i++; | |
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
941 | |
| 37041 | 942 | if (!xmpp) |
| 943 | continue; | |
| 944 | any_registered = TRUE; | |
| 945 | ||
| 946 | purple_signal_connect(xmpp, "jabber-receiving-xmlnode", | |
| 947 | xmpp_console_handle, | |
| 948 | PURPLE_CALLBACK(purple_xmlnode_received_cb), NULL); | |
| 949 | purple_signal_connect(xmpp, "jabber-sending-text", | |
| 950 | xmpp_console_handle, | |
| 951 | PURPLE_CALLBACK(purple_xmlnode_sent_cb), NULL); | |
| 952 | } | |
| 953 | ||
| 954 | if (!any_registered) { | |
| 955 | 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
|
956 | return FALSE; |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
957 | } |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
958 | |
|
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(), "signing-on", |
| 37041 | 960 | 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
|
961 | purple_signal_connect(purple_connections_get_handle(), "signed-off", |
| 37041 | 962 | 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
|
963 | |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
964 | return TRUE; |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
965 | } |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
966 | |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
967 | static gboolean |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
968 | 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
|
969 | { |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
970 | if (console) |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
971 | 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
|
972 | return TRUE; |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
973 | } |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
974 | |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
975 | PURPLE_PLUGIN_INIT(xmppconsole, plugin_query, plugin_load, plugin_unload); |