libpurple/purplenotification.c

Sat, 09 Aug 2025 17:37:27 +0800

author
Gong Zhile <gongzl@stu.hebust.edu.cn>
date
Sat, 09 Aug 2025 17:37:27 +0800
branch
bird-header-fix
changeset 43304
2599d35e9750
parent 43181
ccc35f487917
permissions
-rw-r--r--

Fix the birb header path

The birb header referred would only work with birb provided by wrap casuing
build to fail because of system-installed birb dependency. The commit points
it to the correct path <birb.h>.

See: https://keep.imfreedom.org/birb/birb/file/5bf00c7d7f80/birb/meson.build#l77

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
42909
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
25 #include <birb.h>
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
26
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 #include "purplenotification.h"
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29 #include "purpleenums.h"
42922
46b64a8cbec4 Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents: 42914
diff changeset
30 #include "purplenotificationaddcontact.h"
42929
e9cc6fc1f717 Update Purple.NotificationAuthorizationRequest to take an id and auto populate account
Gary Kramlich <grim@reaperworld.com>
parents: 42928
diff changeset
31 #include "purplenotificationauthorizationrequest.h"
42985
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents: 42929
diff changeset
32 #include "purplenotificationconnectionerror.h"
42725
ceb13f1de2d2 Remove PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents: 42648
diff changeset
33 #include "util.h"
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
35 typedef struct {
42648
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
36 char *id;
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37 PurpleAccount *account;
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39 GDateTime *created_timestamp;
42648
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
40 char *title;
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
41 char *subtitle;
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
42
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
43 char *icon_name;
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 gboolean read;
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 gboolean interactive;
42909
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
46 gboolean persistent;
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 gpointer data;
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49 GDestroyNotify data_destroy_func;
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
50
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
51 gboolean deleted;
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
52 } PurpleNotificationPrivate;
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54 enum {
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
55 SIG_DELETED,
42584
687260353985 Make signal and property enums and initializers consistent
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42576
diff changeset
56 N_SIGNALS,
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
57 };
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
58 static guint signals[N_SIGNALS] = {0, };
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
59
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
60 enum {
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61 PROP_0,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62 PROP_ID,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63 PROP_ACCOUNT,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 PROP_CREATED_TIMESTAMP,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65 PROP_TITLE,
42648
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
66 PROP_SUBTITLE,
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67 PROP_ICON_NAME,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68 PROP_READ,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69 PROP_INTERACTIVE,
42909
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
70 PROP_PERSISTENT,
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71 N_PROPERTIES,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72 };
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73 static GParamSpec *properties[N_PROPERTIES] = {NULL, };
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74
42648
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
75 G_DEFINE_TYPE_WITH_PRIVATE(PurpleNotification, purple_notification,
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
76 G_TYPE_OBJECT)
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78 /******************************************************************************
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79 * Helpers
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
80 *****************************************************************************/
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
81 static void
42909
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
82 purple_notification_set_id(PurpleNotification *notification, const char *id) {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
83 PurpleNotificationPrivate *priv = NULL;
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 g_return_if_fail(PURPLE_IS_NOTIFICATION(notification));
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
87 priv = purple_notification_get_instance_private(notification);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
88
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89 if(id == NULL) {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
90 priv->id = g_uuid_string_random();
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91 } else {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
92 priv->id = g_strdup(id);
41433
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
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
95 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
96 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
98 /******************************************************************************
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
99 * GObject Implementation
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
100 *****************************************************************************/
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
101 static void
43181
ccc35f487917 Set Purple.Notification:create-timestamp to local now if not set
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
102 purple_notification_constructed(GObject *obj) {
ccc35f487917 Set Purple.Notification:create-timestamp to local now if not set
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
103 PurpleNotification *notification = NULL;
ccc35f487917 Set Purple.Notification:create-timestamp to local now if not set
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
104 PurpleNotificationPrivate *priv = NULL;
ccc35f487917 Set Purple.Notification:create-timestamp to local now if not set
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
105
ccc35f487917 Set Purple.Notification:create-timestamp to local now if not set
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
106 G_OBJECT_CLASS(purple_notification_parent_class)->constructed(obj);
ccc35f487917 Set Purple.Notification:create-timestamp to local now if not set
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
107
ccc35f487917 Set Purple.Notification:create-timestamp to local now if not set
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
108 notification = PURPLE_NOTIFICATION(obj);
ccc35f487917 Set Purple.Notification:create-timestamp to local now if not set
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
109 priv = purple_notification_get_instance_private(notification);
ccc35f487917 Set Purple.Notification:create-timestamp to local now if not set
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
110
ccc35f487917 Set Purple.Notification:create-timestamp to local now if not set
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
111 if(priv->created_timestamp == NULL) {
ccc35f487917 Set Purple.Notification:create-timestamp to local now if not set
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
112 priv->created_timestamp = g_date_time_new_now_local();
ccc35f487917 Set Purple.Notification:create-timestamp to local now if not set
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
113 }
ccc35f487917 Set Purple.Notification:create-timestamp to local now if not set
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
114 }
ccc35f487917 Set Purple.Notification:create-timestamp to local now if not set
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
115
ccc35f487917 Set Purple.Notification:create-timestamp to local now if not set
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
116 static void
ccc35f487917 Set Purple.Notification:create-timestamp to local now if not set
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
117 purple_notification_finalize(GObject *obj) {
ccc35f487917 Set Purple.Notification:create-timestamp to local now if not set
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
118 PurpleNotification *notification = PURPLE_NOTIFICATION(obj);
ccc35f487917 Set Purple.Notification:create-timestamp to local now if not set
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
119 PurpleNotificationPrivate *priv = NULL;
ccc35f487917 Set Purple.Notification:create-timestamp to local now if not set
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
120
ccc35f487917 Set Purple.Notification:create-timestamp to local now if not set
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
121 priv = purple_notification_get_instance_private(notification);
ccc35f487917 Set Purple.Notification:create-timestamp to local now if not set
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
122
ccc35f487917 Set Purple.Notification:create-timestamp to local now if not set
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
123 g_clear_pointer(&priv->id, g_free);
ccc35f487917 Set Purple.Notification:create-timestamp to local now if not set
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
124 g_clear_object(&priv->account);
ccc35f487917 Set Purple.Notification:create-timestamp to local now if not set
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
125
ccc35f487917 Set Purple.Notification:create-timestamp to local now if not set
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
126 birb_date_time_clear(&priv->created_timestamp);
ccc35f487917 Set Purple.Notification:create-timestamp to local now if not set
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
127 g_clear_pointer(&priv->title, g_free);
ccc35f487917 Set Purple.Notification:create-timestamp to local now if not set
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
128 g_clear_pointer(&priv->subtitle, g_free);
ccc35f487917 Set Purple.Notification:create-timestamp to local now if not set
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
129 g_clear_pointer(&priv->icon_name, g_free);
ccc35f487917 Set Purple.Notification:create-timestamp to local now if not set
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
130
ccc35f487917 Set Purple.Notification:create-timestamp to local now if not set
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
131 G_OBJECT_CLASS(purple_notification_parent_class)->finalize(obj);
ccc35f487917 Set Purple.Notification:create-timestamp to local now if not set
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
132 }
ccc35f487917 Set Purple.Notification:create-timestamp to local now if not set
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
133
ccc35f487917 Set Purple.Notification:create-timestamp to local now if not set
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
134 static void
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
135 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
136 GParamSpec *pspec)
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 PurpleNotification *notification = PURPLE_NOTIFICATION(obj);
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
139
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
140 switch(param_id) {
42909
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
141 case PROP_ID:
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
142 g_value_set_string(value,
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
143 purple_notification_get_id(notification));
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
144 break;
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
145 case PROP_ACCOUNT:
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
146 g_value_set_object(value,
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
147 purple_notification_get_account(notification));
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
148 break;
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
149 case PROP_CREATED_TIMESTAMP:
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
150 g_value_set_boxed(value,
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
151 purple_notification_get_created_timestamp(notification));
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
152 break;
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
153 case PROP_TITLE:
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
154 g_value_set_string(value,
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
155 purple_notification_get_title(notification));
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
156 break;
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
157 case PROP_SUBTITLE:
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
158 g_value_set_string(value,
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
159 purple_notification_get_subtitle(notification));
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
160 break;
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
161 case PROP_ICON_NAME:
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
162 g_value_set_string(value,
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
163 purple_notification_get_icon_name(notification));
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
164 break;
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
165 case PROP_READ:
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
166 g_value_set_boolean(value,
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
167 purple_notification_get_read(notification));
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
168 break;
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
169 case PROP_INTERACTIVE:
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
170 g_value_set_boolean(value,
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
171 purple_notification_get_interactive(notification));
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
172 break;
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
173 case PROP_PERSISTENT:
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
174 g_value_set_boolean(value,
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
175 purple_notification_get_persistent(notification));
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
176 break;
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
177 default:
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
178 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
179 break;
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
180 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
181 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
182
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
183 static void
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
184 purple_notification_set_property(GObject *obj, guint param_id,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
185 const GValue *value, GParamSpec *pspec)
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
186 {
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
187 PurpleNotification *notification = PURPLE_NOTIFICATION(obj);
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
188
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
189 switch(param_id) {
42909
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
190 case PROP_ID:
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
191 purple_notification_set_id(notification,
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
192 g_value_get_string(value));
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
193 break;
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
194 case PROP_ACCOUNT:
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
195 purple_notification_set_account(notification,
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
196 g_value_get_object(value));
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
197 break;
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
198 case PROP_CREATED_TIMESTAMP:
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
199 purple_notification_set_created_timestamp(notification,
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
200 g_value_get_boxed(value));
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
201 break;
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
202 case PROP_TITLE:
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
203 purple_notification_set_title(notification,
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
204 g_value_get_string(value));
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
205 break;
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
206 case PROP_SUBTITLE:
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
207 purple_notification_set_subtitle(notification,
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
208 g_value_get_string(value));
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
209 break;
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
210 case PROP_ICON_NAME:
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
211 purple_notification_set_icon_name(notification,
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
212 g_value_get_string(value));
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
213 break;
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
214 case PROP_READ:
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
215 purple_notification_set_read(notification,
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
216 g_value_get_boolean(value));
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
217 break;
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
218 case PROP_INTERACTIVE:
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
219 purple_notification_set_interactive(notification,
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
220 g_value_get_boolean(value));
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
221 break;
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
222 case PROP_PERSISTENT:
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
223 purple_notification_set_persistent(notification,
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
224 g_value_get_boolean(value));
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
225 break;
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
226 default:
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
227 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
228 break;
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
229 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
230 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
231
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
232 static void
42927
51bee36eb6cb First steps of cleaning up the notification API
Gary Kramlich <grim@reaperworld.com>
parents: 42922
diff changeset
233 purple_notification_init(G_GNUC_UNUSED PurpleNotification *notification) {
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
234 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
235
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
236 static void
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
237 purple_notification_class_init(PurpleNotificationClass *klass) {
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
238 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
239
43181
ccc35f487917 Set Purple.Notification:create-timestamp to local now if not set
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
240 obj_class->constructed = purple_notification_constructed;
ccc35f487917 Set Purple.Notification:create-timestamp to local now if not set
Gary Kramlich <grim@reaperworld.com>
parents: 42988
diff changeset
241 obj_class->finalize = purple_notification_finalize;
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
242 obj_class->get_property = purple_notification_get_property;
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
243 obj_class->set_property = purple_notification_set_property;
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
244
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
245 /**
42909
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
246 * PurpleNotification:id:
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
247 *
42927
51bee36eb6cb First steps of cleaning up the notification API
Gary Kramlich <grim@reaperworld.com>
parents: 42922
diff changeset
248 * The ID of the notification.
51bee36eb6cb First steps of cleaning up the notification API
Gary Kramlich <grim@reaperworld.com>
parents: 42922
diff changeset
249 *
51bee36eb6cb First steps of cleaning up the notification API
Gary Kramlich <grim@reaperworld.com>
parents: 42922
diff changeset
250 * This used for things that need to address it.
51bee36eb6cb First steps of cleaning up the notification API
Gary Kramlich <grim@reaperworld.com>
parents: 42922
diff changeset
251 *
51bee36eb6cb First steps of cleaning up the notification API
Gary Kramlich <grim@reaperworld.com>
parents: 42922
diff changeset
252 * If not set, this will be auto populated at creation time.
42909
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
253 *
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
254 * Since: 3.0
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
255 */
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
256 properties[PROP_ID] = g_param_spec_string(
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
257 "id", NULL, NULL,
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
258 NULL,
42927
51bee36eb6cb First steps of cleaning up the notification API
Gary Kramlich <grim@reaperworld.com>
parents: 42922
diff changeset
259 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
42909
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
260
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
261 /**
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
262 * PurpleNotification:account:
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
263 *
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
264 * An optional [class@Account] that this notification is for.
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
265 *
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
266 * Since: 3.0
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
267 */
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
268 properties[PROP_ACCOUNT] = g_param_spec_object(
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
269 "account", NULL, NULL,
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
270 PURPLE_TYPE_ACCOUNT,
42927
51bee36eb6cb First steps of cleaning up the notification API
Gary Kramlich <grim@reaperworld.com>
parents: 42922
diff changeset
271 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
42909
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
272
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
273 /**
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
274 * PurpleNotification:created-timestamp:
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
275 *
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
276 * The creation time of this notification. This always represented as UTC
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
277 * internally, and will be set to UTC now by default.
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
278 *
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
279 * Since: 3.0
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
280 */
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
281 properties[PROP_CREATED_TIMESTAMP] = g_param_spec_boxed(
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
282 "created-timestamp", NULL, NULL,
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
283 G_TYPE_DATE_TIME,
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
284 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
285
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
286 /**
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
287 * PurpleNotification:title:
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
288 *
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
289 * An optional title for this notification. A user interface may or may not
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
290 * choose to use this when displaying the notification. Regardless, this
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
291 * should be a translated string.
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
292 *
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
293 * Since: 3.0
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
294 */
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
295 properties[PROP_TITLE] = g_param_spec_string(
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
296 "title", NULL, NULL,
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
297 NULL,
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
298 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
299
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
300 /**
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
301 * PurpleNotification:subtitle:
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
302 *
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
303 * An optional subtitle for this notification. A user interface may or may
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
304 * not choose to use this when displaying the notification. Regardless,
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
305 * this should be a translated string.
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
306 *
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
307 * Since: 3.0
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
308 */
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
309 properties[PROP_SUBTITLE] = g_param_spec_string(
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
310 "subtitle", NULL, NULL,
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
311 NULL,
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
312 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
313
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
314 /**
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
315 * PurpleNotification:icon-name:
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
316 *
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
317 * The icon-name in the icon theme to use for the notification. A user
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
318 * interface may or may not choose to use this when display the
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
319 * notification.
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
320 *
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
321 * Since: 3.0
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
322 */
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
323 properties[PROP_ICON_NAME] = g_param_spec_string(
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
324 "icon-name", NULL, NULL,
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
325 NULL,
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
326 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
327
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
328 /**
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
329 * PurpleNotification:read:
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
330 *
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
331 * Whether or not the notification has been read.
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
332 *
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
333 * Since: 3.0
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
334 */
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
335 properties[PROP_READ] = g_param_spec_boolean(
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
336 "read", NULL, NULL,
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
337 FALSE,
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
338 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
339
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
340 /**
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
341 * PurpleNotification:interactive:
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
342 *
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
343 * Whether or not the notification can be interacted with.
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
344 *
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
345 * Since: 3.0
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
346 */
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
347 properties[PROP_INTERACTIVE] = g_param_spec_boolean(
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
348 "interactive", NULL, NULL,
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
349 FALSE,
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
350 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
351
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
352 /**
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
353 * PurpleNotification:persistent:
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
354 *
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
355 * Whether or not the notification can be dismissed by users.
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
356 *
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
357 * Since: 3.0
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
358 */
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
359 properties[PROP_PERSISTENT] = g_param_spec_boolean(
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
360 "persistent", NULL, NULL,
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
361 FALSE,
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
362 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
363
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
364 g_object_class_install_properties(obj_class, N_PROPERTIES, properties);
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
365
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
366 /**
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
367 * PurpleNotification::deleted:
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
368 * @notification: The instance.
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
369 *
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
370 * 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
371 * user interface calling [method@PurpleNotification.delete].
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
372 *
42614
b75a5bbf6c35 Remove the micro version from since tags for libpurple part 3
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
373 * Since: 3.0
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
374 */
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
375 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
376 "deleted",
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
377 G_OBJECT_CLASS_TYPE(klass),
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
378 G_SIGNAL_RUN_LAST,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
379 NULL,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
380 NULL,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
381 NULL,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
382 NULL,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
383 G_TYPE_NONE,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
384 0);
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
385 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
386
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 * Public API
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
389 *****************************************************************************/
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
390 PurpleNotification *
42988
c2357ee36551 Replace Purple.Notification.new_generic with Purple.Notification.new
Gary Kramlich <grim@reaperworld.com>
parents: 42987
diff changeset
391 purple_notification_new(const char *id, const char *title) {
42927
51bee36eb6cb First steps of cleaning up the notification API
Gary Kramlich <grim@reaperworld.com>
parents: 42922
diff changeset
392 return g_object_new(PURPLE_TYPE_NOTIFICATION,
51bee36eb6cb First steps of cleaning up the notification API
Gary Kramlich <grim@reaperworld.com>
parents: 42922
diff changeset
393 "id", id,
51bee36eb6cb First steps of cleaning up the notification API
Gary Kramlich <grim@reaperworld.com>
parents: 42922
diff changeset
394 "title", title,
51bee36eb6cb First steps of cleaning up the notification API
Gary Kramlich <grim@reaperworld.com>
parents: 42922
diff changeset
395 NULL);
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
396 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
397
42648
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
398 const char *
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
399 purple_notification_get_id(PurpleNotification *notification) {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
400 PurpleNotificationPrivate *priv = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
401
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
402 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
403
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
404 priv = purple_notification_get_instance_private(notification);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
405
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
406 return priv->id;
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
407 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
408
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
409 PurpleAccount *
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
410 purple_notification_get_account(PurpleNotification *notification) {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
411 PurpleNotificationPrivate *priv = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
412
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
413 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
414
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
415 priv = purple_notification_get_instance_private(notification);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
416
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
417 return priv->account;
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
418 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
419
42927
51bee36eb6cb First steps of cleaning up the notification API
Gary Kramlich <grim@reaperworld.com>
parents: 42922
diff changeset
420 void
51bee36eb6cb First steps of cleaning up the notification API
Gary Kramlich <grim@reaperworld.com>
parents: 42922
diff changeset
421 purple_notification_set_account(PurpleNotification *notification,
51bee36eb6cb First steps of cleaning up the notification API
Gary Kramlich <grim@reaperworld.com>
parents: 42922
diff changeset
422 PurpleAccount *account)
51bee36eb6cb First steps of cleaning up the notification API
Gary Kramlich <grim@reaperworld.com>
parents: 42922
diff changeset
423 {
51bee36eb6cb First steps of cleaning up the notification API
Gary Kramlich <grim@reaperworld.com>
parents: 42922
diff changeset
424 PurpleNotificationPrivate *priv = NULL;
51bee36eb6cb First steps of cleaning up the notification API
Gary Kramlich <grim@reaperworld.com>
parents: 42922
diff changeset
425
51bee36eb6cb First steps of cleaning up the notification API
Gary Kramlich <grim@reaperworld.com>
parents: 42922
diff changeset
426 g_return_if_fail(PURPLE_IS_NOTIFICATION(notification));
51bee36eb6cb First steps of cleaning up the notification API
Gary Kramlich <grim@reaperworld.com>
parents: 42922
diff changeset
427
51bee36eb6cb First steps of cleaning up the notification API
Gary Kramlich <grim@reaperworld.com>
parents: 42922
diff changeset
428 priv = purple_notification_get_instance_private(notification);
51bee36eb6cb First steps of cleaning up the notification API
Gary Kramlich <grim@reaperworld.com>
parents: 42922
diff changeset
429
51bee36eb6cb First steps of cleaning up the notification API
Gary Kramlich <grim@reaperworld.com>
parents: 42922
diff changeset
430 if(g_set_object(&priv->account, account)) {
51bee36eb6cb First steps of cleaning up the notification API
Gary Kramlich <grim@reaperworld.com>
parents: 42922
diff changeset
431 g_object_notify_by_pspec(G_OBJECT(notification),
51bee36eb6cb First steps of cleaning up the notification API
Gary Kramlich <grim@reaperworld.com>
parents: 42922
diff changeset
432 properties[PROP_ACCOUNT]);
51bee36eb6cb First steps of cleaning up the notification API
Gary Kramlich <grim@reaperworld.com>
parents: 42922
diff changeset
433 }
51bee36eb6cb First steps of cleaning up the notification API
Gary Kramlich <grim@reaperworld.com>
parents: 42922
diff changeset
434 }
51bee36eb6cb First steps of cleaning up the notification API
Gary Kramlich <grim@reaperworld.com>
parents: 42922
diff changeset
435
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
436 GDateTime *
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
437 purple_notification_get_created_timestamp(PurpleNotification *notification) {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
438 PurpleNotificationPrivate *priv = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
439
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
440 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
441
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
442 priv = purple_notification_get_instance_private(notification);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
443
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
444 return priv->created_timestamp;
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
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
447 void
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
448 purple_notification_set_created_timestamp(PurpleNotification *notification,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
449 GDateTime *timestamp)
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
450 {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
451 PurpleNotificationPrivate *priv = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
452
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
453 g_return_if_fail(PURPLE_IS_NOTIFICATION(notification));
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
454
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
455 priv = purple_notification_get_instance_private(notification);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
456
42909
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
457 if(birb_date_time_set(&priv->created_timestamp, timestamp)) {
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
458 g_object_notify_by_pspec(G_OBJECT(notification),
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
459 properties[PROP_CREATED_TIMESTAMP]);
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
460 }
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
461 }
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
462
42648
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
463 const char *
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
464 purple_notification_get_title(PurpleNotification *notification) {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
465 PurpleNotificationPrivate *priv = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
466
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
467 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
468
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
469 priv = purple_notification_get_instance_private(notification);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
470
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
471 return priv->title;
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
472 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
473
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
474 void
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
475 purple_notification_set_title(PurpleNotification *notification,
42648
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
476 const char *title)
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
477 {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
478 PurpleNotificationPrivate *priv = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
479
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
480 g_return_if_fail(PURPLE_IS_NOTIFICATION(notification));
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
481
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
482 priv = purple_notification_get_instance_private(notification);
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
483
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42725
diff changeset
484 if(g_set_str(&priv->title, title)) {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
485 g_object_notify_by_pspec(G_OBJECT(notification),
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
486 properties[PROP_TITLE]);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
487 }
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
488 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
489
42648
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
490 const char *
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
491 purple_notification_get_subtitle(PurpleNotification *notification) {
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
492 PurpleNotificationPrivate *priv = NULL;
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
493
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
494 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
495
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
496 priv = purple_notification_get_instance_private(notification);
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
497
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
498 return priv->subtitle;
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
499 }
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
500
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
501 void
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
502 purple_notification_set_subtitle(PurpleNotification *notification,
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
503 const char *subtitle)
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
504 {
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
505 PurpleNotificationPrivate *priv = NULL;
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
506
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
507 g_return_if_fail(PURPLE_IS_NOTIFICATION(notification));
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
508
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
509 priv = purple_notification_get_instance_private(notification);
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
510
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42725
diff changeset
511 if(g_set_str(&priv->subtitle, subtitle)) {
42648
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
512 g_object_notify_by_pspec(G_OBJECT(notification),
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
513 properties[PROP_SUBTITLE]);
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
514 }
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
515 }
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
516
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
517 const char *
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
518 purple_notification_get_icon_name(PurpleNotification *notification) {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
519 PurpleNotificationPrivate *priv = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
520
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
521 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
522
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
523 priv = purple_notification_get_instance_private(notification);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
524
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
525 return priv->icon_name;
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
526 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
527
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
528 void
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
529 purple_notification_set_icon_name(PurpleNotification *notification,
42648
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
530 const char *icon_name)
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
531 {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
532 PurpleNotificationPrivate *priv = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
533
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
534 g_return_if_fail(PURPLE_IS_NOTIFICATION(notification));
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
535
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
536 priv = purple_notification_get_instance_private(notification);
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
537
42767
8cf1d11b59c1 Use g_set_str everywhere
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42725
diff changeset
538 if(g_set_str(&priv->icon_name, icon_name)) {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
539 g_object_notify_by_pspec(G_OBJECT(notification),
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
540 properties[PROP_ICON_NAME]);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
541 }
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
542 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
543
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
544 gboolean
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
545 purple_notification_get_read(PurpleNotification *notification) {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
546 PurpleNotificationPrivate *priv = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
547
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
548 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
549
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
550 priv = purple_notification_get_instance_private(notification);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
551
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
552 return priv->read;
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
553 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
554
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
555 void
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
556 purple_notification_set_read(PurpleNotification *notification, gboolean read) {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
557 PurpleNotificationPrivate *priv = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
558
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
559 g_return_if_fail(PURPLE_IS_NOTIFICATION(notification));
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
560
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
561 priv = purple_notification_get_instance_private(notification);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
562
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
563 if(priv->read != read) {
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
564 priv->read = read;
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
565
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
566 g_object_notify_by_pspec(G_OBJECT(notification),
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
567 properties[PROP_READ]);
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
568 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
569 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
570
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
571 gboolean
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
572 purple_notification_get_interactive(PurpleNotification *notification) {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
573 PurpleNotificationPrivate *priv = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
574
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
575 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
576
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
577 priv = purple_notification_get_instance_private(notification);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
578
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
579 return priv->interactive;
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
580 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
581
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
582 void
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
583 purple_notification_set_interactive(PurpleNotification *notification,
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
584 gboolean interactive)
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
585 {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
586 PurpleNotificationPrivate *priv = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
587
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
588 g_return_if_fail(PURPLE_IS_NOTIFICATION(notification));
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
589
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
590 priv = purple_notification_get_instance_private(notification);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
591
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
592 if(priv->interactive != interactive) {
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
593 priv->interactive = interactive;
41433
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
594
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
595 g_object_notify_by_pspec(G_OBJECT(notification),
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
596 properties[PROP_INTERACTIVE]);
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
597 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
598 }
d563b345a096 Phase 1 of the Notifications API
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
599
42909
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
600 gboolean
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
601 purple_notification_get_persistent(PurpleNotification *notification) {
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
602 PurpleNotificationPrivate *priv = NULL;
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
603
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
604 g_return_val_if_fail(PURPLE_IS_NOTIFICATION(notification), FALSE);
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
605
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
606 priv = purple_notification_get_instance_private(notification);
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
607
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
608 return priv->persistent;
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
609 }
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
610
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
611 void
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
612 purple_notification_set_persistent(PurpleNotification *notification,
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
613 gboolean persistent)
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
614 {
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
615 PurpleNotificationPrivate *priv = NULL;
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
616
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
617 g_return_if_fail(PURPLE_IS_NOTIFICATION(notification));
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
618
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
619 priv = purple_notification_get_instance_private(notification);
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
620
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
621 if(priv->persistent != persistent) {
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
622 priv->persistent = persistent;
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
623
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
624 g_object_notify_by_pspec(G_OBJECT(notification),
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
625 properties[PROP_PERSISTENT]);
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
626 }
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
627 }
440ed16de928 Add a persistent property to Purple.Notification
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
628
42648
70d33d4dac09 Add a subtitle property to PurpleNotification
Gary Kramlich <grim@reaperworld.com>
parents: 42630
diff changeset
629 int
41438
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41433
diff changeset
630 purple_notification_compare(gconstpointer a, gconstpointer b) {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
631 PurpleNotification *notification_a = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
632 PurpleNotification *notification_b = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
633 PurpleNotificationPrivate *priv_a = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
634 PurpleNotificationPrivate *priv_b = NULL;
41438
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41433
diff changeset
635
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41433
diff changeset
636 if(a == NULL && b == NULL) {
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41433
diff changeset
637 return 0;
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41433
diff changeset
638 }
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41433
diff changeset
639
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41433
diff changeset
640 if(a == NULL) {
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41433
diff changeset
641 return -1;
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41433
diff changeset
642 }
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41433
diff changeset
643
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41433
diff changeset
644 if(b == NULL) {
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41433
diff changeset
645 return 1;
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41433
diff changeset
646 }
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41433
diff changeset
647
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41433
diff changeset
648 notification_a = (PurpleNotification *)a;
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41433
diff changeset
649 notification_b = (PurpleNotification *)b;
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41433
diff changeset
650
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
651 priv_a = purple_notification_get_instance_private(notification_a);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
652 priv_b = purple_notification_get_instance_private(notification_b);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
653
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
654 return g_date_time_compare(priv_a->created_timestamp,
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
655 priv_b->created_timestamp);
41438
86beaec0fa35 Create and add notifications for account errors.
Gary Kramlich <grim@reaperworld.com>
parents: 41433
diff changeset
656 }
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
657
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
658 void
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
659 purple_notification_delete(PurpleNotification *notification) {
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
660 PurpleNotificationPrivate *priv = NULL;
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
661
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
662 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
663
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
664 priv = purple_notification_get_instance_private(notification);
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
665
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
666 /* Calling this multiple times is a programming error. */
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
667 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
668
42630
4895793f3298 Make PurpleNotification derivable
Gary Kramlich <grim@reaperworld.com>
parents: 42614
diff changeset
669 priv->deleted = TRUE;
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
670
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents: 41438
diff changeset
671 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
672 }

mercurial