mirror of https://github.com/GNOME/gimp.git
Minor plug-in sensitivity refactoring
* app/plug-in/gimppluginprocedure.[ch] (gimp_plug_in_procedure_get_sensitive): change GimpImageType parameter to GimpDrawable and do the type check internally. * app/actions/plug-in-actions.c (plug_in_actions_update): pass the active drawable instead of its type.
This commit is contained in:
parent
f6eed71a5c
commit
b141bcdb60
|
@ -239,17 +239,12 @@ plug_in_actions_update (GimpActionGroup *group,
|
|||
{
|
||||
GimpImage *image = action_data_get_image (data);
|
||||
GimpPlugInManager *manager = group->gimp->plug_in_manager;
|
||||
GimpImageType type = -1;
|
||||
GimpDrawable *drawable = NULL;
|
||||
GSList *list;
|
||||
gint i;
|
||||
|
||||
if (image)
|
||||
{
|
||||
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
|
||||
|
||||
if (drawable)
|
||||
type = gimp_drawable_type (drawable);
|
||||
}
|
||||
drawable = gimp_image_get_active_drawable (image);
|
||||
|
||||
for (list = manager->plug_in_procedures; list; list = g_slist_next (list))
|
||||
{
|
||||
|
@ -260,7 +255,7 @@ plug_in_actions_update (GimpActionGroup *group,
|
|||
proc->image_types_val)
|
||||
{
|
||||
gboolean sensitive = gimp_plug_in_procedure_get_sensitive (proc,
|
||||
type);
|
||||
drawable);
|
||||
|
||||
gimp_action_group_set_action_sensitive (group,
|
||||
GIMP_OBJECT (proc)->name,
|
||||
|
@ -269,7 +264,7 @@ plug_in_actions_update (GimpActionGroup *group,
|
|||
}
|
||||
|
||||
if (manager->history &&
|
||||
gimp_plug_in_procedure_get_sensitive (manager->history->data, type))
|
||||
gimp_plug_in_procedure_get_sensitive (manager->history->data, drawable))
|
||||
{
|
||||
gimp_action_group_set_action_sensitive (group, "plug-in-repeat", TRUE);
|
||||
gimp_action_group_set_action_sensitive (group, "plug-in-reshow", TRUE);
|
||||
|
@ -287,7 +282,7 @@ plug_in_actions_update (GimpActionGroup *group,
|
|||
i + 1);
|
||||
gboolean sensitive;
|
||||
|
||||
sensitive = gimp_plug_in_procedure_get_sensitive (proc, type);
|
||||
sensitive = gimp_plug_in_procedure_get_sensitive (proc, drawable);
|
||||
|
||||
gimp_action_group_set_action_sensitive (group, name, sensitive);
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gegl.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimp-utils.h"
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpmarshal.h"
|
||||
#include "core/gimpparamspecs.h"
|
||||
|
||||
|
@ -683,11 +684,16 @@ gimp_plug_in_procedure_get_help_id (const GimpPlugInProcedure *proc)
|
|||
|
||||
gboolean
|
||||
gimp_plug_in_procedure_get_sensitive (const GimpPlugInProcedure *proc,
|
||||
GimpImageType image_type)
|
||||
GimpDrawable *drawable)
|
||||
{
|
||||
gboolean sensitive;
|
||||
GimpImageType image_type = -1;
|
||||
gboolean sensitive = FALSE;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_PLUG_IN_PROCEDURE (proc), FALSE);
|
||||
g_return_val_if_fail (drawable == NULL || GIMP_IS_DRAWABLE (drawable), FALSE);
|
||||
|
||||
if (drawable)
|
||||
image_type = gimp_drawable_type (drawable);
|
||||
|
||||
switch (image_type)
|
||||
{
|
||||
|
@ -710,7 +716,6 @@ gimp_plug_in_procedure_get_sensitive (const GimpPlugInProcedure *proc,
|
|||
sensitive = proc->image_types_val & GIMP_PLUG_IN_INDEXEDA_IMAGE;
|
||||
break;
|
||||
default:
|
||||
sensitive = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ GdkPixbuf * gimp_plug_in_procedure_get_pixbuf (const GimpPlugInProcedure
|
|||
gchar * gimp_plug_in_procedure_get_help_id (const GimpPlugInProcedure *proc);
|
||||
|
||||
gboolean gimp_plug_in_procedure_get_sensitive (const GimpPlugInProcedure *proc,
|
||||
GimpImageType image_type);
|
||||
GimpDrawable *drawable);
|
||||
|
||||
void gimp_plug_in_procedure_set_image_types (GimpPlugInProcedure *proc,
|
||||
const gchar *image_types);
|
||||
|
|
Loading…
Reference in New Issue