finch/gntidle.c

Mon, 22 Aug 2022 22:05:55 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Mon, 22 Aug 2022 22:05:55 -0500
changeset 41514
a96768bacb59
parent 41136
5397330041d6
child 42079
679258d92a92
permissions
-rw-r--r--

Create PurpleAuthorizationRequest and use it for notifications.

This replaces the old internal representation of authorization requests as well
as the UI's implementation of their own objects. Everything is now controlled
via PurpleAuthorizationRequest and the UI's display the notification for
interaction.

Testing Done:
Verified the notification and actions work in both finch and pidgin.

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

15802
1e124a68997e gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
1 /*
41136
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
2 * Finch - Universal Text Chat Client
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
15802
1e124a68997e gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
4 *
1e124a68997e gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
5 * This program is free software; you can redistribute it and/or modify
1e124a68997e gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
1e124a68997e gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
7 * the Free Software Foundation; either version 2 of the License, or
1e124a68997e gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
8 * (at your option) any later version.
1e124a68997e gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
9 *
1e124a68997e gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
1e124a68997e gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
1e124a68997e gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1e124a68997e gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
13 * GNU General Public License for more details.
1e124a68997e gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
14 *
1e124a68997e gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
41136
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
16 * along with this program; if not, see <https://www.gnu.org/licenses/>.
15802
1e124a68997e gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
17 */
1e124a68997e gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
18
40359
ca141ea93b83 Make all of finch use purple.h
Gary Kramlich <grim@reaperworld.com>
parents: 39887
diff changeset
19 #include <purple.h>
29049
ea3c1e7d47f4 *** Plucked rev ea18c8ce78c0229a5b968aab268f38e9bcae0aee (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Daniel Atallah <datallah@pidgin.im>
parents: 22340
diff changeset
20
40511
ec08ac1f7d5f Fix Finch for the libgnt single header file
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
21 #include <gnt.h>
ec08ac1f7d5f Fix Finch for the libgnt single header file
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
22
15802
1e124a68997e gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
23 #include "gntidle.h"
1e124a68997e gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
24
41136
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
25 struct _FinchIdle {
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
26 GObject parent;
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
27 };
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
28
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
29 /******************************************************************************
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
30 * PurpleIdleUi implementation
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
31 *****************************************************************************/
15802
1e124a68997e gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
32 static time_t
41136
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
33 finch_idle_get_idle_time(PurpleIdleUi *ui) {
15802
1e124a68997e gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
34 return gnt_wm_get_idle_time();
1e124a68997e gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
35 }
1e124a68997e gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
36
41136
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
37 static void
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
38 finch_idle_purple_idle_ui_init(PurpleIdleUiInterface *iface) {
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
39 iface->get_idle_time = finch_idle_get_idle_time;
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
40 }
16748
f8e1573bfde0 And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents: 15931
diff changeset
41
41136
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
42 /******************************************************************************
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
43 * GObject Implementation
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
44 *****************************************************************************/
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
45 G_DEFINE_TYPE_EXTENDED(
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
46 FinchIdle,
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
47 finch_idle,
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
48 G_TYPE_OBJECT,
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
49 0,
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
50 G_IMPLEMENT_INTERFACE(
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
51 PURPLE_TYPE_IDLE_UI,
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
52 finch_idle_purple_idle_ui_init
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
53 )
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
54 );
15802
1e124a68997e gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
55
41136
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
56 static void
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
57 finch_idle_init(FinchIdle *idle) {
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
58 }
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
59
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
60 static void
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
61 finch_idle_class_init(FinchIdleClass *klass) {
15802
1e124a68997e gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents:
diff changeset
62 }
41136
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
63
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
64 /******************************************************************************
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
65 * Public API
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
66 *****************************************************************************/
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
67 PurpleIdleUi *
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
68 finch_idle_new(void) {
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
69 return g_object_new(FINCH_TYPE_IDLE, NULL);
5397330041d6 Replace PurpleIdleUiOps with the PurpleIdleUi Interface
Gary Kramlich <grim@reaperworld.com>
parents: 40616
diff changeset
70 }

mercurial