mirror of https://github.com/GNOME/gimp.git
support '|'-separated lists of dialog identifiers and raise any of them if
2003-11-18 Michael Natterer <mitch@gimp.org> * app/widgets/gimpdialogfactory.[ch] (gimp_dialog_factory_dialog_raise): support '|'-separated lists of dialog identifiers and raise any of them if it is already open, or the first dialog in the list otherwise. * app/gui/dialogs-commands.c (dialogs_create_dockable_cmd_callback): removed the same functionality here. * app/gui/edit-commands.c * app/tools/gimppaintoptions-gui.c * app/tools/gimptextoptions.c * app/widgets/gimpdevicestatus.c * app/widgets/gimptoolbox-indicator-area.c: pass lists of dialog identifiers to gimp_dialog_factory_dialog_raise().
This commit is contained in:
parent
c78386aaf7
commit
56863fac49
17
ChangeLog
17
ChangeLog
|
@ -1,3 +1,20 @@
|
|||
2003-11-18 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/widgets/gimpdialogfactory.[ch]
|
||||
(gimp_dialog_factory_dialog_raise): support '|'-separated lists of
|
||||
dialog identifiers and raise any of them if it is already open, or
|
||||
the first dialog in the list otherwise.
|
||||
|
||||
* app/gui/dialogs-commands.c (dialogs_create_dockable_cmd_callback):
|
||||
removed the same functionality here.
|
||||
|
||||
* app/gui/edit-commands.c
|
||||
* app/tools/gimppaintoptions-gui.c
|
||||
* app/tools/gimptextoptions.c
|
||||
* app/widgets/gimpdevicestatus.c
|
||||
* app/widgets/gimptoolbox-indicator-area.c: pass lists of dialog
|
||||
identifiers to gimp_dialog_factory_dialog_raise().
|
||||
|
||||
2003-11-18 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/core/gimpselection.c (gimp_selection_class_init): use
|
||||
|
|
|
@ -83,36 +83,9 @@ dialogs_create_dockable_cmd_callback (GtkWidget *widget,
|
|||
if (!identifier)
|
||||
return;
|
||||
|
||||
/* 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,
|
||||
gtk_widget_get_screen (widget),
|
||||
ids[i] ? ids[i] : ids[0], -1);
|
||||
|
||||
g_strfreev (ids);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_dialog_factory_dialog_raise (global_dock_factory,
|
||||
gtk_widget_get_screen (widget),
|
||||
identifier, -1);
|
||||
}
|
||||
gimp_dialog_factory_dialog_raise (global_dock_factory,
|
||||
gtk_widget_get_screen (widget),
|
||||
identifier, -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -228,7 +228,7 @@ edit_named_paste_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
gimp_dialog_factory_dialog_raise (global_dock_factory,
|
||||
gtk_widget_get_screen (widget),
|
||||
"gimp-buffer-list", -1);
|
||||
"gimp-buffer-list|gimp-buffer-grid", -1);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -83,36 +83,9 @@ dialogs_create_dockable_cmd_callback (GtkWidget *widget,
|
|||
if (!identifier)
|
||||
return;
|
||||
|
||||
/* 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,
|
||||
gtk_widget_get_screen (widget),
|
||||
ids[i] ? ids[i] : ids[0], -1);
|
||||
|
||||
g_strfreev (ids);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_dialog_factory_dialog_raise (global_dock_factory,
|
||||
gtk_widget_get_screen (widget),
|
||||
identifier, -1);
|
||||
}
|
||||
gimp_dialog_factory_dialog_raise (global_dock_factory,
|
||||
gtk_widget_get_screen (widget),
|
||||
identifier, -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -228,7 +228,7 @@ edit_named_paste_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
gimp_dialog_factory_dialog_raise (global_dock_factory,
|
||||
gtk_widget_get_screen (widget),
|
||||
"gimp-buffer-list", -1);
|
||||
"gimp-buffer-list|gimp-buffer-grid", -1);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -140,7 +140,7 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
|
|||
context,
|
||||
GIMP_PREVIEW_SIZE_SMALL, 1,
|
||||
dialog_factory,
|
||||
"gimp-brush-grid",
|
||||
"gimp-brush-grid|gimp-brush-list",
|
||||
GIMP_STOCK_TOOL_PAINTBRUSH,
|
||||
_("Open the brush selection dialog"));
|
||||
|
||||
|
@ -157,7 +157,7 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
|
|||
context,
|
||||
GIMP_PREVIEW_SIZE_SMALL, 1,
|
||||
dialog_factory,
|
||||
"gimp-pattern-grid",
|
||||
"gimp-pattern-grid|gimp-pattern-list",
|
||||
GIMP_STOCK_TOOL_BUCKET_FILL,
|
||||
_("Open the pattern selection dialog"));
|
||||
|
||||
|
@ -181,7 +181,7 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
|
|||
context,
|
||||
GIMP_PREVIEW_SIZE_LARGE, 1,
|
||||
dialog_factory,
|
||||
"gimp-gradient-list",
|
||||
"gimp-gradient-list|gimp-gradient-grid",
|
||||
GIMP_STOCK_TOOL_BLEND,
|
||||
_("Open the gradient selection dialog"));
|
||||
|
||||
|
|
|
@ -308,7 +308,7 @@ gimp_text_options_gui (GimpToolOptions *tool_options)
|
|||
GIMP_CONTEXT (options),
|
||||
GIMP_PREVIEW_SIZE_SMALL, 1,
|
||||
dialog_factory,
|
||||
"gimp-font-list",
|
||||
"gimp-font-list|gimp-font-grid",
|
||||
GTK_STOCK_SELECT_FONT,
|
||||
_("Open the font selection dialog"));
|
||||
|
||||
|
|
|
@ -215,7 +215,7 @@ gimp_device_status_init (GimpDeviceStatus *status)
|
|||
|
||||
g_signal_connect (entry->tool, "clicked",
|
||||
G_CALLBACK (gimp_device_status_preview_clicked),
|
||||
"gimp-tool-list");
|
||||
"gimp-tool-list|gimp-tool-grid");
|
||||
|
||||
/* the foreground color */
|
||||
|
||||
|
@ -253,7 +253,7 @@ gimp_device_status_init (GimpDeviceStatus *status)
|
|||
|
||||
g_signal_connect (entry->brush, "clicked",
|
||||
G_CALLBACK (gimp_device_status_preview_clicked),
|
||||
"gimp-brush-grid");
|
||||
"gimp-brush-grid|gimp-brush-list");
|
||||
|
||||
/* the pattern */
|
||||
|
||||
|
@ -267,7 +267,7 @@ gimp_device_status_init (GimpDeviceStatus *status)
|
|||
|
||||
g_signal_connect (entry->pattern, "clicked",
|
||||
G_CALLBACK (gimp_device_status_preview_clicked),
|
||||
"gimp-pattern-grid");
|
||||
"gimp-pattern-grid|gimp-pattern-list");
|
||||
|
||||
/* the gradient */
|
||||
|
||||
|
@ -281,7 +281,7 @@ gimp_device_status_init (GimpDeviceStatus *status)
|
|||
|
||||
g_signal_connect (entry->gradient, "clicked",
|
||||
G_CALLBACK (gimp_device_status_preview_clicked),
|
||||
"gimp-gradient-list");
|
||||
"gimp-gradient-list|gimp-gradient-list");
|
||||
|
||||
gimp_device_status_update_entry (device_info, entry);
|
||||
}
|
||||
|
|
|
@ -546,10 +546,10 @@ gimp_dialog_factory_dialog_new_internal (GimpDialogFactory *factory,
|
|||
|
||||
/**
|
||||
* gimp_dialog_factory_dialog_new:
|
||||
* @factory: a #GimpDialogFactory
|
||||
* @screen: the #GdkScreen the dialog should appear on
|
||||
* @identifier: the identifier of the dialog as registered with
|
||||
* gimp_dialog_factory_register_entry()
|
||||
* @factory: a #GimpDialogFactory
|
||||
* @screen: the #GdkScreen the dialog should appear on
|
||||
* @identifier: the identifier of the dialog as registered with
|
||||
* gimp_dialog_factory_register_entry()
|
||||
* @preview_size:
|
||||
*
|
||||
* Creates a new toplevel dialog or a #GimpDockable, depending on whether
|
||||
|
@ -580,43 +580,76 @@ gimp_dialog_factory_dialog_new (GimpDialogFactory *factory,
|
|||
|
||||
/**
|
||||
* gimp_dialog_factory_dialog_raise:
|
||||
* @factory : a #GimpDialogFactory
|
||||
* @screen: the #GdkScreen the dialog should appear on
|
||||
* @identifier: the identifier of the dialog as registered with
|
||||
* gimp_dialog_factory_register_entry()
|
||||
* @factory: a #GimpDialogFactory
|
||||
* @screen: the #GdkScreen the dialog should appear on
|
||||
* @identifiers: a '|' separated list of identifiers of dialogs as
|
||||
* registered with gimp_dialog_factory_register_entry()
|
||||
* @preview_size:
|
||||
*
|
||||
* Raises an already existing toplevel dialog or #GimpDockable if it was
|
||||
* already created by this %facory.
|
||||
* Raises any of a list of already existing toplevel dialog or
|
||||
* #GimpDockable if it was already created by this %facory.
|
||||
*
|
||||
* Implicitly creates a new dialog if it was not found.
|
||||
* Implicitly creates the first dialog in the list if none of the dialogs
|
||||
* were found.
|
||||
*
|
||||
* Return value: the raised or newly created dialog.
|
||||
**/
|
||||
GtkWidget *
|
||||
gimp_dialog_factory_dialog_raise (GimpDialogFactory *factory,
|
||||
GdkScreen *screen,
|
||||
const gchar *identifier,
|
||||
const gchar *identifiers,
|
||||
gint preview_size)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_DIALOG_FACTORY (factory), NULL);
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
||||
g_return_val_if_fail (identifier != NULL, NULL);
|
||||
g_return_val_if_fail (identifiers != NULL, NULL);
|
||||
|
||||
return gimp_dialog_factory_dialog_new_internal (factory,
|
||||
screen,
|
||||
NULL,
|
||||
identifier,
|
||||
preview_size,
|
||||
TRUE);
|
||||
/* 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 (identifiers, '|'))
|
||||
{
|
||||
gchar **ids = g_strsplit (identifiers, "|", 0);
|
||||
gint i;
|
||||
|
||||
for (i = 0; ids[i]; i++)
|
||||
{
|
||||
GimpSessionInfo *info;
|
||||
|
||||
info = gimp_dialog_factory_find_session_info (factory, ids[i]);
|
||||
if (info && info->widget)
|
||||
break;
|
||||
}
|
||||
|
||||
dialog = gimp_dialog_factory_dialog_new_internal (factory,
|
||||
screen,
|
||||
NULL,
|
||||
ids[i] ? ids[i] : ids[0],
|
||||
preview_size,
|
||||
TRUE);
|
||||
g_strfreev (ids);
|
||||
}
|
||||
else
|
||||
{
|
||||
dialog = gimp_dialog_factory_dialog_new_internal (factory,
|
||||
screen,
|
||||
NULL,
|
||||
identifiers,
|
||||
preview_size,
|
||||
TRUE);
|
||||
}
|
||||
|
||||
return dialog;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_dialog_factory_dockable_new:
|
||||
* @factory : a #GimpDialogFactory
|
||||
* @dock : a #GimpDock crated by this %factory.
|
||||
* @identifier: the identifier of the dialog as registered with
|
||||
* gimp_dialog_factory_register_entry()
|
||||
* @factory: a #GimpDialogFactory
|
||||
* @dock: a #GimpDock crated by this %factory.
|
||||
* @identifier: the identifier of the dialog as registered with
|
||||
* gimp_dialog_factory_register_entry()
|
||||
* @preview_size:
|
||||
*
|
||||
* Creates a new #GimpDockable in the context of the #GimpDock it will be
|
||||
|
@ -650,7 +683,7 @@ gimp_dialog_factory_dockable_new (GimpDialogFactory *factory,
|
|||
/**
|
||||
* gimp_dialog_factory_dock_new:
|
||||
* @factory: a #GimpDialogFacotry
|
||||
* @screen: the #GdkScreen the dock should appear on
|
||||
* @screen: the #GdkScreen the dock should appear on
|
||||
*
|
||||
* Returns a new #GimpDock in this %factory's context. We use a function
|
||||
* pointer passed to this %factory's constructor instead of simply
|
||||
|
|
|
@ -108,7 +108,7 @@ GtkWidget * gimp_dialog_factory_dialog_new (GimpDialogFactory *factory,
|
|||
gint preview_size);
|
||||
GtkWidget * gimp_dialog_factory_dialog_raise (GimpDialogFactory *factory,
|
||||
GdkScreen *screen,
|
||||
const gchar *identifier,
|
||||
const gchar *identifiers,
|
||||
gint preview_size);
|
||||
GtkWidget * gimp_dialog_factory_dockable_new (GimpDialogFactory *factory,
|
||||
GimpDock *dock,
|
||||
|
|
|
@ -54,7 +54,7 @@ brush_preview_clicked (GtkWidget *widget,
|
|||
{
|
||||
gimp_dialog_factory_dialog_raise (GIMP_DOCK (toolbox)->dialog_factory,
|
||||
gtk_widget_get_screen (widget),
|
||||
"gimp-brush-grid", -1);
|
||||
"gimp-brush-grid|gimp-brush-list", -1);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -76,7 +76,7 @@ pattern_preview_clicked (GtkWidget *widget,
|
|||
{
|
||||
gimp_dialog_factory_dialog_raise (GIMP_DOCK (toolbox)->dialog_factory,
|
||||
gtk_widget_get_screen (widget),
|
||||
"gimp-pattern-grid", -1);
|
||||
"gimp-pattern-grid|gimp-pattern-list", -1);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -98,7 +98,7 @@ gradient_preview_clicked (GtkWidget *widget,
|
|||
{
|
||||
gimp_dialog_factory_dialog_raise (GIMP_DOCK (toolbox)->dialog_factory,
|
||||
gtk_widget_get_screen (widget),
|
||||
"gimp-gradient-list", -1);
|
||||
"gimp-gradient-list|gimp-gradient-grid", -1);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in New Issue