libpurple/purplenotificationauthorizationrequest.c

Tue, 06 Aug 2024 01:19:18 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Tue, 06 Aug 2024 01:19:18 -0500
changeset 42835
3144fbeba349
parent 42805
libpurple/purpleauthorizationrequestnotification.c@3e77e81168a5
child 42929
e9cc6fc1f717
permissions
-rw-r--r--

Rename AuthorizationRequestNotification to NotificationAuthorizationRequest

This is how we typically name subclasses and pidgin already has names like this.

Testing Done:
Ran the turtles.

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

42651
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * Purple - Internet Messaging Library
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 *
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * Purple is the legal property of its developers, whose names are too numerous
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * to list here. Please refer to the COPYRIGHT file distributed with this
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 * source distribution.
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 *
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 * This library is free software; you can redistribute it and/or modify it
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * under the terms of the GNU General Public License as published by the Free
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * Software Foundation; either version 2 of the License, or (at your option)
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 * any later version.
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 *
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 * This library is distributed in the hope that it will be useful, but WITHOUT
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 * more details.
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 *
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License along with
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20 * this library; if not, see <https://www.gnu.org/licenses/>.
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 */
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23 #include <glib/gi18n-lib.h>
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24
42835
3144fbeba349 Rename AuthorizationRequestNotification to NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
25 #include "purplenotificationauthorizationrequest.h"
42651
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26
42725
ceb13f1de2d2 Remove PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents: 42651
diff changeset
27 #include "util.h"
ceb13f1de2d2 Remove PurpleBuddy
Gary Kramlich <grim@reaperworld.com>
parents: 42651
diff changeset
28
42651
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29 enum {
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30 PROP_0,
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31 PROP_AUTHORIZATION_REQUEST,
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32 N_PROPERTIES,
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33 };
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34 static GParamSpec *properties[N_PROPERTIES] = {NULL, 0};
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35
42835
3144fbeba349 Rename AuthorizationRequestNotification to NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
36 struct _PurpleNotificationAuthorizationRequest {
42651
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37 PurpleNotification parent;
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39 PurpleAuthorizationRequest *authorization_request;
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 };
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 static void
42835
3144fbeba349 Rename AuthorizationRequestNotification to NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
43 purple_notification_authorization_request_request_changed_cb(GObject *obj,
42651
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 GParamSpec *pspec,
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 gpointer data);
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47 /******************************************************************************
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48 * Helpers
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49 *****************************************************************************/
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50 static void
42835
3144fbeba349 Rename AuthorizationRequestNotification to NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
51 purple_notification_authorization_request_update(PurpleNotificationAuthorizationRequest *auth_notification)
42651
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52 {
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 PurpleAccount *account = NULL;
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54 PurpleAuthorizationRequest *request = NULL;
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55 PurpleNotification *notification = PURPLE_NOTIFICATION(auth_notification);
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56 char *title = NULL;
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57 const char *alias = NULL;
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58 const char *username = NULL;
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 request = auth_notification->authorization_request;
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61 account = purple_authorization_request_get_account(request);
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62 username = purple_authorization_request_get_username(request);
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63 alias = purple_authorization_request_get_alias(request);
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65 if(!purple_strempty(alias)) {
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66 title = g_strdup_printf(_("%s (%s) would like to add %s to their"
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67 " contact list"),
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68 alias, username,
42805
3e77e81168a5 Update libpurple to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42725
diff changeset
69 purple_account_get_username(account));
42651
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70 } else {
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71 title = g_strdup_printf(_("%s would like to add %s to their contact"
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72 " list"),
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73 username,
42805
3e77e81168a5 Update libpurple to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42725
diff changeset
74 purple_account_get_username(account));
42651
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75 }
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77 purple_notification_set_title(notification, title);
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78 g_free(title);
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79 }
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
80
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
81 static void
42835
3144fbeba349 Rename AuthorizationRequestNotification to NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
82 purple_notification_authorization_request_set_request(PurpleNotificationAuthorizationRequest *notification,
42651
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
83 PurpleAuthorizationRequest *request)
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84 {
42835
3144fbeba349 Rename AuthorizationRequestNotification to NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
85 g_return_if_fail(PURPLE_IS_NOTIFICATION_AUTHORIZATION_REQUEST(notification));
42651
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87 if(g_set_object(&notification->authorization_request, request)) {
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
88 if(PURPLE_IS_AUTHORIZATION_REQUEST(request)) {
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89 g_signal_connect_object(request, "notify",
42835
3144fbeba349 Rename AuthorizationRequestNotification to NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
90 G_CALLBACK(purple_notification_authorization_request_request_changed_cb),
42651
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91 notification, 0);
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
92
42835
3144fbeba349 Rename AuthorizationRequestNotification to NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
93 purple_notification_authorization_request_update(notification);
42651
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
94 }
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
95
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
96 g_object_notify_by_pspec(G_OBJECT(notification),
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97 properties[PROP_AUTHORIZATION_REQUEST]);
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
98 }
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
99 }
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
100
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
101 /******************************************************************************
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
102 * Callbacks
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
103 *****************************************************************************/
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
104 static void
42835
3144fbeba349 Rename AuthorizationRequestNotification to NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
105 purple_notification_authorization_request_request_changed_cb(G_GNUC_UNUSED GObject *obj,
42651
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
106 G_GNUC_UNUSED GParamSpec *pspec,
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
107 gpointer data)
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
108 {
42835
3144fbeba349 Rename AuthorizationRequestNotification to NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
109 purple_notification_authorization_request_update(data);
42651
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
110 }
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
111
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
112 /******************************************************************************
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
113 * GObject Implementation
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
114 *****************************************************************************/
42835
3144fbeba349 Rename AuthorizationRequestNotification to NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
115 G_DEFINE_FINAL_TYPE(PurpleNotificationAuthorizationRequest,
3144fbeba349 Rename AuthorizationRequestNotification to NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
116 purple_notification_authorization_request,
42651
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
117 PURPLE_TYPE_NOTIFICATION)
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
118
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
119 static void
42835
3144fbeba349 Rename AuthorizationRequestNotification to NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
120 purple_notification_authorization_request_finalize(GObject *object) {
3144fbeba349 Rename AuthorizationRequestNotification to NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
121 PurpleNotificationAuthorizationRequest *notification = NULL;
42651
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
122
42835
3144fbeba349 Rename AuthorizationRequestNotification to NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
123 notification = PURPLE_NOTIFICATION_AUTHORIZATION_REQUEST(object);
42651
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
124
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
125 g_clear_object(&notification->authorization_request);
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
126
42835
3144fbeba349 Rename AuthorizationRequestNotification to NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
127 G_OBJECT_CLASS(purple_notification_authorization_request_parent_class)->finalize(object);
42651
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
128 }
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
129
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
130 static void
42835
3144fbeba349 Rename AuthorizationRequestNotification to NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
131 purple_notification_authorization_request_get_property(GObject *obj,
42651
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
132 guint param_id,
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
133 GValue *value,
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
134 GParamSpec *pspec)
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
135 {
42835
3144fbeba349 Rename AuthorizationRequestNotification to NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
136 PurpleNotificationAuthorizationRequest *notification = NULL;
42651
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
137
42835
3144fbeba349 Rename AuthorizationRequestNotification to NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
138 notification = PURPLE_NOTIFICATION_AUTHORIZATION_REQUEST(obj);
42651
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
139
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
140 switch(param_id) {
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
141 case PROP_AUTHORIZATION_REQUEST:
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
142 g_value_set_object(value,
42835
3144fbeba349 Rename AuthorizationRequestNotification to NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
143 purple_notification_authorization_request_get_request(notification));
42651
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
144 break;
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
145 default:
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
146 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
147 break;
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
148 }
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
149 }
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
150
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
151 static void
42835
3144fbeba349 Rename AuthorizationRequestNotification to NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
152 purple_notification_authorization_request_set_property(GObject *obj,
42651
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
153 guint param_id,
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
154 const GValue *value,
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
155 GParamSpec *pspec)
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
156 {
42835
3144fbeba349 Rename AuthorizationRequestNotification to NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
157 PurpleNotificationAuthorizationRequest *notification = NULL;
42651
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
158
42835
3144fbeba349 Rename AuthorizationRequestNotification to NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
159 notification = PURPLE_NOTIFICATION_AUTHORIZATION_REQUEST(obj);
42651
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
160
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
161 switch(param_id) {
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
162 case PROP_AUTHORIZATION_REQUEST:
42835
3144fbeba349 Rename AuthorizationRequestNotification to NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
163 purple_notification_authorization_request_set_request(notification,
42651
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
164 g_value_get_object(value));
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
165 break;
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
166 default:
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
167 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
168 break;
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
169 }
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
170 }
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
171
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
172 static void
42835
3144fbeba349 Rename AuthorizationRequestNotification to NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
173 purple_notification_authorization_request_init(G_GNUC_UNUSED PurpleNotificationAuthorizationRequest *notification)
42651
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
174 {
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
175 }
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
176
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
177 static void
42835
3144fbeba349 Rename AuthorizationRequestNotification to NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
178 purple_notification_authorization_request_class_init(PurpleNotificationAuthorizationRequestClass *klass)
42651
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
179 {
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
180 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
181
42835
3144fbeba349 Rename AuthorizationRequestNotification to NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
182 obj_class->finalize = purple_notification_authorization_request_finalize;
3144fbeba349 Rename AuthorizationRequestNotification to NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
183 obj_class->get_property = purple_notification_authorization_request_get_property;
3144fbeba349 Rename AuthorizationRequestNotification to NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
184 obj_class->set_property = purple_notification_authorization_request_set_property;
42651
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
185
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
186 /**
42835
3144fbeba349 Rename AuthorizationRequestNotification to NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
187 * PurpleNotificationAuthorizationRequest:authorization-request:
42651
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
188 *
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
189 * The [class@AuthorizationRequest] that this notification was created for.
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
190 *
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
191 * Since: 3.0
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
192 */
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
193 properties[PROP_AUTHORIZATION_REQUEST] = g_param_spec_object(
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
194 "authorization-request", "authorization-request",
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
195 "The authorization request this notification is for.",
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
196 PURPLE_TYPE_AUTHORIZATION_REQUEST,
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
197 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
198
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
199 g_object_class_install_properties(obj_class, N_PROPERTIES, properties);
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
200 }
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
201
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
202 /******************************************************************************
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
203 * Public API
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
204 *****************************************************************************/
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
205 PurpleNotification *
42835
3144fbeba349 Rename AuthorizationRequestNotification to NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
206 purple_notification_authorization_request_new(PurpleAuthorizationRequest *request)
42651
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
207 {
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
208 PurpleAccount *account = NULL;
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
209
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
210 g_return_val_if_fail(PURPLE_IS_AUTHORIZATION_REQUEST(request), NULL);
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
211
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
212 account = purple_authorization_request_get_account(request);
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
213
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
214 return g_object_new(
42835
3144fbeba349 Rename AuthorizationRequestNotification to NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
215 PURPLE_TYPE_NOTIFICATION_AUTHORIZATION_REQUEST,
42651
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
216 "account", account,
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
217 "authorization-request", request,
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
218 NULL);
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
219 }
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
220
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
221 PurpleAuthorizationRequest *
42835
3144fbeba349 Rename AuthorizationRequestNotification to NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
222 purple_notification_authorization_request_get_request(PurpleNotificationAuthorizationRequest *notification)
42651
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
223 {
42835
3144fbeba349 Rename AuthorizationRequestNotification to NotificationAuthorizationRequest
Gary Kramlich <grim@reaperworld.com>
parents: 42805
diff changeset
224 g_return_val_if_fail(PURPLE_IS_NOTIFICATION_AUTHORIZATION_REQUEST(notification),
42651
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
225 NULL);
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
226
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
227 return notification->authorization_request;
5ad29b5bf1c7 Create PurpleAuthorizationRequestNotification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
228 }

mercurial