bilelmoussaoui / nautilus-git

Nautilus/Nemo extension to add important information about the current git directory
GNU General Public License v3.0
149 stars 9 forks source link

Instant reaction to checkouts #2

Closed fbruetting closed 7 years ago

fbruetting commented 7 years ago

Would you make this respond to checkouts directly without having to manually reload the folder? That'd be perfect!

bilelmoussaoui commented 7 years ago

Shouldn't be too complicated to implement, should be on master by tomorrow :)

bilelmoussaoui commented 7 years ago

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

bilelmoussaoui commented 7 years ago

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

fbruetting commented 7 years ago

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?

bilelmoussaoui commented 7 years ago

@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 :(

alex285 commented 7 years ago

@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!

bilelmoussaoui commented 7 years ago

@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

alex285 commented 7 years ago

@bil-elmoussaoui oh in that case it sounds fine!

fbruetting commented 7 years ago

Is it possible to get hooks into inodes, so that a function gets executed if the file is altered?

bilelmoussaoui commented 7 years ago

@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

fbruetting commented 7 years ago

Does this help? https://en.wikipedia.org/wiki/Inotify

bilelmoussaoui commented 7 years ago

@fbruetting Will see what can i do pretty soon ! :+1:

bilelmoussaoui commented 7 years ago

@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...

fbruetting commented 7 years ago

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. :)

bilelmoussaoui commented 7 years ago

Well, that would be much much better...Do you want to create an upstream issue for that?

fbruetting commented 7 years ago

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. :(

bilelmoussaoui commented 7 years ago

Fixed on master! Nautilus git now auto refresh the page on checkout (either using terminal or built in widget to change the current branch)

alex285 commented 7 years ago

it doesnt seem work here

reproduce

  1. i open nautilus to a project in master branch
  2. from terminal i switch branch
  3. in nautilus the branch still remains on master
bilelmoussaoui commented 7 years ago

Can you open Nautilus from terminal and paste the output here?

alex285 commented 7 years ago

@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

alex285 commented 7 years ago

@bil-elmoussaoui how can i see the location of the plugin that Nautilus is loading?

bilelmoussaoui commented 7 years ago

@alex285 you can't do that =p but it works here using Nautilus 3.25.1 too...