aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/empathy-account-assistant.c71
-rw-r--r--src/empathy-account-assistant.h2
-rw-r--r--src/empathy.c10
-rw-r--r--tests/test-empathy-account-assistant.c2
4 files changed, 79 insertions, 6 deletions
diff --git a/src/empathy-account-assistant.c b/src/empathy-account-assistant.c
index 852ea4534..e92826688 100644
--- a/src/empathy-account-assistant.c
+++ b/src/empathy-account-assistant.c
@@ -51,6 +51,10 @@ enum {
PAGE_SALUT_ONLY = 3
};
+enum {
+ PROP_PARENT = 1
+};
+
typedef struct {
FirstPageResponse first_resp;
@@ -433,8 +437,70 @@ account_assistant_build_enter_or_create_page (EmpathyAccountAssistant *self,
}
static void
+do_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ EmpathyAccountAssistantPriv *priv = GET_PRIV (object);
+
+ switch (property_id)
+ {
+ case PROP_PARENT:
+ g_value_set_object (value, priv->parent_window);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
+}
+
+static void
+do_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ EmpathyAccountAssistantPriv *priv = GET_PRIV (object);
+
+ switch (property_id)
+ {
+ case PROP_PARENT:
+ priv->parent_window = g_value_get_object (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
+}
+
+static void
+do_constructed (GObject *object)
+{
+ EmpathyAccountAssistantPriv *priv = GET_PRIV (object);
+
+ /* set us as transient for the parent window if any */
+ if (priv->parent_window)
+ gtk_window_set_transient_for (GTK_WINDOW (object),
+ priv->parent_window);
+
+ gtk_window_set_type_hint (GTK_WINDOW (object), GDK_WINDOW_TYPE_HINT_DIALOG);
+}
+
+static void
empathy_account_assistant_class_init (EmpathyAccountAssistantClass *klass)
{
+ GObjectClass *oclass = G_OBJECT_CLASS (klass);
+ GParamSpec *param_spec;
+
+ oclass->get_property = do_get_property;
+ oclass->set_property = do_set_property;
+ oclass->constructed = do_constructed;
+
+ param_spec = g_param_spec_object ("parent-window",
+ "parent-window", "The parent window",
+ GTK_TYPE_WINDOW,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY);
+ g_object_class_install_property (oclass, PROP_PARENT, param_spec);
+
g_type_class_add_private (klass, sizeof (EmpathyAccountAssistantPriv));
}
@@ -484,7 +550,8 @@ empathy_account_assistant_init (EmpathyAccountAssistant *self)
}
GtkWidget *
-empathy_account_assistant_new (void)
+empathy_account_assistant_new (GtkWindow *window)
{
- return g_object_new (EMPATHY_TYPE_ACCOUNT_ASSISTANT, NULL);
+ return g_object_new (EMPATHY_TYPE_ACCOUNT_ASSISTANT, "parent-window",
+ window, NULL);
}
diff --git a/src/empathy-account-assistant.h b/src/empathy-account-assistant.h
index 82b14e312..857460201 100644
--- a/src/empathy-account-assistant.h
+++ b/src/empathy-account-assistant.h
@@ -56,7 +56,7 @@ typedef struct {
GType empathy_account_assistant_get_type (void);
-GtkWidget *empathy_account_assistant_new (void);
+GtkWidget *empathy_account_assistant_new (GtkWindow *parent);
G_END_DECLS
diff --git a/src/empathy.c b/src/empathy.c
index b80b64be7..acfdcb13e 100644
--- a/src/empathy.c
+++ b/src/empathy.c
@@ -63,6 +63,7 @@
#include <libempathy-gtk/empathy-ui-utils.h>
#include <libempathy-gtk/empathy-location-manager.h>
+#include "empathy-account-assistant.h"
#include "empathy-accounts-dialog.h"
#include "empathy-main-window.h"
#include "empathy-status-icon.h"
@@ -532,12 +533,17 @@ account_manager_ready_cb (EmpathyAccountManager *manager,
GParamSpec *spec,
gpointer user_data)
{
+ GtkWidget *assistant;
+
if (!empathy_account_manager_is_ready (manager))
return;
if (empathy_account_manager_get_count (manager) == 0)
- empathy_accounts_dialog_show (GTK_WINDOW (empathy_main_window_get ()),
- NULL);
+ {
+ assistant = empathy_account_assistant_new (
+ GTK_WINDOW (empathy_main_window_get ()));
+ gtk_window_present (GTK_WINDOW (assistant));
+ }
create_salut_account ();
}
diff --git a/tests/test-empathy-account-assistant.c b/tests/test-empathy-account-assistant.c
index f1f519d77..6d1330eeb 100644
--- a/tests/test-empathy-account-assistant.c
+++ b/tests/test-empathy-account-assistant.c
@@ -12,7 +12,7 @@ int main (int argc, char **argv)
gtk_init (&argc, &argv);
empathy_gtk_init ();
- assistant = empathy_account_assistant_new ();
+ assistant = empathy_account_assistant_new (NULL);
gtk_widget_show_all (assistant);