Thu, 05 Dec 2024 21:27:35 -0600
Add a status label to conversations to show online and error status
This puts the typing label in a stack with another label that shows the status.
The visible child of the stack is controlled by whether or not the conversation
is online or has error.
Testing Done:
Tested with /r/3690
Reviewed at https://reviews.imfreedom.org/r/3691/
|
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" |
|
42527
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
28 | #include "pidgincontactinfomenu.h" |
|
42346
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
29 | #include "pidginconversation.h" |
|
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
30 | #include "pidgininfopane.h" |
|
43093
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
31 | #include "pidginmessage.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; |
|
43099
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
54 | |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
55 | GtkWidget *typing_label; |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
56 | GtkWidget *status_label; |
|
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 | |
|
42575
580339aa47cc
Make sure all of the final types in pidgin are defined as such
Gary Kramlich <grim@reaperworld.com>
parents:
42531
diff
changeset
|
59 | 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
|
60 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
61 | /****************************************************************************** |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
62 | * Helpers |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
63 | *****************************************************************************/ |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
64 | static void |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
65 | pidgin_conversation_set_conversation(PidginConversation *conversation, |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
66 | PurpleConversation *purple_conversation) |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
67 | { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
68 | if(g_set_object(&conversation->conversation, purple_conversation)) { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
69 | if(PURPLE_IS_CONVERSATION(purple_conversation)) { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
70 | g_object_set_data(G_OBJECT(purple_conversation), |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
71 | PIDGIN_CONVERSATION_DATA, conversation); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
72 | } |
|
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 | g_object_notify_by_pspec(G_OBJECT(conversation), |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
75 | properties[PROP_CONVERSATION]); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
76 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
77 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
78 | |
|
42784
909476a9e569
Escape the topic and its tooltip using g_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
42783
diff
changeset
|
79 | /* 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
|
80 | * 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
|
81 | */ |
|
909476a9e569
Escape the topic and its tooltip using g_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
42783
diff
changeset
|
82 | static char * |
|
909476a9e569
Escape the topic and its tooltip using g_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
42783
diff
changeset
|
83 | 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
|
84 | const char *topic, |
|
909476a9e569
Escape the topic and its tooltip using g_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
42783
diff
changeset
|
85 | 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
|
86 | { |
|
909476a9e569
Escape the topic and its tooltip using g_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
42783
diff
changeset
|
87 | if(topic == NULL) { |
|
909476a9e569
Escape the topic and its tooltip using g_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
42783
diff
changeset
|
88 | return g_strdup(""); |
|
909476a9e569
Escape the topic and its tooltip using g_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
42783
diff
changeset
|
89 | } |
|
909476a9e569
Escape the topic and its tooltip using g_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
42783
diff
changeset
|
90 | |
|
909476a9e569
Escape the topic and its tooltip using g_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
42783
diff
changeset
|
91 | 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
|
92 | } |
|
909476a9e569
Escape the topic and its tooltip using g_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
42783
diff
changeset
|
93 | |
|
42812
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
94 | /** |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
95 | * pidgin_conversation_send_message: |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
96 | * @conversation: The instance. |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
97 | * |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
98 | * 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
|
99 | * sends it. |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
100 | * |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
101 | * Since: 3.0 |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
102 | */ |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
103 | static void |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
104 | 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
|
105 | 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
|
106 | PurpleContactInfo *info = NULL; |
|
42812
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
107 | PurpleMessage *message = NULL; |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
108 | GtkTextBuffer *buffer = NULL; |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
109 | GtkTextIter start; |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
110 | GtkTextIter end; |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
111 | char *contents = NULL; |
|
43058
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
112 | gboolean command_executed = FALSE; |
|
42812
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
113 | |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
114 | 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
|
115 | |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
116 | /* 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
|
117 | 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
|
118 | 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
|
119 | 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
|
120 | |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
121 | 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
|
122 | |
|
43058
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
123 | if(contents != NULL && contents[0] == '/') { |
|
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
124 | PurpleCommandManager *manager = NULL; |
|
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
125 | |
|
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
126 | manager = purple_command_manager_get_default(); |
|
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
127 | command_executed = purple_command_manager_find_and_execute(manager, |
|
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
128 | conversation->conversation, |
|
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
129 | contents + 1); |
|
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
130 | } |
|
42812
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
131 | |
|
43058
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
132 | if(!command_executed) { |
|
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
133 | /* Create the message. */ |
|
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
134 | info = purple_account_get_contact_info(account); |
|
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
135 | 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
|
136 | |
|
43058
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
137 | /* Send the message and clean up. We don't worry about the callback as we |
|
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
138 | * don't have anything to do in it right now. |
|
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
139 | */ |
|
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
140 | purple_conversation_send_message_async(conversation->conversation, message, |
|
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
141 | NULL, NULL, NULL); |
|
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
142 | |
|
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
143 | g_clear_object(&message); |
|
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
144 | } |
|
7b3b26faf6ed
Add very basic command support to Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42905
diff
changeset
|
145 | |
|
42812
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
146 | 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
|
147 | |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
148 | 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
|
149 | } |
|
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
150 | |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
151 | /****************************************************************************** |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
152 | * Callbacks |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
153 | *****************************************************************************/ |
|
43099
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
154 | static char * |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
155 | pidgin_conversation_get_status_label(G_GNUC_UNUSED PidginConversation *conversation, |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
156 | GError *error, gboolean online) |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
157 | { |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
158 | const char *message = NULL; |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
159 | |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
160 | if(error != NULL) { |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
161 | message = error->message; |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
162 | } |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
163 | |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
164 | if(purple_strempty(message) && !online) { |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
165 | message = _("Conversation offline"); |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
166 | } |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
167 | |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
168 | if(purple_strempty(message)) { |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
169 | message = ""; |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
170 | } |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
171 | |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
172 | return g_strdup(message); |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
173 | } |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
174 | |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
175 | static GtkWidget * |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
176 | pidgin_conversation_get_status_page(PidginConversation *conversation, |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
177 | GError *error, gboolean online) |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
178 | { |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
179 | if(error != NULL || !online) { |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
180 | return g_object_ref(conversation->status_label); |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
181 | } |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
182 | |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
183 | return g_object_ref(conversation->typing_label); |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
184 | } |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
185 | |
|
42885
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
186 | static void |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
187 | 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
|
188 | G_GNUC_UNUSED const GtkTextIter *iter, |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
189 | G_GNUC_UNUSED char *text, |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
190 | G_GNUC_UNUSED int length, |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
191 | gpointer 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 | PidginConversation *conversation = data; |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
194 | |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
195 | 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
|
196 | PURPLE_TYPING_STATE_TYPING); |
|
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 | |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
199 | static void |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
200 | 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
|
201 | G_GNUC_UNUSED const GtkTextIter *start, |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
202 | G_GNUC_UNUSED const GtkTextIter *end, |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
203 | gpointer data) |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
204 | { |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
205 | PidginConversation *conversation = data; |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
206 | |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
207 | 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
|
208 | 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
|
209 | PURPLE_TYPING_STATE_NONE); |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
210 | } |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
211 | } |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
212 | |
|
42447
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
213 | static gboolean |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
214 | 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
|
215 | guint keyval, |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
216 | G_GNUC_UNUSED guint keycode, |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
217 | GdkModifierType state, |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
218 | gpointer data) |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
219 | { |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
220 | PidginConversation *conversation = data; |
|
42447
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
221 | gboolean handled = TRUE; |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
222 | |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
223 | 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
|
224 | 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
|
225 | return FALSE; |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
226 | } |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
227 | |
|
42812
4d48abf72b94
Update Pidgin.Conversation to use Purple.Conversation.send_message_async
Gary Kramlich <grim@reaperworld.com>
parents:
42801
diff
changeset
|
228 | pidgin_conversation_send_message(conversation); |
|
42447
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
229 | } 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
|
230 | 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
|
231 | } 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
|
232 | 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
|
233 | } else { |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
234 | handled = FALSE; |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
235 | } |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
236 | |
|
42447
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
237 | return handled; |
|
42301
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 | static void |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
241 | pidgin_conversation_detach(PidginConversation *conversation) { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
242 | if(PURPLE_IS_CONVERSATION(conversation->conversation)) { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
243 | gpointer us = NULL; |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
244 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
245 | 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
|
246 | PIDGIN_CONVERSATION_DATA); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
247 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
248 | if(conversation == us) { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
249 | g_object_set_data(G_OBJECT(conversation->conversation), |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
250 | PIDGIN_CONVERSATION_DATA, NULL); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
251 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
252 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
253 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
254 | |
|
42527
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
255 | static void |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
256 | pidgin_conversation_member_list_context_cb(GtkGestureSingle *self, |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
257 | G_GNUC_UNUSED gint n_press, |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
258 | gdouble x, |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
259 | gdouble y, |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
260 | gpointer data) |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
261 | { |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
262 | PurpleAccount *account = NULL; |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
263 | PurpleContactInfo *info = NULL; |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
264 | PurpleConversationMember *member = NULL; |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
265 | GtkWidget *parent = NULL; |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
266 | GtkListItem *item = data; |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
267 | |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
268 | 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
|
269 | |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
270 | member = gtk_list_item_get_item(item); |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
271 | info = purple_conversation_member_get_contact_info(member); |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
272 | |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
273 | /* 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
|
274 | * 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
|
275 | * 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
|
276 | */ |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
277 | if(PURPLE_IS_ACCOUNT(info)) { |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
278 | account = PURPLE_ACCOUNT(info); |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
279 | } else if(PURPLE_IS_CONTACT(info)) { |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
280 | account = purple_contact_get_account(PURPLE_CONTACT(info)); |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
281 | } |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
282 | |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
283 | 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
|
284 | } |
|
1954265c38f0
Implement the member list in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42519
diff
changeset
|
285 | |
|
42783
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
286 | static int |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
287 | 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
|
288 | G_GNUC_UNUSED gpointer data) |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
289 | { |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
290 | PurpleConversationMember *member_a = NULL; |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
291 | PurpleConversationMember *member_b = NULL; |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
292 | PurpleContactInfo *info_a = NULL; |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
293 | PurpleContactInfo *info_b = NULL; |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
294 | |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
295 | 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
|
296 | 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
|
297 | |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
298 | 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
|
299 | 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
|
300 | |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
301 | 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
|
302 | } |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
303 | |
|
43093
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
304 | static void |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
305 | pidgin_conversation_message_setup(G_GNUC_UNUSED GtkSignalListItemFactory *self, |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
306 | GObject *object, |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
307 | G_GNUC_UNUSED gpointer data) |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
308 | { |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
309 | gtk_list_item_set_child(GTK_LIST_ITEM(object), pidgin_message_new(NULL)); |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
310 | } |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
311 | |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
312 | static void |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
313 | pidgin_conversation_message_bind(G_GNUC_UNUSED GtkSignalListItemFactory *self, |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
314 | GObject *object, |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
315 | G_GNUC_UNUSED gpointer data) |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
316 | { |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
317 | PurpleMessage *purple_message = NULL; |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
318 | GtkListItem *item = GTK_LIST_ITEM(object); |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
319 | GtkWidget *pidgin_message = NULL; |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
320 | |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
321 | purple_message = gtk_list_item_get_item(item); |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
322 | pidgin_message = gtk_list_item_get_child(item); |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
323 | |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
324 | pidgin_message_set_message(PIDGIN_MESSAGE(pidgin_message), purple_message); |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
325 | } |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
326 | |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
327 | static void |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
328 | pidgin_conversation_message_unbind(G_GNUC_UNUSED GtkSignalListItemFactory *self, |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
329 | GObject *object, |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
330 | G_GNUC_UNUSED gpointer data) |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
331 | { |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
332 | GtkListItem *item = GTK_LIST_ITEM(object); |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
333 | GtkWidget *message = NULL; |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
334 | |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
335 | message = gtk_list_item_get_child(item); |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
336 | |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
337 | pidgin_message_set_message(PIDGIN_MESSAGE(message), NULL); |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
338 | } |
|
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
339 | |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
340 | /****************************************************************************** |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
341 | * GObject Implementation |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
342 | *****************************************************************************/ |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
343 | static void |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
344 | pidgin_conversation_dispose(GObject *obj) { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
345 | PidginConversation *conversation = PIDGIN_CONVERSATION(obj); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
346 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
347 | pidgin_conversation_detach(conversation); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
348 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
349 | g_clear_object(&conversation->conversation); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
350 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
351 | 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
|
352 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
353 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
354 | static void |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
355 | 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
|
356 | GParamSpec *pspec) |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
357 | { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
358 | PidginConversation *conversation = PIDGIN_CONVERSATION(obj); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
359 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
360 | switch(param_id) { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
361 | case PROP_CONVERSATION: |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
362 | g_value_set_object(value, |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
363 | pidgin_conversation_get_conversation(conversation)); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
364 | break; |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
365 | default: |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
366 | 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
|
367 | break; |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
368 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
369 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
370 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
371 | static void |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
372 | 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
|
373 | const GValue *value, GParamSpec *pspec) |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
374 | { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
375 | PidginConversation *conversation = PIDGIN_CONVERSATION(obj); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
376 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
377 | switch(param_id) { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
378 | case PROP_CONVERSATION: |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
379 | pidgin_conversation_set_conversation(conversation, |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
380 | g_value_get_object(value)); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
381 | break; |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
382 | default: |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
383 | 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
|
384 | break; |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
385 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
386 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
387 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
388 | static void |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
389 | pidgin_conversation_init(PidginConversation *conversation) { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
390 | 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
|
391 | |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
392 | 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
|
393 | pidgin_conversation_member_list_sort, |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
394 | NULL, NULL); |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
395 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
396 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
397 | static void |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
398 | pidgin_conversation_class_init(PidginConversationClass *klass) { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
399 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
400 | GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
401 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
402 | obj_class->dispose = pidgin_conversation_dispose; |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
403 | obj_class->get_property = pidgin_conversation_get_property; |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
404 | obj_class->set_property = pidgin_conversation_set_property; |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
405 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
406 | /** |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
407 | * PidginConversation:conversation: |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
408 | * |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
409 | * 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
|
410 | * |
|
42620
72178a341eb8
Remove minor versions from Since tags in Pidgin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42584
diff
changeset
|
411 | * Since: 3.0 |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
412 | */ |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
413 | properties[PROP_CONVERSATION] = g_param_spec_object( |
|
43072
a59a119b74f5
Remove nick and blurb from Pidgin properties
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43058
diff
changeset
|
414 | "conversation", NULL, NULL, |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
415 | PURPLE_TYPE_CONVERSATION, |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
416 | 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
|
417 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
418 | 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
|
419 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
420 | /* Template stuff. */ |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
421 | gtk_widget_class_set_template_from_resource( |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
422 | widget_class, |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
423 | "/im/pidgin/Pidgin3/Conversations/conversation.ui" |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
424 | ); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
425 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
426 | 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
|
427 | info_pane); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
428 | 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
|
429 | history); |
|
42346
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
430 | 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
|
431 | history_adjustment); |
|
3f1004d7772a
Replace TalkatuEditor in PidginConversation with a basic GtkTextView
Gary Kramlich <grim@reaperworld.com>
parents:
42380
diff
changeset
|
432 | 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
|
433 | memberlist_sorter); |
|
e61721a750e9
Add support for sorting the memberlist in conversations
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
434 | 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
|
435 | input); |
|
43099
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
436 | gtk_widget_class_bind_template_child(widget_class, PidginConversation, |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
437 | typing_label); |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
438 | gtk_widget_class_bind_template_child(widget_class, PidginConversation, |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
439 | status_label); |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
440 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
441 | 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
|
442 | 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
|
443 | gtk_widget_class_bind_template_callback(widget_class, |
|
43099
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
444 | pidgin_conversation_get_status_label); |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
445 | gtk_widget_class_bind_template_callback(widget_class, |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
446 | pidgin_conversation_get_status_page); |
|
60174e318ecc
Add a status label to conversations to show online and error status
Gary Kramlich <grim@reaperworld.com>
parents:
43094
diff
changeset
|
447 | 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
|
448 | pidgin_conversation_input_insert_text_cb); |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
449 | 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
|
450 | pidgin_conversation_input_delete_range_cb); |
|
9b0cae94f406
Set Purple.Conversation:typing when appropriate in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42838
diff
changeset
|
451 | 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
|
452 | pidgin_conversation_input_key_pressed_cb); |
|
42346
45d2756d2a14
Replace TalkatuHistory with our own implementation
Gary Kramlich <grim@reaperworld.com>
parents:
42301
diff
changeset
|
453 | gtk_widget_class_bind_template_callback(widget_class, |
|
43093
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
454 | pidgin_conversation_member_list_context_cb); |
|
42350
0d5319e4b836
Add tooltips to timestamps in PidginConversation
Gary Kramlich <grim@reaperworld.com>
parents:
42346
diff
changeset
|
455 | gtk_widget_class_bind_template_callback(widget_class, |
|
43093
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
456 | pidgin_conversation_message_setup); |
|
42380
165c0b7f3860
Escape message content in Pidgin before displaying it
Gary Kramlich <grim@reaperworld.com>
parents:
42350
diff
changeset
|
457 | gtk_widget_class_bind_template_callback(widget_class, |
|
43093
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
458 | pidgin_conversation_message_bind); |
|
42531
82fffff36df6
If a message is an action format it with italics
Gary Kramlich <grim@reaperworld.com>
parents:
42527
diff
changeset
|
459 | gtk_widget_class_bind_template_callback(widget_class, |
|
43093
27f816a512af
Add a PidginMessage widget
Gary Kramlich <grim@reaperworld.com>
parents:
43072
diff
changeset
|
460 | pidgin_conversation_message_unbind); |
|
42301
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
461 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
462 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
463 | /****************************************************************************** |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
464 | * API |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
465 | *****************************************************************************/ |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
466 | GtkWidget * |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
467 | pidgin_conversation_new(PurpleConversation *conversation) { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
468 | 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
|
469 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
470 | return g_object_new( |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
471 | PIDGIN_TYPE_CONVERSATION, |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
472 | "conversation", conversation, |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
473 | NULL); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
474 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
475 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
476 | GtkWidget * |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
477 | pidgin_conversation_from_purple_conversation(PurpleConversation *conversation) |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
478 | { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
479 | 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
|
480 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
481 | 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
|
482 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
483 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
484 | PurpleConversation * |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
485 | pidgin_conversation_get_conversation(PidginConversation *conversation) { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
486 | 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
|
487 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
488 | return conversation->conversation; |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
489 | } |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
490 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
491 | void |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
492 | pidgin_conversation_close(PidginConversation *conversation) { |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
493 | g_return_if_fail(PIDGIN_IS_CONVERSATION(conversation)); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
494 | |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
495 | pidgin_conversation_detach(conversation); |
|
d3930fe5505c
The start of the new conversation window
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
496 | } |