pidgin/plugins/xmppconsole/xmppconsole.c

Mon, 12 Oct 2020 23:44:21 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Mon, 12 Oct 2020 23:44:21 -0500
changeset 40554
e910eacdf9d9
parent 40502
875489636847
child 40708
53a26c29d26c
permissions
-rw-r--r--

Remove the GEvolution plugin

Removed the gevolution plugin. It's barely supported and does some stuff we don't want to allow anymore.

Testing Done:
Compile test only

Reviewed at https://reviews.imfreedom.org/r/160/

15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1 /*
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15562
diff changeset
2 * Purple - XMPP debugging tool
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
3 *
39810
f75b20dbdfbb Use standard legalese in XMPP console.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39808
diff changeset
4 * Pidgin is the legal property of its developers, whose names are too numerous
f75b20dbdfbb Use standard legalese in XMPP console.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39808
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
f75b20dbdfbb Use standard legalese in XMPP console.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39808
diff changeset
6 * source distribution.
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
7 *
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
11 * (at your option) any later version.
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
12 *
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
16 * GNU General Public License for more details.
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
17 *
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
39810
f75b20dbdfbb Use standard legalese in XMPP console.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39808
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
21 *
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
22 */
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
23
40439
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
24 #include <glib/gi18n-lib.h>
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
25
40502
875489636847 pidgin.h phase3: create pidgin.h and force its usage
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
26 #include <gdk/gdkkeysyms.h>
875489636847 pidgin.h phase3: create pidgin.h and force its usage
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
27
40360
e21f3bbcc2a5 Update all of the pidgin code to include purple.h
Gary Kramlich <grim@reaperworld.com>
parents: 40222
diff changeset
28 #include <purple.h>
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
29
40502
875489636847 pidgin.h phase3: create pidgin.h and force its usage
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
30 #include <pidgin.h>
33011
861a290f5464 Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32998
diff changeset
31
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
32 #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
33 #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
34
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
35 typedef struct {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15562
diff changeset
36 PurpleConnection *gc;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
37 GtkWidget *window;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
38 GtkWidget *hbox;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
39 GtkWidget *dropdown;
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
40 GtkTextBuffer *buffer;
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
41 struct {
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
42 GtkTextTag *info;
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
43 GtkTextTag *incoming;
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
44 GtkTextTag *outgoing;
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
45 GtkTextTag *bracket;
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
46 GtkTextTag *tag;
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
47 GtkTextTag *attr;
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
48 GtkTextTag *value;
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
49 GtkTextTag *xmlns;
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
50 } tags;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
51 GtkWidget *entry;
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
52 GtkTextBuffer *entry_buffer;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
53 GtkWidget *sw;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
54 int count;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
55 GList *accounts;
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
56
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
57 struct {
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
58 GtkPopover *popover;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
59 GtkEntry *to;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
60 GtkComboBoxText *type;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
61 } iq;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
62
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
63 struct {
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
64 GtkPopover *popover;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
65 GtkEntry *to;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
66 GtkComboBoxText *type;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
67 GtkComboBoxText *show;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
68 GtkEntry *status;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
69 GtkEntry *priority;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
70 } presence;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
71
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
72 struct {
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
73 GtkPopover *popover;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
74 GtkEntry *to;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
75 GtkComboBoxText *type;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
76 GtkEntry *body;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
77 GtkEntry *subject;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
78 GtkEntry *thread;
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
79 } message;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
80 } XmppConsole;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
81
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
82 XmppConsole *console = NULL;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
83 static void *xmpp_console_handle = NULL;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
84
35310
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
85 static const gchar *xmpp_prpls[] = {
37248
ef82ac226e4b jabber: removed explicit Facebook support
James Geboski <jgeboski@gmail.com>
parents: 37109
diff changeset
86 "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
87 };
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
88
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
89 static gboolean
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
90 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
91 {
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
92 const gchar *prpl_name;
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
93 int i;
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
94
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
95 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
96
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
97 i = 0;
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
98 while (xmpp_prpls[i] != NULL) {
38358
30ba44276e74 Merge release-2.x.y into default
dx <dx@dxzone.com.ar>
parents: 38007 38259
diff changeset
99 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
100 return TRUE;
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
101 i++;
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
102 }
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
103
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
104 return FALSE;
36f94ccd848b Fix xmpp console plugin to work with all xmpp prpls
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34935
diff changeset
105 }
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
106
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
107 static void
39003
37b2e13b2cfa Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39002
diff changeset
108 purple_xmlnode_append_to_buffer(PurpleXmlNode *node, gint indent_level, GtkTextIter *iter, GtkTextTag *tag)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
109 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34276
diff changeset
110 PurpleXmlNode *c;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
111 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
112 gint i;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
113
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
114 g_return_if_fail(node != NULL);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
115
39003
37b2e13b2cfa Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39002
diff changeset
116 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
117 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
118 }
37b2e13b2cfa Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39002
diff changeset
119
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
120 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
121 tag, console->tags.bracket, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
122 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
123 tag, console->tags.tag, NULL);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
124
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
125 if (node->xmlns) {
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
126 if ((!node->parent ||
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
127 !node->parent->xmlns ||
38259
c593fc9f5438 Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 38258
diff changeset
128 !purple_strequal(node->xmlns, node->parent->xmlns)) &&
c593fc9f5438 Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 38258
diff changeset
129 !purple_strequal(node->xmlns, "jabber:client"))
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
130 {
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
131 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
132 tag, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
133 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
134 tag, console->tags.attr, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
135 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
136 tag, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
137 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
138 tag, console->tags.xmlns, NULL);
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);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
141 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
142 }
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
143 for (c = node->child; c; c = c->next)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
144 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34276
diff changeset
145 if (c->type == PURPLE_XMLNODE_TYPE_ATTRIB) {
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
146 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
147 tag, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
148 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
149 tag, console->tags.attr, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
150 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
151 tag, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
152 gtk_text_buffer_insert_with_tags(console->buffer, iter, c->data, -1,
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
153 tag, console->tags.value, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
154 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
155 tag, NULL);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34276
diff changeset
156 } 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
157 if (c->type == PURPLE_XMLNODE_TYPE_DATA)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
158 pretty = FALSE;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
159 need_end = TRUE;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
160 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
161 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
162
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
163 if (need_end) {
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
164 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
165 tag, console->tags.bracket, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
166 if (pretty) {
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
167 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
168 tag, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
169 }
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
170
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
171 for (c = node->child; c; c = c->next)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
172 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34276
diff changeset
173 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
174 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
175 } 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
176 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
177 tag, NULL);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
178 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
179 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
180
39003
37b2e13b2cfa Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39002
diff changeset
181 if (pretty) {
37b2e13b2cfa Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39002
diff changeset
182 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
183 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
184 }
37b2e13b2cfa Restore XML indenting in XMPP console.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39002
diff changeset
185 }
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
186 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
187 tag, console->tags.bracket, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
188 gtk_text_buffer_insert_with_tags(console->buffer, iter, "/", 1,
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
189 tag, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
190 gtk_text_buffer_insert_with_tags(console->buffer, iter, node->name, -1,
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
191 tag, console->tags.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
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
196 } else {
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
197 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
198 tag, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
199 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
200 tag, console->tags.bracket, NULL);
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
201 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
202 tag, NULL);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
203 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
204 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
205
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
206 static void
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34276
diff changeset
207 purple_xmlnode_received_cb(PurpleConnection *gc, PurpleXmlNode **packet, gpointer null)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
208 {
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
209 GtkTextIter iter;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
210
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
211 if (!console || console->gc != gc)
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
212 return;
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
213
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
214 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
215 purple_xmlnode_append_to_buffer(*packet, 0, &iter, console->tags.incoming);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
216 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
217
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
218 static void
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34276
diff changeset
219 purple_xmlnode_sent_cb(PurpleConnection *gc, char **packet, gpointer null)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
220 {
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
221 GtkTextIter iter;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34276
diff changeset
222 PurpleXmlNode *node;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
223
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
224 if (!console || console->gc != gc)
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
225 return;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34276
diff changeset
226 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
227
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
228 if (!node)
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
229 return;
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
230
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
231 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
232 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
233 purple_xmlnode_free(node);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
234 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
235
33011
861a290f5464 Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32998
diff changeset
236 static gboolean
861a290f5464 Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32998
diff changeset
237 message_send_cb(GtkWidget *widget, GdkEventKey *event, gpointer p)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
238 {
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36543
diff changeset
239 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
240 PurpleConnection *gc;
33011
861a290f5464 Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32998
diff changeset
241 gchar *text;
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
242 GtkTextIter start, end;
33011
861a290f5464 Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32998
diff changeset
243
861a290f5464 Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32998
diff changeset
244 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
245 return FALSE;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
246
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
247 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
248
5fd44f61d007 Fix a crash when trying to use XMPP console with no XMPP accounts connected
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16749
diff changeset
249 if (gc)
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
250 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
251
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
252 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
253 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
254
36633
2dcb81a189bd Refactored pidgin to use the new protocol API
Ankit Vani <a@nevitus.org>
parents: 36626
diff changeset
255 if (protocol)
36719
0d7682bdf828 Updated protocol iface calls
Ankit Vani <a@nevitus.org>
parents: 36692
diff changeset
256 purple_protocol_server_iface_send_raw(protocol, gc, text, strlen(text));
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
257
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
258 g_free(text);
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
259 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
260
861a290f5464 Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32998
diff changeset
261 return TRUE;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
262 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
263
33011
861a290f5464 Convert the XMPP Console entry to WebKit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32998
diff changeset
264 static void
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
265 entry_changed_cb(GtkTextBuffer *buffer, void *data)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
266 {
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
267 GtkTextIter start, end;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
268 char *xmlstr, *str;
39808
a029cf99bfe2 Re-enable entry resizing in XMPP console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39807
diff changeset
269 GtkTextIter iter;
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
270 int wrapped_lines;
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
271 int lines;
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
272 GdkRectangle oneline;
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
273 int height;
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
274 int pad_top, pad_inside, pad_bottom;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34276
diff changeset
275 PurpleXmlNode *node;
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
276 GtkStyleContext *style;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
277
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
278 wrapped_lines = 1;
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
279 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
280 gtk_text_view_get_iter_location(GTK_TEXT_VIEW(console->entry), &iter, &oneline);
39808
a029cf99bfe2 Re-enable entry resizing in XMPP console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39807
diff changeset
281 while (gtk_text_view_forward_display_line(GTK_TEXT_VIEW(console->entry),
a029cf99bfe2 Re-enable entry resizing in XMPP console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39807
diff changeset
282 &iter)) {
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
283 wrapped_lines++;
39808
a029cf99bfe2 Re-enable entry resizing in XMPP console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39807
diff changeset
284 }
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
285
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
286 lines = gtk_text_buffer_get_line_count(buffer);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
287
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
288 /* 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
289 lines = MIN(lines, 6);
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
290 wrapped_lines = MIN(wrapped_lines, 6);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
291
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
292 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
293 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
294 pad_inside = gtk_text_view_get_pixels_inside_wrap(GTK_TEXT_VIEW(console->entry));
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
295
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
296 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
297 height += (oneline.height + pad_inside) * (wrapped_lines - lines);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
298
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
299 gtk_widget_set_size_request(console->sw, -1, height + 6);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
300
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
301 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
302 str = gtk_text_buffer_get_text(buffer, &start, &end, FALSE);
39808
a029cf99bfe2 Re-enable entry resizing in XMPP console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39807
diff changeset
303 if (!str) {
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
304 return;
39808
a029cf99bfe2 Re-enable entry resizing in XMPP console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39807
diff changeset
305 }
a029cf99bfe2 Re-enable entry resizing in XMPP console plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39807
diff changeset
306
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
307 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
308 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
309 style = gtk_widget_get_style_context(console->entry);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
310 if (node) {
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
311 gtk_style_context_remove_class(style, GTK_STYLE_CLASS_ERROR);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
312 } else {
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
313 gtk_style_context_add_class(style, GTK_STYLE_CLASS_ERROR);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
314 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
315 g_free(str);
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
316 g_free(xmlstr);
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
317 if (node)
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34276
diff changeset
318 purple_xmlnode_free(node);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
319 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
320
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
321 static void
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
322 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
323 {
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
324 GtkTextIter where;
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
325 GtkTextMark *mark;
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_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
328
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
329 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
330
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
331 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
332 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
333
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
334 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
335
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
336 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
337 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
338 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
339
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
340 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
341 }
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
342
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
343 static void
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
344 popover_closed_cb(GtkPopover *popover, gpointer data)
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
345 {
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
346 GtkToggleToolButton *button = GTK_TOGGLE_TOOL_BUTTON(data);
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
347
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
348 gtk_toggle_tool_button_set_active(button, FALSE);
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
349 }
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
350
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
351 static void
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
352 toggle_button_toggled_cb(GtkToolButton *button, gpointer data)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
353 {
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
354 GtkPopover *popover = GTK_POPOVER(data);
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
355
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
356 gtk_popover_popup(popover);
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
357 }
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
358
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
359 static void
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
360 iq_clicked_cb(GtkWidget *w, gpointer data)
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
361 {
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
362 XmppConsole *console = (XmppConsole *)data;
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
363 const gchar *to;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
364 char *stanza;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
365
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
366 to = gtk_entry_get_text(console->iq.to);
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
367 stanza = g_strdup_printf(
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
368 "<iq %s%s%s id='console%x' type='%s'>", to && *to ? "to='" : "",
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
369 to && *to ? to : "", to && *to ? "'" : "", g_random_int(),
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
370 gtk_combo_box_text_get_active_text(console->iq.type));
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
371 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
372 gtk_widget_grab_focus(console->entry);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
373 g_free(stanza);
20289
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20288
diff changeset
374
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
375 /* Reset everything. */
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
376 gtk_entry_set_text(console->iq.to, "");
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
377 gtk_combo_box_set_active(GTK_COMBO_BOX(console->iq.type), 0);
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
378 gtk_popover_popdown(console->iq.popover);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
379 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
380
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
381 static void
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
382 presence_clicked_cb(GtkWidget *w, gpointer data)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
383 {
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
384 XmppConsole *console = (XmppConsole *)data;
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
385 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
386 gchar *type, *show;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
387 char *stanza;
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
388
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
389 to = gtk_entry_get_text(console->presence.to);
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
390 type = gtk_combo_box_text_get_active_text(console->presence.type);
38999
b4b1c5868446 Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38358
diff changeset
391 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
392 g_free(type);
b4b1c5868446 Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38358
diff changeset
393 type = g_strdup("");
b4b1c5868446 Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38358
diff changeset
394 }
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
395 show = gtk_combo_box_text_get_active_text(console->presence.show);
38999
b4b1c5868446 Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38358
diff changeset
396 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
397 g_free(show);
b4b1c5868446 Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38358
diff changeset
398 show = g_strdup("");
b4b1c5868446 Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38358
diff changeset
399 }
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
400 status = gtk_entry_get_text(console->presence.status);
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
401 priority = gtk_entry_get_text(console->presence.priority);
38258
9a6551eba09c Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 31321
diff changeset
402 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
403 priority = "";
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
404
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
405 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
406 "%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
407 *to ? "to='" : "",
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
408 *to ? to : "",
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
409 *to ? "'" : "",
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
410 g_random_int(),
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
411
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
412 *type ? "type='" : "",
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
413 *type ? type : "",
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
414 *type ? "'" : "",
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
415
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
416 *show ? "<show>" : "",
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
417 *show ? show : "",
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
418 *show ? "</show>" : "",
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
419
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
420 *status ? "<status>" : "",
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
421 *status ? status : "",
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
422 *status ? "</status>" : "",
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
423
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
424 *priority ? "<priority>" : "",
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
425 *priority ? priority : "",
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
426 *priority ? "</priority>" : "");
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
427
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
428 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
429 gtk_widget_grab_focus(console->entry);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
430 g_free(stanza);
38999
b4b1c5868446 Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38358
diff changeset
431 g_free(type);
b4b1c5868446 Fix leak when using XMPP console templates.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38358
diff changeset
432 g_free(show);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
433
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
434 /* Reset everything. */
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
435 gtk_entry_set_text(console->presence.to, "");
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
436 gtk_combo_box_set_active(GTK_COMBO_BOX(console->presence.type), 0);
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
437 gtk_combo_box_set_active(GTK_COMBO_BOX(console->presence.show), 0);
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
438 gtk_entry_set_text(console->presence.status, "");
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
439 gtk_entry_set_text(console->presence.priority, "0");
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
440 gtk_popover_popdown(console->presence.popover);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
441 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
442
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
443 static void
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
444 message_clicked_cb(GtkWidget *w, gpointer data)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
445 {
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
446 XmppConsole *console = (XmppConsole *)data;
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
447 const gchar *to, *body, *thread, *subject;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
448 char *stanza;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
449
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
450 to = gtk_entry_get_text(console->message.to);
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
451 body = gtk_entry_get_text(console->message.body);
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
452 thread = gtk_entry_get_text(console->message.thread);
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
453 subject = gtk_entry_get_text(console->message.subject);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
454
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
455 stanza = g_strdup_printf(
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
456 "<message %s%s%s id='console%x' type='%s'>"
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
457 "%s%s%s%s%s%s%s%s%s",
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
458
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
459 *to ? "to='" : "", *to ? to : "", *to ? "'" : "",
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
460 g_random_int(),
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
461 gtk_combo_box_text_get_active_text(console->message.type),
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
462
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
463 *body ? "<body>" : "", *body ? body : "",
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
464 *body ? "</body>" : "",
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
465
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
466 *subject ? "<subject>" : "", *subject ? subject : "",
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
467 *subject ? "</subject>" : "",
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
468
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
469 *thread ? "<thread>" : "", *thread ? thread : "",
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
470 *thread ? "</thread>" : "");
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
471
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
472 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
473 gtk_widget_grab_focus(console->entry);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
474 g_free(stanza);
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
475
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
476 /* Reset everything. */
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
477 gtk_entry_set_text(console->message.to, "");
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
478 gtk_combo_box_set_active(GTK_COMBO_BOX(console->message.type), 0);
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
479 gtk_entry_set_text(console->message.body, "");
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
480 gtk_entry_set_text(console->message.subject, "0");
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
481 gtk_entry_set_text(console->message.thread, "0");
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
482 gtk_popover_popdown(console->message.popover);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
483 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
484
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
485 static void
29783
96ab389c9181 xmppconsole: Properly catch things before an account is "signed on".
Paul Aurich <darkrain42@pidgin.im>
parents: 29529
diff changeset
486 signing_on_cb(PurpleConnection *gc)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
487 {
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
488 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
489
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
490 if (!console)
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
491 return;
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
492
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
493 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
494 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
495 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
496
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
497 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>
parents: 33132 32998
diff changeset
498 purple_account_get_username(account));
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
499 console->accounts = g_list_append(console->accounts, gc);
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
500 console->count++;
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
501
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
502 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
503 console->gc = gc;
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
504 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
505 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
506 } else
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
507 gtk_widget_show_all(console->hbox);
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
508 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
509
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
510 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15562
diff changeset
511 signed_off_cb(PurpleConnection *gc)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
512 {
40043
90446617d967 Use GList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents: 39921
diff changeset
513 int i;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
514
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
515 if (!console)
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
516 return;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
517
40043
90446617d967 Use GList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents: 39921
diff changeset
518 i = g_list_index(console->accounts, gc);
90446617d967 Use GList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents: 39921
diff changeset
519 if (i == -1)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
520 return;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
521
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
522 gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(console->dropdown), i);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
523 console->accounts = g_list_remove(console->accounts, gc);
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
524 console->count--;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
525
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
526 if (gc == console->gc) {
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
527 GtkTextIter end;
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
528 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
529 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
530 console->tags.info, NULL);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
531 console->gc = NULL;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
532 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
533 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
534
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
535 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
536 console_destroy(GtkWidget *window, gpointer nul)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
537 {
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
538 g_list_free(console->accounts);
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
539 g_free(console);
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
540 console = NULL;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
541 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
542
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
543 static void
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
544 dropdown_changed_cb(GtkComboBox *widget, gpointer nul)
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
545 {
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
546 if (!console)
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
547 return;
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
548
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
549 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
550 gtk_text_buffer_set_text(console->buffer, "", 0);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
551 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
552
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
553 static void
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
554 create_console(PurplePluginAction *action)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
555 {
39805
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
556 GtkBuilder *builder;
18122
9bf9970c1b6a disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents: 18121
diff changeset
557 GList *connections;
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
558 GtkCssProvider *entry_css;
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
559 GtkStyleContext *context;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
560
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
561 if (console) {
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
562 gtk_window_present(GTK_WINDOW(console->window));
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
563 return;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
564 }
27264
ff58193d8ead Nothing to see here, just some whitespace changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25625
diff changeset
565
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
566 console = g_new0(XmppConsole, 1);
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
567
39805
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
568 builder = gtk_builder_new_from_resource(
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
569 "/im/pidgin/Pidgin/Plugin/XMPPConsole/console.ui");
40439
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
570 gtk_builder_set_translation_domain(builder, GETTEXT_PACKAGE);
39805
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
571 console->window = GTK_WIDGET(
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
572 gtk_builder_get_object(builder, "PidginXmppConsole"));
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
573 gtk_builder_add_callback_symbol(builder, "console_destroy",
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
574 G_CALLBACK(console_destroy));
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
575
39805
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
576 console->hbox = GTK_WIDGET(gtk_builder_get_object(builder, "hbox"));
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
577 console->dropdown =
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
578 GTK_WIDGET(gtk_builder_get_object(builder, "dropdown"));
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15562
diff changeset
579 for (connections = purple_connections_get_all(); connections; connections = connections->next) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15562
diff changeset
580 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
581 if (xmppconsole_is_xmpp_account(purple_connection_get_account(gc))) {
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
582 console->count++;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
583 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
584 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(console->dropdown),
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15562
diff changeset
585 purple_account_get_username(purple_connection_get_account(gc)));
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
586 if (!console->gc)
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
587 console->gc = gc;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
588 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
589 }
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
590 gtk_combo_box_set_active(GTK_COMBO_BOX(console->dropdown), 0);
39805
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
591 gtk_builder_add_callback_symbol(builder, "dropdown_changed_cb",
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
592 G_CALLBACK(dropdown_changed_cb));
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
593
39805
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
594 console->buffer =
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
595 GTK_TEXT_BUFFER(gtk_builder_get_object(builder, "buffer"));
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
596 console->tags.info =
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
597 GTK_TEXT_TAG(gtk_builder_get_object(builder, "tags.info"));
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
598 console->tags.incoming =
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
599 GTK_TEXT_TAG(gtk_builder_get_object(builder, "tags.incoming"));
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
600 console->tags.outgoing =
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
601 GTK_TEXT_TAG(gtk_builder_get_object(builder, "tags.outgoing"));
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
602 console->tags.bracket =
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
603 GTK_TEXT_TAG(gtk_builder_get_object(builder, "tags.bracket"));
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
604 console->tags.tag =
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
605 GTK_TEXT_TAG(gtk_builder_get_object(builder, "tags.tag"));
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
606 console->tags.attr =
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
607 GTK_TEXT_TAG(gtk_builder_get_object(builder, "tags.attr"));
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
608 console->tags.value =
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
609 GTK_TEXT_TAG(gtk_builder_get_object(builder, "tags.value"));
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
610 console->tags.xmlns =
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
611 GTK_TEXT_TAG(gtk_builder_get_object(builder, "tags.xmlns"));
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
612
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
613 if (console->count == 0) {
39001
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
614 GtkTextIter start, end;
d4f73745a8ab Convert XMPP console display to GtkTextView.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 39000
diff changeset
615 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
616 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
617 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
618 }
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
619
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
620 /* Popover for <iq/> button. */
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
621 console->iq.popover =
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
622 GTK_POPOVER(gtk_builder_get_object(builder, "iq.popover"));
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
623 console->iq.to = GTK_ENTRY(gtk_builder_get_object(builder, "iq.to"));
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
624 console->iq.type =
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
625 GTK_COMBO_BOX_TEXT(gtk_builder_get_object(builder, "iq.type"));
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
626
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
627 /* Popover for <presence/> button. */
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
628 console->presence.popover = GTK_POPOVER(
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
629 gtk_builder_get_object(builder, "presence.popover"));
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
630 console->presence.to =
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
631 GTK_ENTRY(gtk_builder_get_object(builder, "presence.to"));
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
632 console->presence.type = GTK_COMBO_BOX_TEXT(
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
633 gtk_builder_get_object(builder, "presence.type"));
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
634 console->presence.show = GTK_COMBO_BOX_TEXT(
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
635 gtk_builder_get_object(builder, "presence.show"));
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
636 console->presence.status =
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
637 GTK_ENTRY(gtk_builder_get_object(builder, "presence.status"));
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
638 console->presence.priority =
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
639 GTK_ENTRY(gtk_builder_get_object(builder, "presence.priority"));
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
640
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
641 /* Popover for <message/> button. */
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
642 console->message.popover =
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
643 GTK_POPOVER(gtk_builder_get_object(builder, "message.popover"));
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
644 console->message.to =
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
645 GTK_ENTRY(gtk_builder_get_object(builder, "message.to"));
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
646 console->message.type = GTK_COMBO_BOX_TEXT(
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
647 gtk_builder_get_object(builder, "message.type"));
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
648 console->message.body =
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
649 GTK_ENTRY(gtk_builder_get_object(builder, "message.body"));
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
650 console->message.subject =
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
651 GTK_ENTRY(gtk_builder_get_object(builder, "message.subject"));
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
652 console->message.thread =
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
653 GTK_ENTRY(gtk_builder_get_object(builder, "message.thread"));
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
654
39805
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
655 gtk_builder_add_callback_symbols(
39807
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
656 builder, "toggle_button_toggled_cb",
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
657 G_CALLBACK(toggle_button_toggled_cb), "popover_closed_cb",
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
658 G_CALLBACK(popover_closed_cb), "iq_clicked_cb",
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
659 G_CALLBACK(iq_clicked_cb), "presence_clicked_cb",
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
660 G_CALLBACK(presence_clicked_cb), "message_clicked_cb",
3af264d5b0f6 Convert XMPP console dialogs to popovers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39805
diff changeset
661 G_CALLBACK(message_clicked_cb), NULL);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
662
39805
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
663 console->entry = GTK_WIDGET(gtk_builder_get_object(builder, "entry"));
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
664 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
665 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
666 "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
667 -1, NULL);
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
668 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
669 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
670 GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
39805
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
671 console->entry_buffer = GTK_TEXT_BUFFER(
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
672 gtk_builder_get_object(builder, "entry_buffer"));
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
673 gtk_builder_add_callback_symbol(builder, "message_send_cb",
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
674 G_CALLBACK(message_send_cb));
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
675
39805
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
676 console->sw = GTK_WIDGET(gtk_builder_get_object(builder, "sw"));
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
677 gtk_builder_add_callback_symbol(builder, "entry_changed_cb",
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
678 G_CALLBACK(entry_changed_cb));
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
679
39000
1a77494777cb Use GtkTextView for XMPP console entry.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 38999
diff changeset
680 entry_changed_cb(console->entry_buffer, NULL);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
681
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
682 gtk_widget_show_all(console->window);
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
683 if (console->count < 2)
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
684 gtk_widget_hide(console->hbox);
39805
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
685
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
686 gtk_builder_connect_signals(builder, console);
17ef924a7e45 Convert XMPP console to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39804
diff changeset
687 g_object_unref(builder);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
688 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
689
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
690 static GList *
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
691 actions(PurplePlugin *plugin)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
692 {
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
693 GList *l = NULL;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15562
diff changeset
694 PurplePluginAction *act = NULL;
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
695
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15562
diff changeset
696 act = purple_plugin_action_new(_("XMPP Console"), create_console);
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
697 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
698
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
699 return l;
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
700 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
701
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
702 static PidginPluginInfo *
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
703 plugin_query(GError **error)
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
704 {
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
705 const gchar * const authors[] = {
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
706 "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
707 NULL
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
708 };
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
709
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
710 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
711 "id", PLUGIN_ID,
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
712 "name", N_("XMPP Console"),
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
713 "version", DISPLAY_VERSION,
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
714 "category", N_("Protocol utility"),
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
715 "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
716 "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
717 "or clients."),
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
718 "authors", authors,
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
719 "website", PURPLE_WEBSITE,
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
720 "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
721 "actions-cb", actions,
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
722 NULL
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
723 );
15412
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
724 }
def58941bcb9 [gaim-migrate @ 18143]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
725
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
726 static gboolean
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
727 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
728 {
37041
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
729 int i;
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
730 gboolean any_registered = FALSE;
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
731
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
732 xmpp_console_handle = plugin;
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
733
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
734 i = 0;
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
735 while (xmpp_prpls[i] != NULL) {
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
736 PurpleProtocol *xmpp;
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
737
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
738 xmpp = purple_protocols_find(xmpp_prpls[i]);
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
739 i++;
36758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
740
37041
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
741 if (!xmpp)
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
742 continue;
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
743 any_registered = TRUE;
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
744
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
745 purple_signal_connect(xmpp, "jabber-receiving-xmlnode",
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
746 xmpp_console_handle,
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
747 PURPLE_CALLBACK(purple_xmlnode_received_cb), NULL);
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
748 purple_signal_connect(xmpp, "jabber-sending-text",
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
749 xmpp_console_handle,
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
750 PURPLE_CALLBACK(purple_xmlnode_sent_cb), NULL);
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
751 }
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
752
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
753 if (!any_registered) {
39921
a9c92a82f4c8 Don't pass literals to g_set_error / g_error_new.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39810
diff changeset
754 g_set_error_literal(error, PLUGIN_DOMAIN, 0,
a9c92a82f4c8 Don't pass literals to g_set_error / g_error_new.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39810
diff changeset
755 _("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
756 return FALSE;
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
757 }
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
758
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
759 purple_signal_connect(purple_connections_get_handle(), "signing-on",
37041
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
760 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
761 purple_signal_connect(purple_connections_get_handle(), "signed-off",
37041
c1936deaa35b Merged gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37005 35311
diff changeset
762 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
763
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
764 return TRUE;
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
765 }
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
766
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
767 static gboolean
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
768 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
769 {
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
770 if (console)
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
771 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
772 return TRUE;
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
773 }
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
774
deee438dc431 Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 36719
diff changeset
775 PURPLE_PLUGIN_INIT(xmppconsole, plugin_query, plugin_load, plugin_unload);

mercurial