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 | |
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')
-rw-r--r-- | libempathy-gtk/empathy-account-widget.c | 27 | ||||
-rw-r--r-- | libempathy-gtk/empathy-account-widget.h | 3 |
2 files changed, 26 insertions, 4 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; } diff --git a/libempathy-gtk/empathy-account-widget.h b/libempathy-gtk/empathy-account-widget.h index 7e6c331d1..ab4e62b45 100644 --- a/libempathy-gtk/empathy-account-widget.h +++ b/libempathy-gtk/empathy-account-widget.h @@ -64,7 +64,8 @@ GtkWidget *empathy_account_widget_new_for_protocol (const char *protocol, EmpathyAccountSettings *settings); GtkWidget * empathy_account_widget_simple_new_for_protocol (const char *protocol, - EmpathyAccountSettings *settings); + EmpathyAccountSettings *settings, + EmpathyAccountWidget **object); G_END_DECLS |