[empathy: 1/2] Check if apply button has a top level window before calling gtk_widget_grab_default()
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy: 1/2] Check if apply button has a top level window before calling gtk_widget_grab_default()
- Date: Wed, 1 Dec 2010 14:50:23 +0000 (UTC)
commit 228251c3b10a22dedd3f3928561f08bbcae040a1
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Wed Dec 1 14:03:31 2010 +0100
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)
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 4645040..b6a308a 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);
+ }
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]