app: Add a 'restore_func' to GimpDialogFactoryEntry
In gimp_session_info_restore() there is code to create a dialog from a session info. GimpSessionInfo lives in the widgets module. Thus we can't add restoration code that depends on a higher level module. In particular, we can't add code to restore docks in an GimpImageWindow since GimpImageWindow lives in the display module. And we need such code to be able to restore a single-window mode session. Since dialogs are defined in the dialogs module, it makes sense to also have the code that restores a dialog in that module. So, add a 'restore_func' member to GimpRestoreDialogFunc of type GimpRestoreDialogFunc and move the code there.
This commit is contained in:
@ -481,29 +481,11 @@ gimp_session_info_restore (GimpSessionInfo *info,
|
||||
info->p->screen = DEFAULT_SCREEN;
|
||||
|
||||
if (info->p->factory_entry &&
|
||||
! info->p->factory_entry->dockable &&
|
||||
! info->p->factory_entry->image_window)
|
||||
info->p->factory_entry->restore_func)
|
||||
{
|
||||
GimpCoreConfig *config = gimp_dialog_factory_get_context (factory)->gimp->config;
|
||||
|
||||
GIMP_LOG (DIALOG_FACTORY, "restoring toplevel \"%s\" (info %p)",
|
||||
info->p->factory_entry->identifier,
|
||||
info);
|
||||
|
||||
dialog =
|
||||
gimp_dialog_factory_dialog_new (factory, screen,
|
||||
NULL /*ui_manager*/,
|
||||
info->p->factory_entry->identifier,
|
||||
info->p->factory_entry->view_size,
|
||||
! GIMP_GUI_CONFIG (config)->hide_docks);
|
||||
|
||||
g_object_set_data (G_OBJECT (dialog), GIMP_DIALOG_VISIBILITY_KEY,
|
||||
GINT_TO_POINTER (GIMP_GUI_CONFIG (config)->hide_docks ?
|
||||
GIMP_DIALOG_VISIBILITY_HIDDEN :
|
||||
GIMP_DIALOG_VISIBILITY_VISIBLE));
|
||||
|
||||
if (dialog && info->p->aux_info)
|
||||
gimp_session_info_aux_set_list (dialog, info->p->aux_info);
|
||||
dialog = info->p->factory_entry->restore_func (factory,
|
||||
screen,
|
||||
info);
|
||||
}
|
||||
|
||||
/* We expect expect there to always be docks. In sessionrc files
|
||||
@ -795,6 +777,14 @@ gimp_session_info_get_info_with_widget (GimpSessionInfo *info,
|
||||
gimp_session_info_set_widget (info, old_widget);
|
||||
}
|
||||
|
||||
GList *
|
||||
gimp_session_info_get_aux_info (GimpSessionInfo *info)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_SESSION_INFO (info), NULL);
|
||||
|
||||
return info->p->aux_info;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_session_info_clear_info (GimpSessionInfo *info)
|
||||
{
|
||||
|
Reference in New Issue
Block a user