Polkit-Qt-1  0.95.0
listeneradapter_p.h
1 /*
2  * This file is part of the Polkit-qt project
3  * Copyright (C) 2009 Jaroslav Reznik <jreznik@redhat.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public License
16  * along with this library; see the file COPYING.LIB. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef LISTENER_ADAPTER_P_H
22 #define LISTENER_ADAPTER_P_H
23 
24 #include <QtCore/QObject>
25 
26 #include "polkitqt1-agent-listener.h"
27 #include "polkitqt1-identity.h"
28 #include "polkitqt1-details.h"
29 
30 typedef struct _GList GList;
31 typedef struct _GCancellable GCancellable;
32 typedef struct _GAsyncResult GAsyncResult;
33 typedef struct _GSimpleAsyncResult GSimpleAsyncResult;
34 typedef struct _GError GError;
35 typedef int gboolean;
36 typedef char gchar;
37 
38 namespace PolkitQt1
39 {
40 
41 namespace Agent
42 {
43 
44 class AsyncResult;
45 class Listener;
46 class ListenerAdapter : public QObject
47 {
48  Q_OBJECT
49  Q_DISABLE_COPY(ListenerAdapter)
50 public:
51  static ListenerAdapter* instance();
52  ~ListenerAdapter() {}
53 
54  void polkit_qt_listener_initiate_authentication(PolkitAgentListener *listener,
55  const gchar *action_id,
56  const gchar *message,
57  const gchar *icon_name,
58  PolkitDetails *details,
59  const gchar *cookie,
60  GList *identities,
61  GCancellable *cancellable,
62  GSimpleAsyncResult *result);
63 
64  gboolean polkit_qt_listener_initiate_authentication_finish(PolkitAgentListener *listener,
65  GAsyncResult *res,
66  GError **error);
67  void cancelled_cb(PolkitAgentListener *listener);
68 private:
69  void addListener(Listener *listener);
70  void removeListener(Listener *listener);
71  Listener* findListener(PolkitAgentListener *listener);
72 
73  explicit ListenerAdapter(QObject *parent = 0);
74  QList<Listener *> m_listeners;
75 
76  friend class Listener;
77 };
78 
79 }
80 
81 }
82 
83 #endif
Namespace wrapping Polkit-Qt classes.
Definition: listeneradapter.cpp:26
Namespace wrapping Polkit-Qt Agent classes.