diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-12-01 21:03:31 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-12-01 21:03:31 +0800 |
commit | 228251c3b10a22dedd3f3928561f08bbcae040a1 (patch) | |
tree | bb04c3105195735b6d8b3a35dbfcec912365e8d8 | |
parent | 1f5ddc41bf768c11138edc049f1f70192cbd82a1 (diff) | |
download | gsoc2013-empathy-228251c3b10a22dedd3f3928561f08bbcae040a1.tar gsoc2013-empathy-228251c3b10a22dedd3f3928561f08bbcae040a1.tar.gz gsoc2013-empathy-228251c3b10a22dedd3f3928561f08bbcae040a1.tar.bz2 gsoc2013-empathy-228251c3b10a22dedd3f3928561f08bbcae040a1.tar.lz gsoc2013-empathy-228251c3b10a22dedd3f3928561f08bbcae040a1.tar.xz gsoc2013-empathy-228251c3b10a22dedd3f3928561f08bbcae040a1.tar.zst gsoc2013-empathy-228251c3b10a22dedd3f3928561f08bbcae040a1.zip |
Check if apply button has a top level window before calling gtk_widget_grab_default()
IRC widgets don't have any mandatory argument, so the account is valid before
the widget has been packed into the accounts dialog. gtk_widget_grab_default()
can't be called on a widget not having a top level window. (#636203)
-rw-r--r-- | libempathy-gtk/empathy-account-widget.c | 13 |
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); + } } } } |