Wed, 12 Mar 2025 01:24:36 -0500
Make the message notifications ignore events
Testing Done:
Joined a channel with another client and verified there was no message notification, then sent a message with that client and verified a message count of 1, then left the client with that client and verified the message count was still 1.
Reviewed at https://reviews.imfreedom.org/r/3898/
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * Pidgin - Internet Messenger |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * Pidgin is the legal property of its developers, whose names are too numerous |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * source distribution. |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * This program is free software; you can redistribute it and/or modify |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * it under the terms of the GNU General Public License as published by |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * the Free Software Foundation; either version 2 of the License, or |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * (at your option) any later version. |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * This program is distributed in the hope that it will be useful, |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | * GNU General Public License for more details. |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | * |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | * You should have received a copy of the GNU General Public License |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | * along with this program; if not, see <https://www.gnu.org/licenses/>. |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | */ |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | #include <glib/gi18n-lib.h> |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | |
|
43186
f869ebb47d88
Add basic support for libspelling
Gary Kramlich <grim@reaperworld.com>
parents:
43173
diff
changeset
|
25 | #include <libspelling.h> |
|
f869ebb47d88
Add basic support for libspelling
Gary Kramlich <grim@reaperworld.com>
parents:
43173
diff
changeset
|
26 | |
|
f869ebb47d88
Add basic support for libspelling
Gary Kramlich <grim@reaperworld.com>
parents:
43173
diff
changeset
|
27 | #include <gtksourceview/gtksourceview.h> |
|
f869ebb47d88
Add basic support for libspelling
Gary Kramlich <grim@reaperworld.com>
parents:
43173
diff
changeset
|
28 | |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | #include <purple.h> |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | |
|
42447
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
31 | #include "pidginautoadjustment.h" |
|
42527
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
32 | #include "pidgincontactinfomenu.h" |
|
42346
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
33 | #include "pidginconversation.h" |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
34 | #include "pidgininfopane.h" |
|
43093
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
35 | #include "pidginmessage.h" |
|
43192
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
36 | #include "pidginnotifiable.h" |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | #define PIDGIN_CONVERSATION_DATA ("pidgin-conversation") |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | enum { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | PROP_0, |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | PROP_CONVERSATION, |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | N_PROPERTIES, |
|
43192
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
44 | /* Overrides */ |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
45 | PROP_NEEDS_ATTENTION = N_PROPERTIES, |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
46 | PROP_NOTIFICATION_COUNT, |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | }; |
|
42584
687260353985
Make signal and property enums and initializers consistent
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42575
diff
changeset
|
48 | static GParamSpec *properties[N_PROPERTIES] = {NULL, }; |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
50 | struct _PidginConversation { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
51 | GtkBox parent; |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
52 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
53 | PurpleConversation *conversation; |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
54 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
55 | GtkWidget *info_pane; |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
56 | GtkWidget *history; |
|
42447
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
57 | GtkAdjustment *history_adjustment; |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
58 | |
|
43173
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
59 | GtkWidget *member_list_search_entry; |
|
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
60 | GtkCustomFilter *member_list_filter; |
|
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
61 | GtkCustomSorter *member_list_sorter; |
|
42783
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
62 | |
|
42447
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
63 | GtkWidget *input; |
|
43186
f869ebb47d88
Add basic support for libspelling
Gary Kramlich <grim@reaperworld.com>
parents:
43173
diff
changeset
|
64 | GtkSourceBuffer *input_buffer; |
|
43099
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
65 | |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
66 | GtkWidget *typing_label; |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
67 | GtkWidget *status_label; |
|
43192
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
68 | |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
69 | /* This is a temporary work around to get new message notifications working |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
70 | * until we implement Purple.History properly. |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
71 | * -- gk 2025-03-11 |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
72 | */ |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
73 | guint notification_count; |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
74 | }; |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
75 | |
|
43192
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
76 | static void |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
77 | pidgin_conversation_messages_changed_cb(GListModel *model, guint position, |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
78 | guint removed, guint added, |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
79 | gpointer data); |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
80 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
81 | /****************************************************************************** |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
82 | * Helpers |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
83 | *****************************************************************************/ |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
84 | static void |
|
43192
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
85 | pidgin_conversation_set_notification_count(PidginConversation *conversation, |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
86 | guint notification_count) |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
87 | { |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
88 | if(conversation->notification_count != notification_count) { |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
89 | GObject *obj = G_OBJECT(conversation); |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
90 | |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
91 | conversation->notification_count = notification_count; |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
92 | |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
93 | g_object_freeze_notify(obj); |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
94 | g_object_notify(obj, "needs-attention"); |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
95 | g_object_notify(obj, "notification-count"); |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
96 | g_object_thaw_notify(obj); |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
97 | } |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
98 | } |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
99 | |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
100 | static void |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
101 | pidgin_conversation_set_conversation(PidginConversation *conversation, |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
102 | PurpleConversation *purple_conversation) |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
103 | { |
|
43192
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
104 | /* Disconnect our old signal. */ |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
105 | if(PURPLE_IS_CONVERSATION(conversation->conversation)) { |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
106 | GListModel *model = NULL; |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
107 | |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
108 | model = purple_conversation_get_messages(conversation->conversation); |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
109 | g_signal_handlers_disconnect_by_func(model, |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
110 | G_CALLBACK(pidgin_conversation_messages_changed_cb), |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
111 | conversation); |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
112 | } |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
113 | |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
114 | if(g_set_object(&conversation->conversation, purple_conversation)) { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
115 | if(PURPLE_IS_CONVERSATION(purple_conversation)) { |
|
43192
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
116 | GListModel *model = NULL; |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
117 | |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
118 | g_object_set_data(G_OBJECT(purple_conversation), |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
119 | PIDGIN_CONVERSATION_DATA, conversation); |
|
43192
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
120 | |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
121 | model = purple_conversation_get_messages(conversation->conversation); |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
122 | |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
123 | g_signal_connect_object(model, "items-changed", |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
124 | G_CALLBACK(pidgin_conversation_messages_changed_cb), |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
125 | conversation, G_CONNECT_DEFAULT); |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
126 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
127 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
128 | g_object_notify_by_pspec(G_OBJECT(conversation), |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
129 | properties[PROP_CONVERSATION]); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
130 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
131 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
132 | |
|
42784
909476a9e569
Escape the topic and its tooltip using g_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
42783
diff
changeset
|
133 | /* This is used to call g_markup_escape_text for the topic before displaying it |
|
909476a9e569
Escape the topic and its tooltip using g_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
42783
diff
changeset
|
134 | * in its normal label and the tool tip for that label. |
|
909476a9e569
Escape the topic and its tooltip using g_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
42783
diff
changeset
|
135 | */ |
|
909476a9e569
Escape the topic and its tooltip using g_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
42783
diff
changeset
|
136 | static char * |
|
909476a9e569
Escape the topic and its tooltip using g_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
42783
diff
changeset
|
137 | pidgin_conversation_escape_topic(G_GNUC_UNUSED GObject *self, |
|
909476a9e569
Escape the topic and its tooltip using g_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
42783
diff
changeset
|
138 | const char *topic, |
|
909476a9e569
Escape the topic and its tooltip using g_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
42783
diff
changeset
|
139 | G_GNUC_UNUSED gpointer data) |
|
909476a9e569
Escape the topic and its tooltip using g_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
42783
diff
changeset
|
140 | { |
|
909476a9e569
Escape the topic and its tooltip using g_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
42783
diff
changeset
|
141 | if(topic == NULL) { |
|
909476a9e569
Escape the topic and its tooltip using g_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
42783
diff
changeset
|
142 | return g_strdup(""); |
|
909476a9e569
Escape the topic and its tooltip using g_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
42783
diff
changeset
|
143 | } |
|
909476a9e569
Escape the topic and its tooltip using g_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
42783
diff
changeset
|
144 | |
|
909476a9e569
Escape the topic and its tooltip using g_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
42783
diff
changeset
|
145 | return g_markup_escape_text(topic, -1); |
|
909476a9e569
Escape the topic and its tooltip using g_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
42783
diff
changeset
|
146 | } |
|
909476a9e569
Escape the topic and its tooltip using g_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
42783
diff
changeset
|
147 | |
|
43129
c72c9ce63177
Add a count of the members above the member list in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
148 | static char * |
|
c72c9ce63177
Add a count of the members above the member list in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
149 | pidgin_conversation_conversation_members_items_changed(G_GNUC_UNUSED PidginConversation *self, |
|
c72c9ce63177
Add a count of the members above the member list in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
150 | guint n_members) |
|
c72c9ce63177
Add a count of the members above the member list in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
151 | { |
|
c72c9ce63177
Add a count of the members above the member list in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
152 | /* TRANSLATORS: This is a label for how many participants are in a |
|
c72c9ce63177
Add a count of the members above the member list in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
153 | * conversation. |
|
c72c9ce63177
Add a count of the members above the member list in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
154 | */ |
|
c72c9ce63177
Add a count of the members above the member list in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
155 | const char *format = g_dngettext(GETTEXT_PACKAGE, "%u Member", |
|
c72c9ce63177
Add a count of the members above the member list in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
156 | "%u Members", n_members); |
|
c72c9ce63177
Add a count of the members above the member list in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
157 | |
|
c72c9ce63177
Add a count of the members above the member list in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
158 | return g_strdup_printf(format, n_members); |
|
c72c9ce63177
Add a count of the members above the member list in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
159 | } |
|
c72c9ce63177
Add a count of the members above the member list in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
160 | |
|
42812
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
161 | /** |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
162 | * pidgin_conversation_send_message: |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
163 | * @conversation: The instance. |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
164 | * |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
165 | * Creates a [class@Purple.Message] from the input widgets of @conversation and |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
166 | * sends it. |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
167 | * |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
168 | * Since: 3.0 |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
169 | */ |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
170 | static void |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
171 | pidgin_conversation_send_message(PidginConversation *conversation) { |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
172 | PurpleAccount *account = NULL; |
|
42838
010bd75895d9
Use purple_message_new instead of purple_message_new_outgoing in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42826
diff
changeset
|
173 | PurpleContactInfo *info = NULL; |
|
42812
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
174 | PurpleMessage *message = NULL; |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
175 | GtkTextBuffer *buffer = NULL; |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
176 | GtkTextIter start; |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
177 | GtkTextIter end; |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
178 | char *contents = NULL; |
|
43058
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
179 | gboolean command_executed = FALSE; |
|
42812
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
180 | |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
181 | account = purple_conversation_get_account(conversation->conversation); |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
182 | |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
183 | /* Get the contents from the buffer. */ |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
184 | buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(conversation->input)); |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
185 | gtk_text_buffer_get_start_iter(buffer, &start); |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
186 | gtk_text_buffer_get_end_iter(buffer, &end); |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
187 | |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
188 | contents = gtk_text_buffer_get_text(buffer, &start, &end, TRUE); |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
189 | |
|
43058
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
190 | if(contents != NULL && contents[0] == '/') { |
|
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
191 | PurpleCommandManager *manager = NULL; |
|
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
192 | |
|
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
193 | manager = purple_command_manager_get_default(); |
|
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
194 | command_executed = purple_command_manager_find_and_execute(manager, |
|
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
195 | conversation->conversation, |
|
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
196 | contents + 1); |
|
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
197 | } |
|
42812
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
198 | |
|
43058
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
199 | if(!command_executed) { |
|
43100
e6df74d36862
Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents:
43099
diff
changeset
|
200 | PurpleConversationMember *author = NULL; |
|
e6df74d36862
Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents:
43099
diff
changeset
|
201 | |
|
43058
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
202 | /* Create the message. */ |
|
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
203 | info = purple_account_get_contact_info(account); |
|
43100
e6df74d36862
Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents:
43099
diff
changeset
|
204 | author = purple_conversation_find_or_add_member(conversation->conversation, |
|
e6df74d36862
Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents:
43099
diff
changeset
|
205 | info, FALSE, NULL); |
|
e6df74d36862
Change Purple.Message:author to Purple.ConversationMember
Gary Kramlich <grim@reaperworld.com>
parents:
43099
diff
changeset
|
206 | message = purple_message_new(author, contents); |
|
42812
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
207 | |
|
43058
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
208 | /* Send the message and clean up. We don't worry about the callback as we |
|
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
209 | * don't have anything to do in it right now. |
|
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
210 | */ |
|
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
211 | purple_conversation_send_message_async(conversation->conversation, message, |
|
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
212 | NULL, NULL, NULL); |
|
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
213 | |
|
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
214 | g_clear_object(&message); |
|
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
215 | } |
|
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
216 | |
|
42812
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
217 | g_clear_pointer(&contents, g_free); |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
218 | |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
219 | gtk_text_buffer_set_text(buffer, "", -1); |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
220 | } |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
221 | |
|
43192
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
222 | static gboolean |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
223 | pidgin_conversation_get_needs_attention(PidginConversation *conversation) |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
224 | { |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
225 | return conversation->notification_count > 0; |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
226 | } |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
227 | |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
228 | static guint |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
229 | pidgin_conversation_get_notification_count(PidginConversation *conversation) { |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
230 | return conversation->notification_count; |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
231 | } |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
232 | |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
233 | /****************************************************************************** |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
234 | * Callbacks |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
235 | *****************************************************************************/ |
|
43192
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
236 | static void |
|
43193
02f50223f45a
Make the message notifications ignore events
Gary Kramlich <grim@reaperworld.com>
parents:
43192
diff
changeset
|
237 | pidgin_conversation_messages_changed_cb(GListModel *model, |
|
02f50223f45a
Make the message notifications ignore events
Gary Kramlich <grim@reaperworld.com>
parents:
43192
diff
changeset
|
238 | guint position, |
|
43192
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
239 | G_GNUC_UNUSED guint removed, |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
240 | guint added, |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
241 | gpointer data) |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
242 | { |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
243 | PidginConversation *conversation = data; |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
244 | guint current = conversation->notification_count; |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
245 | |
|
43193
02f50223f45a
Make the message notifications ignore events
Gary Kramlich <grim@reaperworld.com>
parents:
43192
diff
changeset
|
246 | for(guint i = position; i < position + added; i++) { |
|
02f50223f45a
Make the message notifications ignore events
Gary Kramlich <grim@reaperworld.com>
parents:
43192
diff
changeset
|
247 | PurpleMessage *message = NULL; |
|
02f50223f45a
Make the message notifications ignore events
Gary Kramlich <grim@reaperworld.com>
parents:
43192
diff
changeset
|
248 | |
|
02f50223f45a
Make the message notifications ignore events
Gary Kramlich <grim@reaperworld.com>
parents:
43192
diff
changeset
|
249 | message = g_list_model_get_item(model, i); |
|
02f50223f45a
Make the message notifications ignore events
Gary Kramlich <grim@reaperworld.com>
parents:
43192
diff
changeset
|
250 | if(!purple_message_get_event(message)) { |
|
02f50223f45a
Make the message notifications ignore events
Gary Kramlich <grim@reaperworld.com>
parents:
43192
diff
changeset
|
251 | current += 1; |
|
02f50223f45a
Make the message notifications ignore events
Gary Kramlich <grim@reaperworld.com>
parents:
43192
diff
changeset
|
252 | } |
|
02f50223f45a
Make the message notifications ignore events
Gary Kramlich <grim@reaperworld.com>
parents:
43192
diff
changeset
|
253 | g_clear_object(&message); |
|
02f50223f45a
Make the message notifications ignore events
Gary Kramlich <grim@reaperworld.com>
parents:
43192
diff
changeset
|
254 | } |
|
43192
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
255 | |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
256 | pidgin_conversation_set_notification_count(conversation, current); |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
257 | } |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
258 | |
|
43099
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
259 | static char * |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
260 | pidgin_conversation_get_status_label(G_GNUC_UNUSED PidginConversation *conversation, |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
261 | GError *error, gboolean online) |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
262 | { |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
263 | const char *message = NULL; |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
264 | |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
265 | if(error != NULL) { |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
266 | message = error->message; |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
267 | } |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
268 | |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
269 | if(purple_strempty(message) && !online) { |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
270 | message = _("Conversation offline"); |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
271 | } |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
272 | |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
273 | if(purple_strempty(message)) { |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
274 | message = ""; |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
275 | } |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
276 | |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
277 | return g_strdup(message); |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
278 | } |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
279 | |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
280 | static GtkWidget * |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
281 | pidgin_conversation_get_status_page(PidginConversation *conversation, |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
282 | GError *error, gboolean online) |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
283 | { |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
284 | if(error != NULL || !online) { |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
285 | return g_object_ref(conversation->status_label); |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
286 | } |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
287 | |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
288 | return g_object_ref(conversation->typing_label); |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
289 | } |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
290 | |
|
42885
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
291 | static void |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
292 | pidgin_conversation_input_insert_text_cb(G_GNUC_UNUSED GtkTextBuffer *buffer, |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
293 | G_GNUC_UNUSED const GtkTextIter *iter, |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
294 | G_GNUC_UNUSED char *text, |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
295 | G_GNUC_UNUSED int length, |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
296 | gpointer data) |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
297 | { |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
298 | PidginConversation *conversation = data; |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
299 | |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
300 | purple_conversation_set_typing_state(conversation->conversation, |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
301 | PURPLE_TYPING_STATE_TYPING); |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
302 | } |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
303 | |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
304 | static void |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
305 | pidgin_conversation_input_delete_range_cb(GtkTextBuffer *buffer, |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
306 | G_GNUC_UNUSED const GtkTextIter *start, |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
307 | G_GNUC_UNUSED const GtkTextIter *end, |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
308 | gpointer data) |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
309 | { |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
310 | PidginConversation *conversation = data; |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
311 | |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
312 | if(gtk_text_buffer_get_char_count(buffer) == 0) { |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
313 | purple_conversation_set_typing_state(conversation->conversation, |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
314 | PURPLE_TYPING_STATE_NONE); |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
315 | } |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
316 | } |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
317 | |
|
42447
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
318 | static gboolean |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
319 | pidgin_conversation_input_key_pressed_cb(G_GNUC_UNUSED GtkEventControllerKey *self, |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
320 | guint keyval, |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
321 | G_GNUC_UNUSED guint keycode, |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
322 | GdkModifierType state, |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
323 | gpointer data) |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
324 | { |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
325 | PidginConversation *conversation = data; |
|
42447
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
326 | gboolean handled = TRUE; |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
327 | |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
328 | if(keyval == GDK_KEY_Return || keyval == GDK_KEY_KP_Enter) { |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
329 | if(state == GDK_SHIFT_MASK || state == GDK_CONTROL_MASK) { |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
330 | return FALSE; |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
331 | } |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
332 | |
|
42812
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
333 | pidgin_conversation_send_message(conversation); |
|
42447
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
334 | } else if(keyval == GDK_KEY_Page_Up) { |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
335 | pidgin_auto_adjustment_decrement(PIDGIN_AUTO_ADJUSTMENT(conversation->history_adjustment)); |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
336 | } else if(keyval == GDK_KEY_Page_Down) { |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
337 | pidgin_auto_adjustment_increment(PIDGIN_AUTO_ADJUSTMENT(conversation->history_adjustment)); |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
338 | } else { |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
339 | handled = FALSE; |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
340 | } |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
341 | |
|
42447
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
342 | return handled; |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
343 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
344 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
345 | static void |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
346 | pidgin_conversation_detach(PidginConversation *conversation) { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
347 | if(PURPLE_IS_CONVERSATION(conversation->conversation)) { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
348 | gpointer us = NULL; |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
349 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
350 | us = g_object_get_data(G_OBJECT(conversation->conversation), |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
351 | PIDGIN_CONVERSATION_DATA); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
352 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
353 | if(conversation == us) { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
354 | g_object_set_data(G_OBJECT(conversation->conversation), |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
355 | PIDGIN_CONVERSATION_DATA, NULL); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
356 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
357 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
358 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
359 | |
|
43173
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
360 | static void |
|
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
361 | pidgin_conversation_members_search_changed_cb(GtkSearchEntry *self, |
|
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
362 | gpointer data) |
|
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
363 | { |
|
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
364 | PidginConversation *conversation = data; |
|
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
365 | |
|
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
366 | gtk_filter_changed(GTK_FILTER(conversation->member_list_filter), |
|
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
367 | GTK_FILTER_CHANGE_DIFFERENT); |
|
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
368 | |
|
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
369 | /* Make sure the search widget has focus, this allows the user to clear a |
|
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
370 | * search that has filtered out every item in the list via their keyboard. |
|
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
371 | */ |
|
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
372 | if(!gtk_widget_has_focus(GTK_WIDGET(self))) { |
|
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
373 | gtk_widget_grab_focus(GTK_WIDGET(self)); |
|
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
374 | } |
|
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
375 | } |
|
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
376 | |
|
42783
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
377 | static int |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
378 | pidgin_conversation_member_list_sort(gconstpointer a, gconstpointer b, |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
379 | G_GNUC_UNUSED gpointer data) |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
380 | { |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
381 | PurpleConversationMember *member_a = NULL; |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
382 | PurpleConversationMember *member_b = NULL; |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
383 | PurpleContactInfo *info_a = NULL; |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
384 | PurpleContactInfo *info_b = NULL; |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
385 | |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
386 | member_a = PURPLE_CONVERSATION_MEMBER((gpointer)a); |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
387 | member_b = PURPLE_CONVERSATION_MEMBER((gpointer)b); |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
388 | |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
389 | info_a = purple_conversation_member_get_contact_info(member_a); |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
390 | info_b = purple_conversation_member_get_contact_info(member_b); |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
391 | |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
392 | return purple_contact_info_compare(info_a, info_b); |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
393 | } |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
394 | |
|
43173
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
395 | static gboolean |
|
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
396 | pidgin_conversation_member_list_filter(GObject *item, gpointer data) { |
|
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
397 | PidginConversation *conversation = data; |
|
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
398 | PurpleConversationMember *member = PURPLE_CONVERSATION_MEMBER(item); |
|
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
399 | const char *needle = NULL; |
|
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
400 | |
|
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
401 | needle = gtk_editable_get_text(GTK_EDITABLE(conversation->member_list_search_entry)); |
|
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
402 | |
|
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
403 | return purple_conversation_member_matches(member, needle); |
|
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
404 | } |
|
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
405 | |
|
43093
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
406 | static void |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
407 | pidgin_conversation_message_setup(G_GNUC_UNUSED GtkSignalListItemFactory *self, |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
408 | GObject *object, |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
409 | G_GNUC_UNUSED gpointer data) |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
410 | { |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
411 | gtk_list_item_set_child(GTK_LIST_ITEM(object), pidgin_message_new(NULL)); |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
412 | } |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
413 | |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
414 | static void |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
415 | pidgin_conversation_message_bind(G_GNUC_UNUSED GtkSignalListItemFactory *self, |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
416 | GObject *object, |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
417 | G_GNUC_UNUSED gpointer data) |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
418 | { |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
419 | PurpleMessage *purple_message = NULL; |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
420 | GtkListItem *item = GTK_LIST_ITEM(object); |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
421 | GtkWidget *pidgin_message = NULL; |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
422 | |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
423 | purple_message = gtk_list_item_get_item(item); |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
424 | pidgin_message = gtk_list_item_get_child(item); |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
425 | |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
426 | pidgin_message_set_message(PIDGIN_MESSAGE(pidgin_message), purple_message); |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
427 | } |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
428 | |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
429 | static void |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
430 | pidgin_conversation_message_unbind(G_GNUC_UNUSED GtkSignalListItemFactory *self, |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
431 | GObject *object, |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
432 | G_GNUC_UNUSED gpointer data) |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
433 | { |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
434 | GtkListItem *item = GTK_LIST_ITEM(object); |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
435 | GtkWidget *message = NULL; |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
436 | |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
437 | message = gtk_list_item_get_child(item); |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
438 | |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
439 | pidgin_message_set_message(PIDGIN_MESSAGE(message), NULL); |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
440 | } |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
441 | |
|
43192
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
442 | static void |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
443 | pidgin_conversation_map_cb(GtkWidget *self, G_GNUC_UNUSED gpointer data) { |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
444 | pidgin_conversation_set_notification_count(PIDGIN_CONVERSATION(self), 0); |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
445 | } |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
446 | |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
447 | /****************************************************************************** |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
448 | * PidginNotifiable Implementation |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
449 | *****************************************************************************/ |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
450 | static void |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
451 | pidgin_conversation_notifiable_init(G_GNUC_UNUSED PidginNotifiableInterface *iface) |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
452 | { |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
453 | } |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
454 | |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
455 | /****************************************************************************** |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
456 | * GObject Implementation |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
457 | *****************************************************************************/ |
|
43192
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
458 | G_DEFINE_FINAL_TYPE_WITH_CODE(PidginConversation, |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
459 | pidgin_conversation, |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
460 | GTK_TYPE_BOX, |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
461 | G_IMPLEMENT_INTERFACE(PIDGIN_TYPE_NOTIFIABLE, |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
462 | pidgin_conversation_notifiable_init)) |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
463 | |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
464 | |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
465 | static void |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
466 | pidgin_conversation_dispose(GObject *obj) { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
467 | PidginConversation *conversation = PIDGIN_CONVERSATION(obj); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
468 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
469 | pidgin_conversation_detach(conversation); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
470 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
471 | g_clear_object(&conversation->conversation); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
472 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
473 | G_OBJECT_CLASS(pidgin_conversation_parent_class)->dispose(obj); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
474 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
475 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
476 | static void |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
477 | pidgin_conversation_get_property(GObject *obj, guint param_id, GValue *value, |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
478 | GParamSpec *pspec) |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
479 | { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
480 | PidginConversation *conversation = PIDGIN_CONVERSATION(obj); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
481 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
482 | switch(param_id) { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
483 | case PROP_CONVERSATION: |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
484 | g_value_set_object(value, |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
485 | pidgin_conversation_get_conversation(conversation)); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
486 | break; |
|
43192
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
487 | case PROP_NEEDS_ATTENTION: |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
488 | g_value_set_boolean(value, |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
489 | pidgin_conversation_get_needs_attention(conversation)); |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
490 | break; |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
491 | case PROP_NOTIFICATION_COUNT: |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
492 | g_value_set_uint(value, |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
493 | pidgin_conversation_get_notification_count(conversation)); |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
494 | break; |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
495 | default: |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
496 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
497 | break; |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
498 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
499 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
500 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
501 | static void |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
502 | pidgin_conversation_set_property(GObject *obj, guint param_id, |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
503 | const GValue *value, GParamSpec *pspec) |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
504 | { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
505 | PidginConversation *conversation = PIDGIN_CONVERSATION(obj); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
506 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
507 | switch(param_id) { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
508 | case PROP_CONVERSATION: |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
509 | pidgin_conversation_set_conversation(conversation, |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
510 | g_value_get_object(value)); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
511 | break; |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
512 | default: |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
513 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
514 | break; |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
515 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
516 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
517 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
518 | static void |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
519 | pidgin_conversation_init(PidginConversation *conversation) { |
|
43186
f869ebb47d88
Add basic support for libspelling
Gary Kramlich <grim@reaperworld.com>
parents:
43173
diff
changeset
|
520 | SpellingChecker *checker = NULL; |
|
f869ebb47d88
Add basic support for libspelling
Gary Kramlich <grim@reaperworld.com>
parents:
43173
diff
changeset
|
521 | SpellingTextBufferAdapter *adapter = NULL; |
|
f869ebb47d88
Add basic support for libspelling
Gary Kramlich <grim@reaperworld.com>
parents:
43173
diff
changeset
|
522 | GMenuModel *menu = NULL; |
|
f869ebb47d88
Add basic support for libspelling
Gary Kramlich <grim@reaperworld.com>
parents:
43173
diff
changeset
|
523 | |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
524 | gtk_widget_init_template(GTK_WIDGET(conversation)); |
|
42783
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
525 | |
|
43173
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
526 | gtk_custom_sorter_set_sort_func(conversation->member_list_sorter, |
|
42783
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
527 | pidgin_conversation_member_list_sort, |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
528 | NULL, NULL); |
|
43173
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
529 | |
|
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
530 | gtk_custom_filter_set_filter_func(conversation->member_list_filter, |
|
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
531 | (GtkCustomFilterFunc)pidgin_conversation_member_list_filter, |
|
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
532 | conversation, NULL); |
|
43186
f869ebb47d88
Add basic support for libspelling
Gary Kramlich <grim@reaperworld.com>
parents:
43173
diff
changeset
|
533 | |
|
f869ebb47d88
Add basic support for libspelling
Gary Kramlich <grim@reaperworld.com>
parents:
43173
diff
changeset
|
534 | /* Create the spell checking adapter. */ |
|
f869ebb47d88
Add basic support for libspelling
Gary Kramlich <grim@reaperworld.com>
parents:
43173
diff
changeset
|
535 | checker = spelling_checker_get_default(); |
|
f869ebb47d88
Add basic support for libspelling
Gary Kramlich <grim@reaperworld.com>
parents:
43173
diff
changeset
|
536 | adapter = spelling_text_buffer_adapter_new(conversation->input_buffer, |
|
f869ebb47d88
Add basic support for libspelling
Gary Kramlich <grim@reaperworld.com>
parents:
43173
diff
changeset
|
537 | checker); |
|
f869ebb47d88
Add basic support for libspelling
Gary Kramlich <grim@reaperworld.com>
parents:
43173
diff
changeset
|
538 | |
|
f869ebb47d88
Add basic support for libspelling
Gary Kramlich <grim@reaperworld.com>
parents:
43173
diff
changeset
|
539 | /* Add the spell checking menu items and actions. */ |
|
f869ebb47d88
Add basic support for libspelling
Gary Kramlich <grim@reaperworld.com>
parents:
43173
diff
changeset
|
540 | menu = spelling_text_buffer_adapter_get_menu_model(adapter); |
|
f869ebb47d88
Add basic support for libspelling
Gary Kramlich <grim@reaperworld.com>
parents:
43173
diff
changeset
|
541 | gtk_text_view_set_extra_menu(GTK_TEXT_VIEW(conversation->input), menu); |
|
f869ebb47d88
Add basic support for libspelling
Gary Kramlich <grim@reaperworld.com>
parents:
43173
diff
changeset
|
542 | gtk_widget_insert_action_group(conversation->input, "spelling", |
|
f869ebb47d88
Add basic support for libspelling
Gary Kramlich <grim@reaperworld.com>
parents:
43173
diff
changeset
|
543 | G_ACTION_GROUP(adapter)); |
|
f869ebb47d88
Add basic support for libspelling
Gary Kramlich <grim@reaperworld.com>
parents:
43173
diff
changeset
|
544 | spelling_text_buffer_adapter_set_enabled(adapter, TRUE); |
|
f869ebb47d88
Add basic support for libspelling
Gary Kramlich <grim@reaperworld.com>
parents:
43173
diff
changeset
|
545 | |
|
f869ebb47d88
Add basic support for libspelling
Gary Kramlich <grim@reaperworld.com>
parents:
43173
diff
changeset
|
546 | g_clear_object(&adapter); |
|
43192
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
547 | |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
548 | /* Connect to our map signal to reset the notification-count property. */ |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
549 | g_signal_connect(conversation, "map", |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
550 | G_CALLBACK(pidgin_conversation_map_cb), NULL); |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
551 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
552 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
553 | static void |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
554 | pidgin_conversation_class_init(PidginConversationClass *klass) { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
555 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
556 | GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
557 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
558 | obj_class->dispose = pidgin_conversation_dispose; |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
559 | obj_class->get_property = pidgin_conversation_get_property; |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
560 | obj_class->set_property = pidgin_conversation_set_property; |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
561 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
562 | /** |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
563 | * PidginConversation:conversation: |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
564 | * |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
565 | * The [class@Purple.Conversation] that this conversation is displaying. |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
566 | * |
|
42620
72178a341eb8
Remove minor versions from Since tags in Pidgin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42584
diff
changeset
|
567 | * Since: 3.0 |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
568 | */ |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
569 | properties[PROP_CONVERSATION] = g_param_spec_object( |
|
43072
a59a119b74f5
Remove nick and blurb from Pidgin properties
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43058
diff
changeset
|
570 | "conversation", NULL, NULL, |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
571 | PURPLE_TYPE_CONVERSATION, |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
572 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
573 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
574 | g_object_class_install_properties(obj_class, N_PROPERTIES, properties); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
575 | |
|
43192
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
576 | g_object_class_override_property(obj_class, PROP_NEEDS_ATTENTION, |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
577 | "needs-attention"); |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
578 | g_object_class_override_property(obj_class, PROP_NOTIFICATION_COUNT, |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
579 | "notification-count"); |
|
e690274aee75
Implement message notifications is a hacky way
Gary Kramlich <grim@reaperworld.com>
parents:
43186
diff
changeset
|
580 | |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
581 | /* Template stuff. */ |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
582 | gtk_widget_class_set_template_from_resource( |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
583 | widget_class, |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
584 | "/im/pidgin/Pidgin3/Conversations/conversation.ui" |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
585 | ); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
586 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
587 | gtk_widget_class_bind_template_child(widget_class, PidginConversation, |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
588 | info_pane); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
589 | gtk_widget_class_bind_template_child(widget_class, PidginConversation, |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
590 | history); |
|
42346
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
591 | gtk_widget_class_bind_template_child(widget_class, PidginConversation, |
|
42447
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
592 | history_adjustment); |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
593 | gtk_widget_class_bind_template_child(widget_class, PidginConversation, |
|
43173
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
594 | member_list_search_entry); |
|
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
595 | gtk_widget_class_bind_template_child(widget_class, PidginConversation, |
|
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
596 | member_list_filter); |
|
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
597 | gtk_widget_class_bind_template_child(widget_class, PidginConversation, |
|
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
598 | member_list_sorter); |
|
42783
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
599 | gtk_widget_class_bind_template_child(widget_class, PidginConversation, |
|
42447
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
600 | input); |
|
43099
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
601 | gtk_widget_class_bind_template_child(widget_class, PidginConversation, |
|
43186
f869ebb47d88
Add basic support for libspelling
Gary Kramlich <grim@reaperworld.com>
parents:
43173
diff
changeset
|
602 | input_buffer); |
|
f869ebb47d88
Add basic support for libspelling
Gary Kramlich <grim@reaperworld.com>
parents:
43173
diff
changeset
|
603 | gtk_widget_class_bind_template_child(widget_class, PidginConversation, |
|
43099
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
604 | typing_label); |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
605 | gtk_widget_class_bind_template_child(widget_class, PidginConversation, |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
606 | status_label); |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
607 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
608 | gtk_widget_class_bind_template_callback(widget_class, |
|
42784
909476a9e569
Escape the topic and its tooltip using g_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
42783
diff
changeset
|
609 | pidgin_conversation_escape_topic); |
|
909476a9e569
Escape the topic and its tooltip using g_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
42783
diff
changeset
|
610 | gtk_widget_class_bind_template_callback(widget_class, |
|
43173
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
611 | pidgin_conversation_members_search_changed_cb); |
|
399e2538f319
Implement searching the conversation members
Gary Kramlich <grim@reaperworld.com>
parents:
43163
diff
changeset
|
612 | gtk_widget_class_bind_template_callback(widget_class, |
|
43129
c72c9ce63177
Add a count of the members above the member list in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
613 | pidgin_conversation_conversation_members_items_changed); |
|
c72c9ce63177
Add a count of the members above the member list in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
43100
diff
changeset
|
614 | gtk_widget_class_bind_template_callback(widget_class, |
|
43099
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
615 | pidgin_conversation_get_status_label); |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
616 | gtk_widget_class_bind_template_callback(widget_class, |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
617 | pidgin_conversation_get_status_page); |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
618 | gtk_widget_class_bind_template_callback(widget_class, |
|
42885
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
619 | pidgin_conversation_input_insert_text_cb); |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
620 | gtk_widget_class_bind_template_callback(widget_class, |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
621 | pidgin_conversation_input_delete_range_cb); |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
622 | gtk_widget_class_bind_template_callback(widget_class, |
|
42447
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
623 | pidgin_conversation_input_key_pressed_cb); |
|
42346
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
624 | gtk_widget_class_bind_template_callback(widget_class, |
|
43093
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
625 | pidgin_conversation_message_setup); |
|
42380
165c0b7f3860
Escape message content in Pidgin before displaying it
Gary Kramlich <grim@reaperworld.com>
parents:
42350
diff
changeset
|
626 | gtk_widget_class_bind_template_callback(widget_class, |
|
43093
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
627 | pidgin_conversation_message_bind); |
|
42531
82fffff36df6
If a message is an action format it with italics
Gary Kramlich <grim@reaperworld.com>
parents:
42527
diff
changeset
|
628 | gtk_widget_class_bind_template_callback(widget_class, |
|
43093
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
629 | pidgin_conversation_message_unbind); |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
630 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
631 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
632 | /****************************************************************************** |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
633 | * API |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
634 | *****************************************************************************/ |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
635 | GtkWidget * |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
636 | pidgin_conversation_new(PurpleConversation *conversation) { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
637 | g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), NULL); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
638 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
639 | return g_object_new( |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
640 | PIDGIN_TYPE_CONVERSATION, |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
641 | "conversation", conversation, |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
642 | NULL); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
643 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
644 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
645 | GtkWidget * |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
646 | pidgin_conversation_from_purple_conversation(PurpleConversation *conversation) |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
647 | { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
648 | g_return_val_if_fail(PURPLE_IS_CONVERSATION(conversation), NULL); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
649 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
650 | return g_object_get_data(G_OBJECT(conversation), PIDGIN_CONVERSATION_DATA); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
651 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
652 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
653 | PurpleConversation * |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
654 | pidgin_conversation_get_conversation(PidginConversation *conversation) { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
655 | g_return_val_if_fail(PIDGIN_IS_CONVERSATION(conversation), NULL); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
656 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
657 | return conversation->conversation; |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
658 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
659 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
660 | void |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
661 | pidgin_conversation_close(PidginConversation *conversation) { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
662 | g_return_if_fail(PIDGIN_IS_CONVERSATION(conversation)); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
663 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
664 | pidgin_conversation_detach(conversation); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
665 | } |