aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-01-21 22:33:00 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-01-25 22:13:39 +0800
commita24db41f217eea1cbf929cc3e623c50ca626db4b (patch)
tree040d3acff08bdb54b0e2b0bfe48999611ccce41c /src
parentfcfdcc4011d7131d852d19474eb09eaa4a6e43d7 (diff)
downloadgsoc2013-empathy-a24db41f217eea1cbf929cc3e623c50ca626db4b.tar
gsoc2013-empathy-a24db41f217eea1cbf929cc3e623c50ca626db4b.tar.gz
gsoc2013-empathy-a24db41f217eea1cbf929cc3e623c50ca626db4b.tar.bz2
gsoc2013-empathy-a24db41f217eea1cbf929cc3e623c50ca626db4b.tar.lz
gsoc2013-empathy-a24db41f217eea1cbf929cc3e623c50ca626db4b.tar.xz
gsoc2013-empathy-a24db41f217eea1cbf929cc3e623c50ca626db4b.tar.zst
gsoc2013-empathy-a24db41f217eea1cbf929cc3e623c50ca626db4b.zip
Pass a ready EmpathyConnectionManagers to empathy_account_assistant_show
This kinda suck but we have to construct the assistant in a sync way so can't wait for the manager to become ready.
Diffstat (limited to 'src')
-rw-r--r--src/empathy-account-assistant.c31
-rw-r--r--src/empathy-account-assistant.h5
-rw-r--r--src/empathy.c43
3 files changed, 66 insertions, 13 deletions
diff --git a/src/empathy-account-assistant.c b/src/empathy-account-assistant.c
index 1e9fb32a9..519fc0701 100644
--- a/src/empathy-account-assistant.c
+++ b/src/empathy-account-assistant.c
@@ -65,7 +65,8 @@ enum {
};
enum {
- PROP_PARENT = 1
+ PROP_PARENT = 1,
+ PROP_CONNECTION_MGRS,
};
typedef struct {
@@ -73,6 +74,7 @@ typedef struct {
CreateEnterPageResponse create_enter_resp;
gboolean enter_create_forward;
TpAccountManager *account_mgr;
+ EmpathyConnectionManagers *connection_mgrs;
/* enter or create page */
GtkWidget *enter_or_create_page;
@@ -860,6 +862,9 @@ do_get_property (GObject *object,
case PROP_PARENT:
g_value_set_object (value, priv->parent_window);
break;
+ case PROP_CONNECTION_MGRS:
+ g_value_set_object (value, priv->connection_mgrs);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
@@ -878,6 +883,9 @@ do_set_property (GObject *object,
case PROP_PARENT:
priv->parent_window = g_value_get_object (value);
break;
+ case PROP_CONNECTION_MGRS:
+ priv->connection_mgrs = g_value_dup_object (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
@@ -895,6 +903,9 @@ do_constructed (GObject *object)
/* set the dialog hint, so this will be centered over the parent window */
gtk_window_set_type_hint (GTK_WINDOW (object), GDK_WINDOW_TYPE_HINT_DIALOG);
+
+ g_assert (priv->connection_mgrs != NULL);
+ g_assert (empathy_connection_managers_is_ready (priv->connection_mgrs));
}
static void
@@ -916,6 +927,9 @@ do_dispose (GObject *obj)
g_object_unref (priv->account_mgr);
priv->account_mgr = NULL;
+ g_object_unref (priv->connection_mgrs);
+ priv->connection_mgrs = NULL;
+
if (G_OBJECT_CLASS (empathy_account_assistant_parent_class)->dispose != NULL)
G_OBJECT_CLASS (empathy_account_assistant_parent_class)->dispose (obj);
}
@@ -942,6 +956,12 @@ empathy_account_assistant_class_init (EmpathyAccountAssistantClass *klass)
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_property (oclass, PROP_PARENT, param_spec);
+ param_spec = g_param_spec_object ("connection-managers",
+ "connection-managers", "A EmpathyConnectionManagers",
+ EMPATHY_TYPE_CONNECTION_MANAGERS,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY);
+ g_object_class_install_property (oclass, PROP_CONNECTION_MGRS, param_spec);
+
g_type_class_add_private (klass, sizeof (EmpathyAccountAssistantPriv));
}
@@ -1138,14 +1158,17 @@ empathy_account_assistant_init (EmpathyAccountAssistant *self)
}
GtkWidget *
-empathy_account_assistant_show (GtkWindow *window)
+empathy_account_assistant_show (GtkWindow *window,
+ EmpathyConnectionManagers *connection_mgrs)
{
static GtkWidget *dialog = NULL;
if (dialog == NULL)
{
- dialog = g_object_new (EMPATHY_TYPE_ACCOUNT_ASSISTANT, "parent-window",
- window, NULL);
+ dialog = g_object_new (EMPATHY_TYPE_ACCOUNT_ASSISTANT,
+ "parent-window", window,
+ "connection-managers", connection_mgrs,
+ NULL);
g_object_add_weak_pointer (G_OBJECT (dialog), (gpointer *) &dialog);
}
diff --git a/src/empathy-account-assistant.h b/src/empathy-account-assistant.h
index ef91fa9da..d99475fe3 100644
--- a/src/empathy-account-assistant.h
+++ b/src/empathy-account-assistant.h
@@ -26,6 +26,8 @@
#include <glib-object.h>
#include <gtk/gtk.h>
+#include <libempathy/empathy-connection-managers.h>
+
G_BEGIN_DECLS
#define EMPATHY_TYPE_ACCOUNT_ASSISTANT empathy_account_assistant_get_type()
@@ -56,7 +58,8 @@ typedef struct {
GType empathy_account_assistant_get_type (void);
-GtkWidget *empathy_account_assistant_show (GtkWindow *parent);
+GtkWidget *empathy_account_assistant_show (GtkWindow *parent,
+ EmpathyConnectionManagers *connection_mgrs);
G_END_DECLS
diff --git a/src/empathy.c b/src/empathy.c
index b18e349e6..f272ecfec 100644
--- a/src/empathy.c
+++ b/src/empathy.c
@@ -228,7 +228,8 @@ connection_managers_prepare_cb (GObject *source,
goto out;
if (should_show_account_assistant (account_mgr, cm_mgr))
- empathy_account_assistant_show (GTK_WINDOW (empathy_main_window_get ()));
+ empathy_account_assistant_show (GTK_WINDOW (empathy_main_window_get ()),
+ cm_mgr);
out:
g_object_unref (cm_mgr);
@@ -336,20 +337,46 @@ migrate_config_to_xdg_dir (void)
}
static void
+connection_managers_prepare_for_accounts (GObject *source,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ EmpathyConnectionManagers *cm_mgr = EMPATHY_CONNECTION_MANAGERS (source);
+ GtkWidget *ui;
+
+ if (!empathy_connection_managers_prepare_finish (cm_mgr, result, NULL))
+ goto out;
+
+ ui = empathy_account_assistant_show (GTK_WINDOW (empathy_main_window_get ()),
+ cm_mgr);
+
+ if (account_dialog_only)
+ g_signal_connect (ui, "destroy", G_CALLBACK (gtk_main_quit), NULL);
+
+out:
+ g_object_unref (cm_mgr);
+}
+
+static void
do_show_accounts_ui (GtkWindow *window,
TpAccountManager *manager)
{
+ if (has_non_salut_accounts (manager))
+ {
+ GtkWidget *ui;
- GtkWidget *ui;
+ ui = empathy_accounts_dialog_show (window, NULL);
- if (has_non_salut_accounts (manager))
- ui = empathy_accounts_dialog_show (window, NULL);
+ if (account_dialog_only)
+ g_signal_connect (ui, "destroy", G_CALLBACK (gtk_main_quit), NULL);
+ }
else
- ui = empathy_account_assistant_show (window);
+ {
+ EmpathyConnectionManagers *cm_mgr;
- if (account_dialog_only)
- g_signal_connect (ui, "destroy",
- G_CALLBACK (gtk_main_quit), NULL);
+ empathy_connection_managers_prepare_async (cm_mgr,
+ connection_managers_prepare_for_accounts, NULL);
+ }
}
static void