diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2009-08-05 22:38:55 +0800 |
---|---|---|
committer | Sjoerd Simons <sjoerd.simons@collabora.co.uk> | 2009-08-22 21:20:44 +0800 |
commit | bca9fa60a556e96dbad090afcfd407dab7a4532d (patch) | |
tree | 982d4f6932d95e41b9117e59646538eae3d64580 /src | |
parent | 665eea7db24e59db641803d5d778f0fbc58eebe7 (diff) | |
download | gsoc2013-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')
-rw-r--r-- | src/empathy-account-assistant.c | 71 | ||||
-rw-r--r-- | src/empathy-account-assistant.h | 2 | ||||
-rw-r--r-- | src/empathy.c | 10 |
3 files changed, 78 insertions, 5 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 (); } |