mirror of https://github.com/GNOME/gimp.git
use GQuark for locale and help domains to avoid duplicating the same
2007-04-24 Sven Neumann <sven@gimp.org> * app/plug-in/gimppluginprocedure.[ch]: use GQuark for locale and help domains to avoid duplicating the same strings many times. * app/plug-in/gimppluginmanager-restore.c: removed FIXME. svn path=/trunk/; revision=22304
This commit is contained in:
parent
687fc2d415
commit
5313214382
|
@ -1,3 +1,10 @@
|
|||
2007-04-24 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/plug-in/gimppluginprocedure.[ch]: use GQuark for locale and
|
||||
help domains to avoid duplicating the same strings many times.
|
||||
|
||||
* app/plug-in/gimppluginmanager-restore.c: removed FIXME.
|
||||
|
||||
2007-04-24 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/plug-in/gimppluginmanager-restore.c
|
||||
|
|
|
@ -149,7 +149,7 @@ gimp_plug_in_manager_restore (GimpPlugInManager *manager,
|
|||
plug_in_def->locale_domain_name,
|
||||
plug_in_def->locale_domain_path);
|
||||
else
|
||||
/* FIXME: this consumes too much memory */
|
||||
/* set the default plug-in locale domain */
|
||||
gimp_plug_in_def_set_locale_domain (plug_in_def,
|
||||
gimp_plug_in_manager_get_locale_domain (manager,
|
||||
plug_in_def->prog,
|
||||
|
|
|
@ -118,8 +118,6 @@ gimp_plug_in_procedure_finalize (GObject *object)
|
|||
GimpPlugInProcedure *proc = GIMP_PLUG_IN_PROCEDURE (object);
|
||||
|
||||
g_free (proc->prog);
|
||||
g_free (proc->locale_domain);
|
||||
g_free (proc->help_domain);
|
||||
g_free (proc->menu_label);
|
||||
|
||||
g_list_foreach (proc->menu_paths, (GFunc) g_free, NULL);
|
||||
|
@ -299,8 +297,7 @@ gimp_plug_in_procedure_set_locale_domain (GimpPlugInProcedure *proc,
|
|||
{
|
||||
g_return_if_fail (GIMP_IS_PLUG_IN_PROCEDURE (proc));
|
||||
|
||||
g_free (proc->locale_domain);
|
||||
proc->locale_domain = g_strdup (locale_domain);
|
||||
proc->locale_domain = locale_domain ? g_quark_from_string (locale_domain) : 0;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
|
@ -308,7 +305,7 @@ gimp_plug_in_procedure_get_locale_domain (const GimpPlugInProcedure *proc)
|
|||
{
|
||||
g_return_val_if_fail (GIMP_IS_PLUG_IN_PROCEDURE (proc), NULL);
|
||||
|
||||
return proc->locale_domain;
|
||||
return g_quark_to_string (proc->locale_domain);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -317,8 +314,7 @@ gimp_plug_in_procedure_set_help_domain (GimpPlugInProcedure *proc,
|
|||
{
|
||||
g_return_if_fail (GIMP_IS_PLUG_IN_PROCEDURE (proc));
|
||||
|
||||
g_free (proc->help_domain);
|
||||
proc->help_domain = g_strdup (help_domain);
|
||||
proc->help_domain = help_domain ? g_quark_from_string (help_domain) : 0;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
|
@ -326,7 +322,7 @@ gimp_plug_in_procedure_get_help_domain (const GimpPlugInProcedure *proc)
|
|||
{
|
||||
g_return_val_if_fail (GIMP_IS_PLUG_IN_PROCEDURE (proc), NULL);
|
||||
|
||||
return proc->help_domain;
|
||||
return g_quark_to_string (proc->help_domain);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -535,9 +531,11 @@ gimp_plug_in_procedure_get_label (GimpPlugInProcedure *proc)
|
|||
return proc->label;
|
||||
|
||||
if (proc->menu_label)
|
||||
path = dgettext (proc->locale_domain, proc->menu_label);
|
||||
path = dgettext (gimp_plug_in_procedure_get_locale_domain (proc),
|
||||
proc->menu_label);
|
||||
else if (proc->menu_paths)
|
||||
path = dgettext (proc->locale_domain, proc->menu_paths->data);
|
||||
path = dgettext (gimp_plug_in_procedure_get_locale_domain (proc),
|
||||
proc->menu_paths->data);
|
||||
else
|
||||
return NULL;
|
||||
|
||||
|
@ -574,7 +572,8 @@ gimp_plug_in_procedure_get_blurb (const GimpPlugInProcedure *proc)
|
|||
|
||||
/* do not to pass the empty string to gettext() */
|
||||
if (procedure->blurb && strlen (procedure->blurb))
|
||||
return dgettext (proc->locale_domain, procedure->blurb);
|
||||
return dgettext (gimp_plug_in_procedure_get_locale_domain (proc),
|
||||
procedure->blurb);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -664,10 +663,14 @@ gimp_plug_in_procedure_get_pixbuf (const GimpPlugInProcedure *proc)
|
|||
gchar *
|
||||
gimp_plug_in_procedure_get_help_id (const GimpPlugInProcedure *proc)
|
||||
{
|
||||
const gchar *domain;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_PLUG_IN_PROCEDURE (proc), NULL);
|
||||
|
||||
if (proc->help_domain)
|
||||
return g_strconcat (proc->help_domain, "?", GIMP_OBJECT (proc)->name, NULL);
|
||||
domain = gimp_plug_in_procedure_get_help_domain (proc);
|
||||
|
||||
if (domain)
|
||||
return g_strconcat (domain, "?", GIMP_OBJECT (proc)->name, NULL);
|
||||
|
||||
return g_strdup (GIMP_OBJECT (proc)->name);
|
||||
}
|
||||
|
|
|
@ -44,8 +44,8 @@ struct _GimpPlugInProcedure
|
|||
|
||||
/* common members */
|
||||
gchar *prog;
|
||||
gchar *locale_domain;
|
||||
gchar *help_domain;
|
||||
GQuark locale_domain;
|
||||
GQuark help_domain;
|
||||
gchar *menu_label;
|
||||
GList *menu_paths;
|
||||
gchar *label;
|
||||
|
|
Loading…
Reference in New Issue