From fd7763a53b2e67de8676d34f6a755202832bf363 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Tue, 8 Feb 2011 14:44:58 -0500 Subject: cc-panel: make sure to always pack a widget during construction The CC library expects the panel to have a child widget after it's constructed, otherwise it segfaults. https://bugzilla.gnome.org/show_bug.cgi?id=641867 --- src/cc-empathy-accounts-panel.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/cc-empathy-accounts-panel.c b/src/cc-empathy-accounts-panel.c index 24be69121..1fff907f1 100644 --- a/src/cc-empathy-accounts-panel.c +++ b/src/cc-empathy-accounts-panel.c @@ -52,6 +52,7 @@ struct CcEmpathyAccountsPanelPrivate GtkWidget *accounts_window; GtkWidget *assistant; + GtkWidget *container; }; G_DEFINE_DYNAMIC_TYPE (CcEmpathyAccountsPanel, cc_empathy_accounts_panel, CC_TYPE_PANEL) @@ -79,7 +80,7 @@ panel_pack_with_accounts_dialog (CcEmpathyAccountsPanel *panel) gtk_widget_set_no_show_all (action_area, TRUE); gtk_widget_hide (action_area); - gtk_widget_reparent (content, GTK_WIDGET (panel)); + gtk_widget_reparent (content, GTK_WIDGET (panel->priv->container)); } static void @@ -217,6 +218,14 @@ cc_empathy_accounts_panel_init (CcEmpathyAccountsPanel *panel) panel->priv = CC_EMPATHY_ACCOUNTS_PANEL_GET_PRIVATE (panel); + /* create a container widget immediately, and pack it into the panel, + * because the CC library expects a children to exist after + * the object is constructed. + */ + panel->priv->container = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); + gtk_widget_show (panel->priv->container); + gtk_container_add (GTK_CONTAINER (panel), panel->priv->container); + empathy_gtk_init (); /* unref'd in final endpoint callbacks */ -- cgit