libpurple/purplenotificationconnectionerror.c

Mon, 04 Nov 2024 23:42:22 -0600

author
Gary Kramlich <grim@reaperworld.com>
date
Mon, 04 Nov 2024 23:42:22 -0600
changeset 43054
ccd071e7cd83
parent 43008
d46e90e0757a
permissions
-rw-r--r--

Add a boolean setting for toggling developer mode

This just gives a simple API method for checking the setting.

Testing Done:
Added a temporary `g_warning` to the end of `Pidgin.Application.startup` to verify the setting after modifying the file by hand.

Bugs closed: PIDGIN-17993

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

42985
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * Purple - Internet Messaging Library
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 *
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * Purple is the legal property of its developers, whose names are too numerous
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * to list here. Please refer to the COPYRIGHT file distributed with this
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 * source distribution.
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 *
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 * This library is free software; you can redistribute it and/or modify it
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * under the terms of the GNU General Public License as published by the Free
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * Software Foundation; either version 2 of the License, or (at your option)
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 * any later version.
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 *
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 * This library is distributed in the hope that it will be useful, but WITHOUT
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 * more details.
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 *
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License along with
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20 * this library; if not, see <https://www.gnu.org/licenses/>.
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 */
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23 #include <glib/gi18n-lib.h>
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25 #include "purplenotificationconnectionerror.h"
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 struct _PurpleNotificationConnectionError {
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28 PurpleNotification parent;
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29 };
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31 enum {
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32 PROP_0,
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33 N_PROPERTIES,
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34 /* Overrides */
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35 PROP_ACCOUNT,
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 };
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38 static void
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39 purple_notification_connection_error_error_notify_cb(GObject *self,
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 GParamSpec *pspec,
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 gpointer data);
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 /******************************************************************************
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 * Helpers
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 *****************************************************************************/
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46 static void
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47 purple_notification_connection_error_update(PurpleNotification *notification) {
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48 PurpleAccount *account = NULL;
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49 PurpleProtocol *protocol = NULL;
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
50 GError *error = NULL;
42985
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51 GObject *obj = G_OBJECT(notification);
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52 char *title = NULL;
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 const char *icon_name = "network-error-symbolic";
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54 const char *subtitle = NULL;
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56 account = purple_notification_get_account(notification);
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
57 error = purple_account_get_error(account);
42985
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59 protocol = purple_account_get_protocol(account);
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 if(PURPLE_IS_PROTOCOL(protocol)) {
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61 icon_name = purple_protocol_get_icon_name(protocol);
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62 }
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 if(error == NULL) {
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65 title = g_strdup_printf(_("%s has no connection error"),
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66 purple_account_get_username(account));
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67 } else {
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68 title = g_strdup_printf(_("%s disconnected"),
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69 purple_account_get_username(account));
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
70 subtitle = error->message;
42985
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71 }
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73 g_object_freeze_notify(obj);
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74 purple_notification_set_icon_name(notification, icon_name);
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75 purple_notification_set_subtitle(notification, subtitle);
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76 purple_notification_set_title(notification, title);
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77 g_object_thaw_notify(obj);
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79 g_clear_pointer(&title, g_free);
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
80 }
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
81
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
82 static void
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
83 purple_notification_connection_error_set_account(PurpleNotificationConnectionError *error,
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84 PurpleAccount *account)
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85 {
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86 PurpleAccount *old = NULL;
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87 PurpleNotification *notification = PURPLE_NOTIFICATION(error);
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
88
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89 old = purple_notification_get_account(notification);
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90 if(old == account) {
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91 return;
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
92 }
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
93
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
94 if(PURPLE_IS_ACCOUNT(old)) {
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
95 g_signal_handlers_disconnect_by_func(old,
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
96 purple_notification_connection_error_error_notify_cb,
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97 notification);
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
98 }
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
99
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
100 purple_notification_set_account(notification, account);
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
101
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
102 g_signal_connect_object(account, "notify::error",
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
103 G_CALLBACK(purple_notification_connection_error_error_notify_cb),
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
104 notification, G_CONNECT_DEFAULT);
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
105
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
106 purple_notification_connection_error_update(notification);
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
107 }
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
108
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
109 /******************************************************************************
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
110 * Callbacks
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
111 *****************************************************************************/
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
112 static void
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
113 purple_notification_connection_error_error_notify_cb(G_GNUC_UNUSED GObject *self,
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
114 G_GNUC_UNUSED GParamSpec *pspec,
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
115 gpointer data)
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
116 {
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
117 purple_notification_connection_error_update(data);
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
118 }
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
119
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
120 /******************************************************************************
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
121 * GObject Implementation
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
122 *****************************************************************************/
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
123 G_DEFINE_FINAL_TYPE(PurpleNotificationConnectionError,
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
124 purple_notification_connection_error,
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
125 PURPLE_TYPE_NOTIFICATION)
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
126
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
127 static void
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
128 purple_notification_connection_error_get_property(GObject *obj, guint param_id,
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
129 GValue *value,
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
130 GParamSpec *pspec)
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
131 {
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
132 PurpleNotification *notification = PURPLE_NOTIFICATION(obj);
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
133
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
134 switch(param_id) {
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
135 /* Overrides */
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
136 case PROP_ACCOUNT:
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
137 g_value_set_object(value,
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
138 purple_notification_get_account(notification));
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
139 break;
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
140 default:
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
141 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
142 break;
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
143 }
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
144 }
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
145
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
146 static void
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
147 purple_notification_connection_error_set_property(GObject *obj, guint param_id,
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
148 const GValue *value,
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
149 GParamSpec *pspec)
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
150 {
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
151 PurpleNotificationConnectionError *error = NULL;
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
152
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
153 error = PURPLE_NOTIFICATION_CONNECTION_ERROR(obj);
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
154
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
155 switch(param_id) {
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
156 /* Overrides */
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
157 case PROP_ACCOUNT:
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
158 purple_notification_connection_error_set_account(error,
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
159 g_value_get_object(value));
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
160 break;
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
161 default:
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
162 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
163 break;
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
164 }
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
165 }
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
166
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
167 static void
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
168 purple_notification_connection_error_init(G_GNUC_UNUSED PurpleNotificationConnectionError *notification)
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
169 {
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
170 }
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
171
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
172 static void
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
173 purple_notification_connection_error_class_init(PurpleNotificationConnectionErrorClass *klass)
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
174 {
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
175 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
176
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
177 obj_class->get_property = purple_notification_connection_error_get_property;
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
178 obj_class->set_property = purple_notification_connection_error_set_property;
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
179
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
180 g_object_class_override_property(obj_class, PROP_ACCOUNT, "account");
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
181 }
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
182
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
183 /******************************************************************************
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
184 * Public API
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
185 *****************************************************************************/
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
186 PurpleNotification *
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
187 purple_notification_connection_error_new(const char *id,
43004
06521648500e Update Purple.Account:error to be a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents: 43001
diff changeset
188 PurpleAccount *account)
42985
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
189 {
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
190 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
191
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
192 return g_object_new(
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
193 PURPLE_TYPE_NOTIFICATION_CONNECTION_ERROR,
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
194 "id", id,
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
195 "account", account,
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
196 NULL);
66ad6fc11879 Create Purple.NotificationConnectionError
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
197 }

mercurial