Hiroyuki Ikezoe
ikezo****@users*****
Mon Jan 1 10:08:44 JST 2007
Index: kazehakase/src/kz-app.c diff -u kazehakase/src/kz-app.c:1.7 kazehakase/src/kz-app.c:1.8 --- kazehakase/src/kz-app.c:1.7 Sun Dec 31 22:59:19 2006 +++ kazehakase/src/kz-app.c Mon Jan 1 10:08:44 2007 @@ -343,14 +343,40 @@ return kzapp; } +static void +cb_window_map (KzWindow *kz, GtkAction *action) +{ + gtk_action_activate(action); + g_signal_handlers_disconnect_by_func + (kz, G_CALLBACK(cb_window_map), action); +} + +static void +restore_session (KzApp *app, KzWindow *kz) +{ + GtkAction *action; + + action = gtk_action_group_get_action(kz->actions, + "RestoreSession"); + if (GTK_WIDGET_MAPPED(kz)) + gtk_action_activate(action); + else + g_signal_connect(kz, "map", G_CALLBACK(cb_window_map), action); +} + GtkWidget * kz_app_create_new_window (KzApp *app, const gchar *uri) { GtkWidget *window; + gboolean restore = FALSE; KzAppPrivate *priv = KZ_APP_GET_PRIVATE(app); window = kz_window_new(uri); + KZ_CONF_GET("Session", "restore", restore, BOOL); + if (!priv->window_list && restore) + restore_session (app, KZ_WINDOW(window)); + g_signal_connect(window, "destroy", G_CALLBACK(cb_destroy_window), app); priv->window_list = g_list_append(priv->window_list, window); Index: kazehakase/src/kz-window.c diff -u kazehakase/src/kz-window.c:1.280 kazehakase/src/kz-window.c:1.281 --- kazehakase/src/kz-window.c:1.280 Sun Dec 31 21:21:47 2006 +++ kazehakase/src/kz-window.c Mon Jan 1 10:08:44 2007 @@ -159,7 +159,6 @@ static void kz_window_unset_embed_callbacks (KzWindow *kz, KzEmbed *kzembed); -static void kz_window_restore_session (KzWindow *kz); static void kz_window_store_session (KzWindow *kz); /* callbacks */ @@ -642,8 +641,6 @@ /* kz_actions_set_sensitive(kz, KZ_EMBED(curpage)); */ kz_window_restore_state(kz); - - kz_window_restore_session(kz); } @@ -1575,15 +1572,6 @@ static void -cb_window_map (KzWindow *kz, GtkAction *action) -{ - gtk_action_activate(action); - g_signal_handlers_disconnect_by_func - (kz, G_CALLBACK(cb_window_map), action); -} - - -static void kz_window_store_session (KzWindow *kz) { gboolean save_session = FALSE; @@ -1596,29 +1584,6 @@ } -static void -kz_window_restore_session (KzWindow *kz) -{ - GtkAction *action; - gboolean restore_session = FALSE; - - g_return_if_fail(KZ_IS_WINDOW(kz)); - - KZ_CONF_GET("Session", "restore", - restore_session, BOOL); - if (restore_session && g_list_length((GList*)KZ_GET_WINDOW_LIST) == 0) - { - action = gtk_action_group_get_action(kz->actions, - "RestoreSession"); - if (GTK_WIDGET_MAPPED(kz)) - gtk_action_activate(action); - else - g_signal_connect(kz, "map", - G_CALLBACK(cb_window_map), action); - } -} - - void kz_window_store_state (KzWindow *kz) { @@ -1721,12 +1686,6 @@ kz_profile_set_save_each_time(KZ_GET_GLOBAL_PROFILE, TRUE); kz_profile_save(KZ_GET_GLOBAL_PROFILE); - - /* - * Session - */ - - /* kz_window_store_session(kz); */ }