libgimp*, app: add the help-id to the wire protocol

Pass the help-id specified by the procedure to the core, and use it in
the core if set instead of always using the procedure's name (which
was probably good enough for all eternity, but it's still more
consistent this way).
This commit is contained in:
Michael Natterer 2019-08-08 09:57:56 +02:00
parent 0aa2dcfadb
commit d156028c8a
7 changed files with 43 additions and 7 deletions

View file

@ -749,6 +749,7 @@ gimp_plug_in_handle_proc_install (GimpPlugIn *plug_in,
VALIDATE (canonical) && VALIDATE (canonical) &&
VALIDATE_OR_NULL (proc_install->blurb) && VALIDATE_OR_NULL (proc_install->blurb) &&
VALIDATE_OR_NULL (proc_install->help) && VALIDATE_OR_NULL (proc_install->help) &&
VALIDATE_OR_NULL (proc_install->help_id) &&
VALIDATE_OR_NULL (proc_install->authors) && VALIDATE_OR_NULL (proc_install->authors) &&
VALIDATE_OR_NULL (proc_install->copyright) && VALIDATE_OR_NULL (proc_install->copyright) &&
VALIDATE_OR_NULL (proc_install->date)) VALIDATE_OR_NULL (proc_install->date))
@ -864,6 +865,7 @@ gimp_plug_in_handle_proc_install (GimpPlugIn *plug_in,
proc->menu_label = g_strdup (proc_install->menu_label); proc->menu_label = g_strdup (proc_install->menu_label);
gimp_plug_in_procedure_set_image_types (proc, proc_install->image_types); gimp_plug_in_procedure_set_image_types (proc, proc_install->image_types);
gimp_plug_in_procedure_set_help_id (proc, proc_install->help_id);
for (i = 0; i < proc_install->nparams; i++) for (i = 0; i < proc_install->nparams; i++)
{ {

View file

@ -157,6 +157,7 @@ gimp_plug_in_procedure_finalize (GObject *object)
g_free (proc->label); g_free (proc->label);
g_free (proc->help_id); g_free (proc->help_id);
g_free (proc->help_id_with_domain);
g_free (proc->icon_data); g_free (proc->icon_data);
g_free (proc->image_types); g_free (proc->image_types);
@ -300,18 +301,24 @@ gimp_plug_in_procedure_get_help_id (GimpProcedure *procedure)
{ {
GimpPlugInProcedure *proc = GIMP_PLUG_IN_PROCEDURE (procedure); GimpPlugInProcedure *proc = GIMP_PLUG_IN_PROCEDURE (procedure);
const gchar *domain; const gchar *domain;
const gchar *help_id;
if (proc->help_id) if (proc->help_id_with_domain)
return proc->help_id; return proc->help_id_with_domain;
domain = gimp_plug_in_procedure_get_help_domain (proc); domain = gimp_plug_in_procedure_get_help_domain (proc);
if (domain) if (proc->help_id)
proc->help_id = g_strconcat (domain, "?", gimp_object_get_name (proc), NULL); help_id = proc->help_id;
else else
proc->help_id = g_strdup (gimp_object_get_name (proc)); help_id = gimp_object_get_name (procedure);
return proc->help_id; if (domain)
proc->help_id_with_domain = g_strconcat (domain, "?", help_id, NULL);
else
proc->help_id_with_domain = g_strdup (help_id);
return proc->help_id_with_domain;
} }
static gboolean static gboolean
@ -575,6 +582,18 @@ gimp_plug_in_procedure_set_help_domain (GimpPlugInProcedure *proc,
proc->help_domain = help_domain ? g_quark_from_string (help_domain) : 0; proc->help_domain = help_domain ? g_quark_from_string (help_domain) : 0;
} }
void
gimp_plug_in_procedure_set_help_id (GimpPlugInProcedure *proc,
const gchar *help_id)
{
g_return_if_fail (GIMP_IS_PLUG_IN_PROCEDURE (proc));
g_clear_pointer (&proc->help_id_with_domain, g_free);
g_free (proc->help_id);
proc->help_id = g_strdup (help_id);
}
const gchar * const gchar *
gimp_plug_in_procedure_get_help_domain (GimpPlugInProcedure *proc) gimp_plug_in_procedure_get_help_domain (GimpPlugInProcedure *proc)
{ {

View file

@ -46,6 +46,7 @@ struct _GimpPlugInProcedure
GList *menu_paths; GList *menu_paths;
gchar *label; gchar *label;
gchar *help_id; gchar *help_id;
gchar *help_id_with_domain;
GimpIconType icon_type; GimpIconType icon_type;
gint icon_data_length; gint icon_data_length;
guint8 *icon_data; guint8 *icon_data;
@ -103,6 +104,9 @@ void gimp_plug_in_procedure_set_help_domain (GimpPlugInProcedure *pro
const gchar *help_domain); const gchar *help_domain);
const gchar * gimp_plug_in_procedure_get_help_domain (GimpPlugInProcedure *proc); const gchar * gimp_plug_in_procedure_get_help_domain (GimpPlugInProcedure *proc);
void gimp_plug_in_procedure_set_help_id (GimpPlugInProcedure *proc,
const gchar *help_id);
gboolean gimp_plug_in_procedure_add_menu_path (GimpPlugInProcedure *proc, gboolean gimp_plug_in_procedure_add_menu_path (GimpPlugInProcedure *proc,
const gchar *menu_path, const gchar *menu_path,
GError **error); GError **error);

View file

@ -210,6 +210,7 @@ gimp_install_procedure (const gchar *name,
proc_install.name = (gchar *) name; proc_install.name = (gchar *) name;
proc_install.blurb = (gchar *) blurb; proc_install.blurb = (gchar *) blurb;
proc_install.help = (gchar *) help; proc_install.help = (gchar *) help;
proc_install.help_id = (gchar *) name;
proc_install.authors = (gchar *) author; proc_install.authors = (gchar *) author;
proc_install.copyright = (gchar *) copyright; proc_install.copyright = (gchar *) copyright;
proc_install.date = (gchar *) date; proc_install.date = (gchar *) date;

View file

@ -57,6 +57,7 @@ _gimp_procedure_register (GimpProcedure *procedure)
proc_install.name = (gchar *) gimp_procedure_get_name (procedure); proc_install.name = (gchar *) gimp_procedure_get_name (procedure);
proc_install.blurb = (gchar *) gimp_procedure_get_blurb (procedure); proc_install.blurb = (gchar *) gimp_procedure_get_blurb (procedure);
proc_install.help = (gchar *) gimp_procedure_get_help (procedure); proc_install.help = (gchar *) gimp_procedure_get_help (procedure);
proc_install.help_id = (gchar *) gimp_procedure_get_help_id (procedure);
proc_install.authors = (gchar *) gimp_procedure_get_authors (procedure); proc_install.authors = (gchar *) gimp_procedure_get_authors (procedure);
proc_install.copyright = (gchar *) gimp_procedure_get_copyright (procedure); proc_install.copyright = (gchar *) gimp_procedure_get_copyright (procedure);
proc_install.date = (gchar *) gimp_procedure_get_date (procedure); proc_install.date = (gchar *) gimp_procedure_get_date (procedure);

View file

@ -1202,6 +1202,9 @@ _gp_proc_install_read (GIOChannel *channel,
if (! _gimp_wire_read_string (channel, if (! _gimp_wire_read_string (channel,
&proc_install->help, 1, user_data)) &proc_install->help, 1, user_data))
goto cleanup; goto cleanup;
if (! _gimp_wire_read_string (channel,
&proc_install->help_id, 1, user_data))
goto cleanup;
if (! _gimp_wire_read_string (channel, if (! _gimp_wire_read_string (channel,
&proc_install->authors, 1, user_data)) &proc_install->authors, 1, user_data))
goto cleanup; goto cleanup;
@ -1255,6 +1258,7 @@ _gp_proc_install_read (GIOChannel *channel,
g_free (proc_install->name); g_free (proc_install->name);
g_free (proc_install->blurb); g_free (proc_install->blurb);
g_free (proc_install->help); g_free (proc_install->help);
g_free (proc_install->help_id);
g_free (proc_install->authors); g_free (proc_install->authors);
g_free (proc_install->copyright); g_free (proc_install->copyright);
g_free (proc_install->date); g_free (proc_install->date);
@ -1443,6 +1447,9 @@ _gp_proc_install_write (GIOChannel *channel,
if (! _gimp_wire_write_string (channel, if (! _gimp_wire_write_string (channel,
&proc_install->help, 1, user_data)) &proc_install->help, 1, user_data))
return; return;
if (! _gimp_wire_write_string (channel,
&proc_install->help_id, 1, user_data))
return;
if (! _gimp_wire_write_string (channel, if (! _gimp_wire_write_string (channel,
&proc_install->authors, 1, user_data)) &proc_install->authors, 1, user_data))
return; return;
@ -1498,6 +1505,7 @@ _gp_proc_install_destroy (GimpWireMessage *msg)
g_free (proc_install->name); g_free (proc_install->name);
g_free (proc_install->blurb); g_free (proc_install->blurb);
g_free (proc_install->help); g_free (proc_install->help);
g_free (proc_install->help_id);
g_free (proc_install->authors); g_free (proc_install->authors);
g_free (proc_install->copyright); g_free (proc_install->copyright);
g_free (proc_install->date); g_free (proc_install->date);

View file

@ -26,7 +26,7 @@ G_BEGIN_DECLS
/* Increment every time the protocol changes /* Increment every time the protocol changes
*/ */
#define GIMP_PROTOCOL_VERSION 0x0106 #define GIMP_PROTOCOL_VERSION 0x0107
enum enum
@ -268,6 +268,7 @@ struct _GPProcInstall
gchar *name; gchar *name;
gchar *blurb; gchar *blurb;
gchar *help; gchar *help;
gchar *help_id;
gchar *authors; gchar *authors;
gchar *copyright; gchar *copyright;
gchar *date; gchar *date;