Sat, 09 Aug 2025 17:37:27 +0800
Fix the birb header path
The birb header referred would only work with birb provided by wrap casuing
build to fail because of system-installed birb dependency. The commit points
it to the correct path <birb.h>.
See: https://keep.imfreedom.org/birb/birb/file/5bf00c7d7f80/birb/meson.build#l77
|
42922
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * Purple - Internet Messaging Library |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * Purple is the legal property of its developers, whose names are too numerous |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * source distribution. |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * This library is free software; you can redistribute it and/or modify it |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * under the terms of the GNU General Public License as published by the Free |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * Software Foundation; either version 2 of the License, or (at your option) |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * any later version. |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * This library is distributed in the hope that it will be useful, but WITHOUT |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | * more details. |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | * |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | * You should have received a copy of the GNU General Public License along with |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | * this library; if not, see <https://www.gnu.org/licenses/>. |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | */ |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | #include <glib/gi18n-lib.h> |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | #include "purplenotificationaddcontact.h" |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
26 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | struct _PurpleNotificationAddContact { |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | PurpleNotification parent; |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | PurpleAddContactRequest *request; |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | }; |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | enum { |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | PROP_0, |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | PROP_REQUEST, |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | N_PROPERTIES, |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | }; |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | static GParamSpec *properties[N_PROPERTIES] = {NULL, }; |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | static void |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | purple_notification_add_contact_contact_notify_cb(GObject *obj, |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | GParamSpec *pspec, |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | gpointer data); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | static void |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | purple_notification_add_contact_request_notify_cb(GObject *obj, |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | GParamSpec *pspec, |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | gpointer data); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | /****************************************************************************** |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
50 | * Helpers |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
51 | *****************************************************************************/ |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
52 | static void |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
53 | purple_notification_add_contact_update(PurpleNotificationAddContact *notification) |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
54 | { |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
55 | PurpleAccount *account = NULL; |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
56 | PurpleContact *remote = NULL; |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
57 | PurpleContactInfo *info = NULL; |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
58 | char *title = NULL; |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
59 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
60 | g_return_if_fail(PURPLE_IS_NOTIFICATION_ADD_CONTACT(notification)); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
61 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
62 | remote = purple_add_contact_request_get_contact(notification->request); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
63 | account = purple_contact_get_account(remote); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
64 | info = purple_account_get_contact_info(account); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
65 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
66 | title = g_strdup_printf(_("%s added %s to their contact_list"), |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
67 | purple_contact_info_get_name_for_display(PURPLE_CONTACT_INFO(remote)), |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
68 | purple_contact_info_get_name_for_display(info)); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
69 | purple_notification_set_title(PURPLE_NOTIFICATION(notification), title); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
70 | g_free(title); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
71 | } |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
72 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | static void |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
74 | purple_notification_add_contact_set_request(PurpleNotificationAddContact *notification, |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
75 | PurpleAddContactRequest *request) |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
76 | { |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
77 | g_return_if_fail(PURPLE_IS_NOTIFICATION_ADD_CONTACT(notification)); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
78 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
79 | if(g_set_object(¬ification->request, request)) { |
|
42928
2f12cdef0048
Update Purple.NotificationAddContact to take an id parameter
Gary Kramlich <grim@reaperworld.com>
parents:
42922
diff
changeset
|
80 | PurpleAccount *account = NULL; |
|
2f12cdef0048
Update Purple.NotificationAddContact to take an id parameter
Gary Kramlich <grim@reaperworld.com>
parents:
42922
diff
changeset
|
81 | GObject *obj = G_OBJECT(notification); |
|
2f12cdef0048
Update Purple.NotificationAddContact to take an id parameter
Gary Kramlich <grim@reaperworld.com>
parents:
42922
diff
changeset
|
82 | |
|
2f12cdef0048
Update Purple.NotificationAddContact to take an id parameter
Gary Kramlich <grim@reaperworld.com>
parents:
42922
diff
changeset
|
83 | g_object_freeze_notify(obj); |
|
2f12cdef0048
Update Purple.NotificationAddContact to take an id parameter
Gary Kramlich <grim@reaperworld.com>
parents:
42922
diff
changeset
|
84 | |
|
42922
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
85 | if(PURPLE_IS_ADD_CONTACT_REQUEST(request)) { |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
86 | PurpleContact *contact = NULL; |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
87 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
88 | contact = purple_add_contact_request_get_contact(request); |
|
42928
2f12cdef0048
Update Purple.NotificationAddContact to take an id parameter
Gary Kramlich <grim@reaperworld.com>
parents:
42922
diff
changeset
|
89 | account = purple_contact_get_account(contact); |
|
2f12cdef0048
Update Purple.NotificationAddContact to take an id parameter
Gary Kramlich <grim@reaperworld.com>
parents:
42922
diff
changeset
|
90 | |
|
42922
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
91 | g_signal_connect_object(contact, "notify", |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
92 | G_CALLBACK(purple_notification_add_contact_contact_notify_cb), |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
93 | notification, G_CONNECT_DEFAULT); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
94 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
95 | /* We need to know when the contact or the message changes. */ |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
96 | g_signal_connect_object(request, "notify", |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
97 | G_CALLBACK(purple_notification_add_contact_request_notify_cb), |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
98 | notification, G_CONNECT_DEFAULT); |
|
42956
445c8ac8139f
Add some messages to the Demo contacts that are used for AddContactRequest notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42928
diff
changeset
|
99 | |
|
445c8ac8139f
Add some messages to the Demo contacts that are used for AddContactRequest notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42928
diff
changeset
|
100 | g_object_bind_property(request, "message", |
|
445c8ac8139f
Add some messages to the Demo contacts that are used for AddContactRequest notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42928
diff
changeset
|
101 | notification, "subtitle", |
|
445c8ac8139f
Add some messages to the Demo contacts that are used for AddContactRequest notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42928
diff
changeset
|
102 | G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); |
|
42922
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
103 | } |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
104 | |
|
42928
2f12cdef0048
Update Purple.NotificationAddContact to take an id parameter
Gary Kramlich <grim@reaperworld.com>
parents:
42922
diff
changeset
|
105 | purple_notification_set_account(PURPLE_NOTIFICATION(notification), |
|
2f12cdef0048
Update Purple.NotificationAddContact to take an id parameter
Gary Kramlich <grim@reaperworld.com>
parents:
42922
diff
changeset
|
106 | account); |
|
2f12cdef0048
Update Purple.NotificationAddContact to take an id parameter
Gary Kramlich <grim@reaperworld.com>
parents:
42922
diff
changeset
|
107 | |
|
2f12cdef0048
Update Purple.NotificationAddContact to take an id parameter
Gary Kramlich <grim@reaperworld.com>
parents:
42922
diff
changeset
|
108 | g_object_notify_by_pspec(obj, properties[PROP_REQUEST]); |
|
2f12cdef0048
Update Purple.NotificationAddContact to take an id parameter
Gary Kramlich <grim@reaperworld.com>
parents:
42922
diff
changeset
|
109 | g_object_thaw_notify(obj); |
|
42922
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
110 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
111 | purple_notification_add_contact_update(notification); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
112 | } |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
113 | } |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
114 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
115 | /****************************************************************************** |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
116 | * Callbacks |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
117 | *****************************************************************************/ |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
118 | static void |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
119 | purple_notification_add_contact_contact_notify_cb(G_GNUC_UNUSED GObject *obj, |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
120 | G_GNUC_UNUSED GParamSpec *pspec, |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
121 | gpointer data) |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
122 | { |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
123 | purple_notification_add_contact_update(data); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
124 | } |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
125 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
126 | static void |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
127 | purple_notification_add_contact_request_notify_cb(G_GNUC_UNUSED GObject *obj, |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
128 | G_GNUC_UNUSED GParamSpec *pspec, |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
129 | gpointer data) |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
130 | { |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
131 | purple_notification_add_contact_update(data); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
132 | } |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
133 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
134 | /****************************************************************************** |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
135 | * GObject Implementation |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
136 | *****************************************************************************/ |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
137 | G_DEFINE_FINAL_TYPE(PurpleNotificationAddContact, |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
138 | purple_notification_add_contact, PURPLE_TYPE_NOTIFICATION) |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
139 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
140 | static void |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
141 | purple_notification_add_contact_finalize(GObject *obj) { |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
142 | PurpleNotificationAddContact *notification = NULL; |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
143 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
144 | notification = PURPLE_NOTIFICATION_ADD_CONTACT(obj); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
145 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
146 | g_clear_object(¬ification->request); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
147 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
148 | G_OBJECT_CLASS(purple_notification_add_contact_parent_class)->finalize(obj); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
149 | } |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
150 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
151 | static void |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
152 | purple_notification_add_contact_get_property(GObject *obj, guint param_id, |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
153 | GValue *value, GParamSpec *pspec) |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
154 | { |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
155 | PurpleNotificationAddContact *notification = NULL; |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
156 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
157 | notification = PURPLE_NOTIFICATION_ADD_CONTACT(obj); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
158 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
159 | switch(param_id) { |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
160 | case PROP_REQUEST: |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
161 | g_value_set_object(value, |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
162 | purple_notification_add_contact_get_request(notification)); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
163 | break; |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
164 | default: |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
165 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
166 | break; |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
167 | } |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
168 | } |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
169 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
170 | static void |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
171 | purple_notification_add_contact_set_property(GObject *obj, guint param_id, |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
172 | const GValue *value, |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
173 | GParamSpec *pspec) |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
174 | { |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
175 | PurpleNotificationAddContact *notification = NULL; |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
176 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
177 | notification = PURPLE_NOTIFICATION_ADD_CONTACT(obj); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
178 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
179 | switch(param_id) { |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
180 | case PROP_REQUEST: |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
181 | purple_notification_add_contact_set_request(notification, |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
182 | g_value_get_object(value)); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
183 | break; |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
184 | default: |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
185 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
186 | break; |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
187 | } |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
188 | } |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
189 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
190 | static void |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
191 | purple_notification_add_contact_init(PurpleNotificationAddContact *notification) |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
192 | { |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
193 | purple_notification_set_icon_name(PURPLE_NOTIFICATION(notification), |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
194 | "contact-new-symbolic"); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
195 | } |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
196 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
197 | static void |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
198 | purple_notification_add_contact_class_init(PurpleNotificationAddContactClass *klass) |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
199 | { |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
200 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
201 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
202 | obj_class->finalize = purple_notification_add_contact_finalize; |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
203 | obj_class->get_property = purple_notification_add_contact_get_property; |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
204 | obj_class->set_property = purple_notification_add_contact_set_property; |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
205 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
206 | /** |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
207 | * PurpleNotificationAddContact:request: |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
208 | * |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
209 | * The [class@AddContactRequest] that this notification is for. |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
210 | * |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
211 | * Since: 3.0 |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
212 | */ |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
213 | properties[PROP_REQUEST] = g_param_spec_object( |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
214 | "request", NULL, NULL, |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
215 | PURPLE_TYPE_ADD_CONTACT_REQUEST, |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
216 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
217 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
218 | g_object_class_install_properties(obj_class, N_PROPERTIES, properties); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
219 | } |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
220 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
221 | /****************************************************************************** |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
222 | * Public API |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
223 | *****************************************************************************/ |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
224 | PurpleNotification * |
|
42928
2f12cdef0048
Update Purple.NotificationAddContact to take an id parameter
Gary Kramlich <grim@reaperworld.com>
parents:
42922
diff
changeset
|
225 | purple_notification_add_contact_new(const char *id, |
|
2f12cdef0048
Update Purple.NotificationAddContact to take an id parameter
Gary Kramlich <grim@reaperworld.com>
parents:
42922
diff
changeset
|
226 | PurpleAddContactRequest *request) |
|
2f12cdef0048
Update Purple.NotificationAddContact to take an id parameter
Gary Kramlich <grim@reaperworld.com>
parents:
42922
diff
changeset
|
227 | { |
|
42922
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
228 | g_return_val_if_fail(PURPLE_IS_ADD_CONTACT_REQUEST(request), NULL); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
229 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
230 | return g_object_new( |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
231 | PURPLE_TYPE_NOTIFICATION_ADD_CONTACT, |
|
42928
2f12cdef0048
Update Purple.NotificationAddContact to take an id parameter
Gary Kramlich <grim@reaperworld.com>
parents:
42922
diff
changeset
|
232 | "id", id, |
|
42922
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
233 | "request", request, |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
234 | NULL); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
235 | } |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
236 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
237 | PurpleAddContactRequest * |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
238 | purple_notification_add_contact_get_request(PurpleNotificationAddContact *notification) |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
239 | { |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
240 | g_return_val_if_fail(PURPLE_IS_NOTIFICATION_ADD_CONTACT(notification), |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
241 | NULL); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
242 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
243 | return notification->request; |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
244 | } |