libpurple/purplenotification.c

Sat, 13 Apr 2024 21:21:59 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Sat, 13 Apr 2024 21:21:59 -0500
changeset 42715
f886f74847b0
parent 42648
70d33d4dac09
child 42725
ceb13f1de2d2
permissions
-rw-r--r--

Remove PurpleIMConversation and PurpleProtocolIM

Both of these have been replaced and needed to be removed.

Testing Done:
Checked in with our turtle buddies.

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

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 *
42594
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
5 * Purple is the legal property of its developers, whose names are too numerous
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
6 * to list here. Please refer to the COPYRIGHT file distributed with this
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
7 * source distribution.
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 *
42594
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
9 * This library is free software; you can redistribute it and/or modify it
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
10 * under the terms of the GNU General Public License as published by the Free
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
11 * Software Foundation; either version 2 of the License, or (at your option)
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
12 * any later version.
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 *
42594
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
14 * This library is distributed in the hope that it will be useful, but WITHOUT
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
17 * more details.
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
18 *
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
19 * You should have received a copy of the GNU General Public License along with
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
20 * this library; if not, see <https://www.gnu.org/licenses/>.
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 */
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
23 #include <glib/gi18n-lib.h>
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
24
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25 #include "purplenotification.h"
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 #include "purpleenums.h"
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
29 typedef struct {
42648
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
30 char *id;
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31 PurpleNotificationType type;
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32 PurpleAccount *account;
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 GDateTime *created_timestamp;
42648
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
35 char *title;
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
36 char *subtitle;
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
37
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
38 char *icon_name;
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39 gboolean read;
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 gboolean interactive;
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 gpointer data;
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 GDestroyNotify data_destroy_func;
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
44
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
45 gboolean deleted;
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
46 } PurpleNotificationPrivate;
41433
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 enum {
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
49 SIG_DELETED,
42584
687260353985 Make signal and property enums and initializers consistent
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42576
diff changeset
50 N_SIGNALS,
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
51 };
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
52 static guint signals[N_SIGNALS] = {0, };
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
53
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
54 enum {
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55 PROP_0,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56 PROP_ID,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57 PROP_TYPE,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58 PROP_ACCOUNT,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59 PROP_CREATED_TIMESTAMP,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 PROP_TITLE,
42648
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
61 PROP_SUBTITLE,
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62 PROP_ICON_NAME,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63 PROP_READ,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 PROP_INTERACTIVE,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65 PROP_DATA,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66 PROP_DATA_DESTROY_FUNC,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67 N_PROPERTIES,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68 };
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69 static GParamSpec *properties[N_PROPERTIES] = {NULL, };
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70
42648
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
71 G_DEFINE_TYPE_WITH_PRIVATE(PurpleNotification, purple_notification,
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
72 G_TYPE_OBJECT)
41433
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 /******************************************************************************
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75 * Helpers
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76 *****************************************************************************/
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77 static void
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78 purple_notification_set_id(PurpleNotification *notification, const gchar *id) {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
79 PurpleNotificationPrivate *priv = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
80
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
81 g_return_if_fail(PURPLE_IS_NOTIFICATION(notification));
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
82
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
83 priv = purple_notification_get_instance_private(notification);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
84
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85 if(id == NULL) {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
86 priv->id = g_uuid_string_random();
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87 } else {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
88 priv->id = g_strdup(id);
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89 }
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 g_object_notify_by_pspec(G_OBJECT(notification), properties[PROP_ID]);
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
92 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
93
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
94 static void
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
95 purple_notification_set_notification_type(PurpleNotification *notification,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
96 PurpleNotificationType type)
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97 {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
98 PurpleNotificationPrivate *priv = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
99
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
100 g_return_if_fail(PURPLE_IS_NOTIFICATION(notification));
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
101
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
102 priv = purple_notification_get_instance_private(notification);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
103
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
104 priv->type = type;
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
105
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
106 g_object_notify_by_pspec(G_OBJECT(notification), properties[PROP_TYPE]);
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
107 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
108
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
109 static void
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
110 purple_notification_set_account(PurpleNotification *notification,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
111 PurpleAccount *account)
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
112 {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
113 PurpleNotificationPrivate *priv = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
114
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
115 g_return_if_fail(PURPLE_IS_NOTIFICATION(notification));
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
116
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
117 priv = purple_notification_get_instance_private(notification);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
118
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
119 if(g_set_object(&priv->account, account)) {
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
120 g_object_notify_by_pspec(G_OBJECT(notification),
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
121 properties[PROP_ACCOUNT]);
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
122 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
123 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
124
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
125 static void
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
126 purple_notification_set_data(PurpleNotification *notification, gpointer data) {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
127 PurpleNotificationPrivate *priv = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
128
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
129 g_return_if_fail(PURPLE_IS_NOTIFICATION(notification));
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
130
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
131 priv = purple_notification_get_instance_private(notification);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
132
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
133 priv->data = data;
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
134
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
135 g_object_notify_by_pspec(G_OBJECT(notification), properties[PROP_DATA]);
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
136 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
137
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
138 static void
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
139 purple_notification_set_data_destroy_func(PurpleNotification *notification,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
140 GDestroyNotify data_destroy_func)
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
141 {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
142 PurpleNotificationPrivate *priv = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
143
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
144 g_return_if_fail(PURPLE_IS_NOTIFICATION(notification));
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
145
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
146 priv = purple_notification_get_instance_private(notification);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
147
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
148 priv->data_destroy_func = data_destroy_func;
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
149
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
150 g_object_notify_by_pspec(G_OBJECT(notification),
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
151 properties[PROP_DATA_DESTROY_FUNC]);
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
152 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
153
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
154 /******************************************************************************
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
155 * GObject Implementation
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
156 *****************************************************************************/
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
157 static void
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
158 purple_notification_get_property(GObject *obj, guint param_id, GValue *value,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
159 GParamSpec *pspec)
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
160 {
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
161 PurpleNotification *notification = PURPLE_NOTIFICATION(obj);
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
162
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
163 switch(param_id) {
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
164 case PROP_ID:
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
165 g_value_set_string(value,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
166 purple_notification_get_id(notification));
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
167 break;
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
168 case PROP_TYPE:
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
169 g_value_set_enum(value,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
170 purple_notification_get_notification_type(notification));
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
171 break;
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
172 case PROP_ACCOUNT:
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
173 g_value_set_object(value,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
174 purple_notification_get_account(notification));
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
175 break;
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
176 case PROP_CREATED_TIMESTAMP:
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
177 g_value_set_boxed(value,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
178 purple_notification_get_created_timestamp(notification));
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
179 break;
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
180 case PROP_TITLE:
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
181 g_value_set_string(value,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
182 purple_notification_get_title(notification));
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
183 break;
42648
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
184 case PROP_SUBTITLE:
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
185 g_value_set_string(value,
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
186 purple_notification_get_subtitle(notification));
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
187 break;
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
188 case PROP_ICON_NAME:
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
189 g_value_set_string(value,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
190 purple_notification_get_icon_name(notification));
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
191 break;
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
192 case PROP_READ:
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
193 g_value_set_boolean(value,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
194 purple_notification_get_read(notification));
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
195 break;
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
196 case PROP_INTERACTIVE:
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
197 g_value_set_boolean(value,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
198 purple_notification_get_interactive(notification));
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
199 break;
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
200 case PROP_DATA:
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
201 g_value_set_pointer(value,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
202 purple_notification_get_data(notification));
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
203 break;
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
204 default:
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
205 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
206 break;
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
207 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
208 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
209
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
210 static void
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
211 purple_notification_set_property(GObject *obj, guint param_id,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
212 const GValue *value, GParamSpec *pspec)
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
213 {
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
214 PurpleNotification *notification = PURPLE_NOTIFICATION(obj);
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
215
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
216 switch(param_id) {
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
217 case PROP_ID:
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
218 purple_notification_set_id(notification,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
219 g_value_get_string(value));
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
220 break;
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
221 case PROP_TYPE:
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
222 purple_notification_set_notification_type(notification,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
223 g_value_get_enum(value));
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
224 break;
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
225 case PROP_ACCOUNT:
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
226 purple_notification_set_account(notification,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
227 g_value_get_object(value));
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
228 break;
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
229 case PROP_CREATED_TIMESTAMP:
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
230 purple_notification_set_created_timestamp(notification,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
231 g_value_get_boxed(value));
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
232 break;
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
233 case PROP_TITLE:
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
234 purple_notification_set_title(notification,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
235 g_value_get_string(value));
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
236 break;
42648
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
237 case PROP_SUBTITLE:
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
238 purple_notification_set_subtitle(notification,
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
239 g_value_get_string(value));
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
240 break;
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
241 case PROP_ICON_NAME:
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
242 purple_notification_set_icon_name(notification,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
243 g_value_get_string(value));
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
244 break;
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
245 case PROP_READ:
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
246 purple_notification_set_read(notification,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
247 g_value_get_boolean(value));
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
248 break;
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
249 case PROP_INTERACTIVE:
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
250 purple_notification_set_interactive(notification,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
251 g_value_get_boolean(value));
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
252 break;
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
253 case PROP_DATA:
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
254 purple_notification_set_data(notification,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
255 g_value_get_pointer(value));
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
256 break;
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
257 case PROP_DATA_DESTROY_FUNC:
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
258 purple_notification_set_data_destroy_func(notification,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
259 g_value_get_pointer(value));
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
260 break;
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
261 default:
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
262 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
263 break;
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
264 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
265 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
266
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
267 static void
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
268 purple_notification_finalize(GObject *obj) {
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
269 PurpleNotification *notification = PURPLE_NOTIFICATION(obj);
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
270 PurpleNotificationPrivate *priv = NULL;
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
271
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
272 priv = purple_notification_get_instance_private(notification);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
273
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
274 g_clear_pointer(&priv->id, g_free);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
275 g_clear_object(&priv->account);
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
276
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
277 g_clear_pointer(&priv->created_timestamp, g_date_time_unref);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
278 g_clear_pointer(&priv->title, g_free);
42648
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
279 g_clear_pointer(&priv->subtitle, g_free);
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
280 g_clear_pointer(&priv->icon_name, g_free);
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
281
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
282 if(priv->data_destroy_func != NULL) {
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
283 priv->data_destroy_func(priv->data);
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
284 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
285
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
286 G_OBJECT_CLASS(purple_notification_parent_class)->finalize(obj);
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
287 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
288
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
289 static void
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
290 purple_notification_init(PurpleNotification *notification) {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
291 PurpleNotificationPrivate *priv = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
292
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
293 priv = purple_notification_get_instance_private(notification);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
294
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
295 purple_notification_set_id(notification, NULL);
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
296
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
297 if(priv->created_timestamp == NULL) {
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
298 purple_notification_set_created_timestamp(notification, NULL);
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
299 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
300 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
301
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
302 static void
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
303 purple_notification_class_init(PurpleNotificationClass *klass) {
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
304 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
305
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
306 obj_class->get_property = purple_notification_get_property;
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
307 obj_class->set_property = purple_notification_set_property;
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
308 obj_class->finalize = purple_notification_finalize;
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
309
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
310 /**
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
311 * PurpleNotification::deleted:
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
312 * @notification: The instance.
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
313 *
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
314 * Emitted when the notification is deleted. This is typically done by a
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
315 * user interface calling [method@PurpleNotification.delete].
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
316 *
42614
b75a5bbf6c35 Remove the micro version from since tags for libpurple part 3
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
317 * Since: 3.0
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
318 */
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
319 signals[SIG_DELETED] = g_signal_new_class_handler(
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
320 "deleted",
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
321 G_OBJECT_CLASS_TYPE(klass),
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
322 G_SIGNAL_RUN_LAST,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
323 NULL,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
324 NULL,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
325 NULL,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
326 NULL,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
327 G_TYPE_NONE,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
328 0);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
329
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
330 /**
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
331 * PurpleNotification:id:
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
332 *
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
333 * The ID of the notification. Used for things that need to address it.
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
334 * This is auto populated at creation time.
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
335 *
42614
b75a5bbf6c35 Remove the micro version from since tags for libpurple part 3
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
336 * Since: 3.0
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
337 */
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
338 properties[PROP_ID] = g_param_spec_string(
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
339 "id", "id",
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
340 "The identifier of the notification.",
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
341 NULL,
42648
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
342 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
343
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
344 /**
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
345 * PurpleNotification:type:
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
346 *
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
347 * The [enum@NotificationType] of this notification.
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
348 *
42614
b75a5bbf6c35 Remove the micro version from since tags for libpurple part 3
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
349 * Since: 3.0
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
350 */
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
351 properties[PROP_TYPE] = g_param_spec_enum(
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
352 "type", "type",
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
353 "The type of notification.",
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
354 PURPLE_TYPE_NOTIFICATION_TYPE,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
355 PURPLE_NOTIFICATION_TYPE_UNKNOWN,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
356 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
357
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
358 /**
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
359 * PurpleNotification:account:
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
360 *
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
361 * An optional [class@Account] that this notification is for.
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
362 *
42614
b75a5bbf6c35 Remove the micro version from since tags for libpurple part 3
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
363 * Since: 3.0
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
364 */
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
365 properties[PROP_ACCOUNT] = g_param_spec_object(
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
366 "account", "account",
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
367 "The optional account that this notification is for.",
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
368 PURPLE_TYPE_ACCOUNT,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
369 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
370
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
371 /**
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
372 * PurpleNotification:created-timestamp:
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
373 *
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
374 * The creation time of this notification. This always represented as UTC
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
375 * internally, and will be set to UTC now by default.
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
376 *
42614
b75a5bbf6c35 Remove the micro version from since tags for libpurple part 3
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
377 * Since: 3.0
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
378 */
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
379 properties[PROP_CREATED_TIMESTAMP] = g_param_spec_boxed(
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
380 "created-timestamp", "created-timestamp",
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
381 "The timestamp when this notification was created.",
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
382 G_TYPE_DATE_TIME,
42648
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
383 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
384
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
385 /**
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
386 * PurpleNotification:title:
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
387 *
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
388 * An optional title for this notification. A user interface may or may not
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
389 * choose to use this when displaying the notification. Regardless, this
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
390 * should be a translated string.
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
391 *
42614
b75a5bbf6c35 Remove the micro version from since tags for libpurple part 3
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
392 * Since: 3.0
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
393 */
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
394 properties[PROP_TITLE] = g_param_spec_string(
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
395 "title", "title",
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
396 "The title for the notification.",
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
397 NULL,
42648
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
398 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
399
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
400 /**
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
401 * PurpleNotification:subtitle:
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
402 *
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
403 * An optional subtitle for this notification. A user interface may or may
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
404 * not choose to use this when displaying the notification. Regardless,
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
405 * this should be a translated string.
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
406 *
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
407 * Since: 3.0
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
408 */
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
409 properties[PROP_SUBTITLE] = g_param_spec_string(
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
410 "subtitle", "subtitle",
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
411 "The subtitle for the notification.",
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
412 NULL,
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
413 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
414
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
415 /**
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
416 * PurpleNotification:icon-name:
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
417 *
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
418 * The icon-name in the icon theme to use for the notification. A user
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
419 * interface may or may not choose to use this when display the
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
420 * notification.
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
421 *
42614
b75a5bbf6c35 Remove the micro version from since tags for libpurple part 3
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
422 * Since: 3.0
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
423 */
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
424 properties[PROP_ICON_NAME] = g_param_spec_string(
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
425 "icon-name", "icon-name",
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
426 "The icon name for the notification.",
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
427 NULL,
42648
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
428 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
429
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
430 /**
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
431 * PurpleNotification:read:
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
432 *
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
433 * Whether or not the notification has been read.
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
434 *
42614
b75a5bbf6c35 Remove the micro version from since tags for libpurple part 3
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
435 * Since: 3.0
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
436 */
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
437 properties[PROP_READ] = g_param_spec_boolean(
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
438 "read", "read",
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
439 "Whether or not the notification has been read.",
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
440 FALSE,
42648
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
441 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
442
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
443 /**
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
444 * PurpleNotification:interactive:
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
445 *
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
446 * Whether or not the notification can be interacted with.
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
447 *
42614
b75a5bbf6c35 Remove the micro version from since tags for libpurple part 3
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
448 * Since: 3.0
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
449 */
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
450 properties[PROP_INTERACTIVE] = g_param_spec_boolean(
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
451 "interactive", "interactive",
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
452 "Whether or not the notification can be interacted with.",
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
453 FALSE,
42648
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
454 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
455
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
456 /**
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
457 * PurpleNotification:data:
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
458 *
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
459 * Data specific to the [enum@NotificationType] for the notification.
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
460 *
42614
b75a5bbf6c35 Remove the micro version from since tags for libpurple part 3
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
461 * Since: 3.0
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
462 */
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
463 properties[PROP_DATA] = g_param_spec_pointer(
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
464 "data", "data",
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
465 "The type specific data for the notification.",
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
466 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
467
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
468 /**
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
469 * PurpleNotification:data-destroy-func:
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
470 *
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
471 * A function to call to free [property@PurpleNotification:data].
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
472 *
42614
b75a5bbf6c35 Remove the micro version from since tags for libpurple part 3
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
473 * Since: 3.0
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
474 */
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
475 properties[PROP_DATA_DESTROY_FUNC] = g_param_spec_pointer(
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
476 "data-destroy-func", "data-destroy-func",
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
477 "The destroy function to clean up the data property.",
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
478 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
479
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
480 g_object_class_install_properties(obj_class, N_PROPERTIES, properties);
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
481
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
482 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
483
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
484 /******************************************************************************
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
485 * Public API
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
486 *****************************************************************************/
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
487 PurpleNotification *
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
488 purple_notification_new(PurpleNotificationType type, PurpleAccount *account,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
489 gpointer data, GDestroyNotify data_destroy_func)
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
490 {
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
491 return g_object_new(PURPLE_TYPE_NOTIFICATION,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
492 "type", type,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
493 "account", account,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
494 "data", data,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
495 "data-destroy-func", data_destroy_func,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
496 NULL);
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
497 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
498
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
499 PurpleNotification *
41517
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
500 purple_notification_new_from_add_contact_request(PurpleAddContactRequest *request)
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
501 {
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
502 PurpleAccount *account = NULL;
41976
49969fa9a664 Update libpurple for the deprecations in the account api
Gary Kramlich <grim@reaperworld.com>
parents: 41819
diff changeset
503 PurpleContactInfo *info = NULL;
41517
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
504 PurpleNotification *notification = NULL;
42648
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
505 char *title = NULL;
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
506 const char *alias = NULL;
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
507 const char *username = NULL;
41517
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
508
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
509 g_return_val_if_fail(PURPLE_IS_ADD_CONTACT_REQUEST(request), NULL);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
510
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
511 account = purple_add_contact_request_get_account(request);
41976
49969fa9a664 Update libpurple for the deprecations in the account api
Gary Kramlich <grim@reaperworld.com>
parents: 41819
diff changeset
512 info = PURPLE_CONTACT_INFO(account);
41517
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
513 notification = purple_notification_new(PURPLE_NOTIFICATION_TYPE_ADD_CONTACT,
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
514 account, request, g_object_unref);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
515
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
516 username = purple_add_contact_request_get_username(request);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
517 alias = purple_add_contact_request_get_alias(request);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
518
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
519 if(alias != NULL && *alias != '\0') {
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
520 title = g_strdup_printf(_("%s (%s) added %s to their contact list"),
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
521 alias, username,
41976
49969fa9a664 Update libpurple for the deprecations in the account api
Gary Kramlich <grim@reaperworld.com>
parents: 41819
diff changeset
522 purple_contact_info_get_username(info));
41517
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
523 } else {
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
524 title = g_strdup_printf(_("%s added %s to their contact list"),
41976
49969fa9a664 Update libpurple for the deprecations in the account api
Gary Kramlich <grim@reaperworld.com>
parents: 41819
diff changeset
525 username,
49969fa9a664 Update libpurple for the deprecations in the account api
Gary Kramlich <grim@reaperworld.com>
parents: 41819
diff changeset
526 purple_contact_info_get_username(info));
41517
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
527 }
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
528
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
529 purple_notification_set_title(notification, title);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
530 g_free(title);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
531
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
532 return notification;
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
533 }
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
534
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents: 41514
diff changeset
535 PurpleNotification *
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
536 purple_notification_new_from_authorization_request(PurpleAuthorizationRequest *authorization_request)
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
537 {
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
538 PurpleAccount *account = NULL;
41976
49969fa9a664 Update libpurple for the deprecations in the account api
Gary Kramlich <grim@reaperworld.com>
parents: 41819
diff changeset
539 PurpleContactInfo *info = NULL;
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
540 PurpleNotification *notification = NULL;
42648
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
541 char *title = NULL;
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
542 const char *alias = NULL;
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
543 const char *username = NULL;
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
544
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
545 g_return_val_if_fail(PURPLE_IS_AUTHORIZATION_REQUEST(authorization_request),
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
546 NULL);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
547
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
548 account = purple_authorization_request_get_account(authorization_request);
41976
49969fa9a664 Update libpurple for the deprecations in the account api
Gary Kramlich <grim@reaperworld.com>
parents: 41819
diff changeset
549 info = PURPLE_CONTACT_INFO(account);
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
550 notification = purple_notification_new(PURPLE_NOTIFICATION_TYPE_AUTHORIZATION_REQUEST,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
551 account, authorization_request,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
552 g_object_unref);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
553
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
554 username = purple_authorization_request_get_username(authorization_request);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
555 alias = purple_authorization_request_get_alias(authorization_request);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
556
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
557 if(alias != NULL && *alias != '\0') {
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
558 title = g_strdup_printf(_("%s (%s) would like to add %s to their"
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
559 " contact list"),
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
560 alias, username,
41976
49969fa9a664 Update libpurple for the deprecations in the account api
Gary Kramlich <grim@reaperworld.com>
parents: 41819
diff changeset
561 purple_contact_info_get_username(info));
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
562 } else {
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
563 title = g_strdup_printf(_("%s would like to add %s to their contact"
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
564 " list"),
41976
49969fa9a664 Update libpurple for the deprecations in the account api
Gary Kramlich <grim@reaperworld.com>
parents: 41819
diff changeset
565 username,
49969fa9a664 Update libpurple for the deprecations in the account api
Gary Kramlich <grim@reaperworld.com>
parents: 41819
diff changeset
566 purple_contact_info_get_username(info));
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
567 }
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
568
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
569 purple_notification_set_title(notification, title);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
570 g_free(title);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
571
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
572 return notification;
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
573 }
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
574
41819
4461c8ec4d65 Create purple_notification_new_from_connection_error to clean up the accounts code
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
575 PurpleNotification *
4461c8ec4d65 Create purple_notification_new_from_connection_error to clean up the accounts code
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
576 purple_notification_new_from_connection_error(PurpleAccount *account,
4461c8ec4d65 Create purple_notification_new_from_connection_error to clean up the accounts code
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
577 PurpleConnectionErrorInfo *info)
4461c8ec4d65 Create purple_notification_new_from_connection_error to clean up the accounts code
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
578 {
4461c8ec4d65 Create purple_notification_new_from_connection_error to clean up the accounts code
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
579 PurpleNotification *notification = NULL;
4461c8ec4d65 Create purple_notification_new_from_connection_error to clean up the accounts code
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
580 PurpleProtocol *protocol = NULL;
4461c8ec4d65 Create purple_notification_new_from_connection_error to clean up the accounts code
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
581 char *title = NULL;
4461c8ec4d65 Create purple_notification_new_from_connection_error to clean up the accounts code
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
582 const char *username = NULL;
4461c8ec4d65 Create purple_notification_new_from_connection_error to clean up the accounts code
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
583
4461c8ec4d65 Create purple_notification_new_from_connection_error to clean up the accounts code
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
584 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
4461c8ec4d65 Create purple_notification_new_from_connection_error to clean up the accounts code
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
585 g_return_val_if_fail(info != NULL, NULL);
4461c8ec4d65 Create purple_notification_new_from_connection_error to clean up the accounts code
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
586
4461c8ec4d65 Create purple_notification_new_from_connection_error to clean up the accounts code
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
587 notification = purple_notification_new(PURPLE_NOTIFICATION_TYPE_CONNECTION_ERROR,
4461c8ec4d65 Create purple_notification_new_from_connection_error to clean up the accounts code
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
588 account, info, NULL);
4461c8ec4d65 Create purple_notification_new_from_connection_error to clean up the accounts code
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
589
4461c8ec4d65 Create purple_notification_new_from_connection_error to clean up the accounts code
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
590 /* Set the title of the notification. */
41976
49969fa9a664 Update libpurple for the deprecations in the account api
Gary Kramlich <grim@reaperworld.com>
parents: 41819
diff changeset
591 username = purple_contact_info_get_username(PURPLE_CONTACT_INFO(account));
41819
4461c8ec4d65 Create purple_notification_new_from_connection_error to clean up the accounts code
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
592 if(purple_account_get_enabled(account)) {
4461c8ec4d65 Create purple_notification_new_from_connection_error to clean up the accounts code
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
593 title = g_strdup_printf(_("%s disconnected"), username);
4461c8ec4d65 Create purple_notification_new_from_connection_error to clean up the accounts code
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
594 } else {
4461c8ec4d65 Create purple_notification_new_from_connection_error to clean up the accounts code
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
595 title = g_strdup_printf(_("%s disabled"), username);
4461c8ec4d65 Create purple_notification_new_from_connection_error to clean up the accounts code
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
596 }
4461c8ec4d65 Create purple_notification_new_from_connection_error to clean up the accounts code
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
597 purple_notification_set_title(notification, title);
4461c8ec4d65 Create purple_notification_new_from_connection_error to clean up the accounts code
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
598 g_free(title);
4461c8ec4d65 Create purple_notification_new_from_connection_error to clean up the accounts code
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
599
4461c8ec4d65 Create purple_notification_new_from_connection_error to clean up the accounts code
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
600 /* Add the protocol's icon as the notification's icon. */
4461c8ec4d65 Create purple_notification_new_from_connection_error to clean up the accounts code
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
601 protocol = purple_account_get_protocol(account);
4461c8ec4d65 Create purple_notification_new_from_connection_error to clean up the accounts code
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
602 if(PURPLE_IS_PROTOCOL(protocol)) {
4461c8ec4d65 Create purple_notification_new_from_connection_error to clean up the accounts code
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
603 const char *icon_name = purple_protocol_get_icon_name(protocol);
4461c8ec4d65 Create purple_notification_new_from_connection_error to clean up the accounts code
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
604
4461c8ec4d65 Create purple_notification_new_from_connection_error to clean up the accounts code
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
605 if(icon_name != NULL) {
4461c8ec4d65 Create purple_notification_new_from_connection_error to clean up the accounts code
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
606 purple_notification_set_icon_name(notification, icon_name);
4461c8ec4d65 Create purple_notification_new_from_connection_error to clean up the accounts code
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
607 }
4461c8ec4d65 Create purple_notification_new_from_connection_error to clean up the accounts code
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
608 }
4461c8ec4d65 Create purple_notification_new_from_connection_error to clean up the accounts code
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
609
4461c8ec4d65 Create purple_notification_new_from_connection_error to clean up the accounts code
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
610 return notification;
4461c8ec4d65 Create purple_notification_new_from_connection_error to clean up the accounts code
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
611 }
4461c8ec4d65 Create purple_notification_new_from_connection_error to clean up the accounts code
Gary Kramlich <grim@reaperworld.com>
parents: 41517
diff changeset
612
42648
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
613 const char *
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
614 purple_notification_get_id(PurpleNotification *notification) {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
615 PurpleNotificationPrivate *priv = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
616
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
617 g_return_val_if_fail(PURPLE_IS_NOTIFICATION(notification), NULL);
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
618
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
619 priv = purple_notification_get_instance_private(notification);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
620
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
621 return priv->id;
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
622 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
623
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
624 PurpleNotificationType
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
625 purple_notification_get_notification_type(PurpleNotification *notification) {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
626 PurpleNotificationPrivate *priv = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
627
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
628 g_return_val_if_fail(PURPLE_IS_NOTIFICATION(notification),
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
629 PURPLE_NOTIFICATION_TYPE_UNKNOWN);
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
630
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
631 priv = purple_notification_get_instance_private(notification);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
632
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
633 return priv->type;
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
634 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
635
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
636 PurpleAccount *
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
637 purple_notification_get_account(PurpleNotification *notification) {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
638 PurpleNotificationPrivate *priv = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
639
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
640 g_return_val_if_fail(PURPLE_IS_NOTIFICATION(notification), NULL);
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
641
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
642 priv = purple_notification_get_instance_private(notification);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
643
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
644 return priv->account;
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
645 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
646
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
647 GDateTime *
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
648 purple_notification_get_created_timestamp(PurpleNotification *notification) {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
649 PurpleNotificationPrivate *priv = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
650
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
651 g_return_val_if_fail(PURPLE_IS_NOTIFICATION(notification), NULL);
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
652
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
653 priv = purple_notification_get_instance_private(notification);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
654
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
655 return priv->created_timestamp;
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
656 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
657
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
658 void
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
659 purple_notification_set_created_timestamp(PurpleNotification *notification,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
660 GDateTime *timestamp)
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
661 {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
662 PurpleNotificationPrivate *priv = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
663
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
664 g_return_if_fail(PURPLE_IS_NOTIFICATION(notification));
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
665
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
666 priv = purple_notification_get_instance_private(notification);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
667
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
668 g_clear_pointer(&priv->created_timestamp, g_date_time_unref);
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
669
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
670 if(timestamp == NULL) {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
671 priv->created_timestamp = g_date_time_new_now_utc();
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
672 } else {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
673 priv->created_timestamp = g_date_time_to_utc(timestamp);
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
674 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
675
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
676 g_object_notify_by_pspec(G_OBJECT(notification),
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
677 properties[PROP_CREATED_TIMESTAMP]);
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
678 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
679
42648
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
680 const char *
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
681 purple_notification_get_title(PurpleNotification *notification) {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
682 PurpleNotificationPrivate *priv = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
683
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
684 g_return_val_if_fail(PURPLE_IS_NOTIFICATION(notification), NULL);
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
685
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
686 priv = purple_notification_get_instance_private(notification);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
687
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
688 return priv->title;
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
689 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
690
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
691 void
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
692 purple_notification_set_title(PurpleNotification *notification,
42648
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
693 const char *title)
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
694 {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
695 PurpleNotificationPrivate *priv = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
696
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
697 g_return_if_fail(PURPLE_IS_NOTIFICATION(notification));
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
698
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
699 priv = purple_notification_get_instance_private(notification);
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
700
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
701 if(!purple_strequal(priv->title, title)) {
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
702 g_free(priv->title);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
703 priv->title = g_strdup(title);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
704
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
705 g_object_notify_by_pspec(G_OBJECT(notification),
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
706 properties[PROP_TITLE]);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
707 }
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
708 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
709
42648
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
710 const char *
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
711 purple_notification_get_subtitle(PurpleNotification *notification) {
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
712 PurpleNotificationPrivate *priv = NULL;
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
713
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
714 g_return_val_if_fail(PURPLE_IS_NOTIFICATION(notification), NULL);
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
715
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
716 priv = purple_notification_get_instance_private(notification);
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
717
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
718 return priv->subtitle;
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
719 }
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
720
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
721 void
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
722 purple_notification_set_subtitle(PurpleNotification *notification,
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
723 const char *subtitle)
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
724 {
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
725 PurpleNotificationPrivate *priv = NULL;
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
726
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
727 g_return_if_fail(PURPLE_IS_NOTIFICATION(notification));
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
728
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
729 priv = purple_notification_get_instance_private(notification);
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
730
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
731 if(!purple_strequal(priv->subtitle, subtitle)) {
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
732 g_free(priv->subtitle);
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
733 priv->subtitle = g_strdup(subtitle);
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
734
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
735 g_object_notify_by_pspec(G_OBJECT(notification),
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
736 properties[PROP_SUBTITLE]);
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
737 }
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
738 }
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
739
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
740 const char *
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
741 purple_notification_get_icon_name(PurpleNotification *notification) {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
742 PurpleNotificationPrivate *priv = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
743
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
744 g_return_val_if_fail(PURPLE_IS_NOTIFICATION(notification), NULL);
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
745
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
746 priv = purple_notification_get_instance_private(notification);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
747
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
748 return priv->icon_name;
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
749 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
750
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
751 void
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
752 purple_notification_set_icon_name(PurpleNotification *notification,
42648
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
753 const char *icon_name)
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
754 {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
755 PurpleNotificationPrivate *priv = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
756
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
757 g_return_if_fail(PURPLE_IS_NOTIFICATION(notification));
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
758
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
759 priv = purple_notification_get_instance_private(notification);
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
760
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
761 if(!purple_strequal(priv->icon_name, icon_name)) {
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
762 g_free(priv->icon_name);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
763 priv->icon_name = g_strdup(icon_name);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
764
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
765 g_object_notify_by_pspec(G_OBJECT(notification),
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
766 properties[PROP_ICON_NAME]);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
767 }
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
768
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
769 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
770
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
771 gboolean
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
772 purple_notification_get_read(PurpleNotification *notification) {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
773 PurpleNotificationPrivate *priv = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
774
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
775 g_return_val_if_fail(PURPLE_IS_NOTIFICATION(notification), FALSE);
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
776
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
777 priv = purple_notification_get_instance_private(notification);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
778
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
779 return priv->read;
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
780 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
781
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
782 void
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
783 purple_notification_set_read(PurpleNotification *notification, gboolean read) {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
784 PurpleNotificationPrivate *priv = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
785
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
786 g_return_if_fail(PURPLE_IS_NOTIFICATION(notification));
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
787
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
788 priv = purple_notification_get_instance_private(notification);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
789
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
790 if(priv->read != read) {
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
791 priv->read = read;
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
792
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
793 g_object_notify_by_pspec(G_OBJECT(notification),
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
794 properties[PROP_READ]);
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
795 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
796 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
797
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
798 gboolean
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
799 purple_notification_get_interactive(PurpleNotification *notification) {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
800 PurpleNotificationPrivate *priv = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
801
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
802 g_return_val_if_fail(PURPLE_IS_NOTIFICATION(notification), FALSE);
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
803
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
804 priv = purple_notification_get_instance_private(notification);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
805
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
806 return priv->interactive;
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
807 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
808
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
809 void
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
810 purple_notification_set_interactive(PurpleNotification *notification,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
811 gboolean interactive)
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
812 {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
813 PurpleNotificationPrivate *priv = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
814
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
815 g_return_if_fail(PURPLE_IS_NOTIFICATION(notification));
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
816
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
817 priv = purple_notification_get_instance_private(notification);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
818
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
819 if(priv->interactive != interactive) {
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
820 priv->interactive = interactive;
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
821
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
822 g_object_notify_by_pspec(G_OBJECT(notification),
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
823 properties[PROP_INTERACTIVE]);
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
824 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
825 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
826
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
827 gpointer
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
828 purple_notification_get_data(PurpleNotification *notification) {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
829 PurpleNotificationPrivate *priv = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
830
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
831 g_return_val_if_fail(PURPLE_IS_NOTIFICATION(notification), NULL);
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
832
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
833 priv = purple_notification_get_instance_private(notification);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
834
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
835 return priv->data;
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
836 }
41438
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41433
diff changeset
837
42648
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
838 int
41438
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41433
diff changeset
839 purple_notification_compare(gconstpointer a, gconstpointer b) {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
840 PurpleNotification *notification_a = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
841 PurpleNotification *notification_b = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
842 PurpleNotificationPrivate *priv_a = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
843 PurpleNotificationPrivate *priv_b = NULL;
41438
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41433
diff changeset
844
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41433
diff changeset
845 if(a == NULL && b == NULL) {
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41433
diff changeset
846 return 0;
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41433
diff changeset
847 }
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41433
diff changeset
848
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41433
diff changeset
849 if(a == NULL) {
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41433
diff changeset
850 return -1;
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41433
diff changeset
851 }
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41433
diff changeset
852
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41433
diff changeset
853 if(b == NULL) {
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41433
diff changeset
854 return 1;
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41433
diff changeset
855 }
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41433
diff changeset
856
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41433
diff changeset
857 notification_a = (PurpleNotification *)a;
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41433
diff changeset
858 notification_b = (PurpleNotification *)b;
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41433
diff changeset
859
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
860 priv_a = purple_notification_get_instance_private(notification_a);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
861 priv_b = purple_notification_get_instance_private(notification_b);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
862
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
863 return g_date_time_compare(priv_a->created_timestamp,
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
864 priv_b->created_timestamp);
41438
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41433
diff changeset
865 }
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
866
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
867 void
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
868 purple_notification_delete(PurpleNotification *notification) {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
869 PurpleNotificationPrivate *priv = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
870
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
871 g_return_if_fail(PURPLE_IS_NOTIFICATION(notification));
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
872
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
873 priv = purple_notification_get_instance_private(notification);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
874
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
875 /* Calling this multiple times is a programming error. */
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
876 g_return_if_fail(priv->deleted == FALSE);
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
877
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
878 priv->deleted = TRUE;
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
879
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
880 g_signal_emit(notification, signals[SIG_DELETED], 0);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
881 }

mercurial