Closed fbruetting closed 7 years ago
Shouldn't be too complicated to implement, should be on master by tomorrow :)
I tried two approaches to handle this, working fine on my examples (not a Nautilus extension). The first one was to use a Thread (WatchDog to watch the file under .git called HEAD that points to the current HEAD branch), and it does not work; so I tried to add a timer and check for those information each 60 seconds but does not work either.
It seems that once you returned the widget to Nautilus in order to show it, you can change it anymore :( unless a new once is created...Which means to refresh the page. I can refresh the nautilus page automatically if you wish... @alex285 i would like your opinion as you wanted this too :p
Here's the current documentation https://projects-old.gnome.org/nautilus-python/documentation/html/class-nautilus-python-location-widget-provider.html Sadly there's no signal as for MenuItems to tell Nautilus that the widget was updated.. https://projects-old.gnome.org/nautilus-python/documentation/html/class-nautilus-python-menu-provider.html
Seems like the first solution would be the better one, but we need the signal first… do you want to open a bug report for this?
@fbruetting I will open a report upstream and see if things will be improved. The way nautilus plugins works are not really that good. So limited :(
@bil-elmoussaoui if the question is if you should refresh the Nautilus view every(x) seconds, then I say definitely no! Not only sounds bad, but it will scare the users and they wont use it! I'm already scared!
but it would be nice if Nautilus guys were doing something from their side, like moving to Python3 and allow more control in extensions. On the last I dont have idea though, just because you said it is very limited!
@alex285 Nop, i was going to refresh the view only when it's needed. Ofc, there will be a watcher to watch the HEAD file, whenever this file is changed it will refresh the view. But it's not really the best way of doing things. I will report an upstream issue and hopefully, we will get more control over the extensions. Anyway, for now i will implement the refresh view and make it configurable. Until we get some news from Nautilus guys
@bil-elmoussaoui oh in that case it sounds fine!
Is it possible to get hooks into inodes, so that a function gets executed if the file is altered?
@fbruetting I'm looking for a way to do this, but i'm very busy those last days. I will fix this as soon as i find a way that won't add another dependency to the extension
Does this help? https://en.wikipedia.org/wiki/Inotify
@fbruetting Will see what can i do pretty soon ! :+1:
@fbruetting Sorry for the delay :) it's not the watcher who causes the problem! I still didn't find a way to execute "F5" in order to refresh the current window...
Wouldn't it be better to implement this feature in Nautilus directly, so that the window gets refreshed every time there's a change in the current directory? I sometimes have the problem, that I have to refresh Nautilus manually. So this problem then should be resolved for all cases. :)
Well, that would be much much better...Do you want to create an upstream issue for that?
There are lots of bug reports regarding refreshing Nautilus, think another bug report would be useless… In general, the Gnome guys don't really care about bug reports overall. :(
Fixed on master! Nautilus git now auto refresh the page on checkout (either using terminal or built in widget to change the current branch)
it doesnt seem work here
reproduce
Can you open Nautilus from terminal and paste the output here?
@bil-elmoussaoui
Can you open Nautilus from terminal and paste the output here?
sys:1: PyGIWarning: Nautilus was imported without specifying a version first. Use gi.require_version('Nautilus', '3.0') before import to ensure that the right version gets loaded. Number of files is 0 Number of files is 0
(nautilus:15906): CRITICAL : nautilus_menu_provider_get_background_items: assertion 'NAUTILUS_IS_MENU_PROVIDER (provider)' failed Number of files is 0 Number of files is 0
(nautilus:15906): CRITICAL : nautilus_menu_provider_get_background_items: assertion 'NAUTILUS_IS_MENU_PROVIDER (provider)' failed Number of files is 0 Number of files is 0
(nautilus:15906): CRITICAL : nautilus_menu_provider_get_background_items: assertion 'NAUTILUS_IS_MENU_PROVIDER (provider)' failed
btw that is Nautilus 3.25.1, but i also tried on Nautilus 3.24 and it didnt work
@bil-elmoussaoui how can i see the location of the plugin that Nautilus is loading?
@alex285 you can't do that =p but it works here using Nautilus 3.25.1 too...
Would you make this respond to checkouts directly without having to manually reload the folder? That'd be perfect!