Commit ea8198e4 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

new function which checks a GimpImageType against the

2004-08-08  Michael Natterer  <mitch@gimp.org>

	* app/plug-in/plug-in-proc.[ch] (plug_in_proc_def_get_sensitive):
	new function which checks a GimpImageType against the
	proc_def->image_types_val mask.

	* app/actions/plug-in-actions.c: use the new function here. Also
	separated setting the "Repeat last" and "Reshow last" actions'
	labels from setting their sensitivity and made them use the same
	sensitivity logic as all other plug-in actions. Fixes bug #149567.
parent 72537fea
2004-08-08 Michael Natterer <mitch@gimp.org>
* app/plug-in/plug-in-proc.[ch] (plug_in_proc_def_get_sensitive):
new function which checks a GimpImageType against the
proc_def->image_types_val mask.
* app/actions/plug-in-actions.c: use the new function here. Also
separated setting the "Repeat last" and "Reshow last" actions'
labels from setting their sensitivity and made them use the same
sensitivity logic as all other plug-in actions. Fixes bug #149567.
2004-08-07 Simon Budig <simon@gimp.org>
* libgimpwidgets/gimpcolorscales.c: emit the COLOR_CHANGED signal
......
......@@ -50,8 +50,6 @@
static void plug_in_actions_last_changed (Gimp *gimp,
GimpActionGroup *group);
static void plug_in_actions_update_last (GimpActionGroup *group,
gpointer data);
static gboolean plug_in_actions_check_translation (const gchar *original,
const gchar *translated);
static void plug_in_actions_build_path (GimpActionGroup *group,
......@@ -140,6 +138,7 @@ plug_in_actions_setup (GimpActionGroup *group)
g_signal_connect_object (group->gimp, "last-plug-in-changed",
G_CALLBACK (plug_in_actions_last_changed),
group, 0);
plug_in_actions_last_changed (group->gimp, group);
}
void
......@@ -171,32 +170,7 @@ plug_in_actions_update (GimpActionGroup *group,
! proc_def->prefixes &&
! proc_def->magics)
{
gboolean sensitive;
switch (type)
{
case GIMP_RGB_IMAGE:
sensitive = proc_def->image_types_val & PLUG_IN_RGB_IMAGE;
break;
case GIMP_RGBA_IMAGE:
sensitive = proc_def->image_types_val & PLUG_IN_RGBA_IMAGE;
break;
case GIMP_GRAY_IMAGE:
sensitive = proc_def->image_types_val & PLUG_IN_GRAY_IMAGE;
break;
case GIMP_GRAYA_IMAGE:
sensitive = proc_def->image_types_val & PLUG_IN_GRAYA_IMAGE;
break;
case GIMP_INDEXED_IMAGE:
sensitive = proc_def->image_types_val & PLUG_IN_INDEXED_IMAGE;
break;
case GIMP_INDEXEDA_IMAGE:
sensitive = proc_def->image_types_val & PLUG_IN_INDEXEDA_IMAGE;
break;
default:
sensitive = FALSE;
break;
}
gboolean sensitive = plug_in_proc_def_get_sensitive (proc_def, type);
gimp_action_group_set_action_sensitive (group,
proc_def->db_info.name,
......@@ -204,7 +178,17 @@ plug_in_actions_update (GimpActionGroup *group,
}
}
plug_in_actions_update_last (group, data);
if (group->gimp->last_plug_in &&
plug_in_proc_def_get_sensitive (group->gimp->last_plug_in, type))
{
gimp_action_group_set_action_sensitive (group, "plug-in-repeat", TRUE);
gimp_action_group_set_action_sensitive (group, "plug-in-reshow", TRUE);
}
else
{
gimp_action_group_set_action_sensitive (group, "plug-in-repeat", FALSE);
gimp_action_group_set_action_sensitive (group, "plug-in-reshow", FALSE);
}
}
void
......@@ -323,16 +307,9 @@ static void
plug_in_actions_last_changed (Gimp *gimp,
GimpActionGroup *group)
{
plug_in_actions_update_last (group, NULL);
}
static void
plug_in_actions_update_last (GimpActionGroup *group,
gpointer data)
{
if (group->gimp->last_plug_in)
if (gimp->last_plug_in)
{
PlugInProcDef *proc_def = group->gimp->last_plug_in;
PlugInProcDef *proc_def = gimp->last_plug_in;
const gchar *progname;
const gchar *domain;
gchar *label;
......@@ -354,9 +331,6 @@ plug_in_actions_update_last (GimpActionGroup *group,
g_free (repeat);
g_free (reshow);
gimp_action_group_set_action_sensitive (group, "plug-in-repeat", TRUE);
gimp_action_group_set_action_sensitive (group, "plug-in-reshow", TRUE);
}
else
{
......@@ -364,9 +338,6 @@ plug_in_actions_update_last (GimpActionGroup *group,
_("Repeat Last"));
gimp_action_group_set_action_label (group, "plug-in-reshow",
_("Re-Show Last"));
gimp_action_group_set_action_sensitive (group, "plug-in-repeat", FALSE);
gimp_action_group_set_action_sensitive (group, "plug-in-reshow", FALSE);
}
}
......
......@@ -243,3 +243,39 @@ plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
return help_id;
}
gboolean
plug_in_proc_def_get_sensitive (const PlugInProcDef *proc_def,
GimpImageType image_type)
{
gboolean sensitive;
g_return_val_if_fail (proc_def != NULL, FALSE);
switch (image_type)
{
case GIMP_RGB_IMAGE:
sensitive = proc_def->image_types_val & PLUG_IN_RGB_IMAGE;
break;
case GIMP_RGBA_IMAGE:
sensitive = proc_def->image_types_val & PLUG_IN_RGBA_IMAGE;
break;
case GIMP_GRAY_IMAGE:
sensitive = proc_def->image_types_val & PLUG_IN_GRAY_IMAGE;
break;
case GIMP_GRAYA_IMAGE:
sensitive = proc_def->image_types_val & PLUG_IN_GRAYA_IMAGE;
break;
case GIMP_INDEXED_IMAGE:
sensitive = proc_def->image_types_val & PLUG_IN_INDEXED_IMAGE;
break;
case GIMP_INDEXEDA_IMAGE:
sensitive = proc_def->image_types_val & PLUG_IN_INDEXEDA_IMAGE;
break;
default:
sensitive = FALSE;
break;
}
return sensitive ? TRUE : FALSE;
}
......@@ -63,6 +63,8 @@ const gchar * plug_in_proc_def_get_stock_id (const PlugInProcDef *proc_def)
GdkPixbuf * plug_in_proc_def_get_pixbuf (const PlugInProcDef *proc_def);
gchar * plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
const gchar *help_domain);
gboolean plug_in_proc_def_get_sensitive (const PlugInProcDef *proc_def,
GimpImageType image_type);
#endif /* __PLUG_IN_PROC_H__ */
......@@ -243,3 +243,39 @@ plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
return help_id;
}
gboolean
plug_in_proc_def_get_sensitive (const PlugInProcDef *proc_def,
GimpImageType image_type)
{
gboolean sensitive;
g_return_val_if_fail (proc_def != NULL, FALSE);
switch (image_type)
{
case GIMP_RGB_IMAGE:
sensitive = proc_def->image_types_val & PLUG_IN_RGB_IMAGE;
break;
case GIMP_RGBA_IMAGE:
sensitive = proc_def->image_types_val & PLUG_IN_RGBA_IMAGE;
break;
case GIMP_GRAY_IMAGE:
sensitive = proc_def->image_types_val & PLUG_IN_GRAY_IMAGE;
break;
case GIMP_GRAYA_IMAGE:
sensitive = proc_def->image_types_val & PLUG_IN_GRAYA_IMAGE;
break;
case GIMP_INDEXED_IMAGE:
sensitive = proc_def->image_types_val & PLUG_IN_INDEXED_IMAGE;
break;
case GIMP_INDEXEDA_IMAGE:
sensitive = proc_def->image_types_val & PLUG_IN_INDEXEDA_IMAGE;
break;
default:
sensitive = FALSE;
break;
}
return sensitive ? TRUE : FALSE;
}
......@@ -63,6 +63,8 @@ const gchar * plug_in_proc_def_get_stock_id (const PlugInProcDef *proc_def)
GdkPixbuf * plug_in_proc_def_get_pixbuf (const PlugInProcDef *proc_def);
gchar * plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
const gchar *help_domain);
gboolean plug_in_proc_def_get_sensitive (const PlugInProcDef *proc_def,
GimpImageType image_type);
#endif /* __PLUG_IN_PROC_H__ */
......@@ -243,3 +243,39 @@ plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
return help_id;
}
gboolean
plug_in_proc_def_get_sensitive (const PlugInProcDef *proc_def,
GimpImageType image_type)
{
gboolean sensitive;
g_return_val_if_fail (proc_def != NULL, FALSE);
switch (image_type)
{
case GIMP_RGB_IMAGE:
sensitive = proc_def->image_types_val & PLUG_IN_RGB_IMAGE;
break;
case GIMP_RGBA_IMAGE:
sensitive = proc_def->image_types_val & PLUG_IN_RGBA_IMAGE;
break;
case GIMP_GRAY_IMAGE:
sensitive = proc_def->image_types_val & PLUG_IN_GRAY_IMAGE;
break;
case GIMP_GRAYA_IMAGE:
sensitive = proc_def->image_types_val & PLUG_IN_GRAYA_IMAGE;
break;
case GIMP_INDEXED_IMAGE:
sensitive = proc_def->image_types_val & PLUG_IN_INDEXED_IMAGE;
break;
case GIMP_INDEXEDA_IMAGE:
sensitive = proc_def->image_types_val & PLUG_IN_INDEXEDA_IMAGE;
break;
default:
sensitive = FALSE;
break;
}
return sensitive ? TRUE : FALSE;
}
......@@ -63,6 +63,8 @@ const gchar * plug_in_proc_def_get_stock_id (const PlugInProcDef *proc_def)
GdkPixbuf * plug_in_proc_def_get_pixbuf (const PlugInProcDef *proc_def);
gchar * plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
const gchar *help_domain);
gboolean plug_in_proc_def_get_sensitive (const PlugInProcDef *proc_def,
GimpImageType image_type);
#endif /* __PLUG_IN_PROC_H__ */
......@@ -243,3 +243,39 @@ plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
return help_id;
}
gboolean
plug_in_proc_def_get_sensitive (const PlugInProcDef *proc_def,
GimpImageType image_type)
{
gboolean sensitive;
g_return_val_if_fail (proc_def != NULL, FALSE);
switch (image_type)
{
case GIMP_RGB_IMAGE:
sensitive = proc_def->image_types_val & PLUG_IN_RGB_IMAGE;
break;
case GIMP_RGBA_IMAGE:
sensitive = proc_def->image_types_val & PLUG_IN_RGBA_IMAGE;
break;
case GIMP_GRAY_IMAGE:
sensitive = proc_def->image_types_val & PLUG_IN_GRAY_IMAGE;
break;
case GIMP_GRAYA_IMAGE:
sensitive = proc_def->image_types_val & PLUG_IN_GRAYA_IMAGE;
break;
case GIMP_INDEXED_IMAGE:
sensitive = proc_def->image_types_val & PLUG_IN_INDEXED_IMAGE;
break;
case GIMP_INDEXEDA_IMAGE:
sensitive = proc_def->image_types_val & PLUG_IN_INDEXEDA_IMAGE;
break;
default:
sensitive = FALSE;
break;
}
return sensitive ? TRUE : FALSE;
}
......@@ -63,6 +63,8 @@ const gchar * plug_in_proc_def_get_stock_id (const PlugInProcDef *proc_def)
GdkPixbuf * plug_in_proc_def_get_pixbuf (const PlugInProcDef *proc_def);
gchar * plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
const gchar *help_domain);
gboolean plug_in_proc_def_get_sensitive (const PlugInProcDef *proc_def,
GimpImageType image_type);
#endif /* __PLUG_IN_PROC_H__ */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment