MadsBuus / gedit-snapopen-plugin

Snapopen plugin for Gedit (Linux/Mac)
58 stars 18 forks source link

searches files from the last opened gedit root dir #13

Open gautamkpai opened 12 years ago

gautamkpai commented 12 years ago

When i open a file in directory abc using gedit and i use snapopen to search it searches files properly from within directory abc.

Now suppose I open one more gedit window to open a file from directory xyz. When i now got to project abc and search using snapopen it searches file only from within directory xyz.

Is there anyway to start searching from the root directory of current window's file browser panel?

I am using gedit 3.2.3. And installed snapopen through latest gedit-gmate package.

MadsBuus commented 12 years ago

take a look at the get_filebrowser_root: https://github.com/MadsBuus/gedit-snapopen-plugin/blob/master/snapopen/__init__.py#L205 the 'root' comes from the gnome settings registry: org.gnome.gedit.plugins.filebrowser, the setting 'virtual-root'. My guess is that this setting is actually overwritten by the second window (or rather: kept in memory for each window, but only stored once) I haven't looked into it yet, you would be most welcome.

gautamkpai commented 12 years ago

yup, thats the problem. The setting 'virtual-root' is being overwritten by the gedit window opened last. That effectively means that snap-open would work when you have only one window open.

Any ideas on an alternative approach to fix that? And thanks for a quick response.

MadsBuus commented 12 years ago

No, I'm sorry. This was my very first venture into both gtk and python, and I haven't really had time to go into the gconf documentation. What I did was a googled attempt at reading the current 'root' from the application. You could perhaps hook into the 'set as root folder' event in the gedit file browser pane, and do your own track-keeping of 'roots' per window, but I think I will hope for a Pull Request on that one :-)

/Mads

rubencaro commented 11 years ago

You could take a look at how shipped 'quickopen' plugin does this. They seem to have solved this issue.

http://git.gnome.org/browse/gedit/tree/plugins/quickopen/quickopen/__init__.py#n79