svnno****@sourc*****
svnno****@sourc*****
Wed Apr 4 12:03:57 JST 2007
Revision: 3133 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=kazehakase&view=rev&rev=3133 Author: makeinu Date: 2007-04-04 12:03:55 +0900 (Wed, 04 Apr 2007) Log Message: ----------- Move session handlings in KzWindow to KzApp. Add kz_app_freeze_session() and kz_app_thaw_session(). Fix indent. Modified Paths: -------------- kazehakase/trunk/ChangeLog kazehakase/trunk/src/actions/kz-actions.c kazehakase/trunk/src/bookmarks/kz-session.c kazehakase/trunk/src/kz-app.c kazehakase/trunk/src/kz-app.h kazehakase/trunk/src/kz-window.c Modified: kazehakase/trunk/ChangeLog =================================================================== --- kazehakase/trunk/ChangeLog 2007-04-04 01:11:29 UTC (rev 3132) +++ kazehakase/trunk/ChangeLog 2007-04-04 03:03:55 UTC (rev 3133) @@ -1,3 +1,10 @@ +2007-04-04 Takuro Ashie <ashie****@homa*****> + + * src/kz-window.c, src/kz-app.{ch}, src/actions/kz-actions.c: + Move session handlings in KzWindow to KzApp. + Add kz_app_freeze_session() and kz_app_thaw_session(). + * src/bookmarks/kz-session.c: Fix indent. + 2007-04-04 Hiroyuki Ikezoe <poinc****@ikezo*****> * module/embed/gecko/kz-gecko-embed.cpp: Remove Modified: kazehakase/trunk/src/actions/kz-actions.c =================================================================== --- kazehakase/trunk/src/actions/kz-actions.c 2007-04-04 01:11:29 UTC (rev 3132) +++ kazehakase/trunk/src/actions/kz-actions.c 2007-04-04 03:03:55 UTC (rev 3133) @@ -105,9 +105,9 @@ { g_return_if_fail(KZ_IS_WINDOW(kz)); - kz_session_freeze(KZ_SESSION(KZ_GET_CURRENT_SESSION)); + kz_app_freeze_session(kz_app); gtk_widget_destroy(GTK_WIDGET(kz)); - kz_session_thaw(KZ_SESSION(KZ_GET_CURRENT_SESSION)); + kz_app_thaw_session(kz_app); } Modified: kazehakase/trunk/src/bookmarks/kz-session.c =================================================================== --- kazehakase/trunk/src/bookmarks/kz-session.c 2007-04-04 01:11:29 UTC (rev 3132) +++ kazehakase/trunk/src/bookmarks/kz-session.c 2007-04-04 03:03:55 UTC (rev 3133) @@ -146,7 +146,8 @@ { gboolean auto_save; kz_profile_get_value(profile, "Session", "save", - &auto_save, sizeof(gboolean), KZ_PROFILE_VALUE_TYPE_BOOL); + &auto_save, sizeof(gboolean), + KZ_PROFILE_VALUE_TYPE_BOOL); priv->auto_save = auto_save; } } Modified: kazehakase/trunk/src/kz-app.c =================================================================== --- kazehakase/trunk/src/kz-app.c 2007-04-04 01:11:29 UTC (rev 3132) +++ kazehakase/trunk/src/kz-app.c 2007-04-04 03:03:55 UTC (rev 3133) @@ -484,6 +484,8 @@ static void dispose (GObject *object) { + KzApp *app = KZ_APP(object); + gchar *accel_prefs_file; KzAppPrivate *priv = KZ_APP_GET_PRIVATE(object); @@ -497,7 +499,7 @@ kz_root_bookmark_save_all(priv->bookmarks); /* freeze session for storing last saving session */ - kz_session_freeze(KZ_SESSION(priv->bookmarks->current_session)); + kz_app_freeze_session(app); g_object_unref(G_OBJECT(priv->bookmarks)); kz_profile_close(priv->profile); @@ -627,10 +629,14 @@ priv = KZ_APP_GET_PRIVATE(app); /* close all tabs before loading session file */ - kz_session_freeze(KZ_SESSION(priv->bookmarks->current_session)); + kz_app_freeze_session(app); for (node = priv->window_list; node; node = g_list_next(node)) - kz_window_close_all_tab(KZ_WINDOW(node->data)); - kz_session_thaw(KZ_SESSION(priv->bookmarks->current_session)); + { + KzWindow *kz = KZ_WINDOW(node->data); + kz_bookmark_remove(priv->bookmarks->current_session, + kz->tabs); + kz_window_close_all_tab(kz); + } session = priv->bookmarks->current_session; location = kz_bookmark_file_get_location(KZ_BOOKMARK_FILE(session)); @@ -667,6 +673,7 @@ KzWindow *window = KZ_WINDOW(window_node->data); gtk_widget_destroy(GTK_WIDGET(window)); } + kz_app_thaw_session(app); /* if there is no window, create a window */ if (!priv->window_list) @@ -683,6 +690,12 @@ window = kz_window_new(uri); + if (!kz_session_is_frozen(KZ_SESSION(priv->bookmarks->current_session))) + { + kz_bookmark_append(priv->bookmarks->current_session, + KZ_WINDOW(window)->tabs); + } + g_signal_connect(window, "destroy", G_CALLBACK(cb_destroy_window), app); priv->window_list = g_list_append(priv->window_list, window); @@ -831,11 +844,43 @@ return NULL; } +void +kz_app_freeze_session (KzApp *app) +{ + KzAppPrivate *priv; + + g_return_if_fail (KZ_IS_APP(app)); + + priv = KZ_APP_GET_PRIVATE(app); + kz_session_freeze(KZ_SESSION(priv->bookmarks->current_session)); +} + +void +kz_app_thaw_session (KzApp *app) +{ + KzAppPrivate *priv; + + g_return_if_fail (KZ_IS_APP(app)); + + priv = KZ_APP_GET_PRIVATE(app); + kz_session_thaw(KZ_SESSION(priv->bookmarks->current_session)); +} + static void cb_destroy_window (GtkObject *object, gpointer data) { - KzAppPrivate *priv = KZ_APP_GET_PRIVATE(data); + KzApp *app = KZ_APP(data); + KzAppPrivate *priv = KZ_APP_GET_PRIVATE(app); + KzWindow *kz = KZ_WINDOW (object); + if (kz->tabs) + { + /* CAUTION: make KzApp sure to remove tabs before freeing it. */ + kz_app_freeze_session(app); + kz_bookmark_remove(priv->bookmarks->current_session, kz->tabs); + kz_app_thaw_session(app); + } + g_signal_handlers_disconnect_by_func(object, G_CALLBACK(cb_destroy_window), data); priv->window_list = g_list_remove(priv->window_list, object); Modified: kazehakase/trunk/src/kz-app.h =================================================================== --- kazehakase/trunk/src/kz-app.h 2007-04-04 01:11:29 UTC (rev 3132) +++ kazehakase/trunk/src/kz-app.h 2007-04-04 03:03:55 UTC (rev 3133) @@ -97,6 +97,8 @@ KzProfile *kz_app_get_proxy (KzApp *app); const GList *kz_app_get_window_list (KzApp *app); GtkWidget *kz_app_get_window_from_tab (KzApp *app, GtkWidget *tab); +void kz_app_freeze_session (KzApp *app); +void kz_app_thaw_session (KzApp *app); #if USE_MIGEMO KzMigemo *kz_app_get_migemo (KzApp *app); #endif Modified: kazehakase/trunk/src/kz-window.c =================================================================== --- kazehakase/trunk/src/kz-window.c 2007-04-04 01:11:29 UTC (rev 3132) +++ kazehakase/trunk/src/kz-window.c 2007-04-04 03:03:55 UTC (rev 3133) @@ -577,11 +577,6 @@ gtk_key_theme_changed_cb(settings, 0, 0); kz_bookmark_set_title(kz->tabs, "Window"); - if (!kz_session_is_frozen(KZ_SESSION(KZ_GET_CURRENT_SESSION))) { - /* FIXME!: Session should block inserting new bookmark by it - self. */ - kz_bookmark_append(KZ_GET_CURRENT_SESSION, kz->tabs); - } kz_window_restore_state(kz); } @@ -817,6 +812,10 @@ { kz_embed = KZ_EMBED(kz_embed_new("gtk-webcore")); } + else if (!strcmp(engine, "ie")) + { + kz_embed = KZ_EMBED(kz_embed_new("ie")); + } else { kz_embed = KZ_EMBED(kz_embed_new("gecko")); @@ -895,7 +894,6 @@ priv = KZ_WINDOW_GET_PRIVATE(kz); /* remove old tab bookmark */ - kz_bookmark_remove(KZ_GET_CURRENT_SESSION, kz->tabs); g_object_unref(kz->tabs); kz->tabs = g_object_ref(tabs); @@ -975,12 +973,12 @@ kztab = KZ_TAB_LABEL(gtk_notebook_get_tab_label(GTK_NOTEBOOK(kz->notebook), widget)); g_object_ref(kztab->history); - kz_session_freeze(KZ_SESSION(KZ_GET_CURRENT_SESSION)); + kz_app_freeze_session(kz_app); kz_bookmark_remove(kz->tabs, kztab->history); kz_bookmark_insert_before(kz->tabs, kztab->history, sib_bookmark); - kz_session_thaw(KZ_SESSION(KZ_GET_CURRENT_SESSION)); + kz_app_thaw_session(kz_app); g_object_unref(kztab->history); g_signal_emit(kz, kz_window_signals[REORDER_TAB_SIGNAL], @@ -1077,9 +1075,9 @@ kz_window_store_state(kz); - kz_session_freeze(KZ_SESSION(KZ_GET_CURRENT_SESSION)); + kz_app_freeze_session(kz_app); kz_notebook_close_all_tab(KZ_NOTEBOOK(kz->notebook)); - kz_session_thaw(KZ_SESSION(KZ_GET_CURRENT_SESSION)); + kz_app_thaw_session(kz_app); return FALSE; } @@ -1214,16 +1212,14 @@ kz->popup_tablist = NULL; if (kz->tabs) - { - kz_session_freeze(KZ_SESSION(KZ_GET_CURRENT_SESSION)); - kz_bookmark_remove(KZ_GET_CURRENT_SESSION, kz->tabs); + /* CAUTION: make KzApp sure to remove tabs before freeing it. */ g_object_unref(kz->tabs); - kz_session_thaw(KZ_SESSION(KZ_GET_CURRENT_SESSION)); - kz->tabs = NULL; - } + kz->tabs = NULL; + if (kz->closed_tabs) g_object_unref(kz->closed_tabs); kz->closed_tabs = NULL; + if (kz->history_search) g_object_unref(kz->history_search); kz->history_search = NULL;