[empathy] cc-panel: make sure to always pack a widget during construction



commit fd7763a53b2e67de8676d34f6a755202832bf363
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Tue Feb 8 14:44:58 2011 -0500

    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 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/src/cc-empathy-accounts-panel.c b/src/cc-empathy-accounts-panel.c
index 24be691..1fff907 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 */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]