> @@ -0,0 +1,218 @@
> +/*
> + * demoproxy.c - this file is part of Geany, a fast and lightweight IDE
> + *
> + * Copyright 2007-2012 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
> + * Copyright 2007-2012 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Since you wrote this new file, it would be more appropriate to put your copyright in there.
---
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/629/files#r38823465
@elextr
> as I have said on other versions of this change, I don't agree with forcing the same config so I won't be testing or committing it
We agree to disagree... :)
BTW, I tested creating an Independent command 'New Window' = '[path/]geany -i "%f"' - works like a charm, is fully customizable, and you can even have several of them with different configs.
---
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/637#issuecomment-137814664
@codebrainz
> It would be easier to review (and look back to later) if it was broken down into the general stages of the change, like in a few different commits.
It can be broken into the following steps:
- Add the option reproducer to libmain and export main_get_persistent_argv (or however we call it)
- Alter utils_resource_dir -> utils_resource_path to support RESOURCE_FILE_GEANY (or however we call it)
- Rewrite utils_start_new_geany_instance() - this uses the above and must be the last one.
> the stuff with the options lookup table, and new globals, functions, and data types (change 3..N) seems like a lot of complexity (though it may indeed be warranted)
I'm not aware of an easier way to properly reproduce part of the options. Well, GeanyOptionEntryAux can be replaced with a const char *const with the short options that must be persistent, but that would be less clear.
> and the part that guards out the is_osx_bundle() seems unrelated
Really. I saw a warning "unused function" under Win~1, and instintively fixed it...
Can you please apply this change only to Geany?
---
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/637#issuecomment-137814146
> @@ -52,6 +52,17 @@ CommandLineOptions;
> extern CommandLineOptions cl_options;
>
>
> +/* Information about command line entries that can not be stored in GOptionEntry. */
> +typedef struct
> +{
> + gboolean persistent; /* The option should be passed to "New Window" */
> +}
> +GeanyOptionEntryAux;
> +
> +extern GOptionEntry optentries[];
> +extern GeanyOptionEntryAux optentries_aux[];
The argv parsing happens in GLib. A function may be executed at any time after that. We can't simply get them from the original argv.
I'd rather export a function returning the reproduced GPtrArray (or simply char **). This way, we can extend it reproduce different sets of options, should need be. And GeanyOptionEntryAux is trivial to extend...
---
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/637/files#r38778268
> void utils_start_new_geany_instance(const gchar *doc_path)
> {
> - const gchar *command = is_osx_bundle() ? "open" : "geany";
> - gchar *exec_path = g_find_program_in_path(command);
> + gchar **argv;
> + int i, persistent;
> + int argc;
> + GError *error = NULL;
> +
> + for (i = 0, persistent = 0; optentries[i].long_name; i++)
> + if (optentries_aux[i].persistent)
> + persistent++;
> +
> + argv = g_new0(gchar *, persistent + 5); /* exectuable, -i, --, doc_path, NULL */
> + argv[0] = g_build_filename(utils_resource_dir(RESOURCE_DIR_PREFIX), "bin", "geany", NULL);
It is. Since I don't want an unneeded RESOURCE_DIR_PREFIX under OSX, and g_build_filename() scattered in utils_resource_dir() and utils_start_new_geany_instance(), I'll do the following:
- Rename utils_resource_dir() to utils_resource_path().
- Rename RESOURCE_DIR_PREFIX to RESOURCE_FILE_GEANY or something (please suggest a name).
- Alter utils_resource_path(RESOURCE_FILE_GEANY) to return gtkosx_application_get_executable_path() under OSX or prefix/bin/geany otherwise.
It is the executable name that we really need from utils_resource_path(), not the RESOURCE_DIR_PREFIX.
---
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/637/files#r38777321