remove widget member from struct GimpSessionInfoBook. Return the created

2008-05-14  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpsessioninfo-book.[ch]: remove widget member from
	struct GimpSessionInfoBook. Return the created GimpDockbook from
	restore().

	* app/widgets/gimpsessioninfo-dock.c (restore): use the returned
	book instead of the struct member.


svn path=/trunk/; revision=25658
This commit is contained in:
Michael Natterer 2008-05-14 00:00:41 +00:00 committed by Michael Natterer
parent 5766498fff
commit 9ca46cca70
4 changed files with 25 additions and 21 deletions

View File

@ -1,3 +1,12 @@
2008-05-14 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpsessioninfo-book.[ch]: remove widget member from
struct GimpSessionInfoBook. Return the created GimpDockbook from
restore().
* app/widgets/gimpsessioninfo-dock.c (restore): use the returned
book instead of the struct member.
2008-05-14 Michael Natterer <mitch@gimp.org>
Made session info serialization independent from widgets so it can

View File

@ -201,13 +201,11 @@ gimp_session_info_book_from_widget (GimpDockbook *dockbook)
info = gimp_session_info_book_new ();
info->widget = GTK_WIDGET (dockbook);
if (GTK_IS_VPANED (info->widget->parent))
if (GTK_IS_VPANED (GTK_WIDGET (dockbook)->parent))
{
GtkPaned *paned = GTK_PANED (info->widget->parent);
GtkPaned *paned = GTK_PANED (GTK_WIDGET (dockbook)->parent);
if (info->widget == gtk_paned_get_child2 (paned))
if (GTK_WIDGET (dockbook) == gtk_paned_get_child2 (paned))
info->position = gtk_paned_get_position (paned);
}
@ -232,22 +230,20 @@ gimp_session_info_book_from_widget (GimpDockbook *dockbook)
return info;
}
void
GimpDockbook *
gimp_session_info_book_restore (GimpSessionInfoBook *info,
GimpDock *dock)
{
GtkWidget *dockbook;
GList *pages;
g_return_if_fail (info != NULL);
g_return_if_fail (GIMP_IS_DOCK (dock));
g_return_val_if_fail (info != NULL, NULL);
g_return_val_if_fail (GIMP_IS_DOCK (dock), NULL);
dockbook = gimp_dockbook_new (dock->dialog_factory->menu_factory);
gimp_dock_add_book (dock, GIMP_DOCKBOOK (dockbook), -1);
info->widget = dockbook;
for (pages = info->dockables; pages; pages = g_list_next (pages))
{
GimpSessionInfoDockable *dockable_info = pages->data;
@ -269,4 +265,6 @@ gimp_session_info_book_restore (GimpSessionInfoBook *info,
{
gtk_notebook_set_current_page (GTK_NOTEBOOK (dockbook), 0);
}
}
return GIMP_DOCKBOOK (dockbook);
}

View File

@ -25,13 +25,11 @@
struct _GimpSessionInfoBook
{
gint position;
gint current_page;
GtkWidget *widget;
gint position;
gint current_page;
/* list of GimpSessionInfoDockable */
GList *dockables;
GList *dockables;
};
@ -48,7 +46,7 @@ GTokenType gimp_session_info_book_deserialize (GScanner *scanner,
GimpSessionInfoBook *
gimp_session_info_book_from_widget (GimpDockbook *dockbook);
void gimp_session_info_book_restore (GimpSessionInfoBook *info,
GimpDockbook * gimp_session_info_book_restore (GimpSessionInfoBook *info,
GimpDock *dock);

View File

@ -187,13 +187,12 @@ gimp_session_info_dock_restore (GimpSessionInfo *info,
if (dock && info->aux_info)
gimp_session_info_aux_set_list (GTK_WIDGET (dock), info->aux_info);
for (books = info->books; books; books = g_list_next (books))
gimp_session_info_book_restore (books->data, dock);
for (books = info->books; books; books = g_list_next (books))
{
GimpSessionInfoBook *book_info = books->data;
GtkWidget *dockbook = book_info->widget;
GtkWidget *dockbook;
dockbook = GTK_WIDGET (gimp_session_info_book_restore (book_info, dock));
if (GTK_IS_VPANED (dockbook->parent))
{