1 /* 2 * connection-manager.h - proxy for a Telepathy connection manager 3 * 4 * Copyright (C) 2007-2009 Collabora Ltd. <http://www.collabora.co.uk/> 5 * Copyright (C) 2007-2009 Nokia Corporation 6 * 7 * This library is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU Lesser General Public 9 * License as published by the Free Software Foundation; either 10 * version 2.1 of the License, or (at your option) any later version. 11 * 12 * This library is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Lesser General Public License for more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public 18 * License along with this library; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 */ 21 22 #if defined (TP_DISABLE_SINGLE_INCLUDE) && !defined (_TP_IN_META_HEADER) && !defined (_TP_COMPILATION) 23 #error "Only <telepathy-glib/telepathy-glib.h> and <telepathy-glib/telepathy-glib-dbus.h> can be included directly." 24 #endif 25 26 #ifndef __TP_CONNECTION_MANAGER_H__ 27 #define __TP_CONNECTION_MANAGER_H__ 28 29 #include <telepathy-glib/dbus.h> 30 #include <telepathy-glib/defs.h> 31 #include <telepathy-glib/protocol.h> 32 #include <telepathy-glib/proxy.h> 33 34 #include <telepathy-glib/_gen/genums.h> 35 36 G_BEGIN_DECLS 37 38 typedef struct _TpConnectionManager TpConnectionManager; 39 typedef struct _TpConnectionManagerClass TpConnectionManagerClass; 40 typedef struct _TpConnectionManagerPrivate TpConnectionManagerPrivate; 41 42 GType tp_connection_manager_get_type (void); 43 GType tp_connection_manager_param_get_type (void); 44 GType tp_connection_manager_protocol_get_type (void); 45 46 /* TYPE MACROS */ 47 #define TP_TYPE_CONNECTION_MANAGER \ 48 (tp_connection_manager_get_type ()) 49 #define TP_CONNECTION_MANAGER(obj) \ 50 (G_TYPE_CHECK_INSTANCE_CAST((obj), TP_TYPE_CONNECTION_MANAGER, \ 51 TpConnectionManager)) 52 #define TP_CONNECTION_MANAGER_CLASS(klass) \ 53 (G_TYPE_CHECK_CLASS_CAST((klass), TP_TYPE_CONNECTION_MANAGER, \ 54 TpConnectionManagerClass)) 55 #define TP_IS_CONNECTION_MANAGER(obj) \ 56 (G_TYPE_CHECK_INSTANCE_TYPE((obj), TP_TYPE_CONNECTION_MANAGER)) 57 #define TP_IS_CONNECTION_MANAGER_CLASS(klass) \ 58 (G_TYPE_CHECK_CLASS_TYPE((klass), TP_TYPE_CONNECTION_MANAGER)) 59 #define TP_CONNECTION_MANAGER_GET_CLASS(obj) \ 60 (G_TYPE_INSTANCE_GET_CLASS ((obj), TP_TYPE_CONNECTION_MANAGER, \ 61 TpConnectionManagerClass)) 62 63 #define TP_TYPE_CONNECTION_MANAGER_PARAM \ 64 (tp_connection_manager_param_get_type ()) 65 #define TP_TYPE_CONNECTION_MANAGER_PROTOCOL \ 66 (tp_connection_manager_protocol_get_type ()) 67 68 typedef struct _TpConnectionManagerProtocol TpConnectionManagerProtocol; 69 struct _TpConnectionManagerProtocol 70 { 71 /*<public>*/ 72 gchar *name; 73 TpConnectionManagerParam *params; 74 75 /*<private>*/ 76 gpointer priv; 77 }; 78 79 typedef enum 80 { 81 TP_CM_INFO_SOURCE_NONE, 82 TP_CM_INFO_SOURCE_FILE, 83 TP_CM_INFO_SOURCE_LIVE 84 } TpCMInfoSource; 85 86 struct _TpConnectionManager { 87 /*<private>*/ 88 TpProxy parent; 89 90 const gchar *_TP_SEAL (name); 91 const TpConnectionManagerProtocol * const *_TP_SEAL (protocols); 92 93 /* These are really booleans, but gboolean is signed. Thanks, GLib */ 94 unsigned int _TP_SEAL (running):1; 95 unsigned int _TP_SEAL (always_introspect):1; 96 /* TpCMInfoSource, but can't rely on enums being unsigned */ 97 unsigned int _TP_SEAL (info_source):2; 98 guint _TP_SEAL (reserved_flags):28; 99 100 TpConnectionManagerPrivate *priv; 101 }; 102 103 struct _TpConnectionManagerClass { 104 /*<private>*/ 105 TpProxyClass parent_class; 106 gpointer *priv; 107 }; 108 109 TpConnectionManager *tp_connection_manager_new (TpDBusDaemon *dbus, 110 const gchar *name, const gchar *manager_filename, GError **error) 111 G_GNUC_WARN_UNUSED_RESULT; 112 113 gboolean tp_connection_manager_activate (TpConnectionManager *self); 114 115 typedef void (*TpConnectionManagerListCb) (TpConnectionManager * const *cms, 116 gsize n_cms, const GError *error, gpointer user_data, 117 GObject *weak_object); 118 119 #ifndef TP_DISABLE_DEPRECATED 120 _TP_DEPRECATED_IN_0_20_FOR (tp_list_connection_managers_async) 121 void tp_list_connection_managers (TpDBusDaemon *bus_daemon, 122 TpConnectionManagerListCb callback, 123 gpointer user_data, GDestroyNotify destroy, 124 GObject *weak_object); 125 #endif 126 127 _TP_AVAILABLE_IN_0_18 128 void tp_list_connection_managers_async (TpDBusDaemon *dbus_daemon, 129 GAsyncReadyCallback callback, 130 gpointer user_data); 131 _TP_AVAILABLE_IN_0_18 132 GList *tp_list_connection_managers_finish (GAsyncResult *result, 133 GError **error); 134 135 #ifndef TP_DISABLE_DEPRECATED 136 typedef void (*TpConnectionManagerWhenReadyCb) (TpConnectionManager *cm, 137 const GError *error, gpointer user_data, GObject *weak_object); 138 139 _TP_DEPRECATED_IN_0_18_FOR (tp_proxy_prepare_async) 140 void tp_connection_manager_call_when_ready (TpConnectionManager *self, 141 TpConnectionManagerWhenReadyCb callback, 142 gpointer user_data, GDestroyNotify destroy, GObject *weak_object); 143 144 _TP_DEPRECATED_IN_0_18_FOR (tp_proxy_is_prepared) 145 gboolean tp_connection_manager_is_ready (TpConnectionManager *self); 146 #endif 147 148 const gchar *tp_connection_manager_get_name (TpConnectionManager *self); 149 gboolean tp_connection_manager_is_running (TpConnectionManager *self); 150 TpCMInfoSource tp_connection_manager_get_info_source ( 151 TpConnectionManager *self); 152 153 gboolean tp_connection_manager_check_valid_name (const gchar *name, 154 GError **error); 155 156 gboolean tp_connection_manager_check_valid_protocol_name (const gchar *name, 157 GError **error); 158 159 gchar **tp_connection_manager_dup_protocol_names (TpConnectionManager *self) 160 G_GNUC_WARN_UNUSED_RESULT; 161 gboolean tp_connection_manager_has_protocol (TpConnectionManager *self, 162 const gchar *protocol); 163 TpProtocol *tp_connection_manager_get_protocol_object ( 164 TpConnectionManager *self, const gchar *protocol); 165 _TP_AVAILABLE_IN_0_18 166 GList *tp_connection_manager_dup_protocols (TpConnectionManager *self) 167 G_GNUC_WARN_UNUSED_RESULT; 168 169 #ifndef TP_DISABLE_DEPRECATED 170 _TP_DEPRECATED_IN_0_20_FOR (tp_connection_manager_get_protocol_object) 171 const TpConnectionManagerProtocol *tp_connection_manager_get_protocol ( 172 TpConnectionManager *self, const gchar *protocol); 173 174 _TP_DEPRECATED_IN_0_20_FOR (tp_protocol_dup_param_names) 175 gchar **tp_connection_manager_protocol_dup_param_names ( 176 const TpConnectionManagerProtocol *protocol) 177 G_GNUC_WARN_UNUSED_RESULT; 178 _TP_DEPRECATED_IN_0_20_FOR (tp_protocol_has_param) 179 gboolean tp_connection_manager_protocol_has_param ( 180 const TpConnectionManagerProtocol *protocol, 181 const gchar *param); 182 _TP_DEPRECATED_IN_0_20_FOR (tp_protocol_dup_param) 183 const TpConnectionManagerParam *tp_connection_manager_protocol_get_param ( 184 const TpConnectionManagerProtocol *protocol, const gchar *param); 185 _TP_DEPRECATED_IN_0_20_FOR (tp_protocol_can_register) 186 gboolean tp_connection_manager_protocol_can_register ( 187 const TpConnectionManagerProtocol *protocol); 188 #endif 189 190 const gchar *tp_connection_manager_param_get_name ( 191 const TpConnectionManagerParam *param); 192 const gchar *tp_connection_manager_param_get_dbus_signature ( 193 const TpConnectionManagerParam *param); 194 gboolean tp_connection_manager_param_is_required ( 195 const TpConnectionManagerParam *param); 196 gboolean tp_connection_manager_param_is_required_for_registration ( 197 const TpConnectionManagerParam *param); 198 gboolean tp_connection_manager_param_is_secret ( 199 const TpConnectionManagerParam *param); 200 gboolean tp_connection_manager_param_is_dbus_property ( 201 const TpConnectionManagerParam *param); 202 gboolean tp_connection_manager_param_get_default ( 203 const TpConnectionManagerParam *param, GValue *value); 204 _TP_AVAILABLE_IN_0_20 205 GVariant *tp_connection_manager_param_dup_default_variant ( 206 const TpConnectionManagerParam *param); 207 _TP_AVAILABLE_IN_0_24 208 GVariantType *tp_connection_manager_param_dup_variant_type ( 209 const TpConnectionManagerParam *param); 210 211 void tp_connection_manager_init_known_interfaces (void); 212 213 #define TP_CONNECTION_MANAGER_FEATURE_CORE \ 214 (tp_connection_manager_get_feature_quark_core ()) 215 216 GQuark tp_connection_manager_get_feature_quark_core (void) G_GNUC_CONST; 217 218 TpConnectionManagerParam *tp_connection_manager_param_copy ( 219 const TpConnectionManagerParam *in); 220 void tp_connection_manager_param_free (TpConnectionManagerParam *param); 221 222 #ifndef TP_DISABLE_DEPRECATED 223 _TP_DEPRECATED_IN_0_20 224 TpConnectionManagerProtocol *tp_connection_manager_protocol_copy ( 225 const TpConnectionManagerProtocol *in); 226 _TP_DEPRECATED_IN_0_20 227 void tp_connection_manager_protocol_free (TpConnectionManagerProtocol *proto); 228 #endif 229 230 G_END_DECLS 231 232 #include <telepathy-glib/_gen/tp-cli-connection-manager.h> 233 234 #endif 235