~ubuntu-branches/ubuntu/saucy/hud/saucy-proposed

« back to all changes in this revision

Viewing changes to libhud-client/connection.h

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release
  • Date: 2013-06-05 12:33:44 UTC
  • mto: This revision was merged to the branch mainline in revision 5.
  • Revision ID: package-import@ubuntu.com-20130605123344-cpp4to647tyfv7kr
Tags: upstream-13.10.1daily13.06.05.1
Import upstream version 13.10.1daily13.06.05.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright © 2012 Canonical Ltd.
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify it
 
5
 * under the terms of the GNU General Public License version 3, as
 
6
 * published by the Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful, but
 
9
 * WITHOUT ANY WARRANTY; without even the implied warranties of
 
10
 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
 
11
 * PURPOSE.  See the GNU General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU General Public License along
 
14
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 * Author: Ted Gould <ted@canonical.com>
 
17
 */
 
18
 
 
19
#if !defined (_HUD_CLIENT_H_INSIDE) && !defined (HUD_CLIENT_COMPILATION)
 
20
#error "Only <hud-client.h> can be included directly."
 
21
#endif
 
22
 
 
23
#ifndef __HUD_CLIENT_CONNECTION_H__
 
24
#define __HUD_CLIENT_CONNECTION_H__
 
25
 
 
26
#pragma GCC visibility push(default)
 
27
 
 
28
#include <glib-object.h>
 
29
 
 
30
G_BEGIN_DECLS
 
31
 
 
32
#define HUD_CLIENT_TYPE_CONNECTION            (hud_client_connection_get_type ())
 
33
#define HUD_CLIENT_CONNECTION(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), HUD_CLIENT_TYPE_CONNECTION, HudClientConnection))
 
34
#define HUD_CLIENT_CONNECTION_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), HUD_CLIENT_TYPE_CONNECTION, HudClientConnectionClass))
 
35
#define HUD_CLIENT_IS_CONNECTION(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), HUD_CLIENT_TYPE_CONNECTION))
 
36
#define HUD_CLIENT_IS_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), HUD_CLIENT_TYPE_CONNECTION))
 
37
#define HUD_CLIENT_CONNECTION_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), HUD_CLIENT_TYPE_CONNECTION, HudClientConnectionClass))
 
38
 
 
39
/**
 
40
 * HUD_CLIENT_CONNECTION_SIGNAL_CONNECTION_STATUS:
 
41
 *
 
42
 * Signal to notify on a change in the connection status
 
43
 */
 
44
#define HUD_CLIENT_CONNECTION_SIGNAL_CONNECTION_STATUS   "connection-status"
 
45
 
 
46
typedef struct _HudClientConnection         HudClientConnection;
 
47
typedef struct _HudClientConnectionClass    HudClientConnectionClass;
 
48
typedef struct _HudClientConnectionPrivate  HudClientConnectionPrivate ;
 
49
 
 
50
/**
 
51
 * HudClientConnectionNewQueryCallback:
 
52
 * @connection: #HudClientConnection for the request
 
53
 * @query_path: Path to the query object on DBus
 
54
 * @results_name: DBus name for the results
 
55
 * @appstack_name: DBus name for the appstack
 
56
 * @user_data: Passed in user data
 
57
 *
 
58
 * Callback for the async call to create a new query
 
59
 */
 
60
typedef void  (*HudClientConnectionNewQueryCallback) (HudClientConnection *   connection,
 
61
                                                      const gchar *           query_path,
 
62
                                                      const gchar *           results_name,
 
63
                                                      const gchar *           appstack_name,
 
64
                                                      gpointer                user_data);
 
65
 
 
66
/**
 
67
 * HudClientConnectionClass:
 
68
 * @parent_class: #GObjectClass
 
69
 *
 
70
 * Class information for #HudClientConnection
 
71
 */
 
72
struct _HudClientConnectionClass {
 
73
        GObjectClass parent_class;
 
74
};
 
75
 
 
76
/**
 
77
 * HudClientConnection:
 
78
 *
 
79
 * Object to make a generic connection to a HUD service.  For the most
 
80
 * part people should just create a #HudClientQuery and that'll use the
 
81
 * default HUD service.  For most folks that should be enough.
 
82
 */
 
83
struct _HudClientConnection {
 
84
        GObject parent;
 
85
        HudClientConnectionPrivate * priv;
 
86
};
 
87
 
 
88
GType                   hud_client_connection_get_type   (void);
 
89
HudClientConnection *   hud_client_connection_get_ref    (void);
 
90
HudClientConnection *   hud_client_connection_new        (gchar * dbus_address,
 
91
                                                          gchar * dbus_path);
 
92
void                    hud_client_connection_new_query  (HudClientConnection * connection,
 
93
                                                          const gchar * query,
 
94
                                                          HudClientConnectionNewQueryCallback cb,
 
95
                                                          gpointer user_data);
 
96
const gchar *           hud_client_connection_get_address (HudClientConnection * connection);
 
97
gboolean                hud_client_connection_connected  (HudClientConnection * connection);
 
98
 
 
99
/**
 
100
        SECTION:connection
 
101
        @short_description: Provide a connection to the HUD service
 
102
        @stability: Unstable
 
103
        @include: libhud-client/connection.h
 
104
 
 
105
        The connection is an object to maintain a connection to the default
 
106
        objects on the HUD service.  It provides access to the functionality
 
107
        there and can be used to create queries.
 
108
 
 
109
        Most users should not bother with a connection, it will be created
 
110
        by the #HudClientQuery if one is not provided.  Most usage is for
 
111
        testing and using custom HUD services.
 
112
*/
 
113
 
 
114
G_END_DECLS
 
115
 
 
116
#pragma GCC visibility pop
 
117
 
 
118
#endif