changed member "ProcRecord last_plug_in" to PlugInProcDef last_plug_in".
2004-08-04 Michael Natterer <mitch@gimp.org> * app/core/gimp.[ch]: changed member "ProcRecord last_plug_in" to PlugInProcDef last_plug_in". Added function gimp_set_last_plug_in() and signal Gimp::last-plug-in-changed. * app/actions/plug-in-commands.c * app/plug-in/plug-in-run.c: changed accordingly. * app/actions/plug-in-actions.c: factored out updating of the "Reshow Last" and "Rerun Last" actions to a private function. Connect each "plug-in" action group to Gimp::last-plug-in-changed and update the actions' label and sensitivity in the callback. Fixes bug #149139.
This commit is contained in:

committed by
Michael Natterer

parent
0dabeab6cb
commit
51b8b94ed9
15
ChangeLog
15
ChangeLog
@ -1,3 +1,18 @@
|
||||
2004-08-04 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/core/gimp.[ch]: changed member "ProcRecord last_plug_in" to
|
||||
PlugInProcDef last_plug_in". Added function
|
||||
gimp_set_last_plug_in() and signal Gimp::last-plug-in-changed.
|
||||
|
||||
* app/actions/plug-in-commands.c
|
||||
* app/plug-in/plug-in-run.c: changed accordingly.
|
||||
|
||||
* app/actions/plug-in-actions.c: factored out updating of the
|
||||
"Reshow Last" and "Rerun Last" actions to a private function.
|
||||
Connect each "plug-in" action group to Gimp::last-plug-in-changed
|
||||
and update the actions' label and sensitivity in the
|
||||
callback. Fixes bug #149139.
|
||||
|
||||
2004-08-04 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/widgets/gimplayertreeview.c: #include "core/gimpimage-undo.h"
|
||||
|
@ -48,6 +48,10 @@
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
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,
|
||||
@ -132,6 +136,10 @@ plug_in_actions_setup (GimpActionGroup *group)
|
||||
plug_in_actions_add_proc (group, proc_def);
|
||||
}
|
||||
}
|
||||
|
||||
g_signal_connect_object (group->gimp, "last-plug-in-changed",
|
||||
G_CALLBACK (plug_in_actions_last_changed),
|
||||
group, 0);
|
||||
}
|
||||
|
||||
void
|
||||
@ -193,52 +201,10 @@ plug_in_actions_update (GimpActionGroup *group,
|
||||
gimp_action_group_set_action_sensitive (group,
|
||||
proc_def->db_info.name,
|
||||
sensitive);
|
||||
|
||||
if (group->gimp->last_plug_in &&
|
||||
group->gimp->last_plug_in == &proc_def->db_info)
|
||||
{
|
||||
const gchar *progname;
|
||||
const gchar *domain;
|
||||
gchar *label;
|
||||
gchar *repeat;
|
||||
gchar *reshow;
|
||||
|
||||
progname = plug_in_proc_def_get_progname (proc_def);
|
||||
domain = plug_ins_locale_domain (group->gimp, progname, NULL);
|
||||
|
||||
label = plug_in_proc_def_get_label (proc_def, domain);
|
||||
|
||||
repeat = g_strdup_printf (_("Re_peat \"%s\""), label);
|
||||
reshow = g_strdup_printf (_("R_e-show \"%s\""), label);
|
||||
|
||||
g_free (label);
|
||||
|
||||
gimp_action_group_set_action_label (group, "plug-in-repeat",
|
||||
repeat);
|
||||
gimp_action_group_set_action_label (group, "plug-in-reshow",
|
||||
reshow);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! group->gimp->last_plug_in)
|
||||
{
|
||||
gimp_action_group_set_action_label (group, "plug-in-repeat",
|
||||
_("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);
|
||||
}
|
||||
plug_in_actions_update_last (group, data);
|
||||
}
|
||||
|
||||
void
|
||||
@ -353,6 +319,57 @@ plug_in_actions_remove_proc (GimpActionGroup *group,
|
||||
|
||||
/* private functions */
|
||||
|
||||
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)
|
||||
{
|
||||
PlugInProcDef *proc_def = group->gimp->last_plug_in;
|
||||
const gchar *progname;
|
||||
const gchar *domain;
|
||||
gchar *label;
|
||||
gchar *repeat;
|
||||
gchar *reshow;
|
||||
|
||||
progname = plug_in_proc_def_get_progname (proc_def);
|
||||
domain = plug_ins_locale_domain (group->gimp, progname, NULL);
|
||||
|
||||
label = plug_in_proc_def_get_label (proc_def, domain);
|
||||
|
||||
repeat = g_strdup_printf (_("Re_peat \"%s\""), label);
|
||||
reshow = g_strdup_printf (_("R_e-show \"%s\""), label);
|
||||
|
||||
g_free (label);
|
||||
|
||||
gimp_action_group_set_action_label (group, "plug-in-repeat", repeat);
|
||||
gimp_action_group_set_action_label (group, "plug-in-reshow", reshow);
|
||||
|
||||
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
|
||||
{
|
||||
gimp_action_group_set_action_label (group, "plug-in-repeat",
|
||||
_("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);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
plug_in_actions_check_translation (const gchar *original,
|
||||
const gchar *translated)
|
||||
|
@ -144,11 +144,7 @@ plug_in_run_cmd_callback (GtkAction *action,
|
||||
proc_rec->args[1].arg_type == GIMP_PDB_IMAGE &&
|
||||
proc_rec->args[2].arg_type == GIMP_PDB_DRAWABLE)
|
||||
{
|
||||
gimp->last_plug_in = proc_rec;
|
||||
#if 0
|
||||
FIXME
|
||||
plug_in_menus_update (GIMP_ITEM_FACTORY (item_factory), drawable_type);
|
||||
#endif
|
||||
gimp_set_last_plug_in (gimp, proc_def);
|
||||
}
|
||||
|
||||
g_free (args);
|
||||
|
@ -78,6 +78,7 @@ enum
|
||||
RESTORE,
|
||||
EXIT,
|
||||
BUFFER_CHANGED,
|
||||
LAST_PLUG_IN_CHANGED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
@ -186,6 +187,15 @@ gimp_class_init (GimpClass *klass)
|
||||
gimp_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
gimp_signals[LAST_PLUG_IN_CHANGED] =
|
||||
g_signal_new ("last-plug-in-changed",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GimpClass, last_plug_in_changed),
|
||||
NULL, NULL,
|
||||
gimp_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
object_class->dispose = gimp_dispose;
|
||||
object_class->finalize = gimp_finalize;
|
||||
|
||||
@ -924,6 +934,17 @@ gimp_set_global_buffer (Gimp *gimp,
|
||||
g_signal_emit (gimp, gimp_signals[BUFFER_CHANGED], 0);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_set_last_plug_in (Gimp *gimp,
|
||||
PlugInProcDef *proc_def)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
|
||||
gimp->last_plug_in = proc_def;
|
||||
|
||||
g_signal_emit (gimp, gimp_signals[LAST_PLUG_IN_CHANGED], 0);
|
||||
}
|
||||
|
||||
GimpImage *
|
||||
gimp_create_image (Gimp *gimp,
|
||||
gint width,
|
||||
|
@ -78,7 +78,7 @@ struct _Gimp
|
||||
PlugIn *current_plug_in;
|
||||
GSList *open_plug_ins;
|
||||
GSList *plug_in_stack;
|
||||
ProcRecord *last_plug_in;
|
||||
PlugInProcDef *last_plug_in;
|
||||
|
||||
PlugInShm *plug_in_shm;
|
||||
GimpEnvironTable *environ_table;
|
||||
@ -137,14 +137,15 @@ struct _GimpClass
|
||||
{
|
||||
GimpObjectClass parent_class;
|
||||
|
||||
void (* initialize) (Gimp *gimp,
|
||||
GimpInitStatusFunc status_callback);
|
||||
void (* restore) (Gimp *gimp,
|
||||
GimpInitStatusFunc status_callback);
|
||||
gboolean (* exit) (Gimp *gimp,
|
||||
gboolean force);
|
||||
void (* initialize) (Gimp *gimp,
|
||||
GimpInitStatusFunc status_callback);
|
||||
void (* restore) (Gimp *gimp,
|
||||
GimpInitStatusFunc status_callback);
|
||||
gboolean (* exit) (Gimp *gimp,
|
||||
gboolean force);
|
||||
|
||||
void (* buffer_changed) (Gimp *gimp);
|
||||
void (* buffer_changed) (Gimp *gimp);
|
||||
void (* last_plug_in_changed) (Gimp *gimp);
|
||||
};
|
||||
|
||||
|
||||
@ -174,6 +175,8 @@ void gimp_exit (Gimp *gimp,
|
||||
|
||||
void gimp_set_global_buffer (Gimp *gimp,
|
||||
GimpBuffer *buffer);
|
||||
void gimp_set_last_plug_in (Gimp *gimp,
|
||||
PlugInProcDef *proc_def);
|
||||
|
||||
GimpImage * gimp_create_image (Gimp *gimp,
|
||||
gint width,
|
||||
|
@ -39,6 +39,7 @@
|
||||
|
||||
#include "plug-in.h"
|
||||
#include "plug-in-params.h"
|
||||
#include "plug-in-proc.h"
|
||||
#include "plug-in-run.h"
|
||||
#include "plug-in-shm.h"
|
||||
|
||||
@ -196,7 +197,7 @@ plug_in_repeat (Gimp *gimp,
|
||||
|
||||
/* initialize the first three argument types */
|
||||
for (i = 0; i < 3; i++)
|
||||
args[i].arg_type = gimp->last_plug_in->args[i].arg_type;
|
||||
args[i].arg_type = gimp->last_plug_in->db_info.args[i].arg_type;
|
||||
|
||||
/* initialize the first three plug-in arguments */
|
||||
args[0].value.pdb_int = (with_interface ?
|
||||
@ -205,7 +206,7 @@ plug_in_repeat (Gimp *gimp,
|
||||
args[2].value.pdb_int = drawable_ID;
|
||||
|
||||
/* run the plug-in procedure */
|
||||
plug_in_run (gimp, context, gimp->last_plug_in,
|
||||
plug_in_run (gimp, context, &gimp->last_plug_in->db_info,
|
||||
args, 3, FALSE, TRUE, display_ID);
|
||||
|
||||
g_free (args);
|
||||
|
@ -39,6 +39,7 @@
|
||||
|
||||
#include "plug-in.h"
|
||||
#include "plug-in-params.h"
|
||||
#include "plug-in-proc.h"
|
||||
#include "plug-in-run.h"
|
||||
#include "plug-in-shm.h"
|
||||
|
||||
@ -196,7 +197,7 @@ plug_in_repeat (Gimp *gimp,
|
||||
|
||||
/* initialize the first three argument types */
|
||||
for (i = 0; i < 3; i++)
|
||||
args[i].arg_type = gimp->last_plug_in->args[i].arg_type;
|
||||
args[i].arg_type = gimp->last_plug_in->db_info.args[i].arg_type;
|
||||
|
||||
/* initialize the first three plug-in arguments */
|
||||
args[0].value.pdb_int = (with_interface ?
|
||||
@ -205,7 +206,7 @@ plug_in_repeat (Gimp *gimp,
|
||||
args[2].value.pdb_int = drawable_ID;
|
||||
|
||||
/* run the plug-in procedure */
|
||||
plug_in_run (gimp, context, gimp->last_plug_in,
|
||||
plug_in_run (gimp, context, &gimp->last_plug_in->db_info,
|
||||
args, 3, FALSE, TRUE, display_ID);
|
||||
|
||||
g_free (args);
|
||||
|
@ -39,6 +39,7 @@
|
||||
|
||||
#include "plug-in.h"
|
||||
#include "plug-in-params.h"
|
||||
#include "plug-in-proc.h"
|
||||
#include "plug-in-run.h"
|
||||
#include "plug-in-shm.h"
|
||||
|
||||
@ -196,7 +197,7 @@ plug_in_repeat (Gimp *gimp,
|
||||
|
||||
/* initialize the first three argument types */
|
||||
for (i = 0; i < 3; i++)
|
||||
args[i].arg_type = gimp->last_plug_in->args[i].arg_type;
|
||||
args[i].arg_type = gimp->last_plug_in->db_info.args[i].arg_type;
|
||||
|
||||
/* initialize the first three plug-in arguments */
|
||||
args[0].value.pdb_int = (with_interface ?
|
||||
@ -205,7 +206,7 @@ plug_in_repeat (Gimp *gimp,
|
||||
args[2].value.pdb_int = drawable_ID;
|
||||
|
||||
/* run the plug-in procedure */
|
||||
plug_in_run (gimp, context, gimp->last_plug_in,
|
||||
plug_in_run (gimp, context, &gimp->last_plug_in->db_info,
|
||||
args, 3, FALSE, TRUE, display_ID);
|
||||
|
||||
g_free (args);
|
||||
|
Reference in New Issue
Block a user