diff options
-rw-r--r-- | libempathy-gtk/empathy-protocol-chooser.c | 14 | ||||
-rw-r--r-- | libempathy/Makefile.am | 2 | ||||
-rw-r--r-- | libempathy/empathy-connection-managers.h | 87 | ||||
-rw-r--r-- | src/empathy-accounts-dialog.c | 12 | ||||
-rw-r--r-- | src/empathy-import-dialog.c | 10 | ||||
-rw-r--r-- | src/empathy-import-dialog.h | 4 | ||||
-rw-r--r-- | src/empathy-import-utils.c | 9 | ||||
-rw-r--r-- | src/empathy-import-widget.c | 10 | ||||
-rw-r--r-- | src/empathy-import-widget.h | 4 | ||||
-rw-r--r-- | tp-account-widgets/Makefile.am | 2 | ||||
-rw-r--r-- | tp-account-widgets/tpaw-account-settings.c | 10 | ||||
-rw-r--r-- | tp-account-widgets/tpaw-connection-managers.c (renamed from libempathy/empathy-connection-managers.c) | 122 | ||||
-rw-r--r-- | tp-account-widgets/tpaw-connection-managers.h | 87 |
13 files changed, 187 insertions, 186 deletions
diff --git a/libempathy-gtk/empathy-protocol-chooser.c b/libempathy-gtk/empathy-protocol-chooser.c index b2fec5e0f..d2fec3041 100644 --- a/libempathy-gtk/empathy-protocol-chooser.c +++ b/libempathy-gtk/empathy-protocol-chooser.c @@ -24,8 +24,8 @@ #include "empathy-protocol-chooser.h" #include <glib/gi18n-lib.h> +#include <tp-account-widgets/tpaw-connection-managers.h> -#include "empathy-connection-managers.h" #include "empathy-ui-utils.h" #include "empathy-utils.h" @@ -56,7 +56,7 @@ typedef struct GtkListStore *store; gboolean dispose_run; - EmpathyConnectionManagers *cms; + TpawConnectionManagers *cms; EmpathyProtocolChooserFilterFunc filter_func; gpointer filter_user_data; @@ -301,14 +301,14 @@ protocol_chooser_cms_prepare_cb (GObject *source, GAsyncResult *result, gpointer user_data) { - EmpathyConnectionManagers *cms = EMPATHY_CONNECTION_MANAGERS (source); + TpawConnectionManagers *cms = TPAW_CONNECTION_MANAGERS (source); EmpathyProtocolChooser *protocol_chooser = user_data; - if (!empathy_connection_managers_prepare_finish (cms, result, NULL)) + if (!tpaw_connection_managers_prepare_finish (cms, result, NULL)) return; protocol_chooser_add_cms_list (protocol_chooser, - empathy_connection_managers_get_cms (cms)); + tpaw_connection_managers_get_cms (cms)); } static void @@ -353,7 +353,7 @@ protocol_chooser_constructed (GObject *object) "text", COL_LABEL, NULL); - empathy_connection_managers_prepare_async (priv->cms, + tpaw_connection_managers_prepare_async (priv->cms, protocol_chooser_cms_prepare_cb, protocol_chooser); if (G_OBJECT_CLASS (empathy_protocol_chooser_parent_class)->constructed) @@ -369,7 +369,7 @@ empathy_protocol_chooser_init (EmpathyProtocolChooser *protocol_chooser) EMPATHY_TYPE_PROTOCOL_CHOOSER, EmpathyProtocolChooserPriv); priv->dispose_run = FALSE; - priv->cms = empathy_connection_managers_dup_singleton (); + priv->cms = tpaw_connection_managers_dup_singleton (); priv->protocols = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); diff --git a/libempathy/Makefile.am b/libempathy/Makefile.am index d7a638859..13678a252 100644 --- a/libempathy/Makefile.am +++ b/libempathy/Makefile.am @@ -32,7 +32,6 @@ libempathy_headers = \ empathy-chatroom-manager.h \ empathy-chatroom.h \ empathy-client-factory.h \ - empathy-connection-managers.h \ empathy-connection-aggregator.h \ empathy-contact-groups.h \ empathy-contact.h \ @@ -65,7 +64,6 @@ libempathy_handwritten_source = \ empathy-chatroom-manager.c \ empathy-chatroom.c \ empathy-client-factory.c \ - empathy-connection-managers.c \ empathy-connection-aggregator.c \ empathy-contact-groups.c \ empathy-contact.c \ diff --git a/libempathy/empathy-connection-managers.h b/libempathy/empathy-connection-managers.h deleted file mode 100644 index 0ed20c934..000000000 --- a/libempathy/empathy-connection-managers.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * empathy-connection-managers.h - Header for EmpathyConnectionManagers - * Copyright (C) 2009 Collabora Ltd. - * @author Sjoerd Simons <sjoerd.simons@collabora.co.uk> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef __EMPATHY_CONNECTION_MANAGERS_H__ -#define __EMPATHY_CONNECTION_MANAGERS_H__ - -#include <glib-object.h> -#include <gio/gio.h> -#include <telepathy-glib/telepathy-glib.h> - -G_BEGIN_DECLS - -typedef struct _EmpathyConnectionManagers EmpathyConnectionManagers; -typedef struct _EmpathyConnectionManagersClass EmpathyConnectionManagersClass; - -struct _EmpathyConnectionManagersClass { - GObjectClass parent_class; -}; - -struct _EmpathyConnectionManagers { - GObject parent; - gpointer priv; -}; - -GType empathy_connection_managers_get_type (void); - -/* TYPE MACROS */ -#define EMPATHY_TYPE_CONNECTION_MANAGERS \ - (empathy_connection_managers_get_type ()) -#define EMPATHY_CONNECTION_MANAGERS(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), EMPATHY_TYPE_CONNECTION_MANAGERS, \ - EmpathyConnectionManagers)) -#define EMPATHY_CONNECTION_MANAGERS_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), EMPATHY_TYPE_CONNECTION_MANAGERS, \ - EmpathyConnectionManagersClass)) -#define EMPATHY_IS_CONNECTION_MANAGERS(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), EMPATHY_TYPE_CONNECTION_MANAGERS)) -#define EMPATHY_IS_CONNECTION_MANAGERS_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), EMPATHY_TYPE_CONNECTION_MANAGERS)) -#define EMPATHY_CONNECTION_MANAGERS_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), EMPATHY_TYPE_CONNECTION_MANAGERS, \ - EmpathyConnectionManagersClass)) - -EmpathyConnectionManagers *empathy_connection_managers_dup_singleton (void); -gboolean empathy_connection_managers_is_ready ( - EmpathyConnectionManagers *managers); - -void empathy_connection_managers_update (EmpathyConnectionManagers *managers); - -GList * empathy_connection_managers_get_cms ( - EmpathyConnectionManagers *managers); -guint empathy_connection_managers_get_cms_num - (EmpathyConnectionManagers *managers); - -TpConnectionManager *empathy_connection_managers_get_cm ( - EmpathyConnectionManagers *managers, const gchar *cm); - -void empathy_connection_managers_prepare_async ( - EmpathyConnectionManagers *managers, - GAsyncReadyCallback callback, - gpointer user_data); - -gboolean empathy_connection_managers_prepare_finish ( - EmpathyConnectionManagers *managers, - GAsyncResult *result, - GError **error); - -G_END_DECLS - -#endif /* #ifndef __EMPATHY_CONNECTION_MANAGERS_H__*/ diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c index 73d67485d..409a9ce38 100644 --- a/src/empathy-accounts-dialog.c +++ b/src/empathy-accounts-dialog.c @@ -114,7 +114,7 @@ typedef struct { TpawAccountSettings *settings_ready; TpAccountManager *account_manager; - EmpathyConnectionManagers *cms; + TpawConnectionManagers *cms; GNetworkMonitor *connectivity; GtkWindow *parent_window; @@ -2150,11 +2150,11 @@ accounts_dialog_cms_prepare_cb (GObject *source, GAsyncResult *result, gpointer user_data) { - EmpathyConnectionManagers *cms = EMPATHY_CONNECTION_MANAGERS (source); + TpawConnectionManagers *cms = TPAW_CONNECTION_MANAGERS (source); EmpathyAccountsDialog *dialog = user_data; EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog); - if (!empathy_connection_managers_prepare_finish (cms, result, NULL)) + if (!tpaw_connection_managers_prepare_finish (cms, result, NULL)) goto out; /* No need to update the settings if we are already preparing one */ @@ -2199,9 +2199,9 @@ accounts_dialog_accounts_setup (EmpathyAccountsDialog *dialog) } g_list_free_full (accounts, g_object_unref); - priv->cms = empathy_connection_managers_dup_singleton (); + priv->cms = tpaw_connection_managers_dup_singleton (); - empathy_connection_managers_prepare_async (priv->cms, + tpaw_connection_managers_prepare_async (priv->cms, accounts_dialog_cms_prepare_cb, dialog); accounts_dialog_model_select_first (dialog); @@ -2581,7 +2581,7 @@ empathy_accounts_dialog_show (GtkWindow *parent, if (selected_account) { - if (priv->cms != NULL && empathy_connection_managers_is_ready (priv->cms)) + if (priv->cms != NULL && tpaw_connection_managers_is_ready (priv->cms)) accounts_dialog_set_selected_account (dialog, selected_account); else /* save the selection to set it later when the cms diff --git a/src/empathy-import-dialog.c b/src/empathy-import-dialog.c index 5e6fa8d55..9d86dd1de 100644 --- a/src/empathy-import-dialog.c +++ b/src/empathy-import-dialog.c @@ -43,7 +43,7 @@ typedef struct { EmpathyImportWidget *iw; gboolean show_warning; - EmpathyConnectionManagers *cms; + TpawConnectionManagers *cms; } EmpathyImportDialogPriv; G_DEFINE_TYPE (EmpathyImportDialog, empathy_import_dialog, GTK_TYPE_DIALOG) @@ -241,8 +241,8 @@ empathy_import_dialog_class_init (EmpathyImportDialogClass *klass) g_object_class_install_property (oclass, PROP_SHOW_WARNING, param_spec); param_spec = g_param_spec_object ("cms", - "EmpathyConnectionManagers", "EmpathyConnectionManager", - EMPATHY_TYPE_CONNECTION_MANAGERS, + "TpawConnectionManagers", "EmpathyConnectionManager", + TPAW_TYPE_CONNECTION_MANAGERS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY); g_object_class_install_property (oclass, PROP_CMS, param_spec); @@ -252,9 +252,9 @@ empathy_import_dialog_class_init (EmpathyImportDialogClass *klass) GtkWidget * empathy_import_dialog_new (GtkWindow *parent, gboolean warning, - EmpathyConnectionManagers *cms) + TpawConnectionManagers *cms) { - g_return_val_if_fail (EMPATHY_IS_CONNECTION_MANAGERS (cms), NULL); + g_return_val_if_fail (TPAW_IS_CONNECTION_MANAGERS (cms), NULL); return g_object_new (EMPATHY_TYPE_IMPORT_DIALOG, "parent-window", parent, diff --git a/src/empathy-import-dialog.h b/src/empathy-import-dialog.h index 87f1198f1..8fce49fcd 100644 --- a/src/empathy-import-dialog.h +++ b/src/empathy-import-dialog.h @@ -25,7 +25,7 @@ #ifndef __EMPATHY_IMPORT_DIALOG_H__ #define __EMPATHY_IMPORT_DIALOG_H__ -#include "empathy-connection-managers.h" +#include <tp-account-widgets/tpaw-connection-managers.h> G_BEGIN_DECLS @@ -59,7 +59,7 @@ GType empathy_import_dialog_get_type (void); GtkWidget* empathy_import_dialog_new (GtkWindow *parent_window, gboolean show_warning, - EmpathyConnectionManagers *cms); + TpawConnectionManagers *cms); G_END_DECLS diff --git a/src/empathy-import-utils.c b/src/empathy-import-utils.c index c38233647..d95326bc2 100644 --- a/src/empathy-import-utils.c +++ b/src/empathy-import-utils.c @@ -22,7 +22,8 @@ #include "config.h" #include "empathy-import-utils.h" -#include "empathy-connection-managers.h" +#include <tp-account-widgets/tpaw-connection-managers.h> + #include "empathy-import-pidgin.h" #include "empathy-utils.h" @@ -80,13 +81,13 @@ gboolean empathy_import_protocol_is_supported (const gchar *protocol, TpConnectionManager **cm) { - EmpathyConnectionManagers *manager; + TpawConnectionManagers *manager; GList *cms; GList *l; gboolean proto_is_supported = FALSE; - manager = empathy_connection_managers_dup_singleton (); - cms = empathy_connection_managers_get_cms (manager); + manager = tpaw_connection_managers_dup_singleton (); + cms = tpaw_connection_managers_get_cms (manager); for (l = cms; l; l = l->next) { diff --git a/src/empathy-import-widget.c b/src/empathy-import-widget.c index 86dc95150..0103b6a8f 100644 --- a/src/empathy-import-widget.c +++ b/src/empathy-import-widget.c @@ -60,7 +60,7 @@ typedef struct { GList *accounts; EmpathyImportApplication app_id; - EmpathyConnectionManagers *cms; + TpawConnectionManagers *cms; gboolean dispose_run; } EmpathyImportWidgetPriv; @@ -464,8 +464,8 @@ empathy_import_widget_class_init (EmpathyImportWidgetClass *klass) g_object_class_install_property (oclass, PROP_APPLICATION_ID, param_spec); param_spec = g_param_spec_object ("cms", - "EmpathyConnectionManagers", "EmpathyConnectionManager", - EMPATHY_TYPE_CONNECTION_MANAGERS, + "TpawConnectionManagers", "TpawConnectionManagers", + TPAW_TYPE_CONNECTION_MANAGERS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY); g_object_class_install_property (oclass, PROP_CMS, param_spec); @@ -484,9 +484,9 @@ empathy_import_widget_init (EmpathyImportWidget *self) EmpathyImportWidget * empathy_import_widget_new (EmpathyImportApplication id, - EmpathyConnectionManagers *cms) + TpawConnectionManagers *cms) { - g_return_val_if_fail (EMPATHY_IS_CONNECTION_MANAGERS (cms), NULL); + g_return_val_if_fail (TPAW_IS_CONNECTION_MANAGERS (cms), NULL); return g_object_new (EMPATHY_TYPE_IMPORT_WIDGET, "application-id", id, diff --git a/src/empathy-import-widget.h b/src/empathy-import-widget.h index 8e9f32f5a..221fa1439 100644 --- a/src/empathy-import-widget.h +++ b/src/empathy-import-widget.h @@ -26,8 +26,8 @@ #define __EMPATHY_IMPORT_WIDGET_H__ #include <gtk/gtk.h> +#include <tp-account-widgets/tpaw-connection-managers.h> -#include "empathy-connection-managers.h" #include "empathy-import-utils.h" G_BEGIN_DECLS @@ -61,7 +61,7 @@ typedef struct { GType empathy_import_widget_get_type (void); EmpathyImportWidget* empathy_import_widget_new (EmpathyImportApplication id, - EmpathyConnectionManagers *cms); + TpawConnectionManagers *cms); GtkWidget * empathy_import_widget_get_widget (EmpathyImportWidget *self); diff --git a/tp-account-widgets/Makefile.am b/tp-account-widgets/Makefile.am index 554c1a639..7c615e4b0 100644 --- a/tp-account-widgets/Makefile.am +++ b/tp-account-widgets/Makefile.am @@ -21,6 +21,7 @@ libtp_account_widgets_sources = \ tpaw-account-widget-irc.c \ tpaw-account-widget-private.h \ tpaw-account-widget-sip.c \ + tpaw-connection-managers.c \ tpaw-irc-network-chooser.c \ tpaw-irc-network-chooser-dialog.c \ tpaw-irc-network-dialog.c \ @@ -35,6 +36,7 @@ libtp_account_widgets_headers = \ tpaw-account-widget.h \ tpaw-account-widget-irc.h \ tpaw-account-widget-sip.h \ + tpaw-connection-managers.h \ tpaw-irc-network-chooser-dialog.h \ tpaw-irc-network-chooser.h \ tpaw-irc-network-dialog.h \ diff --git a/tp-account-widgets/tpaw-account-settings.c b/tp-account-widgets/tpaw-account-settings.c index 1559da4bf..a837a251e 100644 --- a/tp-account-widgets/tpaw-account-settings.c +++ b/tp-account-widgets/tpaw-account-settings.c @@ -21,7 +21,7 @@ #include "config.h" #include "tpaw-account-settings.h" -#include "empathy-connection-managers.h" +#include "tpaw-connection-managers.h" #include "empathy-keyring.h" #include "empathy-presence-manager.h" #include "empathy-utils.h" @@ -56,7 +56,7 @@ typedef struct _TpawAccountSettingsPriv TpawAccountSettingsPriv; struct _TpawAccountSettingsPriv { gboolean dispose_has_run; - EmpathyConnectionManagers *managers; + TpawConnectionManagers *managers; TpAccountManager *account_manager; TpConnectionManager *manager; @@ -112,7 +112,7 @@ tpaw_account_settings_init (TpawAccountSettings *obj) obj->priv = priv; /* allocate any data required by the object here */ - priv->managers = empathy_connection_managers_dup_singleton (); + priv->managers = tpaw_connection_managers_dup_singleton (); priv->account_manager = tp_account_manager_dup (); priv->parameters = g_hash_table_new_full (g_str_hash, g_str_equal, @@ -474,12 +474,12 @@ tpaw_account_settings_check_readyness (TpawAccountSettings *self) && !tp_account_is_prepared (priv->account, TP_ACCOUNT_FEATURE_CORE)) return; - if (!empathy_connection_managers_is_ready (priv->managers)) + if (!tpaw_connection_managers_is_ready (priv->managers)) return; if (priv->manager == NULL) { - priv->manager = empathy_connection_managers_get_cm ( + priv->manager = tpaw_connection_managers_get_cm ( priv->managers, priv->cm_name); } diff --git a/libempathy/empathy-connection-managers.c b/tp-account-widgets/tpaw-connection-managers.c index b94ac1253..f648340aa 100644 --- a/libempathy/empathy-connection-managers.c +++ b/tp-account-widgets/tpaw-connection-managers.c @@ -1,5 +1,5 @@ /* - * empathy-connection-managers.c - Source for EmpathyConnectionManagers + * tpaw-connection-managers.c - Source for TpawConnectionManagers * Copyright (C) 2009 Collabora Ltd. * @author Sjoerd Simons <sjoerd.simons@collabora.co.uk> * @@ -19,7 +19,7 @@ */ #include "config.h" -#include "empathy-connection-managers.h" +#include "tpaw-connection-managers.h" #include "empathy-utils.h" @@ -28,7 +28,7 @@ static GObject *managers = NULL; -G_DEFINE_TYPE(EmpathyConnectionManagers, empathy_connection_managers, +G_DEFINE_TYPE(TpawConnectionManagers, tpaw_connection_managers, G_TYPE_OBJECT) /* signal enum */ @@ -45,14 +45,14 @@ enum { PROP_READY = 1 }; -#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyConnectionManagers) +#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, TpawConnectionManagers) /* private structure */ -typedef struct _EmpathyConnectionManagersPriv - EmpathyConnectionManagersPriv; +typedef struct _TpawConnectionManagersPriv + TpawConnectionManagersPriv; -struct _EmpathyConnectionManagersPriv +struct _TpawConnectionManagersPriv { gboolean dispose_has_run; gboolean ready; @@ -63,26 +63,26 @@ struct _EmpathyConnectionManagersPriv }; static void -empathy_connection_managers_init (EmpathyConnectionManagers *obj) +tpaw_connection_managers_init (TpawConnectionManagers *obj) { - EmpathyConnectionManagersPriv *priv = + TpawConnectionManagersPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE ((obj), \ - EMPATHY_TYPE_CONNECTION_MANAGERS, EmpathyConnectionManagersPriv); + TPAW_TYPE_CONNECTION_MANAGERS, TpawConnectionManagersPriv); obj->priv = priv; priv->dbus = tp_dbus_daemon_dup (NULL); g_assert (priv->dbus != NULL); - empathy_connection_managers_update (obj); + tpaw_connection_managers_update (obj); /* allocate any data required by the object here */ } -static void empathy_connection_managers_dispose (GObject *object); +static void tpaw_connection_managers_dispose (GObject *object); static GObject * -empathy_connection_managers_constructor (GType type, +tpaw_connection_managers_constructor (GType type, guint n_construct_params, GObjectConstructParam *construct_params) { @@ -90,7 +90,7 @@ empathy_connection_managers_constructor (GType type, return g_object_ref (managers); managers = - G_OBJECT_CLASS (empathy_connection_managers_parent_class)->constructor + G_OBJECT_CLASS (tpaw_connection_managers_parent_class)->constructor (type, n_construct_params, construct_params); g_object_add_weak_pointer (managers, (gpointer) &managers); @@ -101,13 +101,13 @@ empathy_connection_managers_constructor (GType type, static void -empathy_connection_managers_get_property (GObject *object, +tpaw_connection_managers_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { - EmpathyConnectionManagers *self = EMPATHY_CONNECTION_MANAGERS (object); - EmpathyConnectionManagersPriv *priv = GET_PRIV (self); + TpawConnectionManagers *self = TPAW_CONNECTION_MANAGERS (object); + TpawConnectionManagersPriv *priv = GET_PRIV (self); switch (prop_id) { @@ -121,18 +121,18 @@ empathy_connection_managers_get_property (GObject *object, } static void -empathy_connection_managers_class_init ( - EmpathyConnectionManagersClass *empathy_connection_managers_class) +tpaw_connection_managers_class_init ( + TpawConnectionManagersClass *tpaw_connection_managers_class) { GObjectClass *object_class = - G_OBJECT_CLASS (empathy_connection_managers_class); + G_OBJECT_CLASS (tpaw_connection_managers_class); - g_type_class_add_private (empathy_connection_managers_class, sizeof - (EmpathyConnectionManagersPriv)); + g_type_class_add_private (tpaw_connection_managers_class, sizeof + (TpawConnectionManagersPriv)); - object_class->constructor = empathy_connection_managers_constructor; - object_class->dispose = empathy_connection_managers_dispose; - object_class->get_property = empathy_connection_managers_get_property; + object_class->constructor = tpaw_connection_managers_constructor; + object_class->dispose = tpaw_connection_managers_dispose; + object_class->get_property = tpaw_connection_managers_get_property; g_object_class_install_property (object_class, PROP_READY, g_param_spec_boolean ("ready", @@ -150,9 +150,9 @@ empathy_connection_managers_class_init ( } static void -empathy_connection_managers_free_cm_list (EmpathyConnectionManagers *self) +tpaw_connection_managers_free_cm_list (TpawConnectionManagers *self) { - EmpathyConnectionManagersPriv *priv = GET_PRIV (self); + TpawConnectionManagersPriv *priv = GET_PRIV (self); GList *l; for (l = priv->cms ; l != NULL ; l = g_list_next (l)) @@ -165,10 +165,10 @@ empathy_connection_managers_free_cm_list (EmpathyConnectionManagers *self) } static void -empathy_connection_managers_dispose (GObject *object) +tpaw_connection_managers_dispose (GObject *object) { - EmpathyConnectionManagers *self = EMPATHY_CONNECTION_MANAGERS (object); - EmpathyConnectionManagersPriv *priv = GET_PRIV (self); + TpawConnectionManagers *self = TPAW_CONNECTION_MANAGERS (object); + TpawConnectionManagersPriv *priv = GET_PRIV (self); if (priv->dispose_has_run) return; @@ -179,38 +179,38 @@ empathy_connection_managers_dispose (GObject *object) g_object_unref (priv->dbus); priv->dbus = NULL; - empathy_connection_managers_free_cm_list (self); + tpaw_connection_managers_free_cm_list (self); /* release any references held by the object here */ - if (G_OBJECT_CLASS (empathy_connection_managers_parent_class)->dispose) - G_OBJECT_CLASS (empathy_connection_managers_parent_class)->dispose (object); + if (G_OBJECT_CLASS (tpaw_connection_managers_parent_class)->dispose) + G_OBJECT_CLASS (tpaw_connection_managers_parent_class)->dispose (object); } -EmpathyConnectionManagers * -empathy_connection_managers_dup_singleton (void) +TpawConnectionManagers * +tpaw_connection_managers_dup_singleton (void) { - return EMPATHY_CONNECTION_MANAGERS ( - g_object_new (EMPATHY_TYPE_CONNECTION_MANAGERS, NULL)); + return TPAW_CONNECTION_MANAGERS ( + g_object_new (TPAW_TYPE_CONNECTION_MANAGERS, NULL)); } gboolean -empathy_connection_managers_is_ready (EmpathyConnectionManagers *self) +tpaw_connection_managers_is_ready (TpawConnectionManagers *self) { - EmpathyConnectionManagersPriv *priv = GET_PRIV (self); + TpawConnectionManagersPriv *priv = GET_PRIV (self); return priv->ready; } static void -empathy_connection_managers_listed_cb (GObject *source, +tpaw_connection_managers_listed_cb (GObject *source, GAsyncResult *result, gpointer user_data) { TpWeakRef *wr = user_data; GError *error = NULL; - EmpathyConnectionManagers *self = tp_weak_ref_dup_object (wr); + TpawConnectionManagers *self = tp_weak_ref_dup_object (wr); GList *cms, *l; - EmpathyConnectionManagersPriv *priv; + TpawConnectionManagersPriv *priv; if (self == NULL) { @@ -220,7 +220,7 @@ empathy_connection_managers_listed_cb (GObject *source, priv = GET_PRIV (self); - empathy_connection_managers_free_cm_list (self); + tpaw_connection_managers_free_cm_list (self); cms = tp_list_connection_managers_finish (result, &error); if (error != NULL) @@ -252,28 +252,28 @@ out: } void -empathy_connection_managers_update (EmpathyConnectionManagers *self) +tpaw_connection_managers_update (TpawConnectionManagers *self) { - EmpathyConnectionManagersPriv *priv = GET_PRIV (self); + TpawConnectionManagersPriv *priv = GET_PRIV (self); tp_list_connection_managers_async (priv->dbus, - empathy_connection_managers_listed_cb, + tpaw_connection_managers_listed_cb, tp_weak_ref_new (self, NULL, NULL)); } GList * -empathy_connection_managers_get_cms (EmpathyConnectionManagers *self) +tpaw_connection_managers_get_cms (TpawConnectionManagers *self) { - EmpathyConnectionManagersPriv *priv = GET_PRIV (self); + TpawConnectionManagersPriv *priv = GET_PRIV (self); return priv->cms; } TpConnectionManager * -empathy_connection_managers_get_cm (EmpathyConnectionManagers *self, +tpaw_connection_managers_get_cm (TpawConnectionManagers *self, const gchar *cm) { - EmpathyConnectionManagersPriv *priv = GET_PRIV (self); + TpawConnectionManagersPriv *priv = GET_PRIV (self); GList *l; for (l = priv->cms ; l != NULL; l = g_list_next (l)) @@ -288,11 +288,11 @@ empathy_connection_managers_get_cm (EmpathyConnectionManagers *self, } guint -empathy_connection_managers_get_cms_num (EmpathyConnectionManagers *self) +tpaw_connection_managers_get_cms_num (TpawConnectionManagers *self) { - EmpathyConnectionManagersPriv *priv; + TpawConnectionManagersPriv *priv; - g_return_val_if_fail (EMPATHY_IS_CONNECTION_MANAGERS (self), 0); + g_return_val_if_fail (TPAW_IS_CONNECTION_MANAGERS (self), 0); priv = GET_PRIV (self); @@ -300,7 +300,7 @@ empathy_connection_managers_get_cms_num (EmpathyConnectionManagers *self) } static void -notify_ready_cb (EmpathyConnectionManagers *self, +notify_ready_cb (TpawConnectionManagers *self, GParamSpec *spec, GSimpleAsyncResult *result) { @@ -309,16 +309,16 @@ notify_ready_cb (EmpathyConnectionManagers *self, } void -empathy_connection_managers_prepare_async ( - EmpathyConnectionManagers *self, +tpaw_connection_managers_prepare_async ( + TpawConnectionManagers *self, GAsyncReadyCallback callback, gpointer user_data) { - EmpathyConnectionManagersPriv *priv = GET_PRIV (self); + TpawConnectionManagersPriv *priv = GET_PRIV (self); GSimpleAsyncResult *result; result = g_simple_async_result_new (G_OBJECT (managers), - callback, user_data, empathy_connection_managers_prepare_finish); + callback, user_data, tpaw_connection_managers_prepare_finish); if (priv->ready) { @@ -332,15 +332,15 @@ empathy_connection_managers_prepare_async ( } gboolean -empathy_connection_managers_prepare_finish ( - EmpathyConnectionManagers *self, +tpaw_connection_managers_prepare_finish ( + TpawConnectionManagers *self, GAsyncResult *result, GError **error) { GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result); g_return_val_if_fail (g_simple_async_result_is_valid (result, - G_OBJECT (self), empathy_connection_managers_prepare_finish), FALSE); + G_OBJECT (self), tpaw_connection_managers_prepare_finish), FALSE); if (g_simple_async_result_propagate_error (simple, error)) return FALSE; diff --git a/tp-account-widgets/tpaw-connection-managers.h b/tp-account-widgets/tpaw-connection-managers.h new file mode 100644 index 000000000..33e5aa081 --- /dev/null +++ b/tp-account-widgets/tpaw-connection-managers.h @@ -0,0 +1,87 @@ +/* + * tpaw-connection-managers.h - Header for TpawConnectionManagers + * Copyright (C) 2009 Collabora Ltd. + * @author Sjoerd Simons <sjoerd.simons@collabora.co.uk> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef __TPAW_CONNECTION_MANAGERS_H__ +#define __TPAW_CONNECTION_MANAGERS_H__ + +#include <glib-object.h> +#include <gio/gio.h> +#include <telepathy-glib/telepathy-glib.h> + +G_BEGIN_DECLS + +typedef struct _TpawConnectionManagers TpawConnectionManagers; +typedef struct _TpawConnectionManagersClass TpawConnectionManagersClass; + +struct _TpawConnectionManagersClass { + GObjectClass parent_class; +}; + +struct _TpawConnectionManagers { + GObject parent; + gpointer priv; +}; + +GType tpaw_connection_managers_get_type (void); + +/* TYPE MACROS */ +#define TPAW_TYPE_CONNECTION_MANAGERS \ + (tpaw_connection_managers_get_type ()) +#define TPAW_CONNECTION_MANAGERS(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), TPAW_TYPE_CONNECTION_MANAGERS, \ + TpawConnectionManagers)) +#define TPAW_CONNECTION_MANAGERS_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), TPAW_TYPE_CONNECTION_MANAGERS, \ + TpawConnectionManagersClass)) +#define TPAW_IS_CONNECTION_MANAGERS(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), TPAW_TYPE_CONNECTION_MANAGERS)) +#define TPAW_IS_CONNECTION_MANAGERS_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), TPAW_TYPE_CONNECTION_MANAGERS)) +#define TPAW_CONNECTION_MANAGERS_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), TPAW_TYPE_CONNECTION_MANAGERS, \ + TpawConnectionManagersClass)) + +TpawConnectionManagers *tpaw_connection_managers_dup_singleton (void); +gboolean tpaw_connection_managers_is_ready ( + TpawConnectionManagers *managers); + +void tpaw_connection_managers_update (TpawConnectionManagers *managers); + +GList * tpaw_connection_managers_get_cms ( + TpawConnectionManagers *managers); +guint tpaw_connection_managers_get_cms_num + (TpawConnectionManagers *managers); + +TpConnectionManager *tpaw_connection_managers_get_cm ( + TpawConnectionManagers *managers, const gchar *cm); + +void tpaw_connection_managers_prepare_async ( + TpawConnectionManagers *managers, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean tpaw_connection_managers_prepare_finish ( + TpawConnectionManagers *managers, + GAsyncResult *result, + GError **error); + +G_END_DECLS + +#endif /* #ifndef __TPAW_CONNECTION_MANAGERS_H__*/ |