X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fmilk-main-window.c;fp=src%2Fmilk-main-window.c;h=06d435e0b4b26fd13d2216f8b86607402f2b5340;hb=431081eb0278f0cb2c8cc3badd1b7185dfe89f64;hp=d72b98347452b6ec193615a75940ebafba03b344;hpb=e402b9f688bca871d38c323619c7cc454d07cdc5;p=milk diff --git a/src/milk-main-window.c b/src/milk-main-window.c index d72b983..06d435e 100644 --- a/src/milk-main-window.c +++ b/src/milk-main-window.c @@ -34,6 +34,8 @@ G_DEFINE_TYPE (MilkMainWindow, milk_main_window, HILDON_TYPE_WINDOW) /* less expensive than G_TYPE_INSTANCE_GET_PRIVATE */ #define MILK_MAIN_WINDOW_PRIVATE(o) ((MILK_MAIN_WINDOW ((o)))->priv) +static GtkWidget *default_window = NULL; + struct _MilkMainWindowPrivate { MilkAuth *auth; @@ -238,6 +240,25 @@ contact_column_render_func (GtkCellLayout *cell_layout, g_object_unref (task); } +static gboolean +begin_auth_idle (MilkMainWindow *window) +{ + MilkMainWindowPrivate *priv; + + priv = MILK_MAIN_WINDOW_PRIVATE (window); + + /* FIXME: is there a better place for this? */ + priv->auth = milk_auth_get_default (); + /* FIXME: plug this into the task model */ + + /* FIXME: cut this */ + g_debug ("trying to run the milk auth demo"); + /* FIXME: cut this */ + milk_auth_run_demo (priv->auth); + + return FALSE; +} + static void milk_main_window_constructed (GObject* object) { @@ -306,14 +327,9 @@ milk_main_window_constructed (GObject* object) hildon_window_set_app_menu ( HILDON_WINDOW (self), HILDON_APP_MENU (priv->app_menu)); - /* FIXME: is there a better place for this? */ - priv->auth = milk_auth_get_default (); - /* FIXME: plug this into the task model */ - - /* FIXME: cut this */ - g_debug ("trying to run the milk auth demo"); - /* FIXME: cut this */ - milk_auth_run_demo (priv->auth); + /* break a cyclical dependency by doing this after the window is + * constructed */ + g_idle_add ((GSourceFunc) begin_auth_idle, self); } static void @@ -337,8 +353,11 @@ milk_main_window_init (MilkMainWindow *self) } GtkWidget* -milk_main_window_new () +milk_main_window_get_default () { - return g_object_new (MILK_TYPE_MAIN_WINDOW, - NULL); + if (!default_window) { + default_window = g_object_new (MILK_TYPE_MAIN_WINDOW, NULL); + } + + return default_window; }