Mon, 12 Dec 2022 23:38:47 -0600
Create PurpleAvatar to represent avatars
Testing Done:
Ran the unit tests and manually verified the docs.
Reviewed at https://reviews.imfreedom.org/r/2092/
|
41433
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * Purple - Internet Messaging Library |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * This program is free software; you can redistribute it and/or modify |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * the Free Software Foundation; either version 2 of the License, or |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * (at your option) any later version. |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * along with this program; if not, see <https://www.gnu.org/licenses/>. |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | */ |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | #if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION) |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | # error "only <purple.h> may be included directly" |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | #endif |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | #ifndef PURPLE_NOTIFICATION_MANAGER_H |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | #define PURPLE_NOTIFICATION_MANAGER_H |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
26 | #include <glib.h> |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | #include <glib-object.h> |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | #include "account.h" |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | #include <purplenotification.h> |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | G_BEGIN_DECLS |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | #define PURPLE_TYPE_NOTIFICATION_MANAGER (purple_notification_manager_get_type()) |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | G_DECLARE_FINAL_TYPE(PurpleNotificationManager, purple_notification_manager, |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | PURPLE, NOTIFICATION_MANAGER, GObject) |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | /** |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | * PurpleNotificationManager: |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | * |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | * Purple Notification Manager manages all notifications between protocols and |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | * plugins and how the user interface interacts with them. |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | * |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | * Since: 3.0.0 |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | */ |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | /** |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | * purple_notification_manager_get_default: |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | * |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
50 | * Gets the default [class@NotificationManager] instance. |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
51 | * |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
52 | * Returns: (transfer none): The default instance. |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
53 | * |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
54 | * Since: 3.0.0 |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
55 | */ |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
56 | PurpleNotificationManager *purple_notification_manager_get_default(void); |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
57 | |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
58 | /** |
|
41936
c4a96b5eecba
Make PurpleNotificationManager implement GListModel
Gary Kramlich <grim@reaperworld.com>
parents:
41817
diff
changeset
|
59 | * purple_notification_manager_get_default_as_model: |
|
c4a96b5eecba
Make PurpleNotificationManager implement GListModel
Gary Kramlich <grim@reaperworld.com>
parents:
41817
diff
changeset
|
60 | * |
|
c4a96b5eecba
Make PurpleNotificationManager implement GListModel
Gary Kramlich <grim@reaperworld.com>
parents:
41817
diff
changeset
|
61 | * Gets the default manager instance type casted to [iface@Gio.ListModel]. |
|
c4a96b5eecba
Make PurpleNotificationManager implement GListModel
Gary Kramlich <grim@reaperworld.com>
parents:
41817
diff
changeset
|
62 | * |
|
c4a96b5eecba
Make PurpleNotificationManager implement GListModel
Gary Kramlich <grim@reaperworld.com>
parents:
41817
diff
changeset
|
63 | * Returns: (transfer none): The model. |
|
c4a96b5eecba
Make PurpleNotificationManager implement GListModel
Gary Kramlich <grim@reaperworld.com>
parents:
41817
diff
changeset
|
64 | * |
|
c4a96b5eecba
Make PurpleNotificationManager implement GListModel
Gary Kramlich <grim@reaperworld.com>
parents:
41817
diff
changeset
|
65 | * Since: 3.0.0 |
|
c4a96b5eecba
Make PurpleNotificationManager implement GListModel
Gary Kramlich <grim@reaperworld.com>
parents:
41817
diff
changeset
|
66 | */ |
|
c4a96b5eecba
Make PurpleNotificationManager implement GListModel
Gary Kramlich <grim@reaperworld.com>
parents:
41817
diff
changeset
|
67 | GListModel *purple_notification_manager_get_default_as_model(void); |
|
c4a96b5eecba
Make PurpleNotificationManager implement GListModel
Gary Kramlich <grim@reaperworld.com>
parents:
41817
diff
changeset
|
68 | |
|
c4a96b5eecba
Make PurpleNotificationManager implement GListModel
Gary Kramlich <grim@reaperworld.com>
parents:
41817
diff
changeset
|
69 | /** |
|
41433
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
70 | * purple_notification_manager_add: |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
71 | * @manager: The instance. |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
72 | * @notification: (transfer full): The [class@Notification] to add. |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | * |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
74 | * Adds @notification into @manager. |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
75 | * |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
76 | * Since: 3.0.0 |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
77 | */ |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
78 | void purple_notification_manager_add(PurpleNotificationManager *manager, PurpleNotification *notification); |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
79 | |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
80 | /** |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
81 | * purple_notification_manager_remove: |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
82 | * @manager: The instance. |
|
41438
86beaec0fa35
Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents:
41433
diff
changeset
|
83 | * @notification: The notification to remove. |
|
41433
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
84 | * |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
85 | * Removes @notification from @manager. |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
86 | * |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
87 | * Since: 3.0.0 |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
88 | */ |
|
41438
86beaec0fa35
Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents:
41433
diff
changeset
|
89 | void purple_notification_manager_remove(PurpleNotificationManager *manager, PurpleNotification *notification); |
|
41433
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
90 | |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
91 | /** |
|
41511
2036d450fd18
Add purple_notification_manager_remove_with_account.
Gary Kramlich <grim@reaperworld.com>
parents:
41441
diff
changeset
|
92 | * purple_notification_manager_remove_with_account: |
|
2036d450fd18
Add purple_notification_manager_remove_with_account.
Gary Kramlich <grim@reaperworld.com>
parents:
41441
diff
changeset
|
93 | * @manager: The instance. |
|
2036d450fd18
Add purple_notification_manager_remove_with_account.
Gary Kramlich <grim@reaperworld.com>
parents:
41441
diff
changeset
|
94 | * @account: The [class@Account] whose notifications to remove. |
|
41817
91f9ce89468b
Fix connection errors getting deleted when an account is disconnected
Gary Kramlich <grim@reaperworld.com>
parents:
41511
diff
changeset
|
95 | * @all: Whether or not to clear connection error notifications as well. |
|
41511
2036d450fd18
Add purple_notification_manager_remove_with_account.
Gary Kramlich <grim@reaperworld.com>
parents:
41441
diff
changeset
|
96 | * |
|
2036d450fd18
Add purple_notification_manager_remove_with_account.
Gary Kramlich <grim@reaperworld.com>
parents:
41441
diff
changeset
|
97 | * Removes all notifications with @account from @manager. |
|
2036d450fd18
Add purple_notification_manager_remove_with_account.
Gary Kramlich <grim@reaperworld.com>
parents:
41441
diff
changeset
|
98 | * |
|
41817
91f9ce89468b
Fix connection errors getting deleted when an account is disconnected
Gary Kramlich <grim@reaperworld.com>
parents:
41511
diff
changeset
|
99 | * If @all is set to %TRUE, notifications of type |
|
91f9ce89468b
Fix connection errors getting deleted when an account is disconnected
Gary Kramlich <grim@reaperworld.com>
parents:
41511
diff
changeset
|
100 | * PURPLE_NOTIFICATION_TYPE_CONNECTION_ERROR will be removed as well. These are |
|
91f9ce89468b
Fix connection errors getting deleted when an account is disconnected
Gary Kramlich <grim@reaperworld.com>
parents:
41511
diff
changeset
|
101 | * treated differently from other notifications tied to accounts, as those are |
|
91f9ce89468b
Fix connection errors getting deleted when an account is disconnected
Gary Kramlich <grim@reaperworld.com>
parents:
41511
diff
changeset
|
102 | * transient and depend on the account being connected to be valid. |
|
91f9ce89468b
Fix connection errors getting deleted when an account is disconnected
Gary Kramlich <grim@reaperworld.com>
parents:
41511
diff
changeset
|
103 | * |
|
41511
2036d450fd18
Add purple_notification_manager_remove_with_account.
Gary Kramlich <grim@reaperworld.com>
parents:
41441
diff
changeset
|
104 | * Since: 3.0.0 |
|
2036d450fd18
Add purple_notification_manager_remove_with_account.
Gary Kramlich <grim@reaperworld.com>
parents:
41441
diff
changeset
|
105 | */ |
|
41817
91f9ce89468b
Fix connection errors getting deleted when an account is disconnected
Gary Kramlich <grim@reaperworld.com>
parents:
41511
diff
changeset
|
106 | void purple_notification_manager_remove_with_account(PurpleNotificationManager *manager, PurpleAccount *account, gboolean all); |
|
41511
2036d450fd18
Add purple_notification_manager_remove_with_account.
Gary Kramlich <grim@reaperworld.com>
parents:
41441
diff
changeset
|
107 | |
|
2036d450fd18
Add purple_notification_manager_remove_with_account.
Gary Kramlich <grim@reaperworld.com>
parents:
41441
diff
changeset
|
108 | /** |
|
41433
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
109 | * purple_notification_manager_get_unread_count: |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
110 | * @manager: The instance. |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
111 | * |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
112 | * Gets the number of currently unread notifications. |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
113 | * |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
114 | * Returns: The number of unread notifications. |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
115 | * |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
116 | * Since: 3.0.0 |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
117 | */ |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
118 | guint purple_notification_manager_get_unread_count(PurpleNotificationManager *manager); |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
119 | |
|
41441
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
41438
diff
changeset
|
120 | /** |
|
41936
c4a96b5eecba
Make PurpleNotificationManager implement GListModel
Gary Kramlich <grim@reaperworld.com>
parents:
41817
diff
changeset
|
121 | * purple_notification_manager_clear: |
|
41441
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
41438
diff
changeset
|
122 | * @manager: The instance. |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
41438
diff
changeset
|
123 | * |
|
41936
c4a96b5eecba
Make PurpleNotificationManager implement GListModel
Gary Kramlich <grim@reaperworld.com>
parents:
41817
diff
changeset
|
124 | * Removes all notifications from @manager. |
|
41441
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
41438
diff
changeset
|
125 | * |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
41438
diff
changeset
|
126 | * Since: 3.0.0 |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
41438
diff
changeset
|
127 | */ |
|
41936
c4a96b5eecba
Make PurpleNotificationManager implement GListModel
Gary Kramlich <grim@reaperworld.com>
parents:
41817
diff
changeset
|
128 | void purple_notification_manager_clear(PurpleNotificationManager *manager); |
|
41441
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
41438
diff
changeset
|
129 | |
|
41433
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
130 | G_END_DECLS |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
131 | |
|
d563b345a096
Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
132 | #endif /* PURPLE_NOTIFICATION_MANAGER_H */ |