mirror of https://github.com/GNOME/gimp.git
app: rename GimpPlugInAction to GimpProcedureAction
and make the filter history keep around a list of GimpProcedures instead of GimpPlugInProcedures. Still WIP and unfinished...
This commit is contained in:
parent
050229cb45
commit
e0ab721361
|
@ -528,9 +528,9 @@ static const GimpEnumActionEntry filters_repeat_actions[] =
|
|||
void
|
||||
filters_actions_setup (GimpActionGroup *group)
|
||||
{
|
||||
GimpPlugInActionEntry *entries;
|
||||
gint n_entries;
|
||||
gint i;
|
||||
GimpProcedureActionEntry *entries;
|
||||
gint n_entries;
|
||||
gint i;
|
||||
|
||||
gimp_action_group_add_actions (group, "filters-action",
|
||||
filters_menu_actions,
|
||||
|
@ -560,7 +560,7 @@ filters_actions_setup (GimpActionGroup *group)
|
|||
|
||||
n_entries = gimp_filter_history_size (group->gimp);
|
||||
|
||||
entries = g_new0 (GimpPlugInActionEntry, n_entries);
|
||||
entries = g_new0 (GimpProcedureActionEntry, n_entries);
|
||||
|
||||
for (i = 0; i < n_entries; i++)
|
||||
{
|
||||
|
@ -573,8 +573,8 @@ filters_actions_setup (GimpActionGroup *group)
|
|||
entries[i].help_id = GIMP_HELP_FILTER_RESHOW;
|
||||
}
|
||||
|
||||
gimp_action_group_add_plug_in_actions (group, entries, n_entries,
|
||||
G_CALLBACK (filters_history_cmd_callback));
|
||||
gimp_action_group_add_procedure_actions (group, entries, n_entries,
|
||||
G_CALLBACK (filters_history_cmd_callback));
|
||||
|
||||
for (i = 0; i < n_entries; i++)
|
||||
{
|
||||
|
@ -713,10 +713,11 @@ filters_actions_update (GimpActionGroup *group,
|
|||
#undef SET_SENSITIVE
|
||||
|
||||
{
|
||||
GimpPlugInProcedure *proc = gimp_filter_history_nth (group->gimp, 0);
|
||||
gint i;
|
||||
GimpProcedure *proc = gimp_filter_history_nth (group->gimp, 0);
|
||||
gint i;
|
||||
|
||||
if (proc && gimp_plug_in_procedure_get_sensitive (proc, drawable))
|
||||
/* FIXME history */
|
||||
if (proc && gimp_plug_in_procedure_get_sensitive (GIMP_PLUG_IN_PROCEDURE (proc), drawable))
|
||||
{
|
||||
gimp_action_group_set_action_sensitive (group, "filters-repeat", TRUE);
|
||||
gimp_action_group_set_action_sensitive (group, "filters-reshow", TRUE);
|
||||
|
@ -734,7 +735,8 @@ filters_actions_update (GimpActionGroup *group,
|
|||
|
||||
proc = gimp_filter_history_nth (group->gimp, i);
|
||||
|
||||
sensitive = gimp_plug_in_procedure_get_sensitive (proc, drawable);
|
||||
/* FIXME history */
|
||||
sensitive = gimp_plug_in_procedure_get_sensitive (GIMP_PLUG_IN_PROCEDURE (proc), drawable);
|
||||
|
||||
gimp_action_group_set_action_sensitive (group, name, sensitive);
|
||||
|
||||
|
@ -767,9 +769,9 @@ static void
|
|||
filters_actions_history_changed (Gimp *gimp,
|
||||
GimpActionGroup *group)
|
||||
{
|
||||
GimpPlugInProcedure *proc;
|
||||
GimpActionGroup *plug_in_group;
|
||||
gint i;
|
||||
GimpProcedure *proc;
|
||||
GimpActionGroup *plug_in_group;
|
||||
gint i;
|
||||
|
||||
plug_in_group = filters_actions_get_plug_in_group (group);
|
||||
|
||||
|
@ -782,7 +784,8 @@ filters_actions_history_changed (Gimp *gimp,
|
|||
gchar *reshow;
|
||||
gboolean sensitive = FALSE;
|
||||
|
||||
label = gimp_plug_in_procedure_get_label (proc);
|
||||
/* FIXME history */
|
||||
label = gimp_plug_in_procedure_get_label (GIMP_PLUG_IN_PROCEDURE (proc));
|
||||
|
||||
/* copy the sensitivity of the plug-in procedure's actual action
|
||||
* instead of calling filters_actions_update() because doing the
|
||||
|
@ -836,14 +839,15 @@ filters_actions_history_changed (Gimp *gimp,
|
|||
|
||||
proc = gimp_filter_history_nth (gimp, i);
|
||||
|
||||
if (proc->menu_label)
|
||||
/* FIXME history */
|
||||
if (GIMP_PLUG_IN_PROCEDURE (proc)->menu_label)
|
||||
{
|
||||
label = dgettext (gimp_plug_in_procedure_get_locale_domain (proc),
|
||||
proc->menu_label);
|
||||
label = dgettext (gimp_plug_in_procedure_get_locale_domain (GIMP_PLUG_IN_PROCEDURE (proc)),
|
||||
GIMP_PLUG_IN_PROCEDURE (proc)->menu_label);
|
||||
}
|
||||
else
|
||||
{
|
||||
label = gimp_plug_in_procedure_get_label (proc);
|
||||
label = gimp_plug_in_procedure_get_label (GIMP_PLUG_IN_PROCEDURE (proc));
|
||||
}
|
||||
|
||||
/* see comment above */
|
||||
|
@ -861,8 +865,8 @@ filters_actions_history_changed (Gimp *gimp,
|
|||
"sensitive", sensitive,
|
||||
"procedure", proc,
|
||||
"label", label,
|
||||
"icon-name", gimp_plug_in_procedure_get_icon_name (proc),
|
||||
"tooltip", gimp_plug_in_procedure_get_blurb (proc),
|
||||
"icon-name", gimp_plug_in_procedure_get_icon_name (GIMP_PLUG_IN_PROCEDURE (proc)),
|
||||
"tooltip", gimp_plug_in_procedure_get_blurb (GIMP_PLUG_IN_PROCEDURE (proc)),
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
|
|
@ -103,10 +103,10 @@ filters_repeat_cmd_callback (GtkAction *action,
|
|||
gint value,
|
||||
gpointer data)
|
||||
{
|
||||
GimpPlugInProcedure *procedure;
|
||||
Gimp *gimp;
|
||||
GimpDisplay *display;
|
||||
GimpRunMode run_mode;
|
||||
GimpProcedure *procedure;
|
||||
Gimp *gimp;
|
||||
GimpDisplay *display;
|
||||
GimpRunMode run_mode;
|
||||
return_if_no_gimp (gimp, data);
|
||||
return_if_no_display (display, data);
|
||||
|
||||
|
@ -119,12 +119,12 @@ filters_repeat_cmd_callback (GtkAction *action,
|
|||
GimpValueArray *args;
|
||||
gint n_args;
|
||||
|
||||
args = gimp_procedure_get_arguments (GIMP_PROCEDURE (procedure));
|
||||
args = gimp_procedure_get_arguments (procedure);
|
||||
|
||||
g_value_set_int (gimp_value_array_index (args, 0), run_mode);
|
||||
|
||||
n_args = plug_in_collect_display_args (action, display,
|
||||
GIMP_PROCEDURE (procedure)->args,
|
||||
procedure->args,
|
||||
args, 1);
|
||||
|
||||
plug_in_procedure_execute (procedure, gimp, display, args, n_args);
|
||||
|
@ -134,9 +134,9 @@ filters_repeat_cmd_callback (GtkAction *action,
|
|||
}
|
||||
|
||||
void
|
||||
filters_history_cmd_callback (GtkAction *action,
|
||||
GimpPlugInProcedure *procedure,
|
||||
gpointer data)
|
||||
filters_history_cmd_callback (GtkAction *action,
|
||||
GimpProcedure *procedure,
|
||||
gpointer data)
|
||||
{
|
||||
Gimp *gimp;
|
||||
GimpDisplay *display;
|
||||
|
@ -145,12 +145,12 @@ filters_history_cmd_callback (GtkAction *action,
|
|||
return_if_no_gimp (gimp, data);
|
||||
return_if_no_display (display, data);
|
||||
|
||||
args = gimp_procedure_get_arguments (GIMP_PROCEDURE (procedure));
|
||||
args = gimp_procedure_get_arguments (procedure);
|
||||
|
||||
g_value_set_int (gimp_value_array_index (args, 0), GIMP_RUN_INTERACTIVE);
|
||||
|
||||
n_args = plug_in_collect_display_args (action, display,
|
||||
GIMP_PROCEDURE (procedure)->args,
|
||||
procedure->args,
|
||||
args, 1);
|
||||
|
||||
plug_in_procedure_execute (procedure, gimp, display, args, n_args);
|
||||
|
|
|
@ -19,16 +19,16 @@
|
|||
#define __FILTERS_COMMANDS_H__
|
||||
|
||||
|
||||
void filters_filter_cmd_callback (GtkAction *action,
|
||||
const gchar *operation,
|
||||
gpointer data);
|
||||
void filters_filter_cmd_callback (GtkAction *action,
|
||||
const gchar *operation,
|
||||
gpointer data);
|
||||
|
||||
void filters_repeat_cmd_callback (GtkAction *action,
|
||||
gint value,
|
||||
gpointer data);
|
||||
void filters_history_cmd_callback (GtkAction *action,
|
||||
GimpPlugInProcedure *proc,
|
||||
gpointer data);
|
||||
void filters_repeat_cmd_callback (GtkAction *action,
|
||||
gint value,
|
||||
gpointer data);
|
||||
void filters_history_cmd_callback (GtkAction *action,
|
||||
GimpProcedure *procedure,
|
||||
gpointer data);
|
||||
|
||||
|
||||
#endif /* __FILTERS_COMMANDS_H__ */
|
||||
|
|
|
@ -284,11 +284,11 @@ static void
|
|||
plug_in_actions_add_proc (GimpActionGroup *group,
|
||||
GimpPlugInProcedure *proc)
|
||||
{
|
||||
GimpPlugInActionEntry entry;
|
||||
const gchar *locale_domain;
|
||||
const gchar *label;
|
||||
gchar *path_original = NULL;
|
||||
gchar *path_translated = NULL;
|
||||
GimpProcedureActionEntry entry;
|
||||
const gchar *locale_domain;
|
||||
const gchar *label;
|
||||
gchar *path_original = NULL;
|
||||
gchar *path_translated = NULL;
|
||||
|
||||
locale_domain = gimp_plug_in_procedure_get_locale_domain (proc);
|
||||
|
||||
|
@ -337,7 +337,7 @@ plug_in_actions_add_proc (GimpActionGroup *group,
|
|||
entry.label = label;
|
||||
entry.accelerator = NULL;
|
||||
entry.tooltip = gimp_plug_in_procedure_get_blurb (proc);
|
||||
entry.procedure = proc;
|
||||
entry.procedure = GIMP_PROCEDURE (proc);
|
||||
entry.help_id = gimp_plug_in_procedure_get_help_id (proc);
|
||||
|
||||
#if 0
|
||||
|
@ -345,8 +345,8 @@ plug_in_actions_add_proc (GimpActionGroup *group,
|
|||
gimp_object_get_name (proc), label);
|
||||
#endif
|
||||
|
||||
gimp_action_group_add_plug_in_actions (group, &entry, 1,
|
||||
G_CALLBACK (plug_in_run_cmd_callback));
|
||||
gimp_action_group_add_procedure_actions (group, &entry, 1,
|
||||
G_CALLBACK (plug_in_run_cmd_callback));
|
||||
|
||||
g_free ((gchar *) entry.help_id);
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
/* local function prototypes */
|
||||
|
||||
#if 0
|
||||
static void plug_in_procedure_execute (GimpPlugInProcedure *procedure,
|
||||
static void plug_in_procedure_execute (GimpProcedure *procedure,
|
||||
Gimp *gimp,
|
||||
GimpDisplay *display,
|
||||
GimpValueArray *args,
|
||||
|
@ -102,11 +102,10 @@ static void plug_in_reset_all_response (GtkWidget *dialog,
|
|||
/* public functions */
|
||||
|
||||
void
|
||||
plug_in_run_cmd_callback (GtkAction *action,
|
||||
GimpPlugInProcedure *proc,
|
||||
gpointer data)
|
||||
plug_in_run_cmd_callback (GtkAction *action,
|
||||
GimpProcedure *procedure,
|
||||
gpointer data)
|
||||
{
|
||||
GimpProcedure *procedure = GIMP_PROCEDURE (proc);
|
||||
Gimp *gimp;
|
||||
GimpValueArray *args;
|
||||
gint n_args = 0;
|
||||
|
@ -192,7 +191,7 @@ plug_in_run_cmd_callback (GtkAction *action,
|
|||
}
|
||||
|
||||
if (n_args >= 1)
|
||||
plug_in_procedure_execute (proc, gimp, display, args, n_args);
|
||||
plug_in_procedure_execute (procedure, gimp, display, args, n_args);
|
||||
|
||||
gimp_value_array_unref (args);
|
||||
}
|
||||
|
@ -235,18 +234,18 @@ plug_in_reset_all_cmd_callback (GtkAction *action,
|
|||
|
||||
/* FIXME history */
|
||||
void
|
||||
plug_in_procedure_execute (GimpPlugInProcedure *procedure,
|
||||
Gimp *gimp,
|
||||
GimpDisplay *display,
|
||||
GimpValueArray *args,
|
||||
gint n_args)
|
||||
plug_in_procedure_execute (GimpProcedure *procedure,
|
||||
Gimp *gimp,
|
||||
GimpDisplay *display,
|
||||
GimpValueArray *args,
|
||||
gint n_args)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
gimp_value_array_truncate (args, n_args);
|
||||
|
||||
/* run the plug-in procedure */
|
||||
gimp_procedure_execute_async (GIMP_PROCEDURE (procedure), gimp,
|
||||
gimp_procedure_execute_async (procedure, gimp,
|
||||
gimp_get_user_context (gimp),
|
||||
GIMP_PROGRESS (display), args,
|
||||
GIMP_OBJECT (display), &error);
|
||||
|
@ -261,8 +260,8 @@ plug_in_procedure_execute (GimpPlugInProcedure *procedure,
|
|||
else
|
||||
{
|
||||
/* remember only image plug-ins */
|
||||
if (GIMP_PROCEDURE (procedure)->num_args >= 2 &&
|
||||
GIMP_IS_PARAM_SPEC_IMAGE_ID (GIMP_PROCEDURE (procedure)->args[1]))
|
||||
if (procedure->num_args >= 2 &&
|
||||
GIMP_IS_PARAM_SPEC_IMAGE_ID (procedure->args[1]))
|
||||
{
|
||||
gimp_filter_history_add (gimp, procedure);
|
||||
}
|
||||
|
|
|
@ -19,20 +19,20 @@
|
|||
#define __PLUG_IN_COMMANDS_H__
|
||||
|
||||
|
||||
void plug_in_run_cmd_callback (GtkAction *action,
|
||||
GimpPlugInProcedure *proc,
|
||||
gpointer data);
|
||||
void plug_in_run_cmd_callback (GtkAction *action,
|
||||
GimpProcedure *proc,
|
||||
gpointer data);
|
||||
|
||||
void plug_in_reset_all_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void plug_in_reset_all_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
|
||||
|
||||
/* FIXME history */
|
||||
void plug_in_procedure_execute (GimpPlugInProcedure *procedure,
|
||||
Gimp *gimp,
|
||||
GimpDisplay *display,
|
||||
GimpValueArray *args,
|
||||
gint n_args);
|
||||
void plug_in_procedure_execute (GimpProcedure *procedure,
|
||||
Gimp *gimp,
|
||||
GimpDisplay *display,
|
||||
GimpValueArray *args,
|
||||
gint n_args);
|
||||
gint plug_in_collect_display_args (GtkAction *action,
|
||||
GimpDisplay *display,
|
||||
GParamSpec **pspecs,
|
||||
|
|
|
@ -30,11 +30,10 @@
|
|||
#include "gimp.h"
|
||||
#include "gimp-filter-history.h"
|
||||
|
||||
#include "plug-in/gimppluginmanager.h"
|
||||
#include "plug-in/gimppluginprocedure.h"
|
||||
#include "pdb/gimpprocedure.h"
|
||||
|
||||
|
||||
guint
|
||||
gint
|
||||
gimp_filter_history_size (Gimp *gimp)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), 0);
|
||||
|
@ -42,7 +41,7 @@ gimp_filter_history_size (Gimp *gimp)
|
|||
return MAX (1, gimp->config->filter_history_size);
|
||||
}
|
||||
|
||||
guint
|
||||
gint
|
||||
gimp_filter_history_length (Gimp *gimp)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), 0);
|
||||
|
@ -50,7 +49,7 @@ gimp_filter_history_length (Gimp *gimp)
|
|||
return g_list_length (gimp->filter_history);
|
||||
}
|
||||
|
||||
GimpPlugInProcedure *
|
||||
GimpProcedure *
|
||||
gimp_filter_history_nth (Gimp *gimp,
|
||||
gint n)
|
||||
{
|
||||
|
@ -60,14 +59,14 @@ gimp_filter_history_nth (Gimp *gimp,
|
|||
}
|
||||
|
||||
void
|
||||
gimp_filter_history_add (Gimp *gimp,
|
||||
GimpPlugInProcedure *procedure)
|
||||
gimp_filter_history_add (Gimp *gimp,
|
||||
GimpProcedure *procedure)
|
||||
{
|
||||
GList *link;
|
||||
gint history_size;
|
||||
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
g_return_if_fail (GIMP_IS_PLUG_IN_PROCEDURE (procedure));
|
||||
g_return_if_fail (GIMP_IS_PROCEDURE (procedure));
|
||||
|
||||
/* return early if the procedure is already at the top */
|
||||
if (gimp->filter_history && gimp->filter_history->data == procedure)
|
||||
|
@ -101,13 +100,13 @@ gimp_filter_history_add (Gimp *gimp,
|
|||
}
|
||||
|
||||
void
|
||||
gimp_filter_history_remove (Gimp *gimp,
|
||||
GimpPlugInProcedure *procedure)
|
||||
gimp_filter_history_remove (Gimp *gimp,
|
||||
GimpProcedure *procedure)
|
||||
{
|
||||
GList *link;
|
||||
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
g_return_if_fail (GIMP_IS_PLUG_IN_PROCEDURE (procedure));
|
||||
g_return_if_fail (GIMP_IS_PROCEDURE (procedure));
|
||||
|
||||
link = g_list_find (gimp->filter_history, procedure);
|
||||
|
||||
|
@ -133,5 +132,3 @@ gimp_filter_history_clear (Gimp *gimp)
|
|||
gimp_filter_history_changed (gimp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -21,15 +21,15 @@
|
|||
#define __GIMP_FILTER_HISTORY_H__
|
||||
|
||||
|
||||
guint gimp_filter_history_size (Gimp *gimp);
|
||||
guint gimp_filter_history_length (Gimp *gimp);
|
||||
GimpPlugInProcedure * gimp_filter_history_nth (Gimp *gimp,
|
||||
gint n);
|
||||
void gimp_filter_history_add (Gimp *gimp,
|
||||
GimpPlugInProcedure *procedure);
|
||||
void gimp_filter_history_remove (Gimp *gimp,
|
||||
GimpPlugInProcedure *procedure);
|
||||
void gimp_filter_history_clear (Gimp *gimp);
|
||||
gint gimp_filter_history_size (Gimp *gimp);
|
||||
gint gimp_filter_history_length (Gimp *gimp);
|
||||
GimpProcedure * gimp_filter_history_nth (Gimp *gimp,
|
||||
gint n);
|
||||
void gimp_filter_history_add (Gimp *gimp,
|
||||
GimpProcedure *procedure);
|
||||
void gimp_filter_history_remove (Gimp *gimp,
|
||||
GimpProcedure *procedure);
|
||||
void gimp_filter_history_clear (Gimp *gimp);
|
||||
|
||||
|
||||
#endif /* __GIMP_FILTER_HISTORY_H__ */
|
||||
|
|
|
@ -337,7 +337,7 @@ gimp_plug_in_manager_add_procedure (GimpPlugInManager *manager,
|
|||
manager->export_procs = g_slist_remove (manager->export_procs, tmp_proc);
|
||||
|
||||
/* and from the history */
|
||||
gimp_filter_history_remove (manager->gimp, tmp_proc);
|
||||
gimp_filter_history_remove (manager->gimp, GIMP_PROCEDURE (tmp_proc));
|
||||
|
||||
g_object_unref (tmp_proc);
|
||||
|
||||
|
@ -373,7 +373,7 @@ gimp_plug_in_manager_remove_temp_proc (GimpPlugInManager *manager,
|
|||
procedure);
|
||||
|
||||
gimp_filter_history_remove (manager->gimp,
|
||||
GIMP_PLUG_IN_PROCEDURE (procedure));
|
||||
GIMP_PROCEDURE (procedure));
|
||||
|
||||
gimp_pdb_unregister_procedure (manager->gimp->pdb,
|
||||
GIMP_PROCEDURE (procedure));
|
||||
|
|
|
@ -278,14 +278,14 @@ libappwidgets_a_sources = \
|
|||
gimppickablepopup.h \
|
||||
gimppixbuf.c \
|
||||
gimppixbuf.h \
|
||||
gimppluginaction.c \
|
||||
gimppluginaction.h \
|
||||
gimppolar.c \
|
||||
gimppolar.h \
|
||||
gimppopup.c \
|
||||
gimppopup.h \
|
||||
gimpprefsbox.c \
|
||||
gimpprefsbox.h \
|
||||
gimpprocedureaction.c \
|
||||
gimpprocedureaction.h \
|
||||
gimpprogressbox.c \
|
||||
gimpprogressbox.h \
|
||||
gimpprogressdialog.c \
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include "gimpactiongroup.h"
|
||||
#include "gimpaction.h"
|
||||
#include "gimpenumaction.h"
|
||||
#include "gimppluginaction.h"
|
||||
#include "gimpprocedureaction.h"
|
||||
#include "gimpradioaction.h"
|
||||
#include "gimpstringaction.h"
|
||||
#include "gimptoggleaction.h"
|
||||
|
@ -636,10 +636,10 @@ gimp_action_group_add_string_actions (GimpActionGroup *group,
|
|||
}
|
||||
|
||||
void
|
||||
gimp_action_group_add_plug_in_actions (GimpActionGroup *group,
|
||||
const GimpPlugInActionEntry *entries,
|
||||
guint n_entries,
|
||||
GCallback callback)
|
||||
gimp_action_group_add_procedure_actions (GimpActionGroup *group,
|
||||
const GimpProcedureActionEntry *entries,
|
||||
guint n_entries,
|
||||
GCallback callback)
|
||||
{
|
||||
gint i;
|
||||
|
||||
|
@ -647,16 +647,16 @@ gimp_action_group_add_plug_in_actions (GimpActionGroup *group,
|
|||
|
||||
for (i = 0; i < n_entries; i++)
|
||||
{
|
||||
GimpPlugInAction *action;
|
||||
GimpProcedureAction *action;
|
||||
|
||||
if (! gimp_action_group_check_unique_action (group, entries[i].name))
|
||||
continue;
|
||||
|
||||
action = gimp_plug_in_action_new (entries[i].name,
|
||||
entries[i].label,
|
||||
entries[i].tooltip,
|
||||
entries[i].icon_name,
|
||||
entries[i].procedure);
|
||||
action = gimp_procedure_action_new (entries[i].name,
|
||||
entries[i].label,
|
||||
entries[i].tooltip,
|
||||
entries[i].icon_name,
|
||||
entries[i].procedure);
|
||||
|
||||
if (callback)
|
||||
g_signal_connect (action, "selected",
|
||||
|
|
|
@ -118,16 +118,16 @@ struct _GimpStringActionEntry
|
|||
const gchar *help_id;
|
||||
};
|
||||
|
||||
struct _GimpPlugInActionEntry
|
||||
struct _GimpProcedureActionEntry
|
||||
{
|
||||
const gchar *name;
|
||||
const gchar *icon_name;
|
||||
const gchar *label;
|
||||
const gchar *accelerator;
|
||||
const gchar *tooltip;
|
||||
GimpPlugInProcedure *procedure;
|
||||
const gchar *name;
|
||||
const gchar *icon_name;
|
||||
const gchar *label;
|
||||
const gchar *accelerator;
|
||||
const gchar *tooltip;
|
||||
GimpProcedure *procedure;
|
||||
|
||||
const gchar *help_id;
|
||||
const gchar *help_id;
|
||||
};
|
||||
|
||||
|
||||
|
@ -170,8 +170,8 @@ void gimp_action_group_add_string_actions (GimpActionGroup *grou
|
|||
const GimpStringActionEntry *entries,
|
||||
guint n_entries,
|
||||
GCallback callback);
|
||||
void gimp_action_group_add_plug_in_actions (GimpActionGroup *group,
|
||||
const GimpPlugInActionEntry *entries,
|
||||
void gimp_action_group_add_procedure_actions(GimpActionGroup *group,
|
||||
const GimpProcedureActionEntry *entries,
|
||||
guint n_entries,
|
||||
GCallback callback);
|
||||
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimppluginaction.h
|
||||
* Copyright (C) 2004 Michael Natterer <mitch@gimp.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_PLUG_IN_ACTION_H__
|
||||
#define __GIMP_PLUG_IN_ACTION_H__
|
||||
|
||||
|
||||
#include "gimpaction.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_PLUG_IN_ACTION (gimp_plug_in_action_get_type ())
|
||||
#define GIMP_PLUG_IN_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PLUG_IN_ACTION, GimpPlugInAction))
|
||||
#define GIMP_PLUG_IN_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PLUG_IN_ACTION, GimpPlugInActionClass))
|
||||
#define GIMP_IS_PLUG_IN_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_PLUG_IN_ACTION))
|
||||
#define GIMP_IS_PLUG_IN_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), GIMP_TYPE_PLUG_IN_ACTION))
|
||||
#define GIMP_PLUG_IN_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GIMP_TYPE_PLUG_IN_ACTION, GimpPlugInActionClass))
|
||||
|
||||
|
||||
typedef struct _GimpPlugInActionClass GimpPlugInActionClass;
|
||||
|
||||
struct _GimpPlugInAction
|
||||
{
|
||||
GimpAction parent_instance;
|
||||
|
||||
GimpPlugInProcedure *procedure;
|
||||
};
|
||||
|
||||
struct _GimpPlugInActionClass
|
||||
{
|
||||
GimpActionClass parent_class;
|
||||
|
||||
void (* selected) (GimpPlugInAction *action,
|
||||
GimpPlugInProcedure *proc);
|
||||
};
|
||||
|
||||
|
||||
GType gimp_plug_in_action_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GimpPlugInAction * gimp_plug_in_action_new (const gchar *name,
|
||||
const gchar *label,
|
||||
const gchar *tooltip,
|
||||
const gchar *icon_name,
|
||||
GimpPlugInProcedure *procedure);
|
||||
void gimp_plug_in_action_selected (GimpPlugInAction *action,
|
||||
GimpPlugInProcedure *procedure);
|
||||
|
||||
|
||||
#endif /* __GIMP_PLUG_IN_ACTION_H__ */
|
|
@ -1,8 +1,8 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimppluginaction.c
|
||||
* Copyright (C) 2004 Michael Natterer <mitch@gimp.org>
|
||||
* gimpprocedureaction.c
|
||||
* Copyright (C) 2004-2016 Michael Natterer <mitch@gimp.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -26,9 +26,9 @@
|
|||
|
||||
#include "core/gimpmarshal.h"
|
||||
|
||||
#include "plug-in/gimppluginprocedure.h"
|
||||
#include "plug-in/gimppluginprocedure.h" /* FIXME history */
|
||||
|
||||
#include "gimppluginaction.h"
|
||||
#include "gimpprocedureaction.h"
|
||||
|
||||
|
||||
enum
|
||||
|
@ -44,68 +44,68 @@ enum
|
|||
};
|
||||
|
||||
|
||||
static void gimp_plug_in_action_finalize (GObject *object);
|
||||
static void gimp_plug_in_action_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_plug_in_action_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
static void gimp_procedure_action_finalize (GObject *object);
|
||||
static void gimp_procedure_action_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_procedure_action_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static void gimp_plug_in_action_activate (GtkAction *action);
|
||||
static void gimp_plug_in_action_connect_proxy (GtkAction *action,
|
||||
GtkWidget *proxy);
|
||||
static void gimp_procedure_action_activate (GtkAction *action);
|
||||
static void gimp_procedure_action_connect_proxy (GtkAction *action,
|
||||
GtkWidget *proxy);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpPlugInAction, gimp_plug_in_action, GIMP_TYPE_ACTION)
|
||||
G_DEFINE_TYPE (GimpProcedureAction, gimp_procedure_action, GIMP_TYPE_ACTION)
|
||||
|
||||
#define parent_class gimp_plug_in_action_parent_class
|
||||
#define parent_class gimp_procedure_action_parent_class
|
||||
|
||||
static guint action_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
|
||||
static void
|
||||
gimp_plug_in_action_class_init (GimpPlugInActionClass *klass)
|
||||
gimp_procedure_action_class_init (GimpProcedureActionClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GtkActionClass *action_class = GTK_ACTION_CLASS (klass);
|
||||
|
||||
object_class->finalize = gimp_plug_in_action_finalize;
|
||||
object_class->set_property = gimp_plug_in_action_set_property;
|
||||
object_class->get_property = gimp_plug_in_action_get_property;
|
||||
object_class->finalize = gimp_procedure_action_finalize;
|
||||
object_class->set_property = gimp_procedure_action_set_property;
|
||||
object_class->get_property = gimp_procedure_action_get_property;
|
||||
|
||||
action_class->activate = gimp_plug_in_action_activate;
|
||||
action_class->connect_proxy = gimp_plug_in_action_connect_proxy;
|
||||
action_class->activate = gimp_procedure_action_activate;
|
||||
action_class->connect_proxy = gimp_procedure_action_connect_proxy;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_PROCEDURE,
|
||||
g_param_spec_object ("procedure",
|
||||
NULL, NULL,
|
||||
GIMP_TYPE_PLUG_IN_PROCEDURE,
|
||||
GIMP_TYPE_PROCEDURE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
|
||||
action_signals[SELECTED] =
|
||||
g_signal_new ("selected",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (GimpPlugInActionClass, selected),
|
||||
G_STRUCT_OFFSET (GimpProcedureActionClass, selected),
|
||||
NULL, NULL,
|
||||
gimp_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1,
|
||||
GIMP_TYPE_PLUG_IN_PROCEDURE);
|
||||
GIMP_TYPE_PROCEDURE);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_plug_in_action_init (GimpPlugInAction *action)
|
||||
gimp_procedure_action_init (GimpProcedureAction *action)
|
||||
{
|
||||
action->procedure = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_plug_in_action_finalize (GObject *object)
|
||||
gimp_procedure_action_finalize (GObject *object)
|
||||
{
|
||||
GimpPlugInAction *action = GIMP_PLUG_IN_ACTION (object);
|
||||
GimpProcedureAction *action = GIMP_PROCEDURE_ACTION (object);
|
||||
|
||||
if (action->procedure)
|
||||
{
|
||||
|
@ -117,12 +117,12 @@ gimp_plug_in_action_finalize (GObject *object)
|
|||
}
|
||||
|
||||
static void
|
||||
gimp_plug_in_action_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
gimp_procedure_action_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpPlugInAction *action = GIMP_PLUG_IN_ACTION (object);
|
||||
GimpProcedureAction *action = GIMP_PROCEDURE_ACTION (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
|
@ -137,12 +137,12 @@ gimp_plug_in_action_get_property (GObject *object,
|
|||
}
|
||||
|
||||
static void
|
||||
gimp_plug_in_action_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
gimp_procedure_action_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpPlugInAction *action = GIMP_PLUG_IN_ACTION (object);
|
||||
GimpProcedureAction *action = GIMP_PROCEDURE_ACTION (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
|
@ -159,31 +159,33 @@ gimp_plug_in_action_set_property (GObject *object,
|
|||
}
|
||||
|
||||
static void
|
||||
gimp_plug_in_action_activate (GtkAction *action)
|
||||
gimp_procedure_action_activate (GtkAction *action)
|
||||
{
|
||||
GimpPlugInAction *plug_in_action = GIMP_PLUG_IN_ACTION (action);
|
||||
GimpProcedureAction *procedure_action = GIMP_PROCEDURE_ACTION (action);
|
||||
|
||||
/* Not all actions have procedures associated with them, for example
|
||||
* unused "plug-in-recent-[N]" actions, so check for NULL before we
|
||||
* invoke the plug-in action
|
||||
* invoke the action
|
||||
*/
|
||||
if (plug_in_action->procedure)
|
||||
gimp_plug_in_action_selected (plug_in_action, plug_in_action->procedure);
|
||||
if (procedure_action->procedure)
|
||||
gimp_procedure_action_selected (procedure_action,
|
||||
procedure_action->procedure);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_plug_in_action_connect_proxy (GtkAction *action,
|
||||
GtkWidget *proxy)
|
||||
gimp_procedure_action_connect_proxy (GtkAction *action,
|
||||
GtkWidget *proxy)
|
||||
{
|
||||
GimpPlugInAction *plug_in_action = GIMP_PLUG_IN_ACTION (action);
|
||||
GimpProcedureAction *procedure_action = GIMP_PROCEDURE_ACTION (action);
|
||||
|
||||
GTK_ACTION_CLASS (parent_class)->connect_proxy (action, proxy);
|
||||
|
||||
if (GTK_IS_IMAGE_MENU_ITEM (proxy) && plug_in_action->procedure)
|
||||
if (GTK_IS_IMAGE_MENU_ITEM (proxy) && procedure_action->procedure)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
pixbuf = gimp_plug_in_procedure_get_pixbuf (plug_in_action->procedure);
|
||||
/* FIXME history */
|
||||
pixbuf = gimp_plug_in_procedure_get_pixbuf (GIMP_PLUG_IN_PROCEDURE (procedure_action->procedure));
|
||||
|
||||
if (pixbuf)
|
||||
{
|
||||
|
@ -216,14 +218,14 @@ gimp_plug_in_action_connect_proxy (GtkAction *action,
|
|||
|
||||
/* public functions */
|
||||
|
||||
GimpPlugInAction *
|
||||
gimp_plug_in_action_new (const gchar *name,
|
||||
const gchar *label,
|
||||
const gchar *tooltip,
|
||||
const gchar *icon_name,
|
||||
GimpPlugInProcedure *procedure)
|
||||
GimpProcedureAction *
|
||||
gimp_procedure_action_new (const gchar *name,
|
||||
const gchar *label,
|
||||
const gchar *tooltip,
|
||||
const gchar *icon_name,
|
||||
GimpProcedure *procedure)
|
||||
{
|
||||
return g_object_new (GIMP_TYPE_PLUG_IN_ACTION,
|
||||
return g_object_new (GIMP_TYPE_PROCEDURE_ACTION,
|
||||
"name", name,
|
||||
"label", label,
|
||||
"tooltip", tooltip,
|
||||
|
@ -233,10 +235,10 @@ gimp_plug_in_action_new (const gchar *name,
|
|||
}
|
||||
|
||||
void
|
||||
gimp_plug_in_action_selected (GimpPlugInAction *action,
|
||||
GimpPlugInProcedure *procedure)
|
||||
gimp_procedure_action_selected (GimpProcedureAction *action,
|
||||
GimpProcedure *procedure)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_PLUG_IN_ACTION (action));
|
||||
g_return_if_fail (GIMP_IS_PROCEDURE_ACTION (action));
|
||||
|
||||
g_signal_emit (action, action_signals[SELECTED], 0, procedure);
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpprocedureaction.h
|
||||
* Copyright (C) 2004-2016 Michael Natterer <mitch@gimp.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_PROCEDURE_ACTION_H__
|
||||
#define __GIMP_PROCEDURE_ACTION_H__
|
||||
|
||||
|
||||
#include "gimpaction.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_PROCEDURE_ACTION (gimp_procedure_action_get_type ())
|
||||
#define GIMP_PROCEDURE_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PROCEDURE_ACTION, GimpProcedureAction))
|
||||
#define GIMP_PROCEDURE_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PROCEDURE_ACTION, GimpProcedureActionClass))
|
||||
#define GIMP_IS_PROCEDURE_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_PROCEDURE_ACTION))
|
||||
#define GIMP_IS_PROCEDURE_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), GIMP_TYPE_PROCEDURE_ACTION))
|
||||
#define GIMP_PROCEDURE_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GIMP_TYPE_PROCEDURE_ACTION, GimpProcedureActionClass))
|
||||
|
||||
|
||||
typedef struct _GimpProcedureActionClass GimpProcedureActionClass;
|
||||
|
||||
struct _GimpProcedureAction
|
||||
{
|
||||
GimpAction parent_instance;
|
||||
|
||||
GimpProcedure *procedure;
|
||||
};
|
||||
|
||||
struct _GimpProcedureActionClass
|
||||
{
|
||||
GimpActionClass parent_class;
|
||||
|
||||
void (* selected) (GimpProcedureAction *action,
|
||||
GimpProcedure *procedure);
|
||||
};
|
||||
|
||||
|
||||
GType gimp_procedure_action_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GimpProcedureAction * gimp_procedure_action_new (const gchar *name,
|
||||
const gchar *label,
|
||||
const gchar *tooltip,
|
||||
const gchar *icon_name,
|
||||
GimpProcedure *procedure);
|
||||
void gimp_procedure_action_selected (GimpProcedureAction *action,
|
||||
GimpProcedure *procedure);
|
||||
|
||||
|
||||
#endif /* __GIMP_PROCEDURE_ACTION_H__ */
|
|
@ -125,7 +125,7 @@ typedef struct _GimpActionFactory GimpActionFactory;
|
|||
typedef struct _GimpActionGroup GimpActionGroup;
|
||||
typedef struct _GimpEnumAction GimpEnumAction;
|
||||
typedef struct _GimpMenuFactory GimpMenuFactory;
|
||||
typedef struct _GimpPlugInAction GimpPlugInAction;
|
||||
typedef struct _GimpProcedureAction GimpProcedureAction;
|
||||
typedef struct _GimpStringAction GimpStringAction;
|
||||
typedef struct _GimpUIManager GimpUIManager;
|
||||
|
||||
|
@ -265,7 +265,7 @@ typedef struct _GimpSessionManaged GimpSessionManaged;
|
|||
|
||||
typedef struct _GimpActionEntry GimpActionEntry;
|
||||
typedef struct _GimpEnumActionEntry GimpEnumActionEntry;
|
||||
typedef struct _GimpPlugInActionEntry GimpPlugInActionEntry;
|
||||
typedef struct _GimpProcedureActionEntry GimpProcedureActionEntry;
|
||||
typedef struct _GimpRadioActionEntry GimpRadioActionEntry;
|
||||
typedef struct _GimpStringActionEntry GimpStringActionEntry;
|
||||
typedef struct _GimpToggleActionEntry GimpToggleActionEntry;
|
||||
|
|
Loading…
Reference in New Issue