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:
@ -43,8 +43,6 @@
|
|||||||
|
|
||||||
|
|
||||||
GimpDialogFactory *global_dialog_factory = NULL;
|
GimpDialogFactory *global_dialog_factory = NULL;
|
||||||
GimpDialogFactory *global_display_factory = NULL;
|
|
||||||
|
|
||||||
GimpContainer *global_recent_docks = NULL;
|
GimpContainer *global_recent_docks = NULL;
|
||||||
|
|
||||||
|
|
||||||
@ -63,6 +61,21 @@ GimpContainer *global_recent_docks = NULL;
|
|||||||
TRUE /* hideable */, \
|
TRUE /* hideable */, \
|
||||||
FALSE /* dockable */}
|
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) \
|
#define TOPLEVEL(id, new_func, singleton, session_managed, remember_size) \
|
||||||
{ id /* identifier */, \
|
{ id /* identifier */, \
|
||||||
NULL /* name */, \
|
NULL /* name */, \
|
||||||
@ -347,7 +360,11 @@ static const GimpDialogFactoryEntry entries[] =
|
|||||||
DOCKABLE ("gimp-palette-editor",
|
DOCKABLE ("gimp-palette-editor",
|
||||||
N_("Palette Editor"), NULL, GIMP_STOCK_PALETTE,
|
N_("Palette Editor"), NULL, GIMP_STOCK_PALETTE,
|
||||||
GIMP_HELP_PALETTE_EDITOR_DIALOG,
|
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_GIMP (gimp));
|
||||||
g_return_if_fail (GIMP_IS_MENU_FACTORY (menu_factory));
|
g_return_if_fail (GIMP_IS_MENU_FACTORY (menu_factory));
|
||||||
|
|
||||||
/* Toplevel */
|
|
||||||
global_dialog_factory = gimp_dialog_factory_new ("toplevel",
|
global_dialog_factory = gimp_dialog_factory_new ("toplevel",
|
||||||
gimp_get_user_context (gimp),
|
gimp_get_user_context (gimp),
|
||||||
menu_factory);
|
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++)
|
for (i = 0; i < G_N_ELEMENTS (entries); i++)
|
||||||
gimp_dialog_factory_register_entry (global_dialog_factory,
|
gimp_dialog_factory_register_entry (global_dialog_factory,
|
||||||
entries[i].identifier,
|
entries[i].identifier,
|
||||||
@ -389,19 +399,6 @@ dialogs_init (Gimp *gimp,
|
|||||||
entries[i].hideable,
|
entries[i].hideable,
|
||||||
entries[i].dockable);
|
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);
|
global_recent_docks = gimp_list_new (GIMP_TYPE_SESSION_INFO, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -416,12 +413,6 @@ dialogs_exit (Gimp *gimp)
|
|||||||
global_dialog_factory = NULL;
|
global_dialog_factory = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (global_display_factory)
|
|
||||||
{
|
|
||||||
g_object_unref (global_display_factory);
|
|
||||||
global_display_factory = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (global_recent_docks)
|
if (global_recent_docks)
|
||||||
{
|
{
|
||||||
g_object_unref (global_recent_docks);
|
g_object_unref (global_recent_docks);
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
|
|
||||||
|
|
||||||
extern GimpDialogFactory *global_dialog_factory;
|
extern GimpDialogFactory *global_dialog_factory;
|
||||||
extern GimpDialogFactory *global_display_factory;
|
|
||||||
|
|
||||||
extern GimpContainer *global_recent_docks;
|
extern GimpContainer *global_recent_docks;
|
||||||
|
|
||||||
|
|
||||||
|
@ -325,7 +325,7 @@ gimp_ui_configurer_separate_shells (GimpUIConfigurer *ui_configurer,
|
|||||||
new_image_window = gimp_image_window_new (ui_configurer->p->gimp,
|
new_image_window = gimp_image_window_new (ui_configurer->p->gimp,
|
||||||
NULL,
|
NULL,
|
||||||
global_menu_factory,
|
global_menu_factory,
|
||||||
global_display_factory,
|
global_dialog_factory,
|
||||||
global_dialog_factory);
|
global_dialog_factory);
|
||||||
/* Move the shell there */
|
/* Move the shell there */
|
||||||
shell = gimp_image_window_get_shell (source_image_window, 1);
|
shell = gimp_image_window_get_shell (source_image_window, 1);
|
||||||
|
@ -351,7 +351,7 @@ gui_display_create (Gimp *gimp,
|
|||||||
display = gimp_display_new (gimp, image, unit, scale,
|
display = gimp_display_new (gimp, image, unit, scale,
|
||||||
global_menu_factory,
|
global_menu_factory,
|
||||||
image_managers->data,
|
image_managers->data,
|
||||||
global_display_factory,
|
global_dialog_factory,
|
||||||
global_dialog_factory);
|
global_dialog_factory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,13 +139,15 @@ session_init (Gimp *gimp)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
/* In versions <= GIMP 2.6 there was a "toolbox", a
|
/* In versions <= GIMP 2.6 there was a "toolbox", a
|
||||||
* "dock" and a "toplevel" factory. These are now merged
|
* "dock", a "display" and a "toplevel" factory. These
|
||||||
* so if the factory name is "toolbox" or "dock", get
|
* are now merged so if the factory name is "toolbox",
|
||||||
* the "toplevel" factory instead. We don't change
|
* "dock" or "display", get the "toplevel" factory
|
||||||
* factory_name because we need it below
|
* instead. We don't change factory_name though because
|
||||||
|
* we need it below
|
||||||
*/
|
*/
|
||||||
factory = gimp_dialog_factory_from_name ((strcmp ("toolbox", factory_name) == 0 ||
|
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" :
|
"toplevel" :
|
||||||
factory_name);
|
factory_name);
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@
|
|||||||
(size 902 816))
|
(size 902 816))
|
||||||
(session-info "toplevel" "gimp-image-new-dialog"
|
(session-info "toplevel" "gimp-image-new-dialog"
|
||||||
(position 100 100))
|
(position 100 100))
|
||||||
(session-info "display" "gimp-empty-image-window"
|
(session-info "toplevel" "gimp-empty-image-window"
|
||||||
(position 140 32)
|
(position 140 32)
|
||||||
(size 610 190))
|
(size 610 190))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user