aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-12-01 21:03:31 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-12-01 21:03:31 +0800
commit228251c3b10a22dedd3f3928561f08bbcae040a1 (patch)
treebb04c3105195735b6d8b3a35dbfcec912365e8d8 /libempathy-gtk
parent1f5ddc41bf768c11138edc049f1f70192cbd82a1 (diff)
downloadgsoc2013-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)
Diffstat (limited to 'libempathy-gtk')
-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);
+ }
}
}
}