File indexing completed on 2024-04-14 04:38:30
0001 /* 0002 This file is part of the Polkit-qt project 0003 SPDX-FileCopyrightText: 2009 Jaroslav Reznik <jreznik@redhat.com> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #ifndef LISTENER_ADAPTER_P_H 0009 #define LISTENER_ADAPTER_P_H 0010 0011 #include <QObject> 0012 0013 #include "polkitqt1-agent-listener.h" 0014 #include "polkitqt1-identity.h" 0015 #include "polkitqt1-details.h" 0016 0017 typedef struct _GList GList; 0018 typedef struct _GCancellable GCancellable; 0019 typedef struct _GAsyncResult GAsyncResult; 0020 typedef struct _GSimpleAsyncResult GSimpleAsyncResult; 0021 typedef struct _GError GError; 0022 typedef int gboolean; 0023 typedef char gchar; 0024 0025 namespace PolkitQt1 0026 { 0027 0028 namespace Agent 0029 { 0030 0031 class AsyncResult; 0032 class Listener; 0033 class ListenerAdapter : public QObject 0034 { 0035 Q_OBJECT 0036 Q_DISABLE_COPY(ListenerAdapter) 0037 public: 0038 static ListenerAdapter* instance(); 0039 ~ListenerAdapter() override {} 0040 0041 void polkit_qt_listener_initiate_authentication(PolkitAgentListener *listener, 0042 const gchar *action_id, 0043 const gchar *message, 0044 const gchar *icon_name, 0045 PolkitDetails *details, 0046 const gchar *cookie, 0047 GList *identities, 0048 GCancellable *cancellable, 0049 GSimpleAsyncResult *result); 0050 0051 gboolean polkit_qt_listener_initiate_authentication_finish(PolkitAgentListener *listener, 0052 GAsyncResult *res, 0053 GError **error); 0054 void cancelled_cb(PolkitAgentListener *listener); 0055 private: 0056 void addListener(Listener *listener); 0057 void removeListener(Listener *listener); 0058 Listener* findListener(PolkitAgentListener *listener); 0059 0060 explicit ListenerAdapter(QObject *parent = nullptr); 0061 QList<Listener *> m_listeners; 0062 0063 friend class Listener; 0064 }; 0065 0066 } 0067 0068 } 0069 0070 #endif