Control: tags -1 + pending confirmed

On Thu, Oct 05, 2017 at 09:50:03AM +0200, Didier Roche wrote:
> Please find a patch enclosed for that issue. Already applied and tested in
> the ubuntu package.

Thanks, I think it looks good. I've committed so it'll be in the next
upload.

It would have been nice to attach a reproducer, so for the record here's
mine. It gives:

  laney@raleigh> LC_MESSAGES=zh_CN.UTF-8 ./a.out
  Name: 终端
  action new-window: 新终端

Cheers,

-- 
Iain Lane                                  [ i...@orangesquash.org.uk ]
Debian Developer                                   [ la...@debian.org ]
Ubuntu Developer                                   [ la...@ubuntu.com ]
/* gcc $(pkg-config --cflags glib-2.0 gio-unix-2.0) test.c $(pkg-config --libs glib-2.0 gio-unix-2.0) -g
 *
 * Test with LC_MESSAGES=some_LOCALE ./a.out on a system where the translations
 * are available using gettext.
 *
 */

#include <gio/gdesktopappinfo.h>
#include <glib.h>
#include <glib/gprintf.h>
#include <stdlib.h>
#include <locale.h>

int
main()
{
        g_autoptr(GDesktopAppInfo) terminal = NULL;
        g_autoptr(GError) error = NULL;
        g_autoptr(GKeyFile) key_file = g_key_file_new ();
        g_autofree gchar *name = NULL;

        const gchar * const * actions;

        setlocale (LC_MESSAGES, "");

        if (!g_key_file_load_from_data_dirs (key_file,
                                             "applications/org.gnome.Terminal.desktop",
                                             NULL,
                                             G_KEY_FILE_NONE,
                                             &error))
        {
                g_critical ("Couldn't load GKeyFile: %s", error->message);
                return EXIT_FAILURE;
        }

        terminal = g_desktop_app_info_new_from_keyfile (key_file);

        if (!terminal) {
                g_critical ("Couldn't make GDesktopAppInfo");
                return EXIT_FAILURE;
        }

        actions = g_desktop_app_info_list_actions (terminal);

        name = g_key_file_get_locale_string (key_file,
                                             G_KEY_FILE_DESKTOP_GROUP,
                                             G_KEY_FILE_DESKTOP_KEY_NAME,
                                             NULL,
                                             &error);

        if (!name) {
                g_critical ("Couldn't get name: %s", error->message);
                return EXIT_FAILURE;
        }

        g_printf ("Name: %s\n", name);

        for (int i = 0; actions[i]; ++i) {
                g_printf ("action %s: %s\n", actions[i],
                                           g_desktop_app_info_get_action_name (terminal, actions[i]));
        }
}

Attachment: signature.asc
Description: PGP signature

Reply via email to