diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2009-12-22 01:22:01 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2009-12-22 19:14:15 +0800 |
commit | 1d1f5f138931c698a5ca07c6377278210d36d31c (patch) | |
tree | cb0b9ea6733278d73a9f7b3989c0732c62d71c57 /libempathy-gtk | |
parent | 6886131ed1c93f39dc8d961dbcd52ef85c64c18c (diff) | |
download | gsoc2013-empathy-1d1f5f138931c698a5ca07c6377278210d36d31c.tar gsoc2013-empathy-1d1f5f138931c698a5ca07c6377278210d36d31c.tar.gz gsoc2013-empathy-1d1f5f138931c698a5ca07c6377278210d36d31c.tar.bz2 gsoc2013-empathy-1d1f5f138931c698a5ca07c6377278210d36d31c.tar.lz gsoc2013-empathy-1d1f5f138931c698a5ca07c6377278210d36d31c.tar.xz gsoc2013-empathy-1d1f5f138931c698a5ca07c6377278210d36d31c.tar.zst gsoc2013-empathy-1d1f5f138931c698a5ca07c6377278210d36d31c.zip |
Add register buttons to the account widget
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-account-widget.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index 9b395d08e..216a36571 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -63,6 +63,7 @@ typedef struct { GtkWidget *button_forget; GtkWidget *spinbutton_port; GtkWidget *enabled_checkbox; + GtkWidget *radiobutton_reuse; gboolean simple; @@ -777,6 +778,15 @@ account_widget_apply_clicked_cb (GtkWidget *button, { EmpathyAccountWidgetPriv *priv = GET_PRIV (self); + if (priv->radiobutton_reuse != NULL) + { + gboolean reuse = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON ( + priv->radiobutton_reuse)); + + DEBUG ("Set register param: %d", !reuse); + empathy_account_settings_set_boolean (priv->settings, "register", !reuse); + } + /* workaround to keep widget alive during async call */ g_object_ref (self); empathy_account_settings_apply_async (priv->settings, @@ -1416,6 +1426,45 @@ add_enable_checkbox (EmpathyAccountWidget *self, #endif /* HAVE_MOBLIN */ } +#ifndef HAVE_MOBLIN +/* Moblin doesn't support registration */ +static void +add_register_buttons (EmpathyAccountWidget *self, + TpAccount *account) +{ + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); + const TpConnectionManagerProtocol *protocol; + GtkWidget *radiobutton_register; + GtkWidget *vbox = self->ui_details->widget; + + if (!priv->creating_account) + return; + + protocol = empathy_account_settings_get_tp_protocol (priv->settings); + if (protocol == NULL) + return; + + if (!tp_connection_manager_protocol_can_register (protocol)) + return; + + if (account_widget_is_gtalk (self)) + return; + + priv->radiobutton_reuse = gtk_radio_button_new_with_label (NULL, + _("This account already exists on the server")); + radiobutton_register = gtk_radio_button_new_with_label ( + gtk_radio_button_get_group (GTK_RADIO_BUTTON (priv->radiobutton_reuse)), + _("Create a new account on the server")); + + gtk_box_pack_start (GTK_BOX (vbox), priv->radiobutton_reuse, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (vbox), radiobutton_register, FALSE, FALSE, 0); + gtk_box_reorder_child (GTK_BOX (vbox), priv->radiobutton_reuse, 0); + gtk_box_reorder_child (GTK_BOX (vbox), radiobutton_register, 1); + gtk_widget_show (priv->radiobutton_reuse); + gtk_widget_show (radiobutton_register); +} +#endif + static void do_constructed (GObject *obj) { @@ -1567,6 +1616,9 @@ do_constructed (GObject *obj) G_CALLBACK (empathy_account_widget_enabled_cb), self); } +#ifndef HAVE_MOBLIN + add_register_buttons (self, account); +#endif add_enable_checkbox (self, account); /* hook up to widget destruction to unref ourselves */ |