aboutsummaryrefslogtreecommitdiffstats
path: root/src/ephy-dbus.h
blob: 597109910b8e48728f9c36a13b6d9f09214f599a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/*
 *  Copyright (C) 2004 Jean-François rameau
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2, or (at your option)
 *  any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
 *  $Id$
 */

#ifndef EPHY_DBUS_H
#define EPHY_DBUS_H

#include <glib-object.h>

/* Yes, we know that DBUS API isn't stable yet */
#define DBUS_API_SUBJECT_TO_CHANGE
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>

G_BEGIN_DECLS

/* Epiphany's DBUS ids */
#define DBUS_EPHY_SERVICE       "org.gnome.Epiphany"
#define DBUS_EPHY_PATH          "/org/gnome/Epiphany"
#define DBUS_EPHY_INTERFACE     "org.gnome.Epiphany"

/* NetworkManager's DBUS ids */
#define DBUS_NETWORK_MANAGER_SERVICE    "org.freedesktop.NetworkManager"
#define DBUS_NETWORK_MANAGER_PATH   "/org/freedesktop/NetworkManager"
#define DBUS_NETWORK_MANAGER_INTERFACE  "org.freedesktop.NetworkManager"

#define EPHY_TYPE_DBUS      (ephy_dbus_get_type ())
#define EPHY_DBUS(o)        (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_DBUS, EphyDbus))
#define EPHY_DBUS_CLASS(k)  (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_DBUS, EphyDbusClass))
#define EPHY_IS_DBUS(o)     (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_DBUS))
#define EPHY_IS_DBUS_CLASS(k)   (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_DBUS))
#define EPHY_DBUS_GET_CLASS(o)  (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_DBUS, EphyDbusClass))

extern GQuark ephy_dbus_error_quark;
#define EPHY_DBUS_ERROR_QUARK   (ephy_dbus_error_quark)

typedef struct _EphyDbus    EphyDbus;
typedef struct _EphyDbusPrivate EphyDbusPrivate;
typedef struct _EphyDbusClass   EphyDbusClass;

typedef enum
{
    EPHY_DBUS_SESSION,
    EPHY_DBUS_SYSTEM
} EphyDbusBus;

struct _EphyDbus
{
    GObject parent;

    /*< private >*/
    EphyDbusPrivate *priv;
};

struct _EphyDbusClass
{
    GObjectClass parent_class;

    /* Signals */
    void (* connected)  (EphyDbus *dbus,
                 EphyDbusBus kind);
    void (* disconnected)   (EphyDbus *dbus,
                 EphyDbusBus kind);
};

GType       ephy_dbus_get_type  (void);

EphyDbus       *ephy_dbus_get_default   (void);

DBusGConnection *ephy_dbus_get_bus  (EphyDbus *dbus,
                     EphyDbusBus kind);

DBusGProxy  *ephy_dbus_get_proxy    (EphyDbus *dbus,
                     EphyDbusBus kind);

/* private */
gboolean       _ephy_dbus_startup   (GError **error);

void           _ephy_dbus_release   (void);

gboolean       _ephy_dbus_is_name_owner (void);

G_END_DECLS

#endif /* !EPHY_DBUS_H */