Sun, 03 Nov 2024 00:05:44 -0500
remove purple3-url-handler.desktop.in.in
The application that did the launching was removed long ago. Also this should
be implemented by the user interfaces and they might provide separate files to
groups schemas as well.
Testing Done:
Called in the turtles.
Reviewed at https://reviews.imfreedom.org/r/3640/
|
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 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | #include <purple.h> |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
26 | |
|
42447
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
27 | #include "pidginautoadjustment.h" |
|
42346
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
28 | #include "pidgincolor.h" |
|
42527
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
29 | #include "pidgincontactinfomenu.h" |
|
42346
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
30 | #include "pidginconversation.h" |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
31 | #include "pidgininfopane.h" |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | #define PIDGIN_CONVERSATION_DATA ("pidgin-conversation") |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | enum { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | PROP_0, |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | PROP_CONVERSATION, |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | N_PROPERTIES, |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | }; |
|
42584
687260353985
Make signal and property enums and initializers consistent
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42575
diff
changeset
|
40 | static GParamSpec *properties[N_PROPERTIES] = {NULL, }; |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | struct _PidginConversation { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | GtkBox parent; |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | PurpleConversation *conversation; |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | GtkWidget *info_pane; |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | GtkWidget *history; |
|
42447
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
49 | GtkAdjustment *history_adjustment; |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
50 | |
|
42783
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
51 | GtkCustomSorter *memberlist_sorter; |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
52 | |
|
42447
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
53 | GtkWidget *input; |
|
42301
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 | |
|
42575
580339aa47cc
Make sure all of the final types in pidgin are defined as such
Gary Kramlich <grim@reaperworld.com>
parents:
42531
diff
changeset
|
56 | G_DEFINE_FINAL_TYPE(PidginConversation, pidgin_conversation, GTK_TYPE_BOX) |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
57 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
58 | /****************************************************************************** |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
59 | * Helpers |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
60 | *****************************************************************************/ |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
61 | static void |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
62 | pidgin_conversation_set_conversation(PidginConversation *conversation, |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
63 | PurpleConversation *purple_conversation) |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
64 | { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
65 | if(g_set_object(&conversation->conversation, purple_conversation)) { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
66 | if(PURPLE_IS_CONVERSATION(purple_conversation)) { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
67 | g_object_set_data(G_OBJECT(purple_conversation), |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
68 | PIDGIN_CONVERSATION_DATA, conversation); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
69 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
70 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
71 | g_object_notify_by_pspec(G_OBJECT(conversation), |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
72 | properties[PROP_CONVERSATION]); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | } |
|
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 | |
|
42350
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
76 | /** |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
77 | * pidgin_conversation_set_tooltip_for_timestamp: (skip) |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
78 | * @tooltip: The tooltip to update. |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
79 | * @timestamp: The timestamp to set. |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
80 | * |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
81 | * Updates @tooltip to display @timestamp. This is meant to be called from |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
82 | * a GtkWidget::query-tooltip signal and its return value should be returned |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
83 | * from that handler. |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
84 | * |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
85 | * Returns: %TRUE if a tooltip was set, otherwise %FALSE. |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
86 | * |
|
42620
72178a341eb8
Remove minor versions from Since tags in Pidgin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42584
diff
changeset
|
87 | * Since: 3.0 |
|
42350
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
88 | */ |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
89 | static gboolean |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
90 | pidgin_conversation_set_tooltip_for_timestamp(GtkTooltip *tooltip, |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
91 | GDateTime *timestamp) |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
92 | { |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
93 | GDateTime *local = NULL; |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
94 | char *text = NULL; |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
95 | |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
96 | if(timestamp == NULL) { |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
97 | return FALSE; |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
98 | } |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
99 | |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
100 | local = g_date_time_to_local(timestamp); |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
101 | text = g_date_time_format(local, "%c"); |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
102 | g_clear_pointer(&local, g_date_time_unref); |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
103 | |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
104 | gtk_tooltip_set_text(tooltip, text); |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
105 | g_clear_pointer(&text, g_free); |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
106 | |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
107 | return TRUE; |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
108 | } |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
109 | |
|
42784
909476a9e569
Escape the topic and its tooltip using g_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
42783
diff
changeset
|
110 | /* 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
|
111 | * 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
|
112 | */ |
|
909476a9e569
Escape the topic and its tooltip using g_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
42783
diff
changeset
|
113 | static char * |
|
909476a9e569
Escape the topic and its tooltip using g_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
42783
diff
changeset
|
114 | 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
|
115 | const char *topic, |
|
909476a9e569
Escape the topic and its tooltip using g_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
42783
diff
changeset
|
116 | 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
|
117 | { |
|
909476a9e569
Escape the topic and its tooltip using g_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
42783
diff
changeset
|
118 | if(topic == NULL) { |
|
909476a9e569
Escape the topic and its tooltip using g_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
42783
diff
changeset
|
119 | return g_strdup(""); |
|
909476a9e569
Escape the topic and its tooltip using g_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
42783
diff
changeset
|
120 | } |
|
909476a9e569
Escape the topic and its tooltip using g_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
42783
diff
changeset
|
121 | |
|
909476a9e569
Escape the topic and its tooltip using g_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
42783
diff
changeset
|
122 | 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
|
123 | } |
|
909476a9e569
Escape the topic and its tooltip using g_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
42783
diff
changeset
|
124 | |
|
42812
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
125 | /** |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
126 | * pidgin_conversation_send_message: |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
127 | * @conversation: The instance. |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
128 | * |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
129 | * 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
|
130 | * sends it. |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
131 | * |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
132 | * Since: 3.0 |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
133 | */ |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
134 | static void |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
135 | 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
|
136 | 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
|
137 | PurpleContactInfo *info = NULL; |
|
42812
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
138 | PurpleMessage *message = NULL; |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
139 | GtkTextBuffer *buffer = NULL; |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
140 | GtkTextIter start; |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
141 | GtkTextIter end; |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
142 | char *contents = NULL; |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
143 | |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
144 | 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
|
145 | |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
146 | /* 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
|
147 | 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
|
148 | 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
|
149 | 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
|
150 | |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
151 | 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
|
152 | |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
153 | /* Create the message. */ |
|
42838
010bd75895d9
Use purple_message_new instead of purple_message_new_outgoing in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42826
diff
changeset
|
154 | info = purple_account_get_contact_info(account); |
|
010bd75895d9
Use purple_message_new instead of purple_message_new_outgoing in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42826
diff
changeset
|
155 | message = purple_message_new(info, contents); |
|
42812
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
156 | |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
157 | /* Send the message and clean up. We don't worry about the callback as we |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
158 | * don't have anything to do in it right now. |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
159 | */ |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
160 | purple_conversation_send_message_async(conversation->conversation, message, |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
161 | NULL, NULL, NULL); |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
162 | |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
163 | g_clear_object(&message); |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
164 | 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
|
165 | |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
166 | 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
|
167 | } |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
168 | |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
169 | /****************************************************************************** |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
170 | * Callbacks |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
171 | *****************************************************************************/ |
|
42885
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
172 | static void |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
173 | 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
|
174 | G_GNUC_UNUSED const GtkTextIter *iter, |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
175 | G_GNUC_UNUSED char *text, |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
176 | G_GNUC_UNUSED int length, |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
177 | gpointer data) |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
178 | { |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
179 | PidginConversation *conversation = data; |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
180 | |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
181 | 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
|
182 | PURPLE_TYPING_STATE_TYPING); |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
183 | } |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
184 | |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
185 | static void |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
186 | 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
|
187 | G_GNUC_UNUSED const GtkTextIter *start, |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
188 | G_GNUC_UNUSED const GtkTextIter *end, |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
189 | gpointer data) |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
190 | { |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
191 | PidginConversation *conversation = data; |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
192 | |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
193 | 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
|
194 | 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
|
195 | PURPLE_TYPING_STATE_NONE); |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
196 | } |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
197 | } |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
198 | |
|
42447
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
199 | static gboolean |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
200 | 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
|
201 | guint keyval, |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
202 | G_GNUC_UNUSED guint keycode, |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
203 | GdkModifierType state, |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
204 | gpointer data) |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
205 | { |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
206 | PidginConversation *conversation = data; |
|
42447
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
207 | gboolean handled = TRUE; |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
208 | |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
209 | 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
|
210 | 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
|
211 | return FALSE; |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
212 | } |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
213 | |
|
42812
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
214 | pidgin_conversation_send_message(conversation); |
|
42447
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
215 | } 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
|
216 | 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
|
217 | } 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
|
218 | 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
|
219 | } else { |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
220 | handled = FALSE; |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
221 | } |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
222 | |
|
42447
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
223 | return handled; |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
224 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
225 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
226 | static void |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
227 | pidgin_conversation_detach(PidginConversation *conversation) { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
228 | if(PURPLE_IS_CONVERSATION(conversation->conversation)) { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
229 | gpointer us = NULL; |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
230 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
231 | 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
|
232 | PIDGIN_CONVERSATION_DATA); |
|
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 | if(conversation == us) { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
235 | g_object_set_data(G_OBJECT(conversation->conversation), |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
236 | PIDGIN_CONVERSATION_DATA, NULL); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
237 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
238 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
239 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
240 | |
|
42346
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
241 | static PangoAttrList * |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
242 | pidgin_conversation_get_author_attributes(G_GNUC_UNUSED GObject *self, |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
243 | PurpleMessage *message, |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
244 | G_GNUC_UNUSED gpointer data) |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
245 | { |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
246 | GdkRGBA rgba; |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
247 | PangoAttrList *attrs = NULL; |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
248 | gboolean color_valid = FALSE; |
|
42905
d332eb539cb9
Update Pidgin for the Purple.Message deprecations
Gary Kramlich <grim@reaperworld.com>
parents:
42885
diff
changeset
|
249 | const char *custom_color = NULL; |
|
42346
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
250 | |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
251 | if(!PURPLE_IS_MESSAGE(message)) { |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
252 | return NULL; |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
253 | } |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
254 | |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
255 | custom_color = purple_message_get_author_name_color(message); |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
256 | if(!purple_strempty(custom_color)) { |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
257 | color_valid = gdk_rgba_parse(&rgba, custom_color); |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
258 | } |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
259 | |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
260 | if(!color_valid) { |
|
42905
d332eb539cb9
Update Pidgin for the Purple.Message deprecations
Gary Kramlich <grim@reaperworld.com>
parents:
42885
diff
changeset
|
261 | PurpleContactInfo *author = NULL; |
|
d332eb539cb9
Update Pidgin for the Purple.Message deprecations
Gary Kramlich <grim@reaperworld.com>
parents:
42885
diff
changeset
|
262 | const char *name_for_display = NULL; |
|
d332eb539cb9
Update Pidgin for the Purple.Message deprecations
Gary Kramlich <grim@reaperworld.com>
parents:
42885
diff
changeset
|
263 | |
|
d332eb539cb9
Update Pidgin for the Purple.Message deprecations
Gary Kramlich <grim@reaperworld.com>
parents:
42885
diff
changeset
|
264 | author = purple_message_get_author(message); |
|
d332eb539cb9
Update Pidgin for the Purple.Message deprecations
Gary Kramlich <grim@reaperworld.com>
parents:
42885
diff
changeset
|
265 | name_for_display = purple_contact_info_get_name_for_display(author); |
|
d332eb539cb9
Update Pidgin for the Purple.Message deprecations
Gary Kramlich <grim@reaperworld.com>
parents:
42885
diff
changeset
|
266 | |
|
d332eb539cb9
Update Pidgin for the Purple.Message deprecations
Gary Kramlich <grim@reaperworld.com>
parents:
42885
diff
changeset
|
267 | pidgin_color_calculate_for_text(name_for_display, &rgba); |
|
42346
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
268 | color_valid = TRUE; |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
269 | } |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
270 | |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
271 | attrs = pango_attr_list_new(); |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
272 | |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
273 | if(color_valid) { |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
274 | PangoAttribute *attr = NULL; |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
275 | |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
276 | attr = pango_attr_foreground_new(0xFFFF * rgba.red, |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
277 | 0xFFFF * rgba.green, |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
278 | 0xFFFF * rgba.blue); |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
279 | pango_attr_list_insert(attrs, attr); |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
280 | } |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
281 | |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
282 | return attrs; |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
283 | } |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
284 | |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
285 | static char * |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
286 | pidgin_converation_get_timestamp_string(G_GNUC_UNUSED GObject *self, |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
287 | PurpleMessage *message, |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
288 | G_GNUC_UNUSED gpointer data) |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
289 | { |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
290 | GDateTime *timestamp = NULL; |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
291 | |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
292 | if(!PURPLE_IS_MESSAGE(message)) { |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
293 | return NULL; |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
294 | } |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
295 | |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
296 | timestamp = purple_message_get_timestamp(message); |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
297 | if(timestamp != NULL) { |
|
42490
f864332b13ef
Make sure the timestamp shown on messages is in the user's local time
Gary Kramlich <grim@reaperworld.com>
parents:
42447
diff
changeset
|
298 | GDateTime *local = NULL; |
|
f864332b13ef
Make sure the timestamp shown on messages is in the user's local time
Gary Kramlich <grim@reaperworld.com>
parents:
42447
diff
changeset
|
299 | char *ret = NULL; |
|
f864332b13ef
Make sure the timestamp shown on messages is in the user's local time
Gary Kramlich <grim@reaperworld.com>
parents:
42447
diff
changeset
|
300 | |
|
f864332b13ef
Make sure the timestamp shown on messages is in the user's local time
Gary Kramlich <grim@reaperworld.com>
parents:
42447
diff
changeset
|
301 | local = g_date_time_to_local(timestamp); |
|
f864332b13ef
Make sure the timestamp shown on messages is in the user's local time
Gary Kramlich <grim@reaperworld.com>
parents:
42447
diff
changeset
|
302 | ret = g_date_time_format(local, "%I:%M %p"); |
|
f864332b13ef
Make sure the timestamp shown on messages is in the user's local time
Gary Kramlich <grim@reaperworld.com>
parents:
42447
diff
changeset
|
303 | g_date_time_unref(local); |
|
f864332b13ef
Make sure the timestamp shown on messages is in the user's local time
Gary Kramlich <grim@reaperworld.com>
parents:
42447
diff
changeset
|
304 | |
|
f864332b13ef
Make sure the timestamp shown on messages is in the user's local time
Gary Kramlich <grim@reaperworld.com>
parents:
42447
diff
changeset
|
305 | return ret; |
|
42346
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
306 | } |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
307 | |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
308 | return NULL; |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
309 | } |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
310 | |
|
42350
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
311 | static gboolean |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
312 | pidgin_conversation_query_tooltip_timestamp_cb(G_GNUC_UNUSED GtkWidget *self, |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
313 | G_GNUC_UNUSED gint x, |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
314 | G_GNUC_UNUSED gint y, |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
315 | G_GNUC_UNUSED gboolean keyboard_mode, |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
316 | GtkTooltip *tooltip, |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
317 | gpointer data) |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
318 | { |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
319 | |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
320 | PurpleMessage *message = gtk_list_item_get_item(data); |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
321 | GDateTime *timestamp = NULL; |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
322 | |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
323 | if(!PURPLE_IS_MESSAGE(message)) { |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
324 | return FALSE; |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
325 | } |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
326 | |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
327 | timestamp = purple_message_get_timestamp(message); |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
328 | |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
329 | return pidgin_conversation_set_tooltip_for_timestamp(tooltip, timestamp); |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
330 | } |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
331 | |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
332 | static gboolean |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
333 | pidgin_conversation_query_tooltip_edited_cb(G_GNUC_UNUSED GtkWidget *self, |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
334 | G_GNUC_UNUSED gint x, |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
335 | G_GNUC_UNUSED gint y, |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
336 | G_GNUC_UNUSED gboolean keyboard_mode, |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
337 | GtkTooltip *tooltip, |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
338 | gpointer data) |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
339 | { |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
340 | PurpleMessage *message = gtk_list_item_get_item(data); |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
341 | GDateTime *timestamp = NULL; |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
342 | |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
343 | if(!PURPLE_IS_MESSAGE(message)) { |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
344 | return FALSE; |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
345 | } |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
346 | |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
347 | timestamp = purple_message_get_edited_at(message); |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
348 | |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
349 | return pidgin_conversation_set_tooltip_for_timestamp(tooltip, timestamp); |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
350 | } |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
351 | |
|
42531
82fffff36df6
If a message is an action format it with italics
Gary Kramlich <grim@reaperworld.com>
parents:
42527
diff
changeset
|
352 | static PangoAttrList * |
|
82fffff36df6
If a message is an action format it with italics
Gary Kramlich <grim@reaperworld.com>
parents:
42527
diff
changeset
|
353 | pidgin_conversation_get_message_attributes(G_GNUC_UNUSED GObject *self, |
|
82fffff36df6
If a message is an action format it with italics
Gary Kramlich <grim@reaperworld.com>
parents:
42527
diff
changeset
|
354 | PurpleMessage *message, |
|
82fffff36df6
If a message is an action format it with italics
Gary Kramlich <grim@reaperworld.com>
parents:
42527
diff
changeset
|
355 | G_GNUC_UNUSED gpointer data) |
|
82fffff36df6
If a message is an action format it with italics
Gary Kramlich <grim@reaperworld.com>
parents:
42527
diff
changeset
|
356 | { |
|
82fffff36df6
If a message is an action format it with italics
Gary Kramlich <grim@reaperworld.com>
parents:
42527
diff
changeset
|
357 | PangoAttrList *attrs = NULL; |
|
82fffff36df6
If a message is an action format it with italics
Gary Kramlich <grim@reaperworld.com>
parents:
42527
diff
changeset
|
358 | |
|
82fffff36df6
If a message is an action format it with italics
Gary Kramlich <grim@reaperworld.com>
parents:
42527
diff
changeset
|
359 | if(!PURPLE_IS_MESSAGE(message)) { |
|
82fffff36df6
If a message is an action format it with italics
Gary Kramlich <grim@reaperworld.com>
parents:
42527
diff
changeset
|
360 | return NULL; |
|
82fffff36df6
If a message is an action format it with italics
Gary Kramlich <grim@reaperworld.com>
parents:
42527
diff
changeset
|
361 | } |
|
82fffff36df6
If a message is an action format it with italics
Gary Kramlich <grim@reaperworld.com>
parents:
42527
diff
changeset
|
362 | |
|
82fffff36df6
If a message is an action format it with italics
Gary Kramlich <grim@reaperworld.com>
parents:
42527
diff
changeset
|
363 | attrs = pango_attr_list_new(); |
|
82fffff36df6
If a message is an action format it with italics
Gary Kramlich <grim@reaperworld.com>
parents:
42527
diff
changeset
|
364 | |
|
82fffff36df6
If a message is an action format it with italics
Gary Kramlich <grim@reaperworld.com>
parents:
42527
diff
changeset
|
365 | if(purple_message_get_action(message)) { |
|
82fffff36df6
If a message is an action format it with italics
Gary Kramlich <grim@reaperworld.com>
parents:
42527
diff
changeset
|
366 | PangoAttribute *attr = NULL; |
|
82fffff36df6
If a message is an action format it with italics
Gary Kramlich <grim@reaperworld.com>
parents:
42527
diff
changeset
|
367 | |
|
82fffff36df6
If a message is an action format it with italics
Gary Kramlich <grim@reaperworld.com>
parents:
42527
diff
changeset
|
368 | attr = pango_attr_style_new(PANGO_STYLE_ITALIC); |
|
82fffff36df6
If a message is an action format it with italics
Gary Kramlich <grim@reaperworld.com>
parents:
42527
diff
changeset
|
369 | |
|
82fffff36df6
If a message is an action format it with italics
Gary Kramlich <grim@reaperworld.com>
parents:
42527
diff
changeset
|
370 | pango_attr_list_insert(attrs, attr); |
|
82fffff36df6
If a message is an action format it with italics
Gary Kramlich <grim@reaperworld.com>
parents:
42527
diff
changeset
|
371 | } |
|
82fffff36df6
If a message is an action format it with italics
Gary Kramlich <grim@reaperworld.com>
parents:
42527
diff
changeset
|
372 | |
|
82fffff36df6
If a message is an action format it with italics
Gary Kramlich <grim@reaperworld.com>
parents:
42527
diff
changeset
|
373 | return attrs; |
|
82fffff36df6
If a message is an action format it with italics
Gary Kramlich <grim@reaperworld.com>
parents:
42527
diff
changeset
|
374 | } |
|
82fffff36df6
If a message is an action format it with italics
Gary Kramlich <grim@reaperworld.com>
parents:
42527
diff
changeset
|
375 | |
|
82fffff36df6
If a message is an action format it with italics
Gary Kramlich <grim@reaperworld.com>
parents:
42527
diff
changeset
|
376 | |
|
42380
165c0b7f3860
Escape message content in Pidgin before displaying it
Gary Kramlich <grim@reaperworld.com>
parents:
42350
diff
changeset
|
377 | static char * |
|
165c0b7f3860
Escape message content in Pidgin before displaying it
Gary Kramlich <grim@reaperworld.com>
parents:
42350
diff
changeset
|
378 | pidgin_conversation_process_message_contents_cb(G_GNUC_UNUSED GObject *self, |
|
165c0b7f3860
Escape message content in Pidgin before displaying it
Gary Kramlich <grim@reaperworld.com>
parents:
42350
diff
changeset
|
379 | const char *contents, |
|
165c0b7f3860
Escape message content in Pidgin before displaying it
Gary Kramlich <grim@reaperworld.com>
parents:
42350
diff
changeset
|
380 | G_GNUC_UNUSED gpointer data) |
|
165c0b7f3860
Escape message content in Pidgin before displaying it
Gary Kramlich <grim@reaperworld.com>
parents:
42350
diff
changeset
|
381 | { |
|
42801
69a6faed5ab7
call purple_markup_linkify on message content
Gary Kramlich <grim@reaperworld.com>
parents:
42784
diff
changeset
|
382 | char *escaped = NULL; |
|
69a6faed5ab7
call purple_markup_linkify on message content
Gary Kramlich <grim@reaperworld.com>
parents:
42784
diff
changeset
|
383 | char *linkified = NULL; |
|
69a6faed5ab7
call purple_markup_linkify on message content
Gary Kramlich <grim@reaperworld.com>
parents:
42784
diff
changeset
|
384 | |
|
69a6faed5ab7
call purple_markup_linkify on message content
Gary Kramlich <grim@reaperworld.com>
parents:
42784
diff
changeset
|
385 | escaped = g_markup_escape_text(contents, -1); |
|
69a6faed5ab7
call purple_markup_linkify on message content
Gary Kramlich <grim@reaperworld.com>
parents:
42784
diff
changeset
|
386 | linkified = purple_markup_linkify(escaped); |
|
69a6faed5ab7
call purple_markup_linkify on message content
Gary Kramlich <grim@reaperworld.com>
parents:
42784
diff
changeset
|
387 | g_free(escaped); |
|
69a6faed5ab7
call purple_markup_linkify on message content
Gary Kramlich <grim@reaperworld.com>
parents:
42784
diff
changeset
|
388 | |
|
69a6faed5ab7
call purple_markup_linkify on message content
Gary Kramlich <grim@reaperworld.com>
parents:
42784
diff
changeset
|
389 | return linkified; |
|
42380
165c0b7f3860
Escape message content in Pidgin before displaying it
Gary Kramlich <grim@reaperworld.com>
parents:
42350
diff
changeset
|
390 | } |
|
165c0b7f3860
Escape message content in Pidgin before displaying it
Gary Kramlich <grim@reaperworld.com>
parents:
42350
diff
changeset
|
391 | |
|
42527
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
392 | static void |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
393 | pidgin_conversation_member_list_context_cb(GtkGestureSingle *self, |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
394 | G_GNUC_UNUSED gint n_press, |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
395 | gdouble x, |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
396 | gdouble y, |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
397 | gpointer data) |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
398 | { |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
399 | PurpleAccount *account = NULL; |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
400 | PurpleContactInfo *info = NULL; |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
401 | PurpleConversationMember *member = NULL; |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
402 | GtkWidget *parent = NULL; |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
403 | GtkListItem *item = data; |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
404 | |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
405 | parent = gtk_event_controller_get_widget(GTK_EVENT_CONTROLLER(self)); |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
406 | |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
407 | member = gtk_list_item_get_item(item); |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
408 | info = purple_conversation_member_get_contact_info(member); |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
409 | |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
410 | /* ConversationMembers are a PurpleAccount for the libpurple user, or in |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
411 | * most cases are PurpleContact for all the other users. Because of this, |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
412 | * we have to do a runtime check to determine which one they are. |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
413 | */ |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
414 | if(PURPLE_IS_ACCOUNT(info)) { |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
415 | account = PURPLE_ACCOUNT(info); |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
416 | } else if(PURPLE_IS_CONTACT(info)) { |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
417 | account = purple_contact_get_account(PURPLE_CONTACT(info)); |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
418 | } |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
419 | |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
420 | pidgin_contact_info_menu_popup(info, account, parent, x, y); |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
421 | } |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
422 | |
|
42783
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
423 | static int |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
424 | 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
|
425 | G_GNUC_UNUSED gpointer data) |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
426 | { |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
427 | PurpleConversationMember *member_a = NULL; |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
428 | PurpleConversationMember *member_b = NULL; |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
429 | PurpleContactInfo *info_a = NULL; |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
430 | PurpleContactInfo *info_b = NULL; |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
431 | |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
432 | 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
|
433 | 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
|
434 | |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
435 | 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
|
436 | 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
|
437 | |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
438 | 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
|
439 | } |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
440 | |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
441 | /****************************************************************************** |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
442 | * GObject Implementation |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
443 | *****************************************************************************/ |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
444 | static void |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
445 | pidgin_conversation_dispose(GObject *obj) { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
446 | PidginConversation *conversation = PIDGIN_CONVERSATION(obj); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
447 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
448 | pidgin_conversation_detach(conversation); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
449 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
450 | g_clear_object(&conversation->conversation); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
451 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
452 | 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
|
453 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
454 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
455 | static void |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
456 | 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
|
457 | GParamSpec *pspec) |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
458 | { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
459 | PidginConversation *conversation = PIDGIN_CONVERSATION(obj); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
460 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
461 | switch(param_id) { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
462 | case PROP_CONVERSATION: |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
463 | g_value_set_object(value, |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
464 | pidgin_conversation_get_conversation(conversation)); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
465 | break; |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
466 | default: |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
467 | 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
|
468 | break; |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
469 | } |
|
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 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
472 | static void |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
473 | 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
|
474 | const GValue *value, GParamSpec *pspec) |
|
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 | PidginConversation *conversation = PIDGIN_CONVERSATION(obj); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
477 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
478 | switch(param_id) { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
479 | case PROP_CONVERSATION: |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
480 | pidgin_conversation_set_conversation(conversation, |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
481 | g_value_get_object(value)); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
482 | break; |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
483 | default: |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
484 | 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
|
485 | break; |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
486 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
487 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
488 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
489 | static void |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
490 | pidgin_conversation_init(PidginConversation *conversation) { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
491 | 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
|
492 | |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
493 | gtk_custom_sorter_set_sort_func(conversation->memberlist_sorter, |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
494 | pidgin_conversation_member_list_sort, |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
495 | NULL, NULL); |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
496 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
497 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
498 | static void |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
499 | pidgin_conversation_class_init(PidginConversationClass *klass) { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
500 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
501 | GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
502 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
503 | obj_class->dispose = pidgin_conversation_dispose; |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
504 | obj_class->get_property = pidgin_conversation_get_property; |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
505 | obj_class->set_property = pidgin_conversation_set_property; |
|
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 | /** |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
508 | * PidginConversation:conversation: |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
509 | * |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
510 | * 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
|
511 | * |
|
42620
72178a341eb8
Remove minor versions from Since tags in Pidgin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42584
diff
changeset
|
512 | * Since: 3.0 |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
513 | */ |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
514 | properties[PROP_CONVERSATION] = g_param_spec_object( |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
515 | "conversation", "conversation", |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
516 | "The purple conversation this widget is for.", |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
517 | PURPLE_TYPE_CONVERSATION, |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
518 | 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
|
519 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
520 | 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
|
521 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
522 | /* Template stuff. */ |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
523 | gtk_widget_class_set_template_from_resource( |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
524 | widget_class, |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
525 | "/im/pidgin/Pidgin3/Conversations/conversation.ui" |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
526 | ); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
527 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
528 | 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
|
529 | info_pane); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
530 | 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
|
531 | history); |
|
42346
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
532 | 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
|
533 | history_adjustment); |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
534 | gtk_widget_class_bind_template_child(widget_class, PidginConversation, |
|
42783
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
535 | memberlist_sorter); |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
536 | 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
|
537 | input); |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
538 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
539 | 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
|
540 | 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
|
541 | 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
|
542 | pidgin_conversation_input_insert_text_cb); |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
543 | 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
|
544 | pidgin_conversation_input_delete_range_cb); |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
545 | 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
|
546 | pidgin_conversation_input_key_pressed_cb); |
|
42346
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
547 | gtk_widget_class_bind_template_callback(widget_class, |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
548 | pidgin_conversation_get_author_attributes); |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
549 | gtk_widget_class_bind_template_callback(widget_class, |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
550 | pidgin_converation_get_timestamp_string); |
|
42350
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
551 | gtk_widget_class_bind_template_callback(widget_class, |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
552 | pidgin_conversation_query_tooltip_timestamp_cb); |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
553 | gtk_widget_class_bind_template_callback(widget_class, |
|
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
554 | pidgin_conversation_query_tooltip_edited_cb); |
|
42380
165c0b7f3860
Escape message content in Pidgin before displaying it
Gary Kramlich <grim@reaperworld.com>
parents:
42350
diff
changeset
|
555 | gtk_widget_class_bind_template_callback(widget_class, |
|
42531
82fffff36df6
If a message is an action format it with italics
Gary Kramlich <grim@reaperworld.com>
parents:
42527
diff
changeset
|
556 | pidgin_conversation_get_message_attributes); |
|
82fffff36df6
If a message is an action format it with italics
Gary Kramlich <grim@reaperworld.com>
parents:
42527
diff
changeset
|
557 | gtk_widget_class_bind_template_callback(widget_class, |
|
42380
165c0b7f3860
Escape message content in Pidgin before displaying it
Gary Kramlich <grim@reaperworld.com>
parents:
42350
diff
changeset
|
558 | pidgin_conversation_process_message_contents_cb); |
|
42527
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
559 | gtk_widget_class_bind_template_callback(widget_class, |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
560 | pidgin_conversation_member_list_context_cb); |
|
42301
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 | /****************************************************************************** |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
564 | * API |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
565 | *****************************************************************************/ |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
566 | GtkWidget * |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
567 | pidgin_conversation_new(PurpleConversation *conversation) { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
568 | 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
|
569 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
570 | return g_object_new( |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
571 | PIDGIN_TYPE_CONVERSATION, |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
572 | "conversation", conversation, |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
573 | NULL); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
574 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
575 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
576 | GtkWidget * |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
577 | pidgin_conversation_from_purple_conversation(PurpleConversation *conversation) |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
578 | { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
579 | 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
|
580 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
581 | 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
|
582 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
583 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
584 | PurpleConversation * |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
585 | pidgin_conversation_get_conversation(PidginConversation *conversation) { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
586 | 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
|
587 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
588 | return conversation->conversation; |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
589 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
590 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
591 | void |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
592 | pidgin_conversation_close(PidginConversation *conversation) { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
593 | g_return_if_fail(PIDGIN_IS_CONVERSATION(conversation)); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
594 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
595 | pidgin_conversation_detach(conversation); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
596 | } |