pidgin/pidginnotificationaddcontact.c

Thu, 27 Jun 2024 00:46:27 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Thu, 27 Jun 2024 00:46:27 -0500
changeset 42804
be8c8b5471ca
parent 42711
ab244bae3b82
child 42914
27c407608b6b
permissions
-rw-r--r--

Update pidgin to use get id and username directly on PurpleAccount

This is part of making PurpleAccount have a PurpleContactInfo instead of being
one.

Testing Done:
Ran the turtles, connected some accounts, disabled one via the menu and re-enabled it.

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

41517
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * Pidgin - Internet Messenger
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 *
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * Pidgin is the legal property of its developers, whose names are too numerous
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * to list here. Please refer to the COPYRIGHT file distributed with this
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 * source distribution.
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 *
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 * This program is free software; you can redistribute it and/or modify
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 * (at your option) any later version.
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 *
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 * GNU General Public License for more details.
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 *
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20 * along with this program; if not, see <https://www.gnu.org/licenses/>.
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 */
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23 #include <glib/gi18n-lib.h>
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25 #include <purple.h>
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 #include "pidgin/pidginnotificationaddcontact.h"
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29 struct _PidginNotificationAddContact {
41573
2c4955b639a1 Port add contact notification to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41517
diff changeset
30 AdwActionRow parent;
41517
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32 PurpleNotification *notification;
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33
42195
ce5c1634c6a1 Migrate away from AdwActionRow:icon-name
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41573
diff changeset
34 GtkWidget *icon;
41517
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35 GtkWidget *add;
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 GtkWidget *message;
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37 };
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39 enum {
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 PROP_0,
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 PROP_NOTIFICATION,
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 N_PROPERTIES,
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 };
42584
687260353985 Make signal and property enums and initializers consistent
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42575
diff changeset
44 static GParamSpec *properties[N_PROPERTIES] = {NULL, };
41517
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45
42575
580339aa47cc Make sure all of the final types in pidgin are defined as such
Gary Kramlich <grim@reaperworld.com>
parents: 42202
diff changeset
46 G_DEFINE_FINAL_TYPE(PidginNotificationAddContact,
580339aa47cc Make sure all of the final types in pidgin are defined as such
Gary Kramlich <grim@reaperworld.com>
parents: 42202
diff changeset
47 pidgin_notification_add_contact, ADW_TYPE_ACTION_ROW)
41517
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49 /******************************************************************************
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50 * Helpers
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51 *****************************************************************************/
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52 static void
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 pidgin_notification_add_contact_update(PidginNotificationAddContact *add_contact)
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54 {
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55 PurpleAccount *account = NULL;
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56 PurpleAddContactRequest *request = NULL;
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57 const gchar *title = NULL;
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58 const gchar *icon_name = NULL, *message = NULL;
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 g_return_if_fail(PIDGIN_IS_NOTIFICATION_ADD_CONTACT(add_contact));
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62 if(!PURPLE_IS_NOTIFICATION(add_contact->notification)) {
41573
2c4955b639a1 Port add contact notification to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41517
diff changeset
63 adw_preferences_row_set_title(ADW_PREFERENCES_ROW(add_contact),
41517
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 _("Notification missing"));
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65
42195
ce5c1634c6a1 Migrate away from AdwActionRow:icon-name
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41573
diff changeset
66 gtk_image_set_from_icon_name(GTK_IMAGE(add_contact->icon), NULL);
41573
2c4955b639a1 Port add contact notification to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41517
diff changeset
67 adw_action_row_set_subtitle(ADW_ACTION_ROW(add_contact), NULL);
41517
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68
42202
2273647d24b0 Use gtk_widget_set_visible for everything
Gary Kramlich <grim@reaperworld.com>
parents: 42195
diff changeset
69 gtk_widget_set_visible(add_contact->add, FALSE);
2273647d24b0 Use gtk_widget_set_visible for everything
Gary Kramlich <grim@reaperworld.com>
parents: 42195
diff changeset
70 gtk_widget_set_visible(add_contact->message, FALSE);
41517
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72 return;
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73 }
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75 account = purple_notification_get_account(add_contact->notification);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76 if(!PURPLE_IS_ACCOUNT(account)) {
41573
2c4955b639a1 Port add contact notification to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41517
diff changeset
77 adw_preferences_row_set_title(ADW_PREFERENCES_ROW(add_contact),
41517
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78 _("Notification is missing an account"));
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79
42195
ce5c1634c6a1 Migrate away from AdwActionRow:icon-name
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41573
diff changeset
80 gtk_image_set_from_icon_name(GTK_IMAGE(add_contact->icon), NULL);
41573
2c4955b639a1 Port add contact notification to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41517
diff changeset
81 adw_action_row_set_subtitle(ADW_ACTION_ROW(add_contact), NULL);
41517
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
82
42202
2273647d24b0 Use gtk_widget_set_visible for everything
Gary Kramlich <grim@reaperworld.com>
parents: 42195
diff changeset
83 gtk_widget_set_visible(add_contact->add, FALSE);
2273647d24b0 Use gtk_widget_set_visible for everything
Gary Kramlich <grim@reaperworld.com>
parents: 42195
diff changeset
84 gtk_widget_set_visible(add_contact->message, FALSE);
41517
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86 return;
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87 }
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
88
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89 request = purple_notification_get_data(add_contact->notification);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91 /* Set the icon name if one was specified. */
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
92 icon_name = purple_notification_get_icon_name(add_contact->notification);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
93 if(icon_name == NULL) {
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
94 PurpleProtocol *protocol = NULL;
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
95
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
96 protocol = purple_account_get_protocol(account);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97 icon_name = purple_protocol_get_icon_name(protocol);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
98
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
99 if(icon_name == NULL) {
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
100 icon_name = "dialog-question";
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
101 }
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
102 }
42195
ce5c1634c6a1 Migrate away from AdwActionRow:icon-name
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41573
diff changeset
103 gtk_image_set_from_icon_name(GTK_IMAGE(add_contact->icon), icon_name);
41517
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
104
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
105 title = purple_notification_get_title(add_contact->notification);
41573
2c4955b639a1 Port add contact notification to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41517
diff changeset
106 adw_preferences_row_set_title(ADW_PREFERENCES_ROW(add_contact), title);
41517
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
107
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
108 message = purple_add_contact_request_get_message(request);
41573
2c4955b639a1 Port add contact notification to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41517
diff changeset
109 adw_action_row_set_subtitle(ADW_ACTION_ROW(add_contact), message);
41517
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
110
42202
2273647d24b0 Use gtk_widget_set_visible for everything
Gary Kramlich <grim@reaperworld.com>
parents: 42195
diff changeset
111 gtk_widget_set_visible(add_contact->add, TRUE);
2273647d24b0 Use gtk_widget_set_visible for everything
Gary Kramlich <grim@reaperworld.com>
parents: 42195
diff changeset
112 gtk_widget_set_visible(add_contact->message, TRUE);
41517
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
113 }
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
114
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
115 static void
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
116 pidgin_notification_add_contact_set_notification(PidginNotificationAddContact *add_contact,
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
117 PurpleNotification *notification)
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
118 {
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
119 if(g_set_object(&add_contact->notification, notification)) {
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
120 pidgin_notification_add_contact_update(add_contact);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
121
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
122 g_object_notify_by_pspec(G_OBJECT(add_contact),
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
123 properties[PROP_NOTIFICATION]);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
124 }
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
125 }
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
126
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
127 static void
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
128 pidgin_notification_add_contact_close(PidginNotificationAddContact *add_contact)
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
129 {
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
130 PurpleNotificationManager *manager = NULL;
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
131
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
132 purple_notification_delete(add_contact->notification);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
133
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
134 manager = purple_notification_manager_get_default();
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
135 purple_notification_manager_remove(manager, add_contact->notification);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
136 }
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
137
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
138 /******************************************************************************
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
139 * Callbacks
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
140 *****************************************************************************/
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
141 static void
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
142 pidgin_notification_add_contact_add_cb(G_GNUC_UNUSED GtkButton *button,
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
143 gpointer data)
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
144 {
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
145 PidginNotificationAddContact *pidgin_request = data;
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
146 PurpleAddContactRequest *request = NULL;
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
147
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
148 request = purple_notification_get_data(pidgin_request->notification);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
149
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
150 purple_add_contact_request_add(request);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
151
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
152 pidgin_notification_add_contact_close(pidgin_request);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
153 }
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
154
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
155 static void
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
156 pidgin_notification_add_contact_message_cb(G_GNUC_UNUSED GtkButton *button,
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
157 gpointer data)
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
158 {
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
159 PidginNotificationAddContact *pidgin_request = data;
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
160 PurpleAddContactRequest *request = NULL;
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
161 PurpleAccount *account = NULL;
42710
d122647268be Remove pidgin_dialogs_im_with_user
Gary Kramlich <grim@reaperworld.com>
parents: 42620
diff changeset
162 PurpleContact *contact = NULL;
d122647268be Remove pidgin_dialogs_im_with_user
Gary Kramlich <grim@reaperworld.com>
parents: 42620
diff changeset
163 PurpleContactManager *manager = NULL;
d122647268be Remove pidgin_dialogs_im_with_user
Gary Kramlich <grim@reaperworld.com>
parents: 42620
diff changeset
164 PurpleConversation *conversation = NULL;
d122647268be Remove pidgin_dialogs_im_with_user
Gary Kramlich <grim@reaperworld.com>
parents: 42620
diff changeset
165 const char *username = NULL;
41517
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
166
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
167 request = purple_notification_get_data(pidgin_request->notification);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
168
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
169 account = purple_add_contact_request_get_account(request);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
170 username = purple_add_contact_request_get_username(request);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
171
42710
d122647268be Remove pidgin_dialogs_im_with_user
Gary Kramlich <grim@reaperworld.com>
parents: 42620
diff changeset
172 manager = purple_contact_manager_get_default();
d122647268be Remove pidgin_dialogs_im_with_user
Gary Kramlich <grim@reaperworld.com>
parents: 42620
diff changeset
173 contact = purple_contact_manager_find_with_username(manager, account,
d122647268be Remove pidgin_dialogs_im_with_user
Gary Kramlich <grim@reaperworld.com>
parents: 42620
diff changeset
174 username);
d122647268be Remove pidgin_dialogs_im_with_user
Gary Kramlich <grim@reaperworld.com>
parents: 42620
diff changeset
175
d122647268be Remove pidgin_dialogs_im_with_user
Gary Kramlich <grim@reaperworld.com>
parents: 42620
diff changeset
176 if(!PURPLE_IS_CONTACT(contact)) {
d122647268be Remove pidgin_dialogs_im_with_user
Gary Kramlich <grim@reaperworld.com>
parents: 42620
diff changeset
177 g_warning("failed to find a user named '%s' on account %s",
d122647268be Remove pidgin_dialogs_im_with_user
Gary Kramlich <grim@reaperworld.com>
parents: 42620
diff changeset
178 username,
42804
be8c8b5471ca Update pidgin to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42711
diff changeset
179 purple_account_get_username(account));
42710
d122647268be Remove pidgin_dialogs_im_with_user
Gary Kramlich <grim@reaperworld.com>
parents: 42620
diff changeset
180
d122647268be Remove pidgin_dialogs_im_with_user
Gary Kramlich <grim@reaperworld.com>
parents: 42620
diff changeset
181 return;
d122647268be Remove pidgin_dialogs_im_with_user
Gary Kramlich <grim@reaperworld.com>
parents: 42620
diff changeset
182 }
d122647268be Remove pidgin_dialogs_im_with_user
Gary Kramlich <grim@reaperworld.com>
parents: 42620
diff changeset
183
d122647268be Remove pidgin_dialogs_im_with_user
Gary Kramlich <grim@reaperworld.com>
parents: 42620
diff changeset
184 conversation = purple_contact_find_dm(contact);
d122647268be Remove pidgin_dialogs_im_with_user
Gary Kramlich <grim@reaperworld.com>
parents: 42620
diff changeset
185 if(PURPLE_IS_CONVERSATION(conversation)) {
d122647268be Remove pidgin_dialogs_im_with_user
Gary Kramlich <grim@reaperworld.com>
parents: 42620
diff changeset
186 purple_conversation_present(conversation);
d122647268be Remove pidgin_dialogs_im_with_user
Gary Kramlich <grim@reaperworld.com>
parents: 42620
diff changeset
187 } else {
d122647268be Remove pidgin_dialogs_im_with_user
Gary Kramlich <grim@reaperworld.com>
parents: 42620
diff changeset
188 purple_contact_create_dm_async(contact, NULL, NULL, NULL);
d122647268be Remove pidgin_dialogs_im_with_user
Gary Kramlich <grim@reaperworld.com>
parents: 42620
diff changeset
189 }
41517
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
190 }
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
191
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
192 static void
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
193 pidgin_notification_add_contact_remove_cb(G_GNUC_UNUSED GtkButton *button,
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
194 gpointer data)
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
195 {
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
196 PidginNotificationAddContact *request = data;
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
197
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
198 pidgin_notification_add_contact_close(request);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
199 }
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
200
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
201 /******************************************************************************
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
202 * GObject Implementation
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
203 *****************************************************************************/
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
204 static void
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
205 pidgin_notification_add_contact_get_property(GObject *obj, guint param_id,
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
206 GValue *value, GParamSpec *pspec)
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
207 {
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
208 PidginNotificationAddContact *request = NULL;
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
209
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
210 request = PIDGIN_NOTIFICATION_ADD_CONTACT(obj);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
211
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
212 switch(param_id) {
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
213 case PROP_NOTIFICATION:
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
214 g_value_set_object(value,
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
215 pidgin_notification_add_contact_get_notification(request));
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
216 break;
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
217 default:
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
218 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
219 break;
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
220 }
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
221 }
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
222
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
223 static void
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
224 pidgin_notification_add_contact_set_property(GObject *obj, guint param_id,
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
225 const GValue *value,
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
226 GParamSpec *pspec)
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
227 {
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
228 PidginNotificationAddContact *request = NULL;
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
229
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
230 request = PIDGIN_NOTIFICATION_ADD_CONTACT(obj);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
231
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
232 switch(param_id) {
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
233 case PROP_NOTIFICATION:
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
234 pidgin_notification_add_contact_set_notification(request,
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
235 g_value_get_object(value));
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
236 break;
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
237 default:
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
238 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
239 break;
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
240 }
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
241 }
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
242
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
243 static void
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
244 pidgin_notification_add_contact_dispose(GObject *obj) {
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
245 PidginNotificationAddContact *request = NULL;
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
246
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
247 request = PIDGIN_NOTIFICATION_ADD_CONTACT(obj);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
248
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
249 g_clear_object(&request->notification);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
250
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
251 G_OBJECT_CLASS(pidgin_notification_add_contact_parent_class)->dispose(obj);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
252 }
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
253
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
254 static void
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
255 pidgin_notification_add_contact_init(PidginNotificationAddContact *list) {
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
256 gtk_widget_init_template(GTK_WIDGET(list));
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
257 }
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
258
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
259 static void
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
260 pidgin_notification_add_contact_class_init(PidginNotificationAddContactClass *klass)
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
261 {
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
262 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
263 GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
264
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
265 obj_class->get_property = pidgin_notification_add_contact_get_property;
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
266 obj_class->set_property = pidgin_notification_add_contact_set_property;
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
267 obj_class->dispose = pidgin_notification_add_contact_dispose;
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
268
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
269 /**
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
270 * PidginNotificationAddContact:notification:
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
271 *
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
272 * The [type@Purple.Notification] that is being displayed.
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
273 *
42620
72178a341eb8 Remove minor versions from Since tags in Pidgin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42584
diff changeset
274 * Since: 3.0
41517
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
275 */
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
276 properties[PROP_NOTIFICATION] = g_param_spec_object(
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
277 "notification", "notification",
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
278 "The notification to display",
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
279 PURPLE_TYPE_NOTIFICATION,
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
280 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
281
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
282 g_object_class_install_properties(obj_class, N_PROPERTIES, properties);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
283
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
284 gtk_widget_class_set_template_from_resource(
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
285 widget_class,
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
286 "/im/pidgin/Pidgin3/Notifications/addcontact.ui"
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
287 );
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
288
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
289 gtk_widget_class_bind_template_child(widget_class,
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
290 PidginNotificationAddContact,
42195
ce5c1634c6a1 Migrate away from AdwActionRow:icon-name
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41573
diff changeset
291 icon);
ce5c1634c6a1 Migrate away from AdwActionRow:icon-name
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41573
diff changeset
292 gtk_widget_class_bind_template_child(widget_class,
ce5c1634c6a1 Migrate away from AdwActionRow:icon-name
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41573
diff changeset
293 PidginNotificationAddContact,
41517
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
294 add);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
295 gtk_widget_class_bind_template_child(widget_class,
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
296 PidginNotificationAddContact,
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
297 message);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
298
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
299 gtk_widget_class_bind_template_callback(widget_class,
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
300 pidgin_notification_add_contact_add_cb);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
301 gtk_widget_class_bind_template_callback(widget_class,
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
302 pidgin_notification_add_contact_message_cb);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
303 gtk_widget_class_bind_template_callback(widget_class,
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
304 pidgin_notification_add_contact_remove_cb);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
305 }
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
306
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
307 /******************************************************************************
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
308 * API
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
309 *****************************************************************************/
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
310 GtkWidget *
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
311 pidgin_notification_add_contact_new(PurpleNotification *notification) {
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
312 return g_object_new(
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
313 PIDGIN_TYPE_NOTIFICATION_ADD_CONTACT,
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
314 "notification", notification,
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
315 NULL);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
316 }
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
317
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
318 PurpleNotification *
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
319 pidgin_notification_add_contact_get_notification(PidginNotificationAddContact *add_contact)
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
320 {
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
321 g_return_val_if_fail(PIDGIN_IS_NOTIFICATION_ADD_CONTACT(add_contact), NULL);
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
322
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
323 return add_contact->notification;
5bafe75d3907 Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
324 }

mercurial