app: Merge "toplevel" and "display" factories

Merge "toplevel" and "display" factories so that we only have one
dialog factory. This allows us to get rid of a lot of special casing.
This commit is contained in:
Martin Nordholts 2010-02-20 10:58:29 +01:00
parent 993d2df338
commit c3619fb85c
6 changed files with 30 additions and 39 deletions

View File

@ -43,8 +43,6 @@
GimpDialogFactory *global_dialog_factory = NULL;
GimpDialogFactory *global_display_factory = NULL;
GimpContainer *global_recent_docks = NULL;
@ -63,6 +61,21 @@ GimpContainer *global_recent_docks = NULL;
TRUE /* hideable */, \
FALSE /* dockable */}
#define FOREIGN_NOT_HIDEABLE(id, singleton, remember_size) \
{ id /* identifier */, \
NULL /* name */, \
NULL /* blurb */, \
NULL /* stock_id */, \
NULL /* help_id */, \
NULL /* new_func */, \
0 /* view_size */, \
singleton /* singleton */, \
TRUE /* session_managed */, \
remember_size /* remember_size */, \
FALSE /* remember_if_open */, \
FALSE /* hideable */, \
FALSE /* dockable */}
#define TOPLEVEL(id, new_func, singleton, session_managed, remember_size) \
{ id /* identifier */, \
NULL /* name */, \
@ -347,7 +360,11 @@ static const GimpDialogFactoryEntry entries[] =
DOCKABLE ("gimp-palette-editor",
N_("Palette Editor"), NULL, GIMP_STOCK_PALETTE,
GIMP_HELP_PALETTE_EDITOR_DIALOG,
dialogs_palette_editor_get, 0, TRUE)
dialogs_palette_editor_get, 0, TRUE),
/* emtpy image window */
FOREIGN_NOT_HIDEABLE ("gimp-empty-image-window",
TRUE, TRUE)
};
@ -362,17 +379,10 @@ dialogs_init (Gimp *gimp,
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (GIMP_IS_MENU_FACTORY (menu_factory));
/* Toplevel */
global_dialog_factory = gimp_dialog_factory_new ("toplevel",
gimp_get_user_context (gimp),
menu_factory);
/* Display */
global_display_factory = gimp_dialog_factory_new ("display",
gimp_get_user_context (gimp),
menu_factory);
for (i = 0; i < G_N_ELEMENTS (entries); i++)
gimp_dialog_factory_register_entry (global_dialog_factory,
entries[i].identifier,
@ -389,19 +399,6 @@ dialogs_init (Gimp *gimp,
entries[i].hideable,
entries[i].dockable);
gimp_dialog_factory_register_entry (global_display_factory,
"gimp-empty-image-window",
NULL, NULL,
NULL, NULL,
NULL,
-1,
TRUE,
TRUE,
TRUE,
FALSE,
FALSE,
FALSE);
global_recent_docks = gimp_list_new (GIMP_TYPE_SESSION_INFO, FALSE);
}
@ -416,12 +413,6 @@ dialogs_exit (Gimp *gimp)
global_dialog_factory = NULL;
}
if (global_display_factory)
{
g_object_unref (global_display_factory);
global_display_factory = NULL;
}
if (global_recent_docks)
{
g_object_unref (global_recent_docks);

View File

@ -20,8 +20,6 @@
extern GimpDialogFactory *global_dialog_factory;
extern GimpDialogFactory *global_display_factory;
extern GimpContainer *global_recent_docks;

View File

@ -325,7 +325,7 @@ gimp_ui_configurer_separate_shells (GimpUIConfigurer *ui_configurer,
new_image_window = gimp_image_window_new (ui_configurer->p->gimp,
NULL,
global_menu_factory,
global_display_factory,
global_dialog_factory,
global_dialog_factory);
/* Move the shell there */
shell = gimp_image_window_get_shell (source_image_window, 1);

View File

@ -351,7 +351,7 @@ gui_display_create (Gimp *gimp,
display = gimp_display_new (gimp, image, unit, scale,
global_menu_factory,
image_managers->data,
global_display_factory,
global_dialog_factory,
global_dialog_factory);
}

View File

@ -139,13 +139,15 @@ session_init (Gimp *gimp)
break;
/* In versions <= GIMP 2.6 there was a "toolbox", a
* "dock" and a "toplevel" factory. These are now merged
* so if the factory name is "toolbox" or "dock", get
* the "toplevel" factory instead. We don't change
* factory_name because we need it below
* "dock", a "display" and a "toplevel" factory. These
* are now merged so if the factory name is "toolbox",
* "dock" or "display", get the "toplevel" factory
* instead. We don't change factory_name though because
* we need it below
*/
factory = gimp_dialog_factory_from_name ((strcmp ("toolbox", factory_name) == 0 ||
strcmp ("dock", factory_name) == 0) ?
strcmp ("dock", factory_name) == 0 ||
strcmp ("display", factory_name) == 0) ?
"toplevel" :
factory_name);

View File

@ -88,7 +88,7 @@
(size 902 816))
(session-info "toplevel" "gimp-image-new-dialog"
(position 100 100))
(session-info "display" "gimp-empty-image-window"
(session-info "toplevel" "gimp-empty-image-window"
(position 140 32)
(size 610 190))