pidgin/pidgincontactlist.c

Thu, 02 Jan 2025 22:37:44 -0600

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Thu, 02 Jan 2025 22:37:44 -0600
changeset 43123
4d3b58b6cf06
parent 42795
fedfa85c0b40
child 43237
c641f6bea7dd
permissions
-rw-r--r--

Use g_string_free_and_steal

Added in 2.76, and we require 2.78 now. Also, remove an outdated comment about it.

Testing Done:
Compiled and ran `ninja turtles`.

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

42011
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * Pidgin - Internet Messenger
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 *
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * Pidgin is the legal property of its developers, whose names are too numerous
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * to list here. Please refer to the COPYRIGHT file distributed with this
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 * source distribution.
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 *
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 * This program is free software; you can redistribute it and/or modify
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 * (at your option) any later version.
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 *
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 * GNU General Public License for more details.
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 *
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20 * along with this program; if not, see <https://www.gnu.org/licenses/>.
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 */
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23 #include <glib/gi18n-lib.h>
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25 #include <purple.h>
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26
42304
51a419226147 A basic context menu for PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42237
diff changeset
27 #include "pidgin/pidgincontactinfomenu.h"
42011
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28 #include "pidgin/pidgincontactlist.h"
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30 struct _PidginContactList {
42059
e6dcbf0db616 Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42054
diff changeset
31 GtkBox parent;
42011
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32
42593
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
33 GtkWidget *show_offline;
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
34
42059
e6dcbf0db616 Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42054
diff changeset
35 GtkFilterListModel *filter_model;
42237
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
36 GtkCustomFilter *account_connected_filter;
42593
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
37 GtkCustomFilter *offline_filter;
42059
e6dcbf0db616 Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42054
diff changeset
38 GtkCustomFilter *search_filter;
e6dcbf0db616 Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42054
diff changeset
39
e6dcbf0db616 Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42054
diff changeset
40 GtkWidget *search_entry;
42011
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 };
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42
42575
580339aa47cc Make sure all of the final types in pidgin are defined as such
Gary Kramlich <grim@reaperworld.com>
parents: 42532
diff changeset
43 G_DEFINE_FINAL_TYPE(PidginContactList, pidgin_contact_list, GTK_TYPE_BOX)
42059
e6dcbf0db616 Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42054
diff changeset
44
e6dcbf0db616 Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42054
diff changeset
45 /******************************************************************************
e6dcbf0db616 Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42054
diff changeset
46 * Helpers
e6dcbf0db616 Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42054
diff changeset
47 *****************************************************************************/
e6dcbf0db616 Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42054
diff changeset
48 static gboolean
42237
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
49 pidgin_contact_list_account_connected_filter(GObject *item,
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
50 G_GNUC_UNUSED gpointer data)
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
51 {
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
52 PurplePerson *person = PURPLE_PERSON(item);
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
53 PurpleContactInfo *info = NULL;
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
54
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
55 info = purple_person_get_priority_contact_info(person);
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
56 if(!PURPLE_IS_CONTACT_INFO(info)) {
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
57 return FALSE;
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
58 }
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
59
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
60 /* This should always be a PurpleContact as it's in the contact manager,
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
61 * but it doesn't hurt to check.
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
62 */
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
63 if(PURPLE_IS_CONTACT(info)) {
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
64 PurpleConnection *connection = NULL;
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
65 PurpleContact *contact = PURPLE_CONTACT(info);
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
66 PurpleAccount *account = NULL;
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
67
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
68 account = purple_contact_get_account(contact);
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
69 connection = purple_account_get_connection(account);
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
70
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
71 if(PURPLE_IS_CONNECTION(connection)) {
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
72 PurpleConnectionState state = PURPLE_CONNECTION_STATE_DISCONNECTED;
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
73
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
74 state = purple_connection_get_state(connection);
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
75
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
76 return (state == PURPLE_CONNECTION_STATE_CONNECTED);
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
77 }
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
78
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
79 }
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
80
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
81 return FALSE;
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
82 }
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
83
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
84 static void
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
85 pidgin_contact_list_account_connected_cb(G_GNUC_UNUSED PurpleAccountManager *manager,
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
86 G_GNUC_UNUSED PurpleAccount *account,
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
87 gpointer data)
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
88 {
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
89 PidginContactList *list = data;
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
90
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
91 gtk_filter_changed(GTK_FILTER(list->account_connected_filter),
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
92 GTK_FILTER_CHANGE_LESS_STRICT);
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
93 }
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
94
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
95 static void
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
96 pidgin_contact_list_account_disconnected_cb(G_GNUC_UNUSED PurpleAccountManager *manager,
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
97 G_GNUC_UNUSED PurpleAccount *account,
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
98 gpointer data)
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
99 {
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
100 PidginContactList *list = data;
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
101
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
102 gtk_filter_changed(GTK_FILTER(list->account_connected_filter),
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
103 GTK_FILTER_CHANGE_MORE_STRICT);
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
104 }
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
105
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
106 static gboolean
42593
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
107 pidgin_contact_list_offline_filter(GObject *item, gpointer data) {
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
108 PidginContactList *list = data;
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
109 PurplePerson *person = PURPLE_PERSON(item);
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
110 PurpleContactInfo *info = NULL;
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
111 PurplePresence *presence = NULL;
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
112
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
113 /* If we're showing offline, there's nothing to do here. */
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
114 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(list->show_offline))) {
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
115 return TRUE;
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
116 }
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
117
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
118 info = purple_person_get_priority_contact_info(person);
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
119 if(!PURPLE_IS_CONTACT_INFO(info)) {
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
120 return FALSE;
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
121 }
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
122
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
123 presence = purple_contact_info_get_presence(info);
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
124 if(PURPLE_IS_PRESENCE(presence)) {
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
125 PurplePresencePrimitive primitive = PURPLE_PRESENCE_PRIMITIVE_OFFLINE;
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
126
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
127 primitive = purple_presence_get_primitive(presence);
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
128 if(primitive == PURPLE_PRESENCE_PRIMITIVE_OFFLINE) {
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
129 return FALSE;
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
130 }
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
131 }
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
132
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
133 return TRUE;
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
134 }
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
135
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
136 static gboolean
42059
e6dcbf0db616 Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42054
diff changeset
137 pidgin_contact_list_search_filter(GObject *item, gpointer data) {
e6dcbf0db616 Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42054
diff changeset
138 PidginContactList *list = data;
e6dcbf0db616 Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42054
diff changeset
139 PurplePerson *person = PURPLE_PERSON(item);
e6dcbf0db616 Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42054
diff changeset
140 const char *needle = NULL;
e6dcbf0db616 Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42054
diff changeset
141
e6dcbf0db616 Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42054
diff changeset
142 needle = gtk_editable_get_text(GTK_EDITABLE(list->search_entry));
e6dcbf0db616 Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42054
diff changeset
143
e6dcbf0db616 Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42054
diff changeset
144 return purple_person_matches(person, needle);
e6dcbf0db616 Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42054
diff changeset
145 }
42011
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
146
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
147 /******************************************************************************
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
148 * Callbacks
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
149 *****************************************************************************/
42059
e6dcbf0db616 Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42054
diff changeset
150 static void
42593
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
151 pidgin_contact_list_show_offline_toggled_cb(G_GNUC_UNUSED GtkToggleButton *self,
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
152 gpointer data)
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
153 {
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
154 PidginContactList *list = data;
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
155
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
156 gtk_filter_changed(GTK_FILTER(list->offline_filter),
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
157 GTK_FILTER_CHANGE_DIFFERENT);
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
158 }
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
159
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
160 static void
42577
f8b477a1b0b6 Add an InfoPane to the Contacts widget and move search to it
Gary Kramlich <grim@reaperworld.com>
parents: 42575
diff changeset
161 pidgin_contact_list_search_changed_cb(GtkSearchEntry *self, gpointer data) {
42059
e6dcbf0db616 Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42054
diff changeset
162 PidginContactList *list = data;
e6dcbf0db616 Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42054
diff changeset
163
e6dcbf0db616 Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42054
diff changeset
164 gtk_filter_changed(GTK_FILTER(list->search_filter),
e6dcbf0db616 Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42054
diff changeset
165 GTK_FILTER_CHANGE_DIFFERENT);
42577
f8b477a1b0b6 Add an InfoPane to the Contacts widget and move search to it
Gary Kramlich <grim@reaperworld.com>
parents: 42575
diff changeset
166
f8b477a1b0b6 Add an InfoPane to the Contacts widget and move search to it
Gary Kramlich <grim@reaperworld.com>
parents: 42575
diff changeset
167 /* Make sure the search widget has focus, this allows the user to clear a
f8b477a1b0b6 Add an InfoPane to the Contacts widget and move search to it
Gary Kramlich <grim@reaperworld.com>
parents: 42575
diff changeset
168 * search that has filtered out every item in the list via their keyboard.
f8b477a1b0b6 Add an InfoPane to the Contacts widget and move search to it
Gary Kramlich <grim@reaperworld.com>
parents: 42575
diff changeset
169 */
f8b477a1b0b6 Add an InfoPane to the Contacts widget and move search to it
Gary Kramlich <grim@reaperworld.com>
parents: 42575
diff changeset
170 if(!gtk_widget_has_focus(GTK_WIDGET(self))) {
f8b477a1b0b6 Add an InfoPane to the Contacts widget and move search to it
Gary Kramlich <grim@reaperworld.com>
parents: 42575
diff changeset
171 gtk_widget_grab_focus(GTK_WIDGET(self));
f8b477a1b0b6 Add an InfoPane to the Contacts widget and move search to it
Gary Kramlich <grim@reaperworld.com>
parents: 42575
diff changeset
172 }
42059
e6dcbf0db616 Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42054
diff changeset
173 }
e6dcbf0db616 Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42054
diff changeset
174
42011
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
175 static GdkTexture *
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
176 pidgin_contact_list_avatar_cb(G_GNUC_UNUSED GObject *self,
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
177 PurplePerson *person,
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
178 G_GNUC_UNUSED gpointer data)
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
179 {
42312
7d6f0b8b6e77 Use PurpleAvatar for PurplePerson and PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42304
diff changeset
180 PurpleAvatar *avatar = NULL;
42011
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
181 PurpleContactInfo *info = NULL;
42054
7aa77854392d Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents: 42052
diff changeset
182
42065
b9dc817fbb3f Clean up the null checking in pidgin_contact_list_avatar_cb
Gary Kramlich <grim@reaperworld.com>
parents: 42062
diff changeset
183 /* When filtering we get called for rows that have been filtered out. We
b9dc817fbb3f Clean up the null checking in pidgin_contact_list_avatar_cb
Gary Kramlich <grim@reaperworld.com>
parents: 42062
diff changeset
184 * also get called during finalization. I'm not sure why either of these
b9dc817fbb3f Clean up the null checking in pidgin_contact_list_avatar_cb
Gary Kramlich <grim@reaperworld.com>
parents: 42062
diff changeset
185 * cases happen, but they do.
b9dc817fbb3f Clean up the null checking in pidgin_contact_list_avatar_cb
Gary Kramlich <grim@reaperworld.com>
parents: 42062
diff changeset
186 */
b9dc817fbb3f Clean up the null checking in pidgin_contact_list_avatar_cb
Gary Kramlich <grim@reaperworld.com>
parents: 42062
diff changeset
187 if(!PURPLE_IS_PERSON(person)) {
b9dc817fbb3f Clean up the null checking in pidgin_contact_list_avatar_cb
Gary Kramlich <grim@reaperworld.com>
parents: 42062
diff changeset
188 return NULL;
b9dc817fbb3f Clean up the null checking in pidgin_contact_list_avatar_cb
Gary Kramlich <grim@reaperworld.com>
parents: 42062
diff changeset
189 }
b9dc817fbb3f Clean up the null checking in pidgin_contact_list_avatar_cb
Gary Kramlich <grim@reaperworld.com>
parents: 42062
diff changeset
190
42200
c68c3ce47da8 Fix some issues where we were triggering GWarnings with presence
Gary Kramlich <grim@reaperworld.com>
parents: 42185
diff changeset
191 info = purple_person_get_priority_contact_info(person);
c68c3ce47da8 Fix some issues where we were triggering GWarnings with presence
Gary Kramlich <grim@reaperworld.com>
parents: 42185
diff changeset
192 if(!PURPLE_IS_CONTACT_INFO(info)) {
c68c3ce47da8 Fix some issues where we were triggering GWarnings with presence
Gary Kramlich <grim@reaperworld.com>
parents: 42185
diff changeset
193 return NULL;
c68c3ce47da8 Fix some issues where we were triggering GWarnings with presence
Gary Kramlich <grim@reaperworld.com>
parents: 42185
diff changeset
194 }
c68c3ce47da8 Fix some issues where we were triggering GWarnings with presence
Gary Kramlich <grim@reaperworld.com>
parents: 42185
diff changeset
195
42312
7d6f0b8b6e77 Use PurpleAvatar for PurplePerson and PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42304
diff changeset
196 avatar = purple_person_get_avatar_for_display(person);
7d6f0b8b6e77 Use PurpleAvatar for PurplePerson and PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42304
diff changeset
197 if(PURPLE_IS_AVATAR(avatar)) {
7d6f0b8b6e77 Use PurpleAvatar for PurplePerson and PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42304
diff changeset
198 GdkPixbuf *pixbuf = purple_avatar_get_pixbuf(avatar);
7d6f0b8b6e77 Use PurpleAvatar for PurplePerson and PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42304
diff changeset
199
7d6f0b8b6e77 Use PurpleAvatar for PurplePerson and PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42304
diff changeset
200 if(GDK_IS_PIXBUF(pixbuf)) {
7d6f0b8b6e77 Use PurpleAvatar for PurplePerson and PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42304
diff changeset
201 return gdk_texture_new_for_pixbuf(pixbuf);
7d6f0b8b6e77 Use PurpleAvatar for PurplePerson and PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42304
diff changeset
202 }
42054
7aa77854392d Add a property and accessor for getting the avatar to display for a PurplePerson
Gary Kramlich <grim@reaperworld.com>
parents: 42052
diff changeset
203 }
42011
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
204
42723
3761ba966eed Stop using PurpleBuddy in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 42677
diff changeset
205 return NULL;
42011
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
206 }
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
207
42025
f37c11d0200a Create new conversation when activating users in the new contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42011
diff changeset
208 static void
42795
fedfa85c0b40 Implement presenting and selecting conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42723
diff changeset
209 pidgin_contact_list_create_dm_cb(GObject *source, GAsyncResult *result,
fedfa85c0b40 Implement presenting and selecting conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42723
diff changeset
210 G_GNUC_UNUSED gpointer data)
fedfa85c0b40 Implement presenting and selecting conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42723
diff changeset
211 {
fedfa85c0b40 Implement presenting and selecting conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42723
diff changeset
212 PurpleConversation *conversation = NULL;
fedfa85c0b40 Implement presenting and selecting conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42723
diff changeset
213 GError *error = NULL;
fedfa85c0b40 Implement presenting and selecting conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42723
diff changeset
214
fedfa85c0b40 Implement presenting and selecting conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42723
diff changeset
215 conversation = purple_contact_create_dm_finish(PURPLE_CONTACT(source),
fedfa85c0b40 Implement presenting and selecting conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42723
diff changeset
216 result, &error);
fedfa85c0b40 Implement presenting and selecting conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42723
diff changeset
217
fedfa85c0b40 Implement presenting and selecting conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42723
diff changeset
218 if(error != NULL) {
fedfa85c0b40 Implement presenting and selecting conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42723
diff changeset
219 g_warning("Failed to create dm for contact: %s", error->message);
fedfa85c0b40 Implement presenting and selecting conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42723
diff changeset
220
fedfa85c0b40 Implement presenting and selecting conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42723
diff changeset
221 g_clear_error(&error);
fedfa85c0b40 Implement presenting and selecting conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42723
diff changeset
222
fedfa85c0b40 Implement presenting and selecting conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42723
diff changeset
223 return;
fedfa85c0b40 Implement presenting and selecting conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42723
diff changeset
224 }
fedfa85c0b40 Implement presenting and selecting conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42723
diff changeset
225
fedfa85c0b40 Implement presenting and selecting conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42723
diff changeset
226 purple_conversation_present(conversation);
fedfa85c0b40 Implement presenting and selecting conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42723
diff changeset
227 }
fedfa85c0b40 Implement presenting and selecting conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42723
diff changeset
228
fedfa85c0b40 Implement presenting and selecting conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42723
diff changeset
229 static void
42025
f37c11d0200a Create new conversation when activating users in the new contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42011
diff changeset
230 pidgin_contact_list_activate_cb(GtkListView *self, guint position,
f37c11d0200a Create new conversation when activating users in the new contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42011
diff changeset
231 G_GNUC_UNUSED gpointer data)
f37c11d0200a Create new conversation when activating users in the new contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42011
diff changeset
232 {
f37c11d0200a Create new conversation when activating users in the new contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42011
diff changeset
233 PurpleContactInfo *info = NULL;
42677
66b49e545c53 Update PidginContactList to use purple_contact_create_dm_async
Gary Kramlich <grim@reaperworld.com>
parents: 42593
diff changeset
234 PurpleConversation *conversation = NULL;
42025
f37c11d0200a Create new conversation when activating users in the new contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42011
diff changeset
235 PurplePerson *person = NULL;
f37c11d0200a Create new conversation when activating users in the new contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42011
diff changeset
236 GtkSelectionModel *model = NULL;
f37c11d0200a Create new conversation when activating users in the new contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42011
diff changeset
237
f37c11d0200a Create new conversation when activating users in the new contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42011
diff changeset
238 model = gtk_list_view_get_model(self);
f37c11d0200a Create new conversation when activating users in the new contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42011
diff changeset
239
f37c11d0200a Create new conversation when activating users in the new contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42011
diff changeset
240 person = g_list_model_get_item(G_LIST_MODEL(model), position);
f37c11d0200a Create new conversation when activating users in the new contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42011
diff changeset
241 if(!PURPLE_IS_PERSON(person)) {
f37c11d0200a Create new conversation when activating users in the new contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42011
diff changeset
242 g_warning("we seem to have activated a zombie.. RUN!!!!!!");
f37c11d0200a Create new conversation when activating users in the new contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42011
diff changeset
243
42179
b8bb444799a4 Fix leaks from g_list_model_get_item
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42178
diff changeset
244 g_clear_object(&person);
42025
f37c11d0200a Create new conversation when activating users in the new contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42011
diff changeset
245 return;
f37c11d0200a Create new conversation when activating users in the new contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42011
diff changeset
246 }
f37c11d0200a Create new conversation when activating users in the new contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42011
diff changeset
247
f37c11d0200a Create new conversation when activating users in the new contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42011
diff changeset
248 info = purple_person_get_priority_contact_info(person);
42677
66b49e545c53 Update PidginContactList to use purple_contact_create_dm_async
Gary Kramlich <grim@reaperworld.com>
parents: 42593
diff changeset
249 conversation = purple_contact_find_dm(PURPLE_CONTACT(info));
42795
fedfa85c0b40 Implement presenting and selecting conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42723
diff changeset
250 if(PURPLE_IS_CONVERSATION(conversation)) {
fedfa85c0b40 Implement presenting and selecting conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42723
diff changeset
251 purple_conversation_present(conversation);
fedfa85c0b40 Implement presenting and selecting conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42723
diff changeset
252 } else {
fedfa85c0b40 Implement presenting and selecting conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42723
diff changeset
253 purple_contact_create_dm_async(PURPLE_CONTACT(info), NULL,
fedfa85c0b40 Implement presenting and selecting conversations
Gary Kramlich <grim@reaperworld.com>
parents: 42723
diff changeset
254 pidgin_contact_list_create_dm_cb, NULL);
42677
66b49e545c53 Update PidginContactList to use purple_contact_create_dm_async
Gary Kramlich <grim@reaperworld.com>
parents: 42593
diff changeset
255 }
42179
b8bb444799a4 Fix leaks from g_list_model_get_item
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42178
diff changeset
256
b8bb444799a4 Fix leaks from g_list_model_get_item
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42178
diff changeset
257 g_clear_object(&person);
42025
f37c11d0200a Create new conversation when activating users in the new contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42011
diff changeset
258 }
f37c11d0200a Create new conversation when activating users in the new contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42011
diff changeset
259
42052
e575534f450d Add status-messages to PidginContactList
Gary Kramlich <grim@reaperworld.com>
parents: 42025
diff changeset
260 static gboolean
e575534f450d Add status-messages to PidginContactList
Gary Kramlich <grim@reaperworld.com>
parents: 42025
diff changeset
261 pidgin_contact_list_message_visible_cb(G_GNUC_UNUSED GtkListItem *item,
e575534f450d Add status-messages to PidginContactList
Gary Kramlich <grim@reaperworld.com>
parents: 42025
diff changeset
262 const char *message)
e575534f450d Add status-messages to PidginContactList
Gary Kramlich <grim@reaperworld.com>
parents: 42025
diff changeset
263 {
e575534f450d Add status-messages to PidginContactList
Gary Kramlich <grim@reaperworld.com>
parents: 42025
diff changeset
264 /* If we have a message, return TRUE because this is bound to the label's
e575534f450d Add status-messages to PidginContactList
Gary Kramlich <grim@reaperworld.com>
parents: 42025
diff changeset
265 * visibility.
e575534f450d Add status-messages to PidginContactList
Gary Kramlich <grim@reaperworld.com>
parents: 42025
diff changeset
266 */
42178
e795355c3165 Use the new status api in the demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents: 42065
diff changeset
267 return !purple_strempty(message);
42052
e575534f450d Add status-messages to PidginContactList
Gary Kramlich <grim@reaperworld.com>
parents: 42025
diff changeset
268 }
e575534f450d Add status-messages to PidginContactList
Gary Kramlich <grim@reaperworld.com>
parents: 42025
diff changeset
269
42185
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
270 static char *
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
271 pidgin_contact_list_get_primitive_as_string(G_GNUC_UNUSED GObject *self,
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
272 PurplePresence *presence,
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
273 G_GNUC_UNUSED gpointer data)
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
274 {
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
275 PurplePresencePrimitive primitive;
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
276 GDateTime *idle = NULL;
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
277 GString *str = g_string_new(NULL);
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
278 const char *tmp = NULL;
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
279
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
280 if(!PURPLE_IS_PRESENCE(presence)) {
43123
4d3b58b6cf06 Use g_string_free_and_steal
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42795
diff changeset
281 return g_string_free_and_steal(str);
42185
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
282 }
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
283
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
284 primitive = purple_presence_get_primitive(presence);
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
285 tmp = purple_presence_primitive_to_string(primitive);
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
286 if(tmp != NULL) {
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
287 g_string_append_printf(str, " - %s", tmp);
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
288 }
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
289
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
290 idle = purple_presence_get_idle_time(presence);
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
291 if(idle != NULL) {
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
292 GDateTime *now = NULL;
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
293 GTimeSpan duration;
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
294 guint days;
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
295 guint hours;
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
296 guint minutes;
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
297
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
298 now = g_date_time_new_now_utc();
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
299 duration = g_date_time_difference(now, idle);
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
300 g_date_time_unref(now);
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
301
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
302 days = duration / G_TIME_SPAN_DAY;
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
303 duration %= G_TIME_SPAN_DAY;
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
304 hours = duration / G_TIME_SPAN_HOUR;
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
305 duration %= G_TIME_SPAN_HOUR;
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
306 minutes = duration / G_TIME_SPAN_MINUTE;
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
307
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
308 if(days > 0) {
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
309 g_string_append_printf(str, _(" Idle %dd %dh %02dm"), days, hours,
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
310 minutes);
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
311 } else if(hours > 0) {
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
312 g_string_append_printf(str, _(" Idle %dh %02dm"), hours, minutes);
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
313 } else if(minutes > 0) {
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
314 g_string_append_printf(str, _(" Idle %02dm"), minutes);
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
315 }
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
316 }
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
317
43123
4d3b58b6cf06 Use g_string_free_and_steal
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42795
diff changeset
318 return g_string_free_and_steal(str);
42185
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
319 }
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
320
42304
51a419226147 A basic context menu for PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42237
diff changeset
321 static void
51a419226147 A basic context menu for PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42237
diff changeset
322 pidgin_contact_list_context_cb(GtkGestureSingle *self,
51a419226147 A basic context menu for PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42237
diff changeset
323 G_GNUC_UNUSED gint n_press,
51a419226147 A basic context menu for PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42237
diff changeset
324 gdouble x,
51a419226147 A basic context menu for PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42237
diff changeset
325 gdouble y,
51a419226147 A basic context menu for PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42237
diff changeset
326 gpointer data)
51a419226147 A basic context menu for PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42237
diff changeset
327 {
51a419226147 A basic context menu for PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42237
diff changeset
328 PurpleAccount *account = NULL;
51a419226147 A basic context menu for PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42237
diff changeset
329 PurpleContactInfo *info = NULL;
51a419226147 A basic context menu for PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42237
diff changeset
330 PurplePerson *person = NULL;
51a419226147 A basic context menu for PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42237
diff changeset
331 GtkWidget *parent = NULL;
51a419226147 A basic context menu for PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42237
diff changeset
332 GtkListItem *item = data;
51a419226147 A basic context menu for PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42237
diff changeset
333
51a419226147 A basic context menu for PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42237
diff changeset
334 parent = gtk_event_controller_get_widget(GTK_EVENT_CONTROLLER(self));
51a419226147 A basic context menu for PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42237
diff changeset
335
51a419226147 A basic context menu for PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42237
diff changeset
336 /* Maybe eventually we'll make this show all contacts, but for now we'll
51a419226147 A basic context menu for PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42237
diff changeset
337 * just show the priority contact's menu.
51a419226147 A basic context menu for PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42237
diff changeset
338 */
51a419226147 A basic context menu for PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42237
diff changeset
339 person = gtk_list_item_get_item(item);
51a419226147 A basic context menu for PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42237
diff changeset
340 info = purple_person_get_priority_contact_info(person);
51a419226147 A basic context menu for PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42237
diff changeset
341
51a419226147 A basic context menu for PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42237
diff changeset
342 /* We know the info is a PurpleContact because that's what the contact list
51a419226147 A basic context menu for PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42237
diff changeset
343 * is made of so this cast is fine.
51a419226147 A basic context menu for PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42237
diff changeset
344 */
51a419226147 A basic context menu for PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42237
diff changeset
345 account = purple_contact_get_account(PURPLE_CONTACT(info));
51a419226147 A basic context menu for PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42237
diff changeset
346
51a419226147 A basic context menu for PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42237
diff changeset
347 pidgin_contact_info_menu_popup(info, account, parent, x, y);
51a419226147 A basic context menu for PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42237
diff changeset
348 }
51a419226147 A basic context menu for PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42237
diff changeset
349
42011
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
350 /******************************************************************************
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
351 * GObject Implementation
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
352 *****************************************************************************/
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
353 static void
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
354 pidgin_contact_list_init(PidginContactList *list) {
42237
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
355 PurpleAccountManager *account_manager = NULL;
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
356 PurpleContactManager *contact_manager = NULL;
42011
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
357
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
358 gtk_widget_init_template(GTK_WIDGET(list));
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
359
42237
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
360 contact_manager = purple_contact_manager_get_default();
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
361 gtk_filter_list_model_set_model(list->filter_model,
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
362 G_LIST_MODEL(contact_manager));
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
363
42011
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
364
42237
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
365 /* Setup the filter connected accounts. */
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
366 account_manager = purple_account_manager_get_default();
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
367 gtk_custom_filter_set_filter_func(list->account_connected_filter,
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
368 (GtkCustomFilterFunc)pidgin_contact_list_account_connected_filter,
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
369 list, NULL);
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
370 g_signal_connect_object(account_manager, "account-connected",
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
371 G_CALLBACK(pidgin_contact_list_account_connected_cb),
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
372 list, 0);
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
373 g_signal_connect_object(account_manager, "account-disconnected",
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
374 G_CALLBACK(pidgin_contact_list_account_disconnected_cb),
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
375 list, 0);
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
376
42593
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
377 /* Set the filter function for the offline filter. */
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
378 gtk_custom_filter_set_filter_func(list->offline_filter,
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
379 (GtkCustomFilterFunc)pidgin_contact_list_offline_filter,
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
380 list, NULL);
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
381
42577
f8b477a1b0b6 Add an InfoPane to the Contacts widget and move search to it
Gary Kramlich <grim@reaperworld.com>
parents: 42575
diff changeset
382 /* Setup the search filter and forwarding widget. */
42059
e6dcbf0db616 Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42054
diff changeset
383 gtk_custom_filter_set_filter_func(list->search_filter,
e6dcbf0db616 Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42054
diff changeset
384 (GtkCustomFilterFunc)pidgin_contact_list_search_filter,
e6dcbf0db616 Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42054
diff changeset
385 list, NULL);
42577
f8b477a1b0b6 Add an InfoPane to the Contacts widget and move search to it
Gary Kramlich <grim@reaperworld.com>
parents: 42575
diff changeset
386
f8b477a1b0b6 Add an InfoPane to the Contacts widget and move search to it
Gary Kramlich <grim@reaperworld.com>
parents: 42575
diff changeset
387 gtk_search_entry_set_key_capture_widget(GTK_SEARCH_ENTRY(list->search_entry),
f8b477a1b0b6 Add an InfoPane to the Contacts widget and move search to it
Gary Kramlich <grim@reaperworld.com>
parents: 42575
diff changeset
388 GTK_WIDGET(list));
42011
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
389 }
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
390
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
391 static void
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
392 pidgin_contact_list_class_init(PidginContactListClass *klass) {
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
393 GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
394
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
395 gtk_widget_class_set_template_from_resource(
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
396 widget_class,
42577
f8b477a1b0b6 Add an InfoPane to the Contacts widget and move search to it
Gary Kramlich <grim@reaperworld.com>
parents: 42575
diff changeset
397 "/im/pidgin/Pidgin3/contactlist.ui"
42011
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
398 );
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
399
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
400 gtk_widget_class_bind_template_child(widget_class, PidginContactList,
42059
e6dcbf0db616 Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42054
diff changeset
401 filter_model);
e6dcbf0db616 Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42054
diff changeset
402 gtk_widget_class_bind_template_child(widget_class, PidginContactList,
42237
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
403 account_connected_filter);
57c9deea59c8 Add a custom filter to PidginContactList to filter out disconnected accounts
Gary Kramlich <grim@reaperworld.com>
parents: 42200
diff changeset
404 gtk_widget_class_bind_template_child(widget_class, PidginContactList,
42593
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
405 show_offline);
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
406 gtk_widget_class_bind_template_child(widget_class, PidginContactList,
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
407 offline_filter);
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
408 gtk_widget_class_bind_template_child(widget_class, PidginContactList,
42059
e6dcbf0db616 Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42054
diff changeset
409 search_filter);
e6dcbf0db616 Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42054
diff changeset
410
e6dcbf0db616 Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42054
diff changeset
411 gtk_widget_class_bind_template_child(widget_class, PidginContactList,
e6dcbf0db616 Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42054
diff changeset
412 search_entry);
42011
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
413
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
414 gtk_widget_class_bind_template_callback(widget_class,
42593
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
415 pidgin_contact_list_show_offline_toggled_cb);
c821b5ab8895 Add a show offline buddies toggle button to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42577
diff changeset
416 gtk_widget_class_bind_template_callback(widget_class,
42059
e6dcbf0db616 Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42054
diff changeset
417 pidgin_contact_list_search_changed_cb);
e6dcbf0db616 Add search support to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42054
diff changeset
418 gtk_widget_class_bind_template_callback(widget_class,
42011
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
419 pidgin_contact_list_avatar_cb);
42025
f37c11d0200a Create new conversation when activating users in the new contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42011
diff changeset
420 gtk_widget_class_bind_template_callback(widget_class,
f37c11d0200a Create new conversation when activating users in the new contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42011
diff changeset
421 pidgin_contact_list_activate_cb);
42052
e575534f450d Add status-messages to PidginContactList
Gary Kramlich <grim@reaperworld.com>
parents: 42025
diff changeset
422 gtk_widget_class_bind_template_callback(widget_class,
e575534f450d Add status-messages to PidginContactList
Gary Kramlich <grim@reaperworld.com>
parents: 42025
diff changeset
423 pidgin_contact_list_message_visible_cb);
42185
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
424 gtk_widget_class_bind_template_callback(widget_class,
91d0671d4778 Add the presence primitive and idle time to the contact list
Gary Kramlich <grim@reaperworld.com>
parents: 42179
diff changeset
425 pidgin_contact_list_get_primitive_as_string);
42304
51a419226147 A basic context menu for PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42237
diff changeset
426 gtk_widget_class_bind_template_callback(widget_class,
51a419226147 A basic context menu for PurpleContactInfo
Gary Kramlich <grim@reaperworld.com>
parents: 42237
diff changeset
427 pidgin_contact_list_context_cb);
42011
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
428 }
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
429
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
430 /******************************************************************************
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
431 * API
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
432 *****************************************************************************/
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
433 GtkWidget *
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
434 pidgin_contact_list_new(void) {
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
435 return g_object_new(PIDGIN_TYPE_CONTACT_LIST, NULL);
bb38b9441073 Create a new PidginContactList widget that shows the PurplePersons that PurpleContactManager is tracking
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
436 }

mercurial