diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2009-08-04 17:45:42 +0800 |
---|---|---|
committer | Sjoerd Simons <sjoerd.simons@collabora.co.uk> | 2009-08-22 21:17:38 +0800 |
commit | f274e990d552235090b689071f5d464007948d52 (patch) | |
tree | c5f98e94d92714ea552847601e44388a511dd899 /libempathy-gtk/empathy-account-widget.c | |
parent | 7f784aadcfcadc05128b783a4e8d5f8499887b9d (diff) | |
download | gsoc2013-empathy-f274e990d552235090b689071f5d464007948d52.tar gsoc2013-empathy-f274e990d552235090b689071f5d464007948d52.tar.gz gsoc2013-empathy-f274e990d552235090b689071f5d464007948d52.tar.bz2 gsoc2013-empathy-f274e990d552235090b689071f5d464007948d52.tar.lz gsoc2013-empathy-f274e990d552235090b689071f5d464007948d52.tar.xz gsoc2013-empathy-f274e990d552235090b689071f5d464007948d52.tar.zst gsoc2013-empathy-f274e990d552235090b689071f5d464007948d52.zip |
Add a way to hook up to the apply sensitivity
Diffstat (limited to 'libempathy-gtk/empathy-account-widget.c')
-rw-r--r-- | libempathy-gtk/empathy-account-widget.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index 99b450910..4a6b8f21d 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -68,15 +68,27 @@ enum { PROP_SIMPLE }; +enum { + HANDLE_APPLY, + LAST_SIGNAL +}; + +static guint signals[LAST_SIGNAL] = { 0 }; + #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyAccountWidget) static void account_widget_handle_apply_sensitivity (EmpathyAccountWidget *self) { EmpathyAccountWidgetPriv *priv = GET_PRIV (self); + gboolean is_valid; + + is_valid = empathy_account_settings_is_valid (priv->settings); - gtk_widget_set_sensitive (priv->apply_button, - empathy_account_settings_is_valid (priv->settings)); + if (!priv->simple) + gtk_widget_set_sensitive (priv->apply_button, is_valid); + + g_signal_emit (self, signals[HANDLE_APPLY], 0, is_valid); } static gboolean @@ -950,6 +962,13 @@ empathy_account_widget_class_init (EmpathyAccountWidgetClass *klass) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY); g_object_class_install_property (oclass, PROP_SIMPLE, param_spec); + signals[HANDLE_APPLY] = + g_signal_new ("handle-apply", G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, 0, NULL, NULL, + g_cclosure_marshal_VOID__BOOLEAN, + G_TYPE_NONE, + 1, G_TYPE_BOOLEAN); + g_type_class_add_private (klass, sizeof (EmpathyAccountWidgetPriv)); } @@ -1000,7 +1019,7 @@ empathy_account_widget_new_for_protocol (const char *protocol, GtkWidget * empathy_account_widget_simple_new_for_protocol (const char *protocol, - EmpathyAccountSettings *settings) + EmpathyAccountSettings *settings, EmpathyAccountWidget **object) { EmpathyAccountWidget *self; @@ -1011,5 +1030,7 @@ empathy_account_widget_simple_new_for_protocol (const char *protocol, (EMPATHY_TYPE_ACCOUNT_WIDGET, "protocol", protocol, "settings", settings, "simple", TRUE, NULL); + *object = self; + return self->ui_details->widget; } |