Sat, 28 Apr 2018 02:18:26 -0400
Convert XMPP console display to GtkTextView.
It does not really need much in the way of special formatting or
interactivity that it needs to use a full GtkWebView.
|
22828
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
1 | /* |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
2 | * SendButton - Add a Send button to the conversation window entry area. |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
3 | * Copyright (C) 2008 Etan Reisner <deryni@pidgin.im> |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
4 | * |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
5 | * This program is free software; you can redistribute it and/or |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
6 | * modify it under the terms of the GNU General Public License |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
7 | * as published by the Free Software Foundation; either version 2 |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
8 | * of the License, or (at your option) any later version. |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
9 | * |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
14 | * |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
16 | * along with this program; if not, write to the Free Software |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
18 | */ |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
19 | |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
20 | #ifdef HAVE_CONFIG_H |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
21 | #include <config.h> |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
22 | #endif |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
23 | |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
24 | #include "internal.h" |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
25 | |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
26 | #include "version.h" |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
27 | |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
28 | #include "pidgin.h" |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
29 | |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
30 | #include "gtkconv.h" |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
31 | #include "gtkplugin.h" |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
32 | |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
33 | static void |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
34 | send_button_cb(GtkButton *button, PidginConversation *gtkconv) |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
35 | { |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
36 | g_signal_emit_by_name(gtkconv->entry, "message_send"); |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
37 | } |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
38 | |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
39 | static void |
|
24599
6751ffb09daa
Make the Send button insensitive when there is no text in the input buffer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24598
diff
changeset
|
40 | input_buffer_changed(GtkTextBuffer *text_buffer, GtkWidget *send_button) |
|
6751ffb09daa
Make the Send button insensitive when there is no text in the input buffer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24598
diff
changeset
|
41 | { |
|
6751ffb09daa
Make the Send button insensitive when there is no text in the input buffer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24598
diff
changeset
|
42 | if (gtk_text_buffer_get_char_count(text_buffer) != 0) |
|
6751ffb09daa
Make the Send button insensitive when there is no text in the input buffer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24598
diff
changeset
|
43 | gtk_widget_set_sensitive(send_button, TRUE); |
|
6751ffb09daa
Make the Send button insensitive when there is no text in the input buffer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24598
diff
changeset
|
44 | else |
|
6751ffb09daa
Make the Send button insensitive when there is no text in the input buffer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24598
diff
changeset
|
45 | gtk_widget_set_sensitive(send_button, FALSE); |
|
6751ffb09daa
Make the Send button insensitive when there is no text in the input buffer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24598
diff
changeset
|
46 | } |
|
6751ffb09daa
Make the Send button insensitive when there is no text in the input buffer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24598
diff
changeset
|
47 | |
|
6751ffb09daa
Make the Send button insensitive when there is no text in the input buffer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24598
diff
changeset
|
48 | static void |
|
22828
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
49 | create_send_button_pidgin(PidginConversation *gtkconv) |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
50 | { |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
51 | GtkWidget *send_button; |
|
24599
6751ffb09daa
Make the Send button insensitive when there is no text in the input buffer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24598
diff
changeset
|
52 | GtkTextBuffer *buf; |
|
6751ffb09daa
Make the Send button insensitive when there is no text in the input buffer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24598
diff
changeset
|
53 | guint signal_id; |
|
22828
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
54 | |
|
24598
dcaf0be8d4e6
Don't add the Send button to a gtkconv->lower_hbox when the data specifying it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22828
diff
changeset
|
55 | send_button = g_object_get_data(G_OBJECT(gtkconv->lower_hbox), |
|
dcaf0be8d4e6
Don't add the Send button to a gtkconv->lower_hbox when the data specifying it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22828
diff
changeset
|
56 | "send_button"); |
|
dcaf0be8d4e6
Don't add the Send button to a gtkconv->lower_hbox when the data specifying it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22828
diff
changeset
|
57 | |
|
dcaf0be8d4e6
Don't add the Send button to a gtkconv->lower_hbox when the data specifying it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22828
diff
changeset
|
58 | if (send_button != NULL) |
|
dcaf0be8d4e6
Don't add the Send button to a gtkconv->lower_hbox when the data specifying it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22828
diff
changeset
|
59 | return; |
|
dcaf0be8d4e6
Don't add the Send button to a gtkconv->lower_hbox when the data specifying it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22828
diff
changeset
|
60 | |
|
22828
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
61 | send_button = gtk_button_new_with_mnemonic(_("_Send")); |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
62 | g_signal_connect(G_OBJECT(send_button), "clicked", |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
63 | G_CALLBACK(send_button_cb), gtkconv); |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
64 | gtk_box_pack_end(GTK_BOX(gtkconv->lower_hbox), send_button, FALSE, |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
65 | FALSE, 0); |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
66 | gtk_widget_show(send_button); |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
67 | |
|
24599
6751ffb09daa
Make the Send button insensitive when there is no text in the input buffer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24598
diff
changeset
|
68 | buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); |
|
6751ffb09daa
Make the Send button insensitive when there is no text in the input buffer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24598
diff
changeset
|
69 | if (buf) { |
|
6751ffb09daa
Make the Send button insensitive when there is no text in the input buffer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24598
diff
changeset
|
70 | signal_id = g_signal_connect(G_OBJECT(buf), "changed", |
|
6751ffb09daa
Make the Send button insensitive when there is no text in the input buffer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24598
diff
changeset
|
71 | G_CALLBACK(input_buffer_changed), |
|
6751ffb09daa
Make the Send button insensitive when there is no text in the input buffer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24598
diff
changeset
|
72 | send_button); |
|
6751ffb09daa
Make the Send button insensitive when there is no text in the input buffer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24598
diff
changeset
|
73 | g_object_set_data(G_OBJECT(send_button), "buffer-signal", |
|
6751ffb09daa
Make the Send button insensitive when there is no text in the input buffer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24598
diff
changeset
|
74 | GINT_TO_POINTER(signal_id)); |
|
6751ffb09daa
Make the Send button insensitive when there is no text in the input buffer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24598
diff
changeset
|
75 | input_buffer_changed(buf, send_button); |
|
6751ffb09daa
Make the Send button insensitive when there is no text in the input buffer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24598
diff
changeset
|
76 | } |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
77 | |
|
22828
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
78 | g_object_set_data(G_OBJECT(gtkconv->lower_hbox), "send_button", |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
79 | send_button); |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
80 | } |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
81 | |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
82 | static void |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
83 | remove_send_button_pidgin(PidginConversation *gtkconv) |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
84 | { |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
85 | GtkWidget *send_button = NULL; |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
86 | |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
87 | send_button = g_object_get_data(G_OBJECT(gtkconv->lower_hbox), |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
88 | "send_button"); |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
89 | if (send_button != NULL) { |
|
24599
6751ffb09daa
Make the Send button insensitive when there is no text in the input buffer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24598
diff
changeset
|
90 | GtkTextBuffer *buf; |
|
6751ffb09daa
Make the Send button insensitive when there is no text in the input buffer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24598
diff
changeset
|
91 | guint signal_id; |
|
6751ffb09daa
Make the Send button insensitive when there is no text in the input buffer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24598
diff
changeset
|
92 | |
|
6751ffb09daa
Make the Send button insensitive when there is no text in the input buffer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24598
diff
changeset
|
93 | buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); |
|
6751ffb09daa
Make the Send button insensitive when there is no text in the input buffer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24598
diff
changeset
|
94 | signal_id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(send_button), |
|
6751ffb09daa
Make the Send button insensitive when there is no text in the input buffer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24598
diff
changeset
|
95 | "buffer-signal")); |
|
6751ffb09daa
Make the Send button insensitive when there is no text in the input buffer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24598
diff
changeset
|
96 | if (buf && signal_id) |
|
6751ffb09daa
Make the Send button insensitive when there is no text in the input buffer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24598
diff
changeset
|
97 | g_signal_handler_disconnect(G_OBJECT(buf), signal_id); |
|
6751ffb09daa
Make the Send button insensitive when there is no text in the input buffer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24598
diff
changeset
|
98 | |
|
22828
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
99 | gtk_widget_destroy(send_button); |
|
24598
dcaf0be8d4e6
Don't add the Send button to a gtkconv->lower_hbox when the data specifying it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22828
diff
changeset
|
100 | g_object_set_data(G_OBJECT(gtkconv->lower_hbox), |
|
dcaf0be8d4e6
Don't add the Send button to a gtkconv->lower_hbox when the data specifying it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22828
diff
changeset
|
101 | "send_button", NULL); |
|
22828
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
102 | } |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
103 | } |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
104 | |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
105 | static void |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
106 | conversation_displayed_cb(PidginConversation *gtkconv) |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
107 | { |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
108 | GtkWidget *send_button = NULL; |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
109 | |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
110 | send_button = g_object_get_data(G_OBJECT(gtkconv->lower_hbox), |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
111 | "send_button"); |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
112 | if (send_button == NULL) { |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
113 | create_send_button_pidgin(gtkconv); |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
114 | } |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
115 | } |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
116 | |
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34655
diff
changeset
|
117 | static PidginPluginInfo * |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34655
diff
changeset
|
118 | plugin_query(GError **error) |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34655
diff
changeset
|
119 | { |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34655
diff
changeset
|
120 | const gchar * const authors[] = { |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34655
diff
changeset
|
121 | "Etan Reisner <deryni@pidgin.im>", |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34655
diff
changeset
|
122 | NULL |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34655
diff
changeset
|
123 | }; |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34655
diff
changeset
|
124 | |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34655
diff
changeset
|
125 | return pidgin_plugin_info_new( |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34655
diff
changeset
|
126 | "id", "gtksendbutton", |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34655
diff
changeset
|
127 | "name", N_("Send Button"), |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34655
diff
changeset
|
128 | "version", DISPLAY_VERSION, |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34655
diff
changeset
|
129 | "category", N_("User interface"), |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34655
diff
changeset
|
130 | "summary", N_("Conversation Window Send Button."), |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34655
diff
changeset
|
131 | "description", N_("Adds a Send button to the entry area of the " |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34655
diff
changeset
|
132 | "conversation window. Intended for use when no " |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34655
diff
changeset
|
133 | "physical keyboard is present."), |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34655
diff
changeset
|
134 | "authors", authors, |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34655
diff
changeset
|
135 | "website", PURPLE_WEBSITE, |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34655
diff
changeset
|
136 | "abi-version", PURPLE_ABI_VERSION, |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34655
diff
changeset
|
137 | NULL |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34655
diff
changeset
|
138 | ); |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34655
diff
changeset
|
139 | } |
|
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34655
diff
changeset
|
140 | |
|
22828
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
141 | static gboolean |
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34655
diff
changeset
|
142 | plugin_load(PurplePlugin *plugin, GError **error) |
|
22828
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
143 | { |
|
34655
6a939719ea98
Replaced purple_conversations_get() with purple_conversations_get_all(), similar to other purple entities
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
144 | GList *convs = purple_conversations_get_all(); |
|
22828
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
145 | void *gtk_conv_handle = pidgin_conversations_get_handle(); |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
146 | |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
147 | purple_signal_connect(gtk_conv_handle, "conversation-displayed", plugin, |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
148 | PURPLE_CALLBACK(conversation_displayed_cb), NULL); |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
149 | /* |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
150 | purple_signal_connect(gtk_conv_handle, "conversation-hiding", plugin, |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
151 | PURPLE_CALLBACK(conversation_hiding_cb), NULL); |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
152 | */ |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
153 | |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
154 | while (convs) { |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
27525
diff
changeset
|
155 | |
|
22828
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
156 | PurpleConversation *conv = (PurpleConversation *)convs->data; |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
157 | |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
158 | /* Setup Send button */ |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
159 | if (PIDGIN_IS_PIDGIN_CONVERSATION(conv)) { |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
160 | create_send_button_pidgin(PIDGIN_CONVERSATION(conv)); |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
161 | } |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
162 | |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
163 | convs = convs->next; |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
164 | } |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
165 | |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
166 | return TRUE; |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
167 | } |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
168 | |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
169 | static gboolean |
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34655
diff
changeset
|
170 | plugin_unload(PurplePlugin *plugin, GError **error) |
|
22828
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
171 | { |
|
34655
6a939719ea98
Replaced purple_conversations_get() with purple_conversations_get_all(), similar to other purple entities
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
172 | GList *convs = purple_conversations_get_all(); |
|
22828
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
173 | |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
174 | while (convs) { |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
175 | PurpleConversation *conv = (PurpleConversation *)convs->data; |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
176 | |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
177 | /* Remove Send button */ |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
178 | if (PIDGIN_IS_PIDGIN_CONVERSATION(conv)) { |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
179 | remove_send_button_pidgin(PIDGIN_CONVERSATION(conv)); |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
180 | } |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
181 | |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
182 | convs = convs->next; |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
183 | } |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
184 | |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
185 | return TRUE; |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
186 | } |
|
6a1885524a97
Add a plugin to add a Send button to the conversation windows, users of tablet
Etan Reisner <deryni@pidgin.im>
parents:
diff
changeset
|
187 | |
|
36758
deee438dc431
Refactored more pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34655
diff
changeset
|
188 | PURPLE_PLUGIN_INIT(sendbutton, plugin_query, plugin_load, plugin_unload); |