This feature is most helpful when recursively opening multiple files in the second instance of Geany where opening from the command-line doesn't help, since it just makes the first instance open them. Having another instance is necessary if you want to open another project.
This feature recognizes the specified filter in the dialog box, and uses it to select enumerated files to be opened.
Snapshot: http://imgur.com/a/DtiRI
You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/1163
-- Commit Summary --
* Add 'File->Open Files Recursively'
-- File Changes --
M data/geany.glade (9) M doc/geany.txt (2) M src/callbacks.c (9) M src/callbacks.h (2) M src/dialogs.c (60) M src/dialogs.h (2) M src/document.c (113) M src/document.h (3) M src/keybindings.c (5) M src/keybindings.h (1)
-- Patch Links --
https://github.com/geany/geany/pull/1163.patch https://github.com/geany/geany/pull/1163.diff
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/1163
@konsolebox pushed 3 commits.
59f5f05 Do not skip explicitly selected symbolic links 836bc85 Fix "Cancel": GEANY_RESPONSE_OPEN_RECURSIVELY wasn't checking against 'response' 55caa0a Use current directory if nothing is selected
--- You are receiving this because you are subscribed to this thread. View it on GitHub: https://github.com/geany/geany/pull/1163/files/b5e3c5dc466d2a207f9ac3aeee10e...
Whats wrong with using the -i option on the command line?
Multiple instances using the same configuration should not be encouraged. It will blow up in users faces at some point.
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/1163#issuecomment-237770628
Whats wrong with using the -i option on the command line?
It's only applicable when opening new instances. You can't always be opening all files you need opened at one command.
Multiple instances using the same configuration should not be encouraged. It will blow up in users faces at some point.
Unfortunately that's the best thing you can do when wanting to have multiple projects opened. You wouldn't want to be managing multiple users for each, and making sure every user would have mutual permissions.
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/1163#issuecomment-237771699
You can use separate configuration directories for different projects and use the -c option to select which one you want. Then if you open files from the command line `geany -c config_with_project_1 file1` and `geany -c config_with_project_2 file2` will send the files to the specified instance. And when you close the instances they won't fight over which project and open files gets stored in the config file since each has its own :)
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/1163#issuecomment-237772412
I should also add that this feature is helpful enough in environments where the user is unable to open multiple files recursively by himself, like there are no commands usable for it, or when simply the user doesn't know how to do it.
You can use separate configuration directories for different projects and use the -c option to select which one you want. Then if you open files from the command line geany -c config_with_project_1 file1 and geany -c config_with_project_2 file2 will send the files to the specified instance. And when you close the instances they won't fight over which project and open files gets stored in the config file since each has its own :)
Hmm. I guess that's one correct way to do it if we want to open multiple files by the command-line. But I guess that also proves that it's possible to sanely have multiple instances?
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/1163#issuecomment-237773220
Travis CI build fails because `g_file_enumerator_iterate()` requires GLib 2.44.
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/1163#issuecomment-237776634
I guess that also proves that it's possible to sanely have multiple instances?
Yes you can have multiple instances safely with different configs, as noted above you can direct files opened at the command line, or you can open the file sin the instance as well of course.
Can you discuss your use-case more? Your first post doesn't actually make a lot of sense when you look at it in this light.
Travis CI build fails because g_file_enumerator_iterate() requires GLib 2.44.
Geany's requirement is 2.32 so you will have to find another solution.
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/1163#issuecomment-237778041
Geany's requirement is 2.32 so you will have to find another solution.
Using the other function `g_file_enumerator_next_file()` would make the code messy as you would have to manage instances of GFile and GFileInfo as you traverse yourself. I also don't like converting it to a recursive function (if it may be the solution). I guess I'll just wait for a version requirement bump.
Can you discuss your use-case more? Your first post doesn't actually make a lot of sense when you look at it in this light.
I thought saying "most helpful when recursively opening multiple files in the second instance of Geany" was my trump card because I assumed that there was no way to open other files in another instance but it turns out that there's actually a way.
So I guess I have to give other reasons why this feature would be helpful besides that. And one simply is the basic function it gives: It helps users open multiple instances recursively, whether they would be capable of doing that in the command-line or not.
It's easier to open a dialog box than type `find /geany/src/ ( -name '*.c' -o -name '*.h' ) -print0 | xargs -0 geany`. And if we use `-c`, we would also have to remember the directory that the target instance is using. Maybe I could create a script for that - that's flexible enough to be configurable with the type of files I want to be opened, and the target instance I want the files to be opened with, but it's still much more convenient to just have it in a dialog box. I do it often after all.
Reasons for opening multiple files recursively are pretty much obvious already, but here are mine:
- Open multiple files of the source directory of a project I want to work on with (like Geany's `./src`). - Open multiple files of the source directory of a dependency I want to examine (like glib and gtk+ 2) so I would know how their functions work. I could access them easily with "Find Usage". - Open multiple files in /usr/include (like /usr/include/glib-2.0/ and /usr/include/gtk-2.0/gtk/ ) so I could have completion.
That is of course not only about Geany.
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/1163#issuecomment-237784071
Opening files in recursive directories is something that belongs in a plugin, not in core.
Also look at the project plugins (there are two of them at least) because they may do part of what you want too and also the treebrowser plugin which does recursive directory walking without too-new glib functions.
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/1163#issuecomment-237808797
Opening files in recursive directories is something that belongs in a plugin, not in core.
I thought it's doable, but I'm not sure about the idea of mirror-copying open-dialog-box related codes to a plugin. Having an Open Dialog box under Tools menu also seems awkward. But I can do that if I decide to.
Also look at the project plugins (there are two of them at least) because they may do part of what you want too and also the treebrowser plugin which does recursive directory walking without too-new glib functions.
It's ok. I can easily picture how it can be done with `g_file_enumerator_next_file()`. Also, it seems like not explicitly requesting a GFile instance from an iteration function is better since we don't need it when we're opening a file. An instance should only be created if we're opening another directory.
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/1163#issuecomment-237833181
@konsolebox pushed 4 commits.
5046fc2 Make specifying recursion limit more consistent 97e7f17 Do not specify URI b76b58a Use simpler function calls for getting attributes 13f47d6 Use g_file_enumerator_next_file() instead of g_file_enumerator_iterate()
--- You are receiving this because you are subscribed to this thread. View it on GitHub: https://github.com/geany/geany/pull/1163/files/55caa0a81784abcf9d2db1f64b002...
@konsolebox pushed 1 commit.
cf9c0e6 Reformat affected while loop
--- You are receiving this because you are subscribed to this thread. View it on GitHub: https://github.com/geany/geany/pull/1163/files/13f47d6da30e83111b977bd75a060...
@konsolebox pushed 1 commit.
837eb0c Use stock icon
@konsolebox pushed 1 commit.
04c26d1 Revert the unreverted modification for the title arg to win32_show_document_open_dialog()
@konsolebox pushed 1 commit.
4c22050 Ask before opening many files
I think the general feature is OK, however I think it's better to integrate this into the existing open dialog. Perhaps with a checkbox ([x] open recursively) and a text entry to optionally specify file patterns (and maybe read them from project settings?)
however I think it's better to integrate this into the existing open dialog. Perhaps with a checkbox ([x] open recursively)
I think I tried to do that initially, but I got into some issues that made me decide to just use another dialog box. It's probably the difference in behavior between targetting files, and targetting both files and directories. I can't remember if it was the stock button or the dialog box itself that's to be blamed.
Anyway, I find using another dialog box more convenient and faster to use. I don't have to click a checkbox, or check if it's been activated or not before clicking a View or Open button. Differing behavior, and programmatical issues that might occur are also segregated.
elextr commented on this pull request.
@@ -1565,6 +1565,138 @@ void document_open_files(const GSList *filenames, gboolean readonly, GeanyFilety
}
+static GFileEnumerator *enumerate_children(const char *dir_path, GError **error) +{ + GFile *file = g_file_new_for_path(dir_path); + + const gchar *attributes = G_FILE_ATTRIBUTE_STANDARD_TYPE "," G_FILE_ATTRIBUTE_STANDARD_NAME "," + G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME "," G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE; + + GFileEnumerator *enumerator = g_file_enumerate_children(file, attributes,
Currently Geany only requires 2.32, but this is a 2.44 function.
konsolebox commented on this pull request.
@@ -1565,6 +1565,138 @@ void document_open_files(const GSList *filenames, gboolean readonly, GeanyFilety
}
+static GFileEnumerator *enumerate_children(const char *dir_path, GError **error) +{ + GFile *file = g_file_new_for_path(dir_path); + + const gchar *attributes = G_FILE_ATTRIBUTE_STANDARD_TYPE "," G_FILE_ATTRIBUTE_STANDARD_NAME "," + G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME "," G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE; + + GFileEnumerator *enumerator = g_file_enumerate_children(file, attributes,
What function, g_file_enumerate_children? It does exist in that version.
Ahh, my mistake, my google found g_file_enumerator type which is 2.44, carry on.
Closing for lack of interest.
Closed #1163.
github-comments@lists.geany.org