diff options
author | Not Zed <NotZed@Ximian.com> | 2004-12-22 15:36:46 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2004-12-22 15:36:46 +0800 |
commit | cd453acb04a6ccca20028f325d786980b570cad4 (patch) | |
tree | ce8998b3113a3196e3eae00b16143bedc0fe44e7 | |
parent | 64b26e8b3a2a9bb1e2db4c72a5b63c0819212bfa (diff) | |
download | gsoc2013-evolution-cd453acb04a6ccca20028f325d786980b570cad4.tar.gz gsoc2013-evolution-cd453acb04a6ccca20028f325d786980b570cad4.tar.zst gsoc2013-evolution-cd453acb04a6ccca20028f325d786980b570cad4.zip |
include config.h.
2004-12-22 Not Zed <NotZed@Ximian.com>
* e-plugin.c: include config.h.
2004-12-17 Not Zed <NotZed@Ximian.com>
* e-popup.c (e_popup_add_items): add a translation domain to api.
(e_popup_create_menu): translate the label using the supplied
domain.
(emph_popup_factory): pass domain to popup_add_items.
* e-plugin.c (ep_construct): if we have a localedir set, then
bindtextdomain so gettext can find it.
svn path=/trunk/; revision=28175
-rw-r--r-- | e-util/ChangeLog | 14 | ||||
-rw-r--r-- | e-util/e-plugin.c | 11 | ||||
-rw-r--r-- | e-util/e-popup.c | 11 | ||||
-rw-r--r-- | e-util/e-popup.h | 2 |
4 files changed, 34 insertions, 4 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog index 157e4debc6..dfe7035b6e 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,3 +1,17 @@ +2004-12-22 Not Zed <NotZed@Ximian.com> + + * e-plugin.c: include config.h. + +2004-12-17 Not Zed <NotZed@Ximian.com> + + * e-popup.c (e_popup_add_items): add a translation domain to api. + (e_popup_create_menu): translate the label using the supplied + domain. + (emph_popup_factory): pass domain to popup_add_items. + + * e-plugin.c (ep_construct): if we have a localedir set, then + bindtextdomain so gettext can find it. + 2004-12-21 JP Rosevear <jpr@novell.com> Fixes #30992 diff --git a/e-util/e-plugin.c b/e-util/e-plugin.c index 0d74043b4d..d7320ab2cf 100644 --- a/e-util/e-plugin.c +++ b/e-util/e-plugin.c @@ -1,4 +1,8 @@ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + #include <sys/types.h> #include <dirent.h> #include <string.h> @@ -113,8 +117,15 @@ ep_construct(EPlugin *ep, xmlNodePtr root) { xmlNodePtr node; int res = -1; + char *localedir; ep->domain = e_plugin_xml_prop(root, "domain"); + if (ep->domain + && (localedir = e_plugin_xml_prop(root, "localedir"))) { + bindtextdomain(ep->domain, localedir); + g_free(localedir); + } + ep->name = e_plugin_xml_prop_domain(root, "name", ep->domain); pd(printf("creating plugin '%s' '%s'\n", ep->name?ep->name:"un-named", ep->id)); diff --git a/e-util/e-popup.c b/e-util/e-popup.c index 20fe0c82f6..6ce73ab2db 100644 --- a/e-util/e-popup.c +++ b/e-util/e-popup.c @@ -69,6 +69,7 @@ struct _menu_node { EPopup *popup; GSList *menu; + char *domain; EPopupItemsFunc freefunc; void *data; @@ -107,6 +108,8 @@ ep_finalise(GObject *o) if (mnode->freefunc) mnode->freefunc(emp, mnode->menu, mnode->data); + g_free(mnode->domain); + /* free item activate callback data */ inode = mnode->items; while (inode) { @@ -219,6 +222,7 @@ EPopup *e_popup_construct(EPopup *ep, const char *menuid) * e_popup_add_items: * @emp: An EPopup derived object. * @items: A list of EPopupItem's to add to the current popup menu. + * @domain: Translation domain for translating labels. * @freefunc: A function which will be called when the items are no * longer needed. * @data: user-data passed to @freefunc, and passed to all activate @@ -230,12 +234,13 @@ EPopup *e_popup_construct(EPopup *ep, const char *menuid) * built to create a complex heirarchy of menus. **/ void -e_popup_add_items(EPopup *emp, GSList *items, EPopupItemsFunc freefunc, void *data) +e_popup_add_items(EPopup *emp, GSList *items, const char *domain, EPopupItemsFunc freefunc, void *data) { struct _menu_node *node; node = g_malloc0(sizeof(*node)); node->menu = items; + node->domain = g_strdup(domain); node->freefunc = freefunc; node->data = data; node->popup = emp; @@ -424,7 +429,7 @@ e_popup_create_menu(EPopup *emp, EPopupTarget *target, guint32 mask) } if (item->label) { - label = gtk_label_new_with_mnemonic(_(item->label)); + label = gtk_label_new_with_mnemonic(dgettext(inode->menu->domain, item->label)); gtk_misc_set_alignment((GtkMisc *)label, 0.0, 0.5); gtk_widget_show(label); gtk_container_add((GtkContainer *)menuitem, label); @@ -643,7 +648,7 @@ emph_popup_factory(EPopup *emp, void *data) return; if (menu->items) - e_popup_add_items(emp, menu->items, NULL, menu->hook); + e_popup_add_items(emp, menu->items, menu->hook->hook.plugin->domain, NULL, menu->hook); } static void diff --git a/e-util/e-popup.h b/e-util/e-popup.h index 36d45bcf51..d347b38d62 100644 --- a/e-util/e-popup.h +++ b/e-util/e-popup.h @@ -200,7 +200,7 @@ void e_popup_class_remove_factory(EPopupClass *klass, EPopupFactory *f); EPopup *e_popup_construct(EPopup *, const char *menuid); -void e_popup_add_items(EPopup *, GSList *items, EPopupItemsFunc freefunc, void *data); +void e_popup_add_items(EPopup *, GSList *items, const char *domain, EPopupItemsFunc freefunc, void *data); void e_popup_add_static_items(EPopup *emp, EPopupTarget *target); /* do not call e_popup_create_menu, it can leak structures if not used right */ |