[Kazehakase-cvs] CVS update: kazehakase/src/actions

Zurück zum Archiv-Index

Hiroyuki Ikezoe ikezo****@users*****
Tue Jan 2 10:51:43 JST 2007


Index: kazehakase/src/actions/kz-actions.c
diff -u kazehakase/src/actions/kz-actions.c:1.233 kazehakase/src/actions/kz-actions.c:1.234
--- kazehakase/src/actions/kz-actions.c:1.233	Tue Jan  2 09:49:35 2007
+++ kazehakase/src/actions/kz-actions.c	Tue Jan  2 10:51:42 2007
@@ -1414,7 +1414,6 @@
 static void
 act_save_session (GtkAction *action, KzWindow *kz)
 {
-	/*FIXME! set current tab position */ 
 	kz_bookmark_file_save(KZ_BOOKMARK_FILE(KZ_GET_CURRENT_SESSION));
 }
 
@@ -1422,116 +1421,7 @@
 static void
 act_restore_session (GtkAction *action, KzWindow *kz)
 {
-	GList *list;
-	const GList *node;
-	gchar *current_session;
-	gint i, num, pos = 0;
-
-	g_return_if_fail(KZ_IS_WINDOW (kz));
-
-	kz_session_freeze(KZ_SESSION(KZ_GET_CURRENT_SESSION));
-#if 1
-	{
-	const GList *window_list, *window_node;
-	KzBookmark *tmp_bookmark;
-
-	/* reload from current session file */
-	current_session  = g_build_filename(g_get_home_dir(),
-					    "."PACKAGE,
-					    "current_session.xml",
-					     NULL);
-	if (!g_file_test(current_session, G_FILE_TEST_EXISTS))
-	{
-		g_free(current_session);
-		return;
-	}
-	tmp_bookmark = KZ_BOOKMARK(kz_bookmark_file_new(current_session,
-					   _("Current Session"),
-					   "XBEL"));
-	g_free(current_session);
-	kz_bookmark_file_load(KZ_BOOKMARK_FILE(tmp_bookmark));
-
-	window_list = KZ_GET_WINDOW_LIST;
-	for (node = window_list; node; node = g_list_next (node))
-	{
-		KzWindow *window = KZ_WINDOW(node->data);
-		num = gtk_notebook_get_n_pages(GTK_NOTEBOOK(window->notebook));
-		for (i = num - 1; i >= 0; i--)
-		{
-			GtkWidget *widget = KZ_WINDOW_NTH_PAGE(window, i);
-			kz_window_close_tab(window, widget);
-		}
-	}
-
-	list = kz_bookmark_get_children(tmp_bookmark);
-
-	window_node = window_list;
-	/* windows */
-	for (node = list; node; node = g_list_next(node))
-	{
-		GList *tabs, *tabnode;
-		KzWindow *window;
-		KzBookmark *window_bookmark = KZ_BOOKMARK(node->data);
-		tabs = kz_bookmark_get_children(window_bookmark);
-
-		if (!window_node)
-		{
-			window = KZ_WINDOW(kz_app_create_new_window(kz_app, NULL));
-			gtk_widget_show(GTK_WIDGET(window));
-		}
-		else
-			window = KZ_WINDOW(window_node->data);
-	
-		/* tabs */
-		for (tabnode = tabs; tabnode; tabnode = g_list_next(tabnode))
-		{
-			GtkWidget *widget;
-			KzBookmark *child = KZ_BOOKMARK(tabnode->data);
-			KzTabLabel *kztab;
-			widget = kz_window_open_new_tab_at_tail(window, NULL);
-			kz_embed_set_history(KZ_EMBED(widget), child);
-			kztab = KZ_TAB_LABEL(gtk_notebook_get_tab_label(GTK_NOTEBOOK(window->notebook),
-									widget));
-
-			if (kz_bookmark_get_lock(child))
-			{
-				kz_tab_label_set_lock(kztab, TRUE);
-			}
-			if (kz_bookmark_get_auto_refresh(child))
-			{
-				kz_tab_label_set_auto_refresh(kztab, TRUE);
-			}
-			if (kz_bookmark_get_javascript(child))
-			{
-				kz_embed_set_allow_javascript(KZ_EMBED(kztab->kzembed), TRUE);
-				kz_tab_label_set_javascript(kztab, TRUE);
-			}
-			else
-			{
-				kz_embed_set_allow_javascript(KZ_EMBED(kztab->kzembed), FALSE);
-				kz_tab_label_set_javascript(kztab, FALSE);
-			}
-		}
-		g_list_free(tabs);
-		pos = kz_bookmark_get_current(window_bookmark);
-		gtk_notebook_set_current_page(GTK_NOTEBOOK(window->notebook), pos);
-
-		if (window_node)
-			window_node = g_list_next(window_node);
-	}
-	g_list_free(list);
-
-	for (;window_node; window_node = g_list_next(window_node))
-	{
-		KzWindow *window = KZ_WINDOW(window_node->data);
-		gtk_widget_destroy(GTK_WIDGET(window));
-	}
-	
-	kz_bookmark_file_save(KZ_BOOKMARK_FILE(tmp_bookmark));
-	g_object_unref(tmp_bookmark);
-	}
-#endif
-	kz_session_thaw(KZ_SESSION(KZ_GET_CURRENT_SESSION));
+	kz_app_restore_session(kz_app);
 }
 
 


More information about the Kazehakase-cvs mailing list
Zurück zum Archiv-Index