[Github-comments] [geany] Fix for "Open in New Window". (#637)
Colomban Wendling
notifications at xxxxx
Thu Sep 3 13:15:21 UTC 2015
> + gboolean val = *(gboolean *)optentry->arg_data;
> + gboolean reverse = (optentry->flags & G_OPTION_FLAG_REVERSE);
> + if ((val && !reverse) || (!val && reverse)) /* logical XOR */
> + s = g_strdup_printf("--%s", optentry->long_name);
> + }
> + break;
> +
> + case G_OPTION_ARG_INT:
> + if (*(gint *)optentry->arg_data)
> + s = g_strdup_printf("--%s=%d", optentry->long_name, *(gint *)optentry->arg_data);
> + break;
> +
> + case G_OPTION_ARG_STRING:
> + case G_OPTION_ARG_FILENAME:
> + if (*(gchar **)optentry->arg_data)
> + s = g_strdup_printf("--%s=%s", optentry->long_name, *(gchar **)optentry->arg_data);
`STRING` and `FILENAME` have different encoding, I'm not sure if a conversion is needed.
[GLib's docs](https://developer.gnome.org/glib/unstable/glib-Commandline-option-parser.html#glib-Commandline-option-parser.description) say:
> On UNIX systems, the argv that is passed to `main()` has no particular encoding, even to the extent that different parts of it may have different encodings. In general, normal arguments and flags will be in the current locale and filenames should be considered to be opaque byte strings. Proper use of [G_OPTION_ARG_FILENAME](https://developer.gnome.org/glib/unstable/glib-Commandline-option-parser.html#G-OPTION-ARG-FILENAME:CAPS) vs [G_OPTION_ARG_STRING](https://developer.gnome.org/glib/unstable/glib-Commandline-option-parser.html#G-OPTION-ARG-STRING:CAPS) is therefore important.
---
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/637/files#r38643575
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20150903/532e972a/attachment.html>
More information about the Github-comments
mailing list