From ccfca2e1b5fe8a6a216ba7ec2307a0e8b49ad3cf Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Wed, 8 Mar 2000 22:53:20 +0000 Subject: [PATCH] fix it properly --Sven --- ChangeLog | 3 +-- app/gui/menus.c | 18 +++++++++++++----- app/menus.c | 18 +++++++++++++----- app/menus/menus.c | 18 +++++++++++++----- app/widgets/gimpitemfactory.c | 18 +++++++++++++----- 5 files changed, 53 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index b446ee287e..49bbaba337 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,6 @@ Wed Mar 8 23:37:38 CET 2000 Sven Neumann - * app/menus.c: ooops, my last commit broke LANG=C - This is a quick fix and leaks memory. I'm working on a proper fix. + * app/menus.c: Oops, my last commit broke LANG=C. This is now fixed. Wed Mar 8 21:52:51 CET 2000 Sven Neumann diff --git a/app/gui/menus.c b/app/gui/menus.c index 37b5a02a18..66baa05964 100644 --- a/app/gui/menus.c +++ b/app/gui/menus.c @@ -1686,7 +1686,6 @@ menu_translate (const gchar *path, GtkItemFactory *item_factory = NULL; gchar *retval; gchar *factory; - gchar *fullpath; gchar *translation; gchar *domain = NULL; gchar *complete = NULL; @@ -1711,7 +1710,8 @@ menu_translate (const gchar *path, if (domain) /* use the plugin textdomain */ { - fullpath = g_strconcat (factory, path, NULL); + g_free (menupath); + menupath = g_strconcat (factory, path, NULL); complete = gtk_object_get_data (GTK_OBJECT (item_factory), "complete"); if (complete) @@ -1723,7 +1723,7 @@ menu_translate (const gchar *path, complete = g_strconcat (factory, complete, NULL); translation = g_strdup (dgettext (domain, complete)); - while (*complete && *translation && strcmp (complete, fullpath)) + while (*complete && *translation && strcmp (complete, menupath)) { p = strrchr (complete, '/'); t = strrchr (translation, '/'); @@ -1735,10 +1735,12 @@ menu_translate (const gchar *path, else break; } + + g_free (complete); } else { - translation = dgettext (domain, fullpath); + translation = dgettext (domain, menupath); } /* @@ -1747,10 +1749,16 @@ menu_translate (const gchar *path, if (strncmp (factory, translation, strlen (factory)) == 0) { retval = translation + strlen (factory); + if (complete) + { + g_free (menupath); + menupath = translation; + } } else { - g_warning ("bad translation for menupath: %s (%s)", fullpath, translation); + g_warning ("bad translation for menupath: %s", menupath); + retval = menupath + strlen (factory); if (complete) g_free (translation); } diff --git a/app/menus.c b/app/menus.c index 37b5a02a18..66baa05964 100644 --- a/app/menus.c +++ b/app/menus.c @@ -1686,7 +1686,6 @@ menu_translate (const gchar *path, GtkItemFactory *item_factory = NULL; gchar *retval; gchar *factory; - gchar *fullpath; gchar *translation; gchar *domain = NULL; gchar *complete = NULL; @@ -1711,7 +1710,8 @@ menu_translate (const gchar *path, if (domain) /* use the plugin textdomain */ { - fullpath = g_strconcat (factory, path, NULL); + g_free (menupath); + menupath = g_strconcat (factory, path, NULL); complete = gtk_object_get_data (GTK_OBJECT (item_factory), "complete"); if (complete) @@ -1723,7 +1723,7 @@ menu_translate (const gchar *path, complete = g_strconcat (factory, complete, NULL); translation = g_strdup (dgettext (domain, complete)); - while (*complete && *translation && strcmp (complete, fullpath)) + while (*complete && *translation && strcmp (complete, menupath)) { p = strrchr (complete, '/'); t = strrchr (translation, '/'); @@ -1735,10 +1735,12 @@ menu_translate (const gchar *path, else break; } + + g_free (complete); } else { - translation = dgettext (domain, fullpath); + translation = dgettext (domain, menupath); } /* @@ -1747,10 +1749,16 @@ menu_translate (const gchar *path, if (strncmp (factory, translation, strlen (factory)) == 0) { retval = translation + strlen (factory); + if (complete) + { + g_free (menupath); + menupath = translation; + } } else { - g_warning ("bad translation for menupath: %s (%s)", fullpath, translation); + g_warning ("bad translation for menupath: %s", menupath); + retval = menupath + strlen (factory); if (complete) g_free (translation); } diff --git a/app/menus/menus.c b/app/menus/menus.c index 37b5a02a18..66baa05964 100644 --- a/app/menus/menus.c +++ b/app/menus/menus.c @@ -1686,7 +1686,6 @@ menu_translate (const gchar *path, GtkItemFactory *item_factory = NULL; gchar *retval; gchar *factory; - gchar *fullpath; gchar *translation; gchar *domain = NULL; gchar *complete = NULL; @@ -1711,7 +1710,8 @@ menu_translate (const gchar *path, if (domain) /* use the plugin textdomain */ { - fullpath = g_strconcat (factory, path, NULL); + g_free (menupath); + menupath = g_strconcat (factory, path, NULL); complete = gtk_object_get_data (GTK_OBJECT (item_factory), "complete"); if (complete) @@ -1723,7 +1723,7 @@ menu_translate (const gchar *path, complete = g_strconcat (factory, complete, NULL); translation = g_strdup (dgettext (domain, complete)); - while (*complete && *translation && strcmp (complete, fullpath)) + while (*complete && *translation && strcmp (complete, menupath)) { p = strrchr (complete, '/'); t = strrchr (translation, '/'); @@ -1735,10 +1735,12 @@ menu_translate (const gchar *path, else break; } + + g_free (complete); } else { - translation = dgettext (domain, fullpath); + translation = dgettext (domain, menupath); } /* @@ -1747,10 +1749,16 @@ menu_translate (const gchar *path, if (strncmp (factory, translation, strlen (factory)) == 0) { retval = translation + strlen (factory); + if (complete) + { + g_free (menupath); + menupath = translation; + } } else { - g_warning ("bad translation for menupath: %s (%s)", fullpath, translation); + g_warning ("bad translation for menupath: %s", menupath); + retval = menupath + strlen (factory); if (complete) g_free (translation); } diff --git a/app/widgets/gimpitemfactory.c b/app/widgets/gimpitemfactory.c index 37b5a02a18..66baa05964 100644 --- a/app/widgets/gimpitemfactory.c +++ b/app/widgets/gimpitemfactory.c @@ -1686,7 +1686,6 @@ menu_translate (const gchar *path, GtkItemFactory *item_factory = NULL; gchar *retval; gchar *factory; - gchar *fullpath; gchar *translation; gchar *domain = NULL; gchar *complete = NULL; @@ -1711,7 +1710,8 @@ menu_translate (const gchar *path, if (domain) /* use the plugin textdomain */ { - fullpath = g_strconcat (factory, path, NULL); + g_free (menupath); + menupath = g_strconcat (factory, path, NULL); complete = gtk_object_get_data (GTK_OBJECT (item_factory), "complete"); if (complete) @@ -1723,7 +1723,7 @@ menu_translate (const gchar *path, complete = g_strconcat (factory, complete, NULL); translation = g_strdup (dgettext (domain, complete)); - while (*complete && *translation && strcmp (complete, fullpath)) + while (*complete && *translation && strcmp (complete, menupath)) { p = strrchr (complete, '/'); t = strrchr (translation, '/'); @@ -1735,10 +1735,12 @@ menu_translate (const gchar *path, else break; } + + g_free (complete); } else { - translation = dgettext (domain, fullpath); + translation = dgettext (domain, menupath); } /* @@ -1747,10 +1749,16 @@ menu_translate (const gchar *path, if (strncmp (factory, translation, strlen (factory)) == 0) { retval = translation + strlen (factory); + if (complete) + { + g_free (menupath); + menupath = translation; + } } else { - g_warning ("bad translation for menupath: %s (%s)", fullpath, translation); + g_warning ("bad translation for menupath: %s", menupath); + retval = menupath + strlen (factory); if (complete) g_free (translation); }