Bug 603848 - Single-window mode is not properly session managed yet

Make GimpImageWindow implement GimpDockContainer and
GimpSessionManaged so that GIMP can be started in single-window mode.
This commit is contained in:
Martin Nordholts
2011-05-31 23:49:24 +02:00
parent 75259bf4bb
commit 42c2c747d8
3 changed files with 303 additions and 4 deletions

View File

@ -30,6 +30,9 @@
#include "config/gimpguiconfig.h"
#include "display/gimpdisplay.h"
#include "display/gimpdisplayshell.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimplist.h"
@ -78,7 +81,7 @@ GimpContainer *global_recent_docks = NULL;
NULL /* stock_id */, \
NULL /* help_id */, \
NULL /* new_func */, \
NULL /* restore_func */, \
dialogs_restore_window /* restore_func */, \
0 /* view_size */, \
singleton /* singleton */, \
TRUE /* session_managed */, \
@ -209,6 +212,9 @@ GimpContainer *global_recent_docks = NULL;
static GtkWidget * dialogs_restore_dialog (GimpDialogFactory *factory,
GdkScreen *screen,
GimpSessionInfo *info);
static GtkWidget * dialogs_restore_window (GimpDialogFactory *factory,
GdkScreen *screen,
GimpSessionInfo *info);
static const GimpDialogFactoryEntry entries[] =
@ -445,6 +451,34 @@ dialogs_restore_dialog (GimpDialogFactory *factory,
return dialog;
}
/**
* dialogs_restore_window:
* @factory:
* @screen:
* @info:
*
* "restores" the image window. We don't really restore anything since
* the image window is created earlier, so we just look for and return
* the already-created image window.
*
* Returns:
**/
static GtkWidget *
dialogs_restore_window (GimpDialogFactory *factory,
GdkScreen *screen,
GimpSessionInfo *info)
{
/* FIXME: We can't always use the empty display here */
Gimp *gimp = gimp_dialog_factory_get_context (factory)->gimp;
GimpDisplay *display = GIMP_DISPLAY (gimp_get_empty_display (gimp));
GimpDisplayShell *shell = gimp_display_get_shell (display);
GtkWidget *dialog;
dialog = GTK_WIDGET (gimp_display_shell_get_window (shell));
return dialog;
}
/* public functions */