New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate Caja to GtkApplication #570
Comments
I have done some basic work with this, sucessfully running Caja in GtkApplication windows and using GtkApplication to hold it open as in Nautilus and Nemo. This might only be the beginning though as I find references to "_unique" all over the code in a total of 23 files. This WIP branch shows what I've gotten so far, based on Master 7-11-2016: https://github.com/lukefromdc/caja/tree/GtkApplication-WIP Again, it looks like this is barely the start of it but it does build and run over GTK 3.21. No help for the GTK 3.21.3 desktop issue but that is no surprise because Nemo has that issue to and uses GtkApplication already. One issue did arise, not sure why: Cannot run Caja as root (at least not in normal MATE session), possibly due to GtkApplication treating them as two attempts to run as though two instances in same user? Like I said, this is rough and a starting point only, |
Cool that you working on it. |
Btw. there are more applications which needs to be ported, ie. mate-power-manager. |
I'll need help understanding what libunique is doing with some of that On 7/12/2016 at 5:09 AM, "raveit65" notifications@github.com wrote:
|
Here's what I'm getting right now when trying to run as root, looks like an issue of something that is still using libunique and needs to be ported over. Keep in mind, ALL of the file managers get Dbus issues when running as root over a non-root session-and Nemo segfaults when run under su in a non-root X session. I need my file managers to work as root for many reasons: sudo caja:
su
|
In digging through old Nautilus commit I found references to a "major refactoring" needed to fully adapt to the use of GtkApplication. That sort of work would be quite beyond me. |
The first block of warnings i see always when i run caja as root.
This is because no session-manager is running for the root account.
This seems to be related. You can try run caja with gdb to find out at which place caja segfault.
Which commit is this? |
Segfaults are only with "su" and are shared by Nemo. I'm getting some On 7/12/2016 at 3:49 PM, "raveit65" notifications@github.com wrote:
|
I just found that replacing the original with /* Keep the main event loop alive as long as the window exists */ is enough to trigger the immediate exit of the root instance on "sudo caja," this is the exit without the segfault. |
Reverted the removal of "caja_main_event_loop_register" in caja-window.c, now it works fine as root and seems to be indistinguishable in behavior from Master. Still a hell of a lot of instances of libunique in this but it seems to be fine with running in a GtkApplicationWindow |
I just managed to get Caja running both normally and as root with libunique excluded entirely. Lost the special icons for home, trash, and computer (network not selected) due to one of the _unique_message_data functions apparently being responsible for fetching their URI's. Looks like it will be far easier to fix this with new code than old nautilus commits due to so many differences. Had to make a new GTK3-only branch due to build failures with the #if selectors in caja-application.h for some wierd reason. This also allows a search for "unique" in the code to verify it is gone. All other files containing this in code refer to functions in Eel and not to libunique it seems, and I didn't find any other files that used an include for libunique. I tried to apply I've apparently got libunique out of this in a far simpler way, in fact even did a build of my just commited code with all references to libunique removed from configure.ac. I just need a way to get back the trash, home, and computer icons. Don't know if this is good usage of GtkApplication though so this one REALLY would need that code review. |
maybe @clefebvre can help too |
I think is better drop all gtk 2 old code, before the gtkapplication implementation |
https://github.com/lukefromdc/caja/tree/GtkApplication_Nogtk2_WIP4 Newest branch fixes the special icons on the desktop and extensions, is based on today's master. Problem was very simple: the "finish_startup" function was never being reached as the code to launch it was behind the libunique stuff I removed. I set it to run unconditionally and it works. Everything is on the desktop and navigation windows I expect, CPU use stays down, errors in terminal running root are same as for master. So far no discernable behavior change from this from master at all. I just built this with the "pathbar" commits also applied and packaged it up for daily use and testing. I could put in a PR now but people were saying they wanted to drop the GTK2 stuf first. Today's branch does not support GTK2 builds, that was just too complex. Didn't change configure.ac yet to exclude libunique checks but have tested that. It too is too complex for me if GTK2 is retained but very simple for GTK3 only, so I left that alone for now in case we decide to go back and reinstall GTK2 support in this(which could be done, I've done that kind of thing before in mate-panel). |
I just found one behavioral change: it's possible by calling Caja from terminal with no arguments to open a second instance of Caja though no ill effects are observed from this. Preventing this was presumably libunique's job and apparently can also be done with GtkApplication, though what I've done does not have that effect. This being the file manager code review is more important than normal: it would really suck to get MATE 1.16 out the door only to find out 2 months later that some corner case has been eating people's files-and that half of those folks had no backups. Thus changes to make this code more robust, more secure, whatever are more than welcome. |
branch rebased for changes in Master as |
more documentation about this: |
I'm just testing your current branch, seems to be OK after a quick test. |
I'm playing with some of the code for changing the startup coding to Checking warnings is best done by comparing build and runtime warnings On 7/15/2016 at 5:43 PM, "raveit65" notifications@github.com wrote:
|
@raveit65 thanks, good choice :) I need to do that on mate-user-share: |
Nautilus turns out to be a rather ugly mess, using parts of both GtkApplication AND Gapplication. Very hard to apply what they did piecemeal without getting segfaults. What I've managed to do so far is a minimal removal of the Libunique dependency plus using the GtkApplicationWindow code from the engrampa commits. If this works we could leave that as-is, but one concern I have is the growing number of kludges and workarounds ge get trying to run the treadmill GTK changes are throwing at us. If it is possible to match what Nautilus (or Nemo forked from Nautilus 3.4) did, then the amount of code divergence is reduced. Not sure if I can make much headway on that though. There is another, rather radical idea: take the code for say, Nautilus 3.14 which still used the eel-editable-label and will build on current GTK 3.21 or on GTK 3.14 (oldest we are worried about) and back out all the UI changes-get rid of the headerbar, bring back the traditional menubar, toolbar, navigation bar, and the old sidebar. The add back the missing features. Finally replace every instance of "nautiilus" with "caja" in every file. This is almost guaranteed to fix the problems with the GTK 3.21 desktop as well, because that works in Nauitlus 3.14. EDIT: Starting to wonder if that might actually be easier than what we've been doing-but not easy either, I got got nowhere in 2 hours trying to put the old toolbar back in Nautilus 3.8, the oldest I can build. |
In other report you said nautilus-3.8 does not have the redraw issue, right ?
If you mean the same commits than me, i think we will only lost function which are mostly broken and nobody works on it, eg.
Note, i don't want prefer any solution at the moment, without any of the other core member did a statement. |
I hope we can avoid a scratch refork. Since 2.32 Nautilus has been The original MATE documentation lists Caja as being forked from a On 7/16/2016 at 4:21 AM, "raveit65" notifications@github.com wrote:
|
After an entire week of work, I finally managed to port the original Nautilus commits for this to Caja. https://github.com/lukefromdc/caja/tree/GtkApplicationfromNaut_WIP1 GTK 3 only branch presumably. I had to start with the nautilus version of caja-application.c as it was far easier to add back the Caja changes than ever to apply the massive Nautilus commits by hand. This is from the early work GNOME did and has one serious issue at the moment: opens with a window showing, exits if the last window is closed (desktop included). A later commit to fix some ugly session manager issues probably including this didn't build but I wanted to ensure this code did not get away from me after so much work. Other than the close on last window/open with one window showing SM issue it works normally-and I still remember those bugs from Nautilus 2.91. Based on all of these Nautilus commits, which had to be sequentially applied to build, and the final one to get it to run: GNOME/nautilus@dc0b129 GNOME/nautilus@b03b081 GNOME/nautilus@a8481ee GNOME/nautilus@f487966 GNOME/nautilus@7500dd4 YIELDED: (caja:2227): GLib-GIO-CRITICAL **: GApplication subclass 'CajaApplication' failed to chain up on ::startup (from start of override function) So apply: GNOME/nautilus@2d702e1 WORKS, but CRASH on closing last window. EDIT: From this point more Nautilus commits can be applied as needed (and will build) |
More Nautilus commits applied to last night's branch, yielding this branch that seems to work fine except that it must be started from a .desktop file and not the session manager (the way Nautilus itself is also now started in GNOME): https://github.com/lukefromdc/caja/tree/GtkApplicationfromNaut_WIP2 To last night's branch I had to apply everything between that affected the GtkApplication work and had not already been applied on a GTK3 build selector basis. If you try to start this with the session manager it starts with a navigation window open, and worse the session manager hangs, crashes, and restarts. With a blank filemanager entry in session>required-components and an autostart .desktop file calling caja -n the session and caja seem to function fine except that (like Nautilus in GNOME) there is no auto-restart if Caja is killed. |
3.21.4 is now landed in fedora rawhide, now i can reproduce issues and test fixes. |
Maybe it's possible to start caja like nemo. |
To get this working we need to backport changes from early g-s-m. |
I will try that tonight, I am now using that code with a .desktop file to start it. On 7/20/2016 at 10:41 AM, "raveit65" notifications@github.com wrote:
|
Got a sucessful distcheck completion by running mate-distcheck with caja not running-and moving the init_css function back to caja_application_command_line , this time just before creating the other windows. Maybe distcheck was catching a race condition, it was failing to load the css file and stopping on that error until this commit: |
Just rebased the GtkApplication branch for 8-10-2016 Master with the desktop fixes: There remains the issue that it has to be started up the same way Nautilus and Nemo are, by a file in /etc/XDG/autostart. I have not been able to get data/makefile.am to installl that for the life of me, a fix for that and I think this is ready for a PR. If we don't want to deal with the behavior changes GtkApplication introduces there is another option: cut-and-paste the necessary libunique files directly into Caja and build with it as part of Caja itself. This way Debian can drop it and we still have it. That gives us auto-restart and saved sessions, two features Caja and Nemo don't have. |
I just tested #613 |
PS: i really miss some comments from debian Mate maintainer here....... |
One answer is this: dump this branch entirely and simply drop the To get back the autostart in GtkApplication exceeds my coding ability On 8/14/2016 at 4:51 AM, "raveit65" notifications@github.com wrote:
|
For me the drop in debian sounds not necessary, as main gtk+ and gnome devs are from RedHat, |
#613 is so far the only code I've been able to come up with that actually works under a wide variety of conditions, doesn't use libunique, and confines all invocations of caja by one user to a single instance. The only way I can think of now to fix that "caja ." bug is to special case that character on the command line, get the working directory, and open a window there. Still doesn't fix restart though. None of the later Nautilus code seems to work in caja as they have just diverged too far by that point. |
Personal, i would stop working on it at the moment as no one from Mate debian maintainer did answer here. We can leave #613 open. |
WARNING: Application 'caja.desktop' failed to register before timeout If your session manager use org.gnome.SessionManager dbus name then only "register-session" property must be set to TRUE when creating GtkApplication: Otherwise you must create patch that adds support for MATE session manager in gtk+ or simply add registration code in caja: |
@albertsmuktupavels |
Then this is all you need: |
That WORKS, I just tested it and got clean session startup with functional restart. On 8/15/2016 at 1:42 PM, "Alberts Muktupāvels" notifications@github.com wrote:
|
@albertsmuktupavels |
lukefromdc@08c9822 |
https://github.com/lukefromdc/caja/tree/dev-GtkApplication2 has been rebased and that segfault traced to a faulty loop and fixed. |
Just tested both the PR and dev-GtkApplication2.
full stacktrace: https://dl.dropboxusercontent.com/u/49862637/Mate-desktop/Bugs/caja-backtrace-GtkApplication-with-sudo And with dev-GtkApplication2 branch the --browser option is missing.
Anyway, best state of work on this issue, thank you. |
Just pushed one more commit to dev-GtkApplication2 to restore function of --browser. Just tested it, it will open a window in browser mode even when Caja on the desktop is in spatial mode. So will simply invoking "caja" as the preference "open each folder in its own window" seems to apply only to the initial invocation (known in GtkApplication as the local instance). Nautilus dumped the Spatial mode before Nemo was forked, so had this option (which the code does not actually do anything with) opened a spatial window I would have had to write code from scratch to ensure that caja --browser actually opened a browser window. It does anyway so I get a break. |
I looked at your backtrace and there may be a simple fix: only register Caja when not running in root |
raveit65, See if lukefromdc@6a8d0cf stops segfaults when invoking "sudo caja" with your GTK version. If so, Nemo should also use this to stop problems with some GTK versions. This commit limits registering the app with the session manager to invocations running in MATE and not running as root. |
Yeap, --brower and 'sudo caja' work now with gtk+-3.21.4.
because i had reports from users who use caja in kde or xfce. Also it seems that caja is an alternative for flashback session. |
I can easily take out the limitation to a mate-session, that is trivial to do. On 8/16/2016 at 5:38 PM, "raveit65" notifications@github.com wrote:
|
Having caja try to find a session manager as root that is not running always The sudo issuse should thus keep this fix-unless we want to set up On 8/16/2016 at 5:38 PM, "raveit65" notifications@github.com wrote:
|
I pulled out the code to limit registering caja to mate-sesions, left in At any rate, this can easily be set up any way we want when GTK 3.21.5 On 8/16/2016 at 5:38 PM, "raveit65" notifications@github.com wrote:
|
I finally get session saving and reloading to work with lukefromdc@6cb010e |
Does anyone have a list of the non-standard use configurations for Caja? I've got dev-GtkApplication3 behaving rather well other than deliberately keeping the case from master where turning off the desktop and setting exit with last window creates a restart loop. I left that alone because I didn't want to create any intentional behavior changes. Otherwise I would have forced hold-in on all autostarted instances. I've tested spatial and browser windows as user and root, intentional bad URIs, relative paths, various restart conditions, etc but really could use a list of things that need testing, especially those common in scripts. I can do a lot of this testing while we wait for the next GTK 3.21 release. |
Commit 9fb1211 is a most of the way fix for the inabily to use --geometry with a second (local) instance of Caja imported from Nautilus 3.4/Nemo with the command line fix for relative paths. Can use --geometry or --browser but not both at once at the moment. That is because commit uses the "hint" string passed to "open" to send either --browser or a geometry string to the main running instance, but cannot do both at once without more string manipulation than I know how to do right now. If the "hint" string was "600x600browser" or "browser600x600" the browser/spatial switch could easily look for "browser" but the geometry string would have to be separated from the combined string before it could be used. If someone can help me with this string handling I could get the --browser and --geometry options to play nice together. The only other way to pass options from the local instance's command line to the main instance without screwing up relative paths is to do it the way Nautilus now does. I tested that, it worked but broke passing the command line options to the session manager, so to use it with session saving would require rewrites in cut-n-paste-code/libegg too. I found that out while hooking other options back up one by one and called it at that point. The "hint" method also offers Nemo a fix for their --geometry bug. BTW, --geometry does not work in spatial windows with master, so it does not here either. Something in the spatial window code either ignores or does not get the string. Not sure how important that is, but we DID recently get an issue from someone who wanted to know how to enable spatial windows. |
Finally fixed using --geometry and --browser together, plus rebased and squashed again for today's change in master. |
Closed by |
Update: Debian Stretch is now in "soft freeze" with full freeze in a month. This means no new packages added or removed-and libunique is still in the repos at My guess now is that libunique will be removed from Debian Unstable sometime after the release of Stretch. |
Debian has raised the following bug:
This MATE component needs migrating to GtkApplication:
The text was updated successfully, but these errors were encountered: