app/actions/plug-in-actions.c added utility function to retrieve the

2007-02-14  Sven Neumann  <sven@gimp.org>

	* app/actions/plug-in-actions.c
	* app/plug-in/gimppluginprocedure.[ch]: added utility function to
	retrieve the translated blurb of a plug-in procedure. Make sure
	that gettext isn't called with the empty string.


svn path=/trunk/; revision=21917
This commit is contained in:
Sven Neumann 2007-02-14 13:38:09 +00:00 committed by Sven Neumann
parent d09c931131
commit ccafc8d3bd
4 changed files with 31 additions and 13 deletions

View File

@ -1,3 +1,10 @@
2007-02-14 Sven Neumann <sven@gimp.org>
* app/actions/plug-in-actions.c
* app/plug-in/gimppluginprocedure.[ch]: added utility function to
retrieve the translated blurb of a plug-in procedure. Make sure
that gettext isn't called with the empty string.
2007-02-14 Sven Neumann <sven@gimp.org>
* app/display/gimpstatusbar.c: when multi-line strings end up

View File

@ -416,7 +416,6 @@ plug_in_actions_add_proc (GimpActionGroup *group,
const gchar *locale_domain;
const gchar *help_domain;
const gchar *label;
const gchar *tooltip = NULL;
gchar *path_original = NULL;
gchar *path_translated = NULL;
@ -454,14 +453,11 @@ plug_in_actions_add_proc (GimpActionGroup *group,
label = p2 + 1;
}
if (GIMP_PROCEDURE (proc)->blurb)
tooltip = dgettext (locale_domain, GIMP_PROCEDURE (proc)->blurb);
entry.name = GIMP_OBJECT (proc)->name;
entry.stock_id = gimp_plug_in_procedure_get_stock_id (proc);
entry.label = label;
entry.accelerator = NULL;
entry.tooltip = tooltip;
entry.tooltip = gimp_plug_in_procedure_get_blurb (proc, locale_domain);
entry.procedure = proc;
entry.help_id = gimp_plug_in_procedure_get_help_id (proc, help_domain);
@ -543,10 +539,9 @@ plug_in_actions_history_changed (GimpPlugInManager *manager,
for (i = 0; i < gimp_plug_in_manager_history_length (manager); i++)
{
GtkAction *action;
gchar *name = g_strdup_printf ("plug-in-recent-%02d", i + 1);
gchar *label;
const gchar *tooltip = NULL;
GtkAction *action;
gchar *name = g_strdup_printf ("plug-in-recent-%02d", i + 1);
gchar *label;
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), name);
g_free (name);
@ -558,15 +553,12 @@ plug_in_actions_history_changed (GimpPlugInManager *manager,
label = gimp_plug_in_procedure_get_label (proc, domain);
if (GIMP_PROCEDURE (proc)->blurb)
tooltip = dgettext (domain, GIMP_PROCEDURE (proc)->blurb);
g_object_set (action,
"visible", TRUE,
"procedure", proc,
"label", label,
"stock-id", gimp_plug_in_procedure_get_stock_id (proc),
"tooltip", tooltip,
"tooltip", gimp_plug_in_procedure_get_blurb (proc, domain),
NULL);
g_free (label);

View File

@ -518,6 +518,23 @@ gimp_plug_in_procedure_get_label (const GimpPlugInProcedure *proc,
return label;
}
const gchar *
gimp_plug_in_procedure_get_blurb (const GimpPlugInProcedure *proc,
const gchar *locale_domain)
{
GimpProcedure *procedure;
g_return_val_if_fail (GIMP_IS_PLUG_IN_PROCEDURE (proc), NULL);
procedure = GIMP_PROCEDURE (proc);
/* do not to pass the empty string to gettext() */
if (procedure->blurb && strlen (procedure->blurb))
return dgettext (locale_domain, procedure->blurb);
return NULL;
}
void
gimp_plug_in_procedure_set_icon (GimpPlugInProcedure *proc,
GimpIconType icon_type,

View File

@ -94,6 +94,8 @@ gboolean gimp_plug_in_procedure_add_menu_path (GimpPlugInProcedure
gchar * gimp_plug_in_procedure_get_label (const GimpPlugInProcedure *proc,
const gchar *locale_domain);
const gchar * gimp_plug_in_procedure_get_blurb (const GimpPlugInProcedure *proc,
const gchar *locale_domain);
void gimp_plug_in_procedure_set_icon (GimpPlugInProcedure *proc,
GimpIconType type,
const guint8 *data,