From 20454a9f8c3fb4b390420828709b4022f1563b6e Mon Sep 17 00:00:00 2001 From: Vincent Geddes Date: Mon, 2 Jul 2007 18:29:19 +0000 Subject: Properly handle dgettext() operations (#453105, Christian Persch). * gladeui/glade-catalog.c: Properly handle dgettext() operations (#453105, Christian Persch). svn path=/trunk/; revision=1424 --- ChangeLog | 4 ++-- gladeui/glade-app.c | 3 +-- gladeui/glade-catalog.c | 22 ++++++++++++++++------ 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6440579f..024f5524 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,7 @@ 2007-07-02 Vincent Geddes - * gladeui/glade-app.c: Revert last change. Do not free catalogs - in finalize as a result of #453105. + * gladeui/glade-catalog.c: Properly handle dgettext() operations + (#453105, Christian Persch). 2007-07-01 Vincent Geddes diff --git a/gladeui/glade-app.c b/gladeui/glade-app.c index 95167078..06270497 100644 --- a/gladeui/glade-app.c +++ b/gladeui/glade-app.c @@ -189,8 +189,7 @@ glade_app_finalize (GObject *app) g_free (locale_dir); glade_binding_unload_all (); - - /* FIXME: destroy catalogs */ + glade_catalog_destroy_all (); G_OBJECT_CLASS (glade_app_parent_class)->finalize (app); } diff --git a/gladeui/glade-catalog.c b/gladeui/glade-catalog.c index 903a6be4..bea1f655 100644 --- a/gladeui/glade-catalog.c +++ b/gladeui/glade-catalog.c @@ -373,6 +373,7 @@ catalog_load_group (GladeCatalog *catalog, GladeXmlNode *group_node) { GladeWidgetGroup *group; GladeXmlNode *node; + char *title, *translated_title; group = g_slice_new0 (GladeWidgetGroup); @@ -386,9 +387,9 @@ catalog_load_group (GladeCatalog *catalog, GladeXmlNode *group_node) return FALSE; } - group->title = glade_xml_get_property_string (group_node, - GLADE_TAG_TITLE); - if (!group->title) + title = glade_xml_get_property_string (group_node, + GLADE_TAG_TITLE); + if (!title) { g_warning ("Required property 'title' not found in group node"); widget_group_destroy (group); @@ -399,9 +400,18 @@ catalog_load_group (GladeCatalog *catalog, GladeXmlNode *group_node) group->expanded = TRUE; /* Translate it */ - group->title = dgettext (catalog->domain ? - catalog->domain : catalog->library, - group->title); + translated_title = dgettext (catalog->domain ? + catalog->domain : catalog->library, + title); + if (translated_title != title) + { + group->title = g_strdup (translated_title); + g_free (title); + } + else + { + group->title = title; + } group->adaptors = NULL; -- cgit v1.2.1