aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-account-widget.c
diff options
context:
space:
mode:
Diffstat (limited to 'libempathy-gtk/empathy-account-widget.c')
-rw-r--r--libempathy-gtk/empathy-account-widget.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c
index 4645040a2..b6a308aff 100644
--- a/libempathy-gtk/empathy-account-widget.c
+++ b/libempathy-gtk/empathy-account-widget.c
@@ -183,8 +183,17 @@ account_widget_set_control_buttons_sensitivity (EmpathyAccountWidget *self,
if (sensitive)
{
- gtk_widget_set_can_default (priv->apply_button, TRUE);
- gtk_widget_grab_default (priv->apply_button);
+ /* We can't grab default if the widget hasn't be packed in a
+ * window */
+ GtkWidget *window;
+
+ window = gtk_widget_get_toplevel (priv->apply_button);
+ if (window != NULL &&
+ gtk_widget_is_toplevel (window))
+ {
+ gtk_widget_set_can_default (priv->apply_button, TRUE);
+ gtk_widget_grab_default (priv->apply_button);
+ }
}
}
}