accept a list of dialog identifiers and try to raise an existing dockable

2003-09-30  Sven Neumann  <sven@gimp.org>

	* app/gui/dialogs-commands.c (dialogs_create_dockable_cmd_callback):
	accept a list of dialog identifiers and try to raise an existing
	dockable from the list. If that fails, create a new one from the
	first entry.

	* app/gui/image-menu.c
	* app/gui/toolbox-menu.c: specify alternative dialog identifiers
	where appropriate.

	* app/vectors/gimpstroke.c (gimp_stroke_interpolate): use NULL
	instead of 0.
This commit is contained in:
Sven Neumann 2003-09-30 15:48:14 +00:00 committed by Sven Neumann
parent 20683bede5
commit b563329c28
8 changed files with 115 additions and 51 deletions

View File

@ -1,3 +1,17 @@
2003-09-30 Sven Neumann <sven@gimp.org>
* app/gui/dialogs-commands.c (dialogs_create_dockable_cmd_callback):
accept a list of dialog identifiers and try to raise an existing
dockable from the list. If that fails, create a new one from the
first entry.
* app/gui/image-menu.c
* app/gui/toolbox-menu.c: specify alternative dialog identifiers
where appropriate.
* app/vectors/gimpstroke.c (gimp_stroke_interpolate): use NULL
instead of 0.
2003-09-30 Simon Budig <simon@gimp.org>
* app/vectors/gimpbezierstroke.c:

View File

@ -58,9 +58,7 @@ dialogs_create_toplevel_cmd_callback (GtkWidget *widget,
{
if (action)
{
const gchar *identifier;
identifier = g_quark_to_string ((GQuark) action);
const gchar *identifier = g_quark_to_string ((GQuark) action);
if (identifier)
gimp_dialog_factory_dialog_new (global_dialog_factory, identifier, -1);
@ -74,12 +72,39 @@ dialogs_create_dockable_cmd_callback (GtkWidget *widget,
{
if (action)
{
const gchar *identifier;
const gchar *identifier = g_quark_to_string ((GQuark) action);
identifier = g_quark_to_string ((GQuark) action);
if (!identifier)
return;
if (identifier)
gimp_dialog_factory_dialog_raise (global_dock_factory, identifier, -1);
/* If the identifier is a list, try to find a matching dialog and
* raise it. If there's no match, use the first list item.
*/
if (strchr (identifier, '|'))
{
gchar **ids = g_strsplit (identifier, "|", 0);
gint i;
for (i = 0; ids[i]; i++)
{
GimpSessionInfo *info;
info = gimp_dialog_factory_find_session_info (global_dock_factory,
ids[i]);
if (info && info->widget)
break;
}
gimp_dialog_factory_dialog_raise (global_dock_factory,
ids[i] ? ids[i] : ids[0], -1);
g_strfreev (ids);
}
else
{
gimp_dialog_factory_dialog_raise (global_dock_factory,
identifier, -1);
}
}
}

View File

@ -58,9 +58,7 @@ dialogs_create_toplevel_cmd_callback (GtkWidget *widget,
{
if (action)
{
const gchar *identifier;
identifier = g_quark_to_string ((GQuark) action);
const gchar *identifier = g_quark_to_string ((GQuark) action);
if (identifier)
gimp_dialog_factory_dialog_new (global_dialog_factory, identifier, -1);
@ -74,12 +72,39 @@ dialogs_create_dockable_cmd_callback (GtkWidget *widget,
{
if (action)
{
const gchar *identifier;
const gchar *identifier = g_quark_to_string ((GQuark) action);
identifier = g_quark_to_string ((GQuark) action);
if (!identifier)
return;
if (identifier)
gimp_dialog_factory_dialog_raise (global_dock_factory, identifier, -1);
/* If the identifier is a list, try to find a matching dialog and
* raise it. If there's no match, use the first list item.
*/
if (strchr (identifier, '|'))
{
gchar **ids = g_strsplit (identifier, "|", 0);
gint i;
for (i = 0; ids[i]; i++)
{
GimpSessionInfo *info;
info = gimp_dialog_factory_find_session_info (global_dock_factory,
ids[i]);
if (info && info->widget)
break;
}
gimp_dialog_factory_dialog_raise (global_dock_factory,
ids[i] ? ids[i] : ids[0], -1);
g_strfreev (ids);
}
else
{
gimp_dialog_factory_dialog_raise (global_dock_factory,
identifier, -1);
}
}
}

View File

@ -108,7 +108,7 @@ GimpItemFactoryEntry image_menu_entries[] =
{ { N_("/File/Open Recent/Document _History..."), "foo",
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GTK_STOCK_OPEN },
"gimp-document-list",
"gimp-document-list|gimp-document-grid",
GIMP_HELP_DOCUMENT_DIALOG, NULL },
MENU_SEPARATOR ("/File/---"),
@ -985,32 +985,32 @@ GimpItemFactoryEntry image_menu_entries[] =
{ { N_("/Dialogs/Brus_hes..."), "<control><shift>B",
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOL_PAINTBRUSH },
"gimp-brush-grid",
"gimp-brush-grid|gimp-brush-list",
GIMP_HELP_BRUSH_DIALOG, NULL },
{ { N_("/Dialogs/P_atterns..."), "<control><shift>P",
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOL_BUCKET_FILL },
"gimp-pattern-grid",
"gimp-pattern-grid|gimp-pattern-list",
GIMP_HELP_PATTERN_DIALOG, NULL },
{ { N_("/Dialogs/_Gradients..."), "<control>G",
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOL_BLEND },
"gimp-gradient-list",
"gimp-gradient-list|gimp-gradient-grid",
GIMP_HELP_GRADIENT_DIALOG, NULL },
{ { N_("/Dialogs/Pal_ettes..."), "<control>P",
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GTK_STOCK_SELECT_COLOR },
"gimp-palette-list",
"gimp-palette-list|gimp-palette-grid",
GIMP_HELP_PALETTE_DIALOG, NULL },
{ { N_("/Dialogs/_Fonts..."), NULL,
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GTK_STOCK_SELECT_FONT },
"gimp-font-list",
"gimp-font-list|gimp-font-grid",
GIMP_HELP_FONT_DIALOG, NULL },
{ { N_("/Dialogs/_Buffers..."), "foo",
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GTK_STOCK_PASTE },
"gimp-buffer-list",
"gimp-buffer-list|gimp-buffer-grid",
GIMP_HELP_BUFFER_DIALOG, NULL },
MENU_SEPARATOR ("/Dialogs/---"),
@ -1018,17 +1018,17 @@ GimpItemFactoryEntry image_menu_entries[] =
{ { N_("/Dialogs/I_mages..."), NULL,
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_IMAGES },
"gimp-image-list",
"gimp-image-list|gimp-image-grid",
GIMP_HELP_IMAGE_DIALOG, NULL },
{ { N_("/Dialogs/Document Histor_y..."), "",
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GTK_STOCK_OPEN },
"gimp-document-list",
"gimp-document-list|gimp-document-grid",
GIMP_HELP_DOCUMENT_DIALOG, NULL },
{ { N_("/Dialogs/_Templates..."), NULL,
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TEMPLATE },
"gimp-template-list",
"gimp-template-list|gimp-template-grid",
GIMP_HELP_TEMPLATE_DIALOG, NULL },
{ { N_("/Dialogs/Error Co_nsole..."), NULL,
dialogs_create_dockable_cmd_callback, 0,

View File

@ -71,7 +71,7 @@ GimpItemFactoryEntry toolbox_menu_entries[] =
{ { N_("/File/Open Recent/Document _History..."), "foo",
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GTK_STOCK_OPEN },
"gimp-document-list",
"gimp-document-list|gimp-document-grid",
GIMP_HELP_DOCUMENT_DIALOG, NULL },
/* <Toolbox>/File/Acquire */
@ -174,22 +174,22 @@ GimpItemFactoryEntry toolbox_menu_entries[] =
{ { N_("/File/Dialogs/_Gradients..."), "<control>G",
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOL_BLEND },
"gimp-gradient-list",
"gimp-gradient-list|gimp-gradient-grid",
GIMP_HELP_GRADIENT_DIALOG, NULL },
{ { N_("/File/Dialogs/Pal_ettes..."), "<control>P",
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GTK_STOCK_SELECT_COLOR },
"gimp-palette-list",
"gimp-palette-list|gimp-palette-list",
GIMP_HELP_PALETTE_DIALOG, NULL },
{ { N_("/File/Dialogs/_Fonts..."), NULL,
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GTK_STOCK_SELECT_FONT },
"gimp-font-list",
"gimp-font-list, gimp-font-grid",
GIMP_HELP_FONT_DIALOG, NULL },
{ { N_("/File/Dialogs/_Buffers..."), "foo",
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GTK_STOCK_PASTE },
"gimp-buffer-list",
"gimp-buffer-list|gimp-buffer-grid",
GIMP_HELP_BUFFER_DIALOG, NULL },
MENU_SEPARATOR ("/File/Dialogs/---"),
@ -197,17 +197,17 @@ GimpItemFactoryEntry toolbox_menu_entries[] =
{ { N_("/File/Dialogs/I_mages..."), NULL,
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_IMAGES },
"gimp-image-list",
"gimp-image-list|gimp-image-grid",
GIMP_HELP_IMAGE_DIALOG, NULL },
{ { N_("/File/Dialogs/Document Histor_y..."), "",
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GTK_STOCK_OPEN },
"gimp-document-list",
"gimp-document-list|gimp-document-grid",
GIMP_HELP_DOCUMENT_DIALOG, NULL },
{ { N_("/File/Dialogs/_Templates..."), "",
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TEMPLATE },
"gimp-template-list",
"gimp-template-list|gimp-template-grid",
GIMP_HELP_TEMPLATE_DIALOG, NULL },
{ { N_("/File/Dialogs/Error Co_nsole..."), NULL,
dialogs_create_dockable_cmd_callback, 0,

View File

@ -108,7 +108,7 @@ GimpItemFactoryEntry image_menu_entries[] =
{ { N_("/File/Open Recent/Document _History..."), "foo",
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GTK_STOCK_OPEN },
"gimp-document-list",
"gimp-document-list|gimp-document-grid",
GIMP_HELP_DOCUMENT_DIALOG, NULL },
MENU_SEPARATOR ("/File/---"),
@ -985,32 +985,32 @@ GimpItemFactoryEntry image_menu_entries[] =
{ { N_("/Dialogs/Brus_hes..."), "<control><shift>B",
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOL_PAINTBRUSH },
"gimp-brush-grid",
"gimp-brush-grid|gimp-brush-list",
GIMP_HELP_BRUSH_DIALOG, NULL },
{ { N_("/Dialogs/P_atterns..."), "<control><shift>P",
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOL_BUCKET_FILL },
"gimp-pattern-grid",
"gimp-pattern-grid|gimp-pattern-list",
GIMP_HELP_PATTERN_DIALOG, NULL },
{ { N_("/Dialogs/_Gradients..."), "<control>G",
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOL_BLEND },
"gimp-gradient-list",
"gimp-gradient-list|gimp-gradient-grid",
GIMP_HELP_GRADIENT_DIALOG, NULL },
{ { N_("/Dialogs/Pal_ettes..."), "<control>P",
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GTK_STOCK_SELECT_COLOR },
"gimp-palette-list",
"gimp-palette-list|gimp-palette-grid",
GIMP_HELP_PALETTE_DIALOG, NULL },
{ { N_("/Dialogs/_Fonts..."), NULL,
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GTK_STOCK_SELECT_FONT },
"gimp-font-list",
"gimp-font-list|gimp-font-grid",
GIMP_HELP_FONT_DIALOG, NULL },
{ { N_("/Dialogs/_Buffers..."), "foo",
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GTK_STOCK_PASTE },
"gimp-buffer-list",
"gimp-buffer-list|gimp-buffer-grid",
GIMP_HELP_BUFFER_DIALOG, NULL },
MENU_SEPARATOR ("/Dialogs/---"),
@ -1018,17 +1018,17 @@ GimpItemFactoryEntry image_menu_entries[] =
{ { N_("/Dialogs/I_mages..."), NULL,
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_IMAGES },
"gimp-image-list",
"gimp-image-list|gimp-image-grid",
GIMP_HELP_IMAGE_DIALOG, NULL },
{ { N_("/Dialogs/Document Histor_y..."), "",
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GTK_STOCK_OPEN },
"gimp-document-list",
"gimp-document-list|gimp-document-grid",
GIMP_HELP_DOCUMENT_DIALOG, NULL },
{ { N_("/Dialogs/_Templates..."), NULL,
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TEMPLATE },
"gimp-template-list",
"gimp-template-list|gimp-template-grid",
GIMP_HELP_TEMPLATE_DIALOG, NULL },
{ { N_("/Dialogs/Error Co_nsole..."), NULL,
dialogs_create_dockable_cmd_callback, 0,

View File

@ -71,7 +71,7 @@ GimpItemFactoryEntry toolbox_menu_entries[] =
{ { N_("/File/Open Recent/Document _History..."), "foo",
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GTK_STOCK_OPEN },
"gimp-document-list",
"gimp-document-list|gimp-document-grid",
GIMP_HELP_DOCUMENT_DIALOG, NULL },
/* <Toolbox>/File/Acquire */
@ -174,22 +174,22 @@ GimpItemFactoryEntry toolbox_menu_entries[] =
{ { N_("/File/Dialogs/_Gradients..."), "<control>G",
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOL_BLEND },
"gimp-gradient-list",
"gimp-gradient-list|gimp-gradient-grid",
GIMP_HELP_GRADIENT_DIALOG, NULL },
{ { N_("/File/Dialogs/Pal_ettes..."), "<control>P",
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GTK_STOCK_SELECT_COLOR },
"gimp-palette-list",
"gimp-palette-list|gimp-palette-list",
GIMP_HELP_PALETTE_DIALOG, NULL },
{ { N_("/File/Dialogs/_Fonts..."), NULL,
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GTK_STOCK_SELECT_FONT },
"gimp-font-list",
"gimp-font-list, gimp-font-grid",
GIMP_HELP_FONT_DIALOG, NULL },
{ { N_("/File/Dialogs/_Buffers..."), "foo",
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GTK_STOCK_PASTE },
"gimp-buffer-list",
"gimp-buffer-list|gimp-buffer-grid",
GIMP_HELP_BUFFER_DIALOG, NULL },
MENU_SEPARATOR ("/File/Dialogs/---"),
@ -197,17 +197,17 @@ GimpItemFactoryEntry toolbox_menu_entries[] =
{ { N_("/File/Dialogs/I_mages..."), NULL,
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_IMAGES },
"gimp-image-list",
"gimp-image-list|gimp-image-grid",
GIMP_HELP_IMAGE_DIALOG, NULL },
{ { N_("/File/Dialogs/Document Histor_y..."), "",
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GTK_STOCK_OPEN },
"gimp-document-list",
"gimp-document-list|gimp-document-grid",
GIMP_HELP_DOCUMENT_DIALOG, NULL },
{ { N_("/File/Dialogs/_Templates..."), "",
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TEMPLATE },
"gimp-template-list",
"gimp-template-list|gimp-template-grid",
GIMP_HELP_TEMPLATE_DIALOG, NULL },
{ { N_("/File/Dialogs/Error Co_nsole..."), NULL,
dialogs_create_dockable_cmd_callback, 0,

View File

@ -894,7 +894,7 @@ gimp_stroke_interpolate (const GimpStroke *stroke,
gdouble precision,
gboolean *ret_closed)
{
g_return_val_if_fail (GIMP_IS_STROKE (stroke), 0);
g_return_val_if_fail (GIMP_IS_STROKE (stroke), NULL);
return GIMP_STROKE_GET_CLASS (stroke)->interpolate (stroke, precision,
ret_closed);