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);