~ubuntu-branches/ubuntu/oneiric/polkit-qt-1/oneiric-proposed

« back to all changes in this revision

Viewing changes to agent/listeneradapter.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Thomas
  • Date: 2009-12-13 09:08:07 UTC
  • Revision ID: james.westby@ubuntu.com-20091213090807-ibl3mdtee5964009
Tags: upstream-0.95.0~svn1057107
ImportĀ upstreamĀ versionĀ 0.95.0~svn1057107

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 POLKIT_QT_AGENT_LISTENER_ADAPTER_H
 
22
#define POLKIT_QT_AGENT_LISTENER_ADAPTER_H
 
23
 
 
24
#include <QtCore/QObject>
 
25
 
 
26
#include "listener.h"
 
27
#include <PolkitQt/Identity>
 
28
#include <PolkitQt/Details>
 
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
/**
 
39
 * \namespace PolkitQtAgent PolkitQtAgent
 
40
 *
 
41
 * \brief Namespace wrapping Polkit-Qt Agent classes
 
42
 *
 
43
 * This namespace wraps all Polkit-Qt Agent classes.
 
44
 */
 
45
namespace PolkitQtAgent
 
46
{
 
47
class AsyncResult;
 
48
class Listener;
 
49
class ListenerAdapter : public QObject
 
50
{
 
51
    Q_OBJECT
 
52
    Q_DISABLE_COPY(ListenerAdapter)
 
53
public:
 
54
    static ListenerAdapter* instance();
 
55
    ~ListenerAdapter() {}
 
56
    
 
57
    void polkit_qt_listener_initiate_authentication(PolkitAgentListener  *listener,
 
58
                                                    const gchar          *action_id,
 
59
                                                    const gchar          *message,
 
60
                                                    const gchar          *icon_name,
 
61
                                                    PolkitDetails        *details,
 
62
                                                    const gchar          *cookie,
 
63
                                                    GList                *identities,
 
64
                                                    GCancellable         *cancellable,
 
65
                                                    GSimpleAsyncResult   *result);
 
66
                                                           
 
67
    gboolean polkit_qt_listener_initiate_authentication_finish(PolkitAgentListener  *listener,
 
68
                                                               GAsyncResult         *res,
 
69
                                                               GError               **error);
 
70
    void cancelled_cb(PolkitAgentListener *listener);
 
71
private:
 
72
    void addListener(Listener *listener);
 
73
    void removeListener(Listener *listener);
 
74
    Listener* findListener(PolkitAgentListener *listener);
 
75
    
 
76
    explicit ListenerAdapter(QObject *parent = 0); 
 
77
    QList<Listener *> m_listeners;
 
78
    
 
79
    friend class Listener;
 
80
};
 
81
 
 
82
}
 
83
 
 
84
#endif