gimp r25657 - in trunk: . app/widgets
- From: mitch svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r25657 - in trunk: . app/widgets
- Date: Wed, 14 May 2008 00:43:57 +0100 (BST)
Author: mitch
Date: Tue May 13 23:43:57 2008
New Revision: 25657
URL: http://svn.gnome.org/viewvc/gimp?rev=25657&view=rev
Log:
2008-05-14 Michael Natterer <mitch gimp org>
Made session info serialization independent from widgets so it can
be used on stored dock layouts which are not open:
* app/widgets/gimpsessioninfo-book.[ch]
* app/widgets/gimpsessioninfo-dock.[ch]
* app/widgets/gimpsessioninfo-dockable.[ch]: add from_widget()
functions which return newly allocated session info structs.
Changed serialize() functions to take these structs instead of
widgets. Changed deserialize() functions to return the structs
instead of appending them to lists in their parent structs. Don't
free anything in restore().
* app/widgets/gimpsessioninfo-aux.[ch]
(gimp_session_info_aux_serialize): take a GList of aux_info
instead of a widget.
* app/widgets/gimpsessioninfo.[ch]: add new functions get_info()
which collects above session info details from dialogs and
clear_info() which clears that info. Call clear_info() from
finalize(). Don't free anything in restore().
* app/widgets/gimpdialogfactory.c
(gimp_dialog_factories_save_foreach): collect the session info
detials from the dialogs before serializing because serialize()
doesn't know about the widget any longer. Clear the infos after
serializing.
(gimp_dialog_factories_restore_foreach): clear the session info
details after creating the dialogs because restore() doesn't clear
the info by itself any longer.
Modified:
trunk/ChangeLog
trunk/app/widgets/gimpdialogfactory.c
trunk/app/widgets/gimpsessioninfo-aux.c
trunk/app/widgets/gimpsessioninfo-aux.h
trunk/app/widgets/gimpsessioninfo-book.c
trunk/app/widgets/gimpsessioninfo-book.h
trunk/app/widgets/gimpsessioninfo-dock.c
trunk/app/widgets/gimpsessioninfo-dock.h
trunk/app/widgets/gimpsessioninfo-dockable.c
trunk/app/widgets/gimpsessioninfo-dockable.h
trunk/app/widgets/gimpsessioninfo.c
trunk/app/widgets/gimpsessioninfo.h
Modified: trunk/app/widgets/gimpdialogfactory.c
==============================================================================
--- trunk/app/widgets/gimpdialogfactory.c (original)
+++ trunk/app/widgets/gimpdialogfactory.c Tue May 13 23:43:57 2008
@@ -1336,7 +1336,13 @@
(info->toplevel_entry && ! info->toplevel_entry->session_managed))
continue;
+ if (info->widget)
+ gimp_session_info_get_info (info);
+
gimp_session_info_serialize (writer, info, GIMP_OBJECT (factory)->name);
+
+ if (info->widget)
+ gimp_session_info_clear_info (info);
}
}
@@ -1352,7 +1358,10 @@
GimpSessionInfo *info = infos->data;
if (info->open)
- gimp_session_info_restore (info, factory);
+ {
+ gimp_session_info_restore (info, factory);
+ gimp_session_info_clear_info (info);
+ }
}
}
Modified: trunk/app/widgets/gimpsessioninfo-aux.c
==============================================================================
--- trunk/app/widgets/gimpsessioninfo-aux.c (original)
+++ trunk/app/widgets/gimpsessioninfo-aux.c Tue May 13 23:43:57 2008
@@ -203,35 +203,25 @@
void
gimp_session_info_aux_serialize (GimpConfigWriter *writer,
- GtkWidget *widget)
+ GList *aux_info)
{
- GList *aux_info;
+ GList *list;
g_return_if_fail (writer != NULL);
- g_return_if_fail (GTK_IS_WIDGET (widget));
+ g_return_if_fail (aux_info != NULL);
- aux_info = gimp_session_info_aux_get_list (widget);
+ gimp_config_writer_open (writer, "aux-info");
- if (aux_info)
+ for (list = aux_info; list; list = g_list_next (list))
{
- GList *list;
-
- gimp_config_writer_open (writer, "aux-info");
-
- for (list = aux_info; list; list = g_list_next (list))
- {
- GimpSessionInfoAux *aux = list->data;
-
- gimp_config_writer_open (writer, aux->name);
- gimp_config_writer_string (writer, aux->value);
- gimp_config_writer_close (writer);
- }
+ GimpSessionInfoAux *aux = list->data;
+ gimp_config_writer_open (writer, aux->name);
+ gimp_config_writer_string (writer, aux->value);
gimp_config_writer_close (writer);
-
- g_list_foreach (aux_info, (GFunc) gimp_session_info_aux_free, NULL);
- g_list_free (aux_info);
}
+
+ gimp_config_writer_close (writer);
}
GTokenType
Modified: trunk/app/widgets/gimpsessioninfo-aux.h
==============================================================================
--- trunk/app/widgets/gimpsessioninfo-aux.h (original)
+++ trunk/app/widgets/gimpsessioninfo-aux.h Tue May 13 23:43:57 2008
@@ -42,7 +42,7 @@
...) G_GNUC_NULL_TERMINATED;
void gimp_session_info_aux_serialize (GimpConfigWriter *writer,
- GtkWidget *widget);
+ GList *aux_info);
GTokenType gimp_session_info_aux_deserialize (GScanner *scanner,
GList **aux_list);
Modified: trunk/app/widgets/gimpsessioninfo-book.c
==============================================================================
--- trunk/app/widgets/gimpsessioninfo-book.c (original)
+++ trunk/app/widgets/gimpsessioninfo-book.c Tue May 13 23:43:57 2008
@@ -30,7 +30,6 @@
#include "gimpdialogfactory.h"
#include "gimpdock.h"
#include "gimpdockbook.h"
-#include "gimpsessioninfo.h"
#include "gimpsessioninfo-book.h"
#include "gimpsessioninfo-dockable.h"
@@ -61,63 +60,50 @@
g_list_foreach (info->dockables, (GFunc) gimp_session_info_dockable_free,
NULL);
g_list_free (info->dockables);
+ info->dockables = NULL;
}
g_slice_free (GimpSessionInfoBook, info);
}
void
-gimp_session_info_book_serialize (GimpConfigWriter *writer,
- GimpDockbook *dockbook)
+gimp_session_info_book_serialize (GimpConfigWriter *writer,
+ GimpSessionInfoBook *info)
{
- GList *children;
GList *pages;
- gint current_page;
g_return_if_fail (writer != NULL);
- g_return_if_fail (GIMP_IS_DOCKBOOK (dockbook));
+ g_return_if_fail (info != NULL);
gimp_config_writer_open (writer, "book");
- if (GTK_IS_VPANED (GTK_WIDGET (dockbook)->parent))
+ if (info->position != 0)
{
- GtkPaned *paned = GTK_PANED (GTK_WIDGET (dockbook)->parent);
-
- if (GTK_WIDGET (dockbook) == gtk_paned_get_child2 (paned))
- {
- gimp_config_writer_open (writer, "position");
- gimp_config_writer_printf (writer, "%d",
- gtk_paned_get_position (paned));
- gimp_config_writer_close (writer);
- }
+ gimp_config_writer_open (writer, "position");
+ gimp_config_writer_printf (writer, "%d", info->position);
+ gimp_config_writer_close (writer);
}
- current_page = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook));
-
gimp_config_writer_open (writer, "current-page");
- gimp_config_writer_printf (writer, "%d", current_page);
+ gimp_config_writer_printf (writer, "%d", info->current_page);
gimp_config_writer_close (writer);
- children = gtk_container_get_children (GTK_CONTAINER (dockbook));
-
- for (pages = children; pages; pages = g_list_next (pages))
+ for (pages = info->dockables; pages; pages = g_list_next (pages))
gimp_session_info_dockable_serialize (writer, pages->data);
- g_list_free (children);
-
gimp_config_writer_close (writer);
}
GTokenType
-gimp_session_info_book_deserialize (GScanner *scanner,
- gint scope,
- GimpSessionInfo *info)
+gimp_session_info_book_deserialize (GScanner *scanner,
+ gint scope,
+ GimpSessionInfoBook **book)
{
- GimpSessionInfoBook *book;
+ GimpSessionInfoBook *info;
GTokenType token;
g_return_val_if_fail (scanner != NULL, G_TOKEN_LEFT_PAREN);
- g_return_val_if_fail (info != NULL, G_TOKEN_LEFT_PAREN);
+ g_return_val_if_fail (book != NULL, G_TOKEN_LEFT_PAREN);
g_scanner_scope_add_symbol (scanner, scope, "position",
GINT_TO_POINTER (SESSION_INFO_BOOK_POSITION));
@@ -126,7 +112,7 @@
g_scanner_scope_add_symbol (scanner, scope, "dockable",
GINT_TO_POINTER (SESSION_INFO_BOOK_DOCKABLE));
- book = gimp_session_info_book_new ();
+ info = gimp_session_info_book_new ();
token = G_TOKEN_LEFT_PAREN;
@@ -143,15 +129,17 @@
case G_TOKEN_SYMBOL:
switch (GPOINTER_TO_INT (scanner->value.v_symbol))
{
+ GimpSessionInfoDockable *dockable;
+
case SESSION_INFO_BOOK_POSITION:
token = G_TOKEN_INT;
- if (! gimp_scanner_parse_int (scanner, &book->position))
+ if (! gimp_scanner_parse_int (scanner, &info->position))
goto error;
break;
case SESSION_INFO_BOOK_CURRENT_PAGE:
token = G_TOKEN_INT;
- if (! gimp_scanner_parse_int (scanner, &book->current_page))
+ if (! gimp_scanner_parse_int (scanner, &info->current_page))
goto error;
break;
@@ -159,10 +147,13 @@
g_scanner_set_scope (scanner, scope + 1);
token = gimp_session_info_dockable_deserialize (scanner,
scope + 1,
- book);
+ &dockable);
if (token == G_TOKEN_LEFT_PAREN)
- g_scanner_set_scope (scanner, scope);
+ {
+ info->dockables = g_list_append (info->dockables, dockable);
+ g_scanner_set_scope (scanner, scope);
+ }
else
goto error;
@@ -183,7 +174,7 @@
}
}
- info->books = g_list_append (info->books, book);
+ *book = info;
g_scanner_scope_remove_symbol (scanner, scope, "position");
g_scanner_scope_remove_symbol (scanner, scope, "current-page");
@@ -192,11 +183,55 @@
return token;
error:
- gimp_session_info_book_free (book);
+ *book = NULL;
+
+ gimp_session_info_book_free (info);
return token;
}
+GimpSessionInfoBook *
+gimp_session_info_book_from_widget (GimpDockbook *dockbook)
+{
+ GimpSessionInfoBook *info;
+ GList *children;
+ GList *list;
+
+ g_return_val_if_fail (GIMP_IS_DOCKBOOK (dockbook), NULL);
+
+ info = gimp_session_info_book_new ();
+
+ info->widget = GTK_WIDGET (dockbook);
+
+ if (GTK_IS_VPANED (info->widget->parent))
+ {
+ GtkPaned *paned = GTK_PANED (info->widget->parent);
+
+ if (info->widget == gtk_paned_get_child2 (paned))
+ info->position = gtk_paned_get_position (paned);
+ }
+
+ info->current_page =
+ gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook));
+
+ children = gtk_container_get_children (GTK_CONTAINER (dockbook));
+
+ for (list = children; list; list = g_list_next (list))
+ {
+ GimpSessionInfoDockable *dockable;
+
+ dockable = gimp_session_info_dockable_from_widget (list->data);
+
+ info->dockables = g_list_prepend (info->dockables, dockable);
+ }
+
+ info->dockables = g_list_reverse (info->dockables);
+
+ g_list_free (children);
+
+ return info;
+}
+
void
gimp_session_info_book_restore (GimpSessionInfoBook *info,
GimpDock *dock)
Modified: trunk/app/widgets/gimpsessioninfo-book.h
==============================================================================
--- trunk/app/widgets/gimpsessioninfo-book.h (original)
+++ trunk/app/widgets/gimpsessioninfo-book.h Tue May 13 23:43:57 2008
@@ -37,16 +37,19 @@
GimpSessionInfoBook *
gimp_session_info_book_new (void);
-void gimp_session_info_book_free (GimpSessionInfoBook *info);
+void gimp_session_info_book_free (GimpSessionInfoBook *info);
-void gimp_session_info_book_serialize (GimpConfigWriter *writer,
- GimpDockbook *dockbook);
-GTokenType gimp_session_info_book_deserialize (GScanner *scanner,
- gint scope,
- GimpSessionInfo *info);
+void gimp_session_info_book_serialize (GimpConfigWriter *writer,
+ GimpSessionInfoBook *book);
+GTokenType gimp_session_info_book_deserialize (GScanner *scanner,
+ gint scope,
+ GimpSessionInfoBook **book);
-void gimp_session_info_book_restore (GimpSessionInfoBook *info,
- GimpDock *dock);
+GimpSessionInfoBook *
+ gimp_session_info_book_from_widget (GimpDockbook *dockbook);
+
+void gimp_session_info_book_restore (GimpSessionInfoBook *info,
+ GimpDock *dock);
#endif /* __GIMP_SESSION_INFO_BOOK_H__ */
Modified: trunk/app/widgets/gimpsessioninfo-dock.c
==============================================================================
--- trunk/app/widgets/gimpsessioninfo-dock.c (original)
+++ trunk/app/widgets/gimpsessioninfo-dock.c Tue May 13 23:43:57 2008
@@ -45,17 +45,17 @@
void
gimp_session_info_dock_serialize (GimpConfigWriter *writer,
- GimpDock *dock)
+ GList *books)
{
- GList *books;
+ GList *list;
g_return_if_fail (writer != NULL);
- g_return_if_fail (GIMP_IS_DOCK (dock));
+ g_return_if_fail (books != NULL);
gimp_config_writer_open (writer, "dock");
- for (books = dock->dockbooks; books; books = g_list_next (books))
- gimp_session_info_book_serialize (writer, books->data);
+ for (list = books; list; list = g_list_next (list))
+ gimp_session_info_book_serialize (writer, list->data);
gimp_config_writer_close (writer);
}
@@ -88,13 +88,18 @@
case G_TOKEN_SYMBOL:
switch (GPOINTER_TO_INT (scanner->value.v_symbol))
{
+ GimpSessionInfoBook *book;
+
case SESSION_INFO_BOOK:
g_scanner_set_scope (scanner, scope + 1);
token = gimp_session_info_book_deserialize (scanner, scope + 1,
- info);
+ &book);
if (token == G_TOKEN_LEFT_PAREN)
- g_scanner_set_scope (scanner, scope);
+ {
+ info->books = g_list_append (info->books, book);
+ g_scanner_set_scope (scanner, scope);
+ }
else
return token;
@@ -120,6 +125,26 @@
return token;
}
+GList *
+gimp_session_info_dock_from_widget (GimpDock *dock)
+{
+ GList *list;
+ GList *infos = NULL;
+
+ g_return_val_if_fail (GIMP_IS_DOCK (dock), NULL);
+
+ for (list = dock->dockbooks; list; list = g_list_next (list))
+ {
+ GimpSessionInfoBook *book;
+
+ book = gimp_session_info_book_from_widget (list->data);
+
+ infos = g_list_prepend (infos, book);
+ }
+
+ return g_list_reverse (infos);
+}
+
static void
gimp_session_info_dock_paned_size_allocate (GtkWidget *paned,
GtkAllocation *allocation,
@@ -181,9 +206,5 @@
}
}
- g_list_foreach (info->books, (GFunc) gimp_session_info_book_free, NULL);
- g_list_free (info->books);
- info->books = NULL;
-
gtk_widget_show (GTK_WIDGET (dock));
}
Modified: trunk/app/widgets/gimpsessioninfo-dock.h
==============================================================================
--- trunk/app/widgets/gimpsessioninfo-dock.h (original)
+++ trunk/app/widgets/gimpsessioninfo-dock.h Tue May 13 23:43:57 2008
@@ -24,11 +24,13 @@
void gimp_session_info_dock_serialize (GimpConfigWriter *writer,
- GimpDock *dock);
+ GList *books);
GTokenType gimp_session_info_dock_deserialize (GScanner *scanner,
gint scope,
GimpSessionInfo *info);
+GList * gimp_session_info_dock_from_widget (GimpDock *dock);
+
void gimp_session_info_dock_restore (GimpSessionInfo *info,
GimpDialogFactory *factory,
GdkScreen *screen);
Modified: trunk/app/widgets/gimpsessioninfo-dockable.c
==============================================================================
--- trunk/app/widgets/gimpsessioninfo-dockable.c (original)
+++ trunk/app/widgets/gimpsessioninfo-dockable.c Tue May 13 23:43:57 2008
@@ -33,7 +33,6 @@
#include "gimpdock.h"
#include "gimpdockable.h"
#include "gimpsessioninfo-aux.h"
-#include "gimpsessioninfo-book.h"
#include "gimpsessioninfo-dockable.h"
@@ -59,83 +58,73 @@
g_return_if_fail (info != NULL);
if (info->identifier)
- g_free (info->identifier);
+ {
+ g_free (info->identifier);
+ info->identifier = NULL;
+ }
if (info->aux_info)
{
g_list_foreach (info->aux_info, (GFunc) gimp_session_info_aux_free, NULL);
g_list_free (info->aux_info);
+ info->aux_info = NULL;
}
g_slice_free (GimpSessionInfoDockable, info);
}
void
-gimp_session_info_dockable_serialize (GimpConfigWriter *writer,
- GimpDockable *dockable)
+gimp_session_info_dockable_serialize (GimpConfigWriter *writer,
+ GimpSessionInfoDockable *info)
{
- GimpDialogFactoryEntry *entry;
+ GEnumClass *enum_class;
+ GEnumValue *enum_value;
+ const gchar *tab_style = "icon";
g_return_if_fail (writer != NULL);
- g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
-
- gimp_dialog_factory_from_widget (GTK_WIDGET (dockable), &entry);
+ g_return_if_fail (info != NULL);
- if (entry)
- {
- GimpContainerView *view;
- GEnumClass *enum_class;
- GEnumValue *enum_value;
- const gchar *tab_style = "icon";
- gint view_size = -1;
+ enum_class = g_type_class_ref (GIMP_TYPE_TAB_STYLE);
- enum_class = g_type_class_ref (GIMP_TYPE_TAB_STYLE);
+ gimp_config_writer_open (writer, "dockable");
+ gimp_config_writer_string (writer, info->identifier);
- gimp_config_writer_open (writer, "dockable");
- gimp_config_writer_string (writer, entry->identifier);
+ enum_value = g_enum_get_value (enum_class, info->tab_style);
- enum_value = g_enum_get_value (enum_class, dockable->tab_style);
+ if (enum_value)
+ tab_style = enum_value->value_nick;
- if (enum_value)
- tab_style = enum_value->value_nick;
+ gimp_config_writer_open (writer, "tab-style");
+ gimp_config_writer_print (writer, tab_style, -1);
+ gimp_config_writer_close (writer);
- gimp_config_writer_open (writer, "tab-style");
- gimp_config_writer_print (writer, tab_style, -1);
+ if (info->view_size > 0)
+ {
+ gimp_config_writer_open (writer, "preview-size");
+ gimp_config_writer_printf (writer, "%d", info->view_size);
gimp_config_writer_close (writer);
+ }
- view = gimp_container_view_get_by_dockable (dockable);
-
- if (view)
- view_size = gimp_container_view_get_view_size (view, NULL);
-
- if (view_size > 0 &&
- view_size != entry->view_size)
- {
- gimp_config_writer_open (writer, "preview-size");
- gimp_config_writer_printf (writer, "%d", view_size);
- gimp_config_writer_close (writer);
- }
-
- gimp_session_info_aux_serialize (writer, GTK_WIDGET (dockable));
+ if (info->aux_info)
+ gimp_session_info_aux_serialize (writer, info->aux_info);
- gimp_config_writer_close (writer);
+ gimp_config_writer_close (writer);
- g_type_class_unref (enum_class);
- }
+ g_type_class_unref (enum_class);
}
GTokenType
-gimp_session_info_dockable_deserialize (GScanner *scanner,
- gint scope,
- GimpSessionInfoBook *book)
+gimp_session_info_dockable_deserialize (GScanner *scanner,
+ gint scope,
+ GimpSessionInfoDockable **dockable)
{
- GimpSessionInfoDockable *dockable;
+ GimpSessionInfoDockable *info;
GEnumClass *enum_class;
GEnumValue *enum_value;
GTokenType token;
g_return_val_if_fail (scanner != NULL, G_TOKEN_LEFT_PAREN);
- g_return_val_if_fail (book != NULL, G_TOKEN_LEFT_PAREN);
+ g_return_val_if_fail (dockable != NULL, G_TOKEN_LEFT_PAREN);
g_scanner_scope_add_symbol (scanner, scope, "tab-style",
GINT_TO_POINTER (SESSION_INFO_DOCKABLE_TAB_STYLE));
@@ -144,12 +133,12 @@
g_scanner_scope_add_symbol (scanner, scope, "aux-info",
GINT_TO_POINTER (SESSION_INFO_DOCKABLE_AUX));
- dockable = gimp_session_info_dockable_new ();
+ info = gimp_session_info_dockable_new ();
enum_class = g_type_class_ref (GIMP_TYPE_TAB_STYLE);
token = G_TOKEN_STRING;
- if (! gimp_scanner_parse_string (scanner, &dockable->identifier))
+ if (! gimp_scanner_parse_string (scanner, &info->identifier))
goto error;
token = G_TOKEN_LEFT_PAREN;
@@ -182,18 +171,18 @@
scanner->value.v_identifier);
if (enum_value)
- dockable->tab_style = enum_value->value;
+ info->tab_style = enum_value->value;
break;
case SESSION_INFO_DOCKABLE_VIEW_SIZE:
token = G_TOKEN_INT;
- if (! gimp_scanner_parse_int (scanner, &dockable->view_size))
+ if (! gimp_scanner_parse_int (scanner, &info->view_size))
goto error;
break;
case SESSION_INFO_DOCKABLE_AUX:
token = gimp_session_info_aux_deserialize (scanner,
- &dockable->aux_info);
+ &info->aux_info);
if (token != G_TOKEN_LEFT_PAREN)
goto error;
break;
@@ -213,7 +202,8 @@
}
}
- book->dockables = g_list_append (book->dockables, dockable);
+ *dockable = info;
+
g_type_class_unref (enum_class);
g_scanner_scope_remove_symbol (scanner, scope, "tab-style");
@@ -223,12 +213,47 @@
return token;
error:
- gimp_session_info_dockable_free (dockable);
+ *dockable = NULL;
+
+ gimp_session_info_dockable_free (info);
g_type_class_unref (enum_class);
return token;
}
+GimpSessionInfoDockable *
+gimp_session_info_dockable_from_widget (GimpDockable *dockable)
+{
+ GimpSessionInfoDockable *info;
+ GimpDialogFactoryEntry *entry;
+ GimpContainerView *view;
+ gint view_size = -1;
+
+ g_return_val_if_fail (GIMP_IS_DOCKABLE (dockable), NULL);
+
+ gimp_dialog_factory_from_widget (GTK_WIDGET (dockable), &entry);
+
+ g_return_val_if_fail (entry != NULL, NULL);
+
+ info = gimp_session_info_dockable_new ();
+
+ info->identifier = g_strdup (entry->identifier);
+ info->tab_style = dockable->tab_style;
+ info->view_size = -1;
+
+ view = gimp_container_view_get_by_dockable (dockable);
+
+ if (view)
+ view_size = gimp_container_view_get_view_size (view, NULL);
+
+ if (view_size > 0 && view_size != entry->view_size)
+ info->view_size = view_size;
+
+ info->aux_info = gimp_session_info_aux_get_list (GTK_WIDGET (dockable));
+
+ return info;
+}
+
GimpDockable *
gimp_session_info_dockable_restore (GimpSessionInfoDockable *info,
GimpDock *dock)
Modified: trunk/app/widgets/gimpsessioninfo-dockable.h
==============================================================================
--- trunk/app/widgets/gimpsessioninfo-dockable.h (original)
+++ trunk/app/widgets/gimpsessioninfo-dockable.h Tue May 13 23:43:57 2008
@@ -36,16 +36,19 @@
GimpSessionInfoDockable *
gimp_session_info_dockable_new (void);
-void gimp_session_info_dockable_free (GimpSessionInfoDockable *info);
+void gimp_session_info_dockable_free (GimpSessionInfoDockable *info);
-void gimp_session_info_dockable_serialize (GimpConfigWriter *writer,
- GimpDockable *dockable);
-GTokenType gimp_session_info_dockable_deserialize (GScanner *scanner,
- gint scope,
- GimpSessionInfoBook *book);
+void gimp_session_info_dockable_serialize (GimpConfigWriter *writer,
+ GimpSessionInfoDockable *dockable);
+GTokenType gimp_session_info_dockable_deserialize (GScanner *scanner,
+ gint scope,
+ GimpSessionInfoDockable **dockable);
-GimpDockable * gimp_session_info_dockable_restore (GimpSessionInfoDockable *info,
- GimpDock *dock);
+GimpSessionInfoDockable *
+ gimp_session_info_dockable_from_widget (GimpDockable *dockable);
+
+GimpDockable * gimp_session_info_dockable_restore (GimpSessionInfoDockable *info,
+ GimpDock *dock);
#endif /* __GIMP_SESSION_INFO_DOCKABLE_H__ */
Modified: trunk/app/widgets/gimpsessioninfo.c
==============================================================================
--- trunk/app/widgets/gimpsessioninfo.c (original)
+++ trunk/app/widgets/gimpsessioninfo.c Tue May 13 23:43:57 2008
@@ -81,19 +81,7 @@
{
GimpSessionInfo *info = GIMP_SESSION_INFO (object);
- if (info->aux_info)
- {
- g_list_foreach (info->aux_info,
- (GFunc) gimp_session_info_aux_free, NULL);
- g_list_free (info->aux_info);
- }
-
- if (info->books)
- {
- g_list_foreach (info->books,
- (GFunc) gimp_session_info_book_free, NULL);
- g_list_free (info->books);
- }
+ gimp_session_info_clear_info (info);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@ -131,9 +119,6 @@
g_return_if_fail (factory_name != NULL);
g_return_if_fail (writer != NULL);
- if (info->widget)
- gimp_session_info_get_geometry (info);
-
if (info->toplevel_entry)
dialog_name = info->toplevel_entry->identifier;
else
@@ -166,10 +151,11 @@
if (info->widget)
{
- gimp_session_info_aux_serialize (writer, info->widget);
+ if (info->aux_info)
+ gimp_session_info_aux_serialize (writer, info->aux_info);
- if (! info->toplevel_entry)
- gimp_session_info_dock_serialize (writer, GIMP_DOCK (info->widget));
+ if (info->books)
+ gimp_session_info_dock_serialize (writer, info->books);
}
gimp_config_writer_close (writer); /* session-info */
@@ -405,10 +391,6 @@
{
gimp_session_info_dock_restore (info, factory, screen);
}
-
- g_list_foreach (info->aux_info, (GFunc) gimp_session_info_aux_free, NULL);
- g_list_free (info->aux_info);
- info->aux_info = NULL;
}
/* This function mostly lifted from
@@ -581,3 +563,39 @@
info->screen = gdk_screen_get_number (screen);
}
}
+
+void
+gimp_session_info_get_info (GimpSessionInfo *info)
+{
+ g_return_if_fail (GIMP_IS_SESSION_INFO (info));
+ g_return_if_fail (GTK_IS_WIDGET (info->widget));
+
+ gimp_session_info_get_geometry (info);
+
+ info->aux_info = gimp_session_info_aux_get_list (info->widget);
+
+ if (! info->toplevel_entry)
+ info->books = gimp_session_info_dock_from_widget (GIMP_DOCK (info->widget));
+}
+
+void
+gimp_session_info_clear_info (GimpSessionInfo *info)
+{
+ g_return_if_fail (GIMP_IS_SESSION_INFO (info));
+
+ if (info->aux_info)
+ {
+ g_list_foreach (info->aux_info,
+ (GFunc) gimp_session_info_aux_free, NULL);
+ g_list_free (info->aux_info);
+ info->aux_info = NULL;
+ }
+
+ if (info->books)
+ {
+ g_list_foreach (info->books,
+ (GFunc) gimp_session_info_book_free, NULL);
+ g_list_free (info->books);
+ info->books = NULL;
+ }
+}
Modified: trunk/app/widgets/gimpsessioninfo.h
==============================================================================
--- trunk/app/widgets/gimpsessioninfo.h (original)
+++ trunk/app/widgets/gimpsessioninfo.h Tue May 13 23:43:57 2008
@@ -86,5 +86,8 @@
void gimp_session_info_set_geometry (GimpSessionInfo *info);
void gimp_session_info_get_geometry (GimpSessionInfo *info);
+void gimp_session_info_get_info (GimpSessionInfo *info);
+void gimp_session_info_clear_info (GimpSessionInfo *info);
+
#endif /* __GIMP_SESSION_INFO_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]