aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy-account-assistant.c
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2009-08-05 22:38:55 +0800
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-08-22 21:20:44 +0800
commitbca9fa60a556e96dbad090afcfd407dab7a4532d (patch)
tree982d4f6932d95e41b9117e59646538eae3d64580 /src/empathy-account-assistant.c
parent665eea7db24e59db641803d5d778f0fbc58eebe7 (diff)
downloadgsoc2013-empathy-bca9fa60a556e96dbad090afcfd407dab7a4532d.tar
gsoc2013-empathy-bca9fa60a556e96dbad090afcfd407dab7a4532d.tar.gz
gsoc2013-empathy-bca9fa60a556e96dbad090afcfd407dab7a4532d.tar.bz2
gsoc2013-empathy-bca9fa60a556e96dbad090afcfd407dab7a4532d.tar.lz
gsoc2013-empathy-bca9fa60a556e96dbad090afcfd407dab7a4532d.tar.xz
gsoc2013-empathy-bca9fa60a556e96dbad090afcfd407dab7a4532d.tar.zst
gsoc2013-empathy-bca9fa60a556e96dbad090afcfd407dab7a4532d.zip
Add a parent window property to the assistant
Diffstat (limited to 'src/empathy-account-assistant.c')
-rw-r--r--src/empathy-account-assistant.c71
1 files changed, 69 insertions, 2 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);
}