pidgin/pidgincontactcompletion.h

Fri, 05 Mar 2021 03:31:29 -0600

author
Gary Kramlich <grim@reaperworld.com>
date
Fri, 05 Mar 2021 03:31:29 -0600
changeset 40810
28d50eece92d
parent 40502
875489636847
child 41124
95555046173e
permissions
-rw-r--r--

Create a PidginAvatar widget.

This does everything the existing code does, but trying to integrate right now
is kind of difficult. The plan is to use this in a new PidginInfoPane I have
started, but that change got very large so I just packed it into the end of
the existing info pane.

The only things that are not implement right now, are making menu items
insensitive and that's because we need to figure out a better want to handle
custom avatars for users.

Testing Done:
Ran locally.

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

39579
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /* pidgin
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 *
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 * Pidgin is the legal property of its developers, whose names are too numerous
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 * to list here. Please refer to the COPYRIGHT file distributed with this
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * source distribution.
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 *
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * (at your option) any later version.
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 *
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * GNU General Public License for more details.
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 *
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20 */
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21
40502
875489636847 pidgin.h phase3: create pidgin.h and force its usage
Gary Kramlich <grim@reaperworld.com>
parents: 39581
diff changeset
22 #if !defined(PIDGIN_GLOBAL_HEADER_INSIDE) && !defined(PIDGIN_COMPILATION)
875489636847 pidgin.h phase3: create pidgin.h and force its usage
Gary Kramlich <grim@reaperworld.com>
parents: 39581
diff changeset
23 # error "only <pidgin.h> may be included directly"
875489636847 pidgin.h phase3: create pidgin.h and force its usage
Gary Kramlich <grim@reaperworld.com>
parents: 39581
diff changeset
24 #endif
875489636847 pidgin.h phase3: create pidgin.h and force its usage
Gary Kramlich <grim@reaperworld.com>
parents: 39581
diff changeset
25
39579
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26 #ifndef PIDGIN_CONTACT_COMPLETION_H
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 #define PIDGIN_CONTACT_COMPLETION_H
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29 /**
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30 * SECTION:pidgincontactcompletion
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31 * @section_id: pidgin-contact-completion
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32 * @short_description: A GtkEntryCompletion for contacts
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33 * @title: Contact Name Completion
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34 *
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35 * #PidginContactCompletion should be treated like a normal
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 * #GtkEntryCompletion, except it already does all of the setup for the
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37 * completion. You can also filter by a #PurpleAccount to limit what's shown.
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38 *
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39 * |[<!-- language="C" -->
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 * GtkWidget *entry = gtk_entry_new();
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 * GtkEntryCompletion *completion = pidgin_contact_completion_new();
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 *
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 * gtk_entry_set_completion(GTK_ENTRY(entry), completion);
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 * pidgin_contact_completion_set_account(PIDGIN_CONTACT_COMPLETION(completion), account);
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 * g_object_unref(completion);
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46 * ]|
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47 */
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49 #include <gtk/gtk.h>
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51 #include <purple.h>
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 G_BEGIN_DECLS
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55 #define PIDGIN_TYPE_CONTACT_COMPLETION pidgin_contact_completion_get_type()
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57 G_DECLARE_FINAL_TYPE(PidginContactCompletion, pidgin_contact_completion, PIDGIN,
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58 CONTACT_COMPLETION, GtkEntryCompletion)
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 /**
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61 * pidgin_contact_completion_new:
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62 *
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63 * Creates a new #GtkEntryCompletion for looking up contacts.
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 *
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65 * Returns: (transfer full): The new #GtkEntryCompletion instance.
39581
28b38c0602d6 Replace ChangeLog.API entries with Since tags from PidginContactCompletion
Gary Kramlich <grim@reaperworld.com>
parents: 39579
diff changeset
66 *
28b38c0602d6 Replace ChangeLog.API entries with Since tags from PidginContactCompletion
Gary Kramlich <grim@reaperworld.com>
parents: 39579
diff changeset
67 * Since: 3.0.0
39579
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68 */
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69 GtkEntryCompletion *pidgin_contact_completion_new(void);
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71 /**
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72 * pidgin_contact_completion_get_account:
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73 * @completion: The #PidginContactCompletion instance.
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74 *
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75 * Gets the account that @completion is filtering for. If no filtering is set
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76 * %NULL will be returned.
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77 *
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78 * Returns: (transfer full) (nullable): The #PurpleAccount that's being
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79 * filtered for.
39581
28b38c0602d6 Replace ChangeLog.API entries with Since tags from PidginContactCompletion
Gary Kramlich <grim@reaperworld.com>
parents: 39579
diff changeset
80 *
28b38c0602d6 Replace ChangeLog.API entries with Since tags from PidginContactCompletion
Gary Kramlich <grim@reaperworld.com>
parents: 39579
diff changeset
81 * Since: 3.0.0
39579
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
82 */
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
83 PurpleAccount *pidgin_contact_completion_get_account(PidginContactCompletion *completion);
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85 /**
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86 * pidgin_contact_completion_set_account:
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87 * @completion: The #PidginContactCompletion instance.
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
88 * @account: (nullable): The #PurpleAccount to filter for or %NULL.
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89 *
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90 * Set the #PurpleAccount that @completion should filter for. If @account is
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91 * %NULL, all filtering will be disabled.
39581
28b38c0602d6 Replace ChangeLog.API entries with Since tags from PidginContactCompletion
Gary Kramlich <grim@reaperworld.com>
parents: 39579
diff changeset
92 *
28b38c0602d6 Replace ChangeLog.API entries with Since tags from PidginContactCompletion
Gary Kramlich <grim@reaperworld.com>
parents: 39579
diff changeset
93 * Since: 3.0.0
39579
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
94 */
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
95 void pidgin_contact_completion_set_account(PidginContactCompletion *completion, PurpleAccount *account);
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
96
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97 G_END_DECLS
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
98
34e0b0e7df81 Finish up the invite dialog with contact completion and documentation for all.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
99 #endif /* PIDGIN_CONTACT_COMPLETION_H */

mercurial