GNOME Bugzilla – Bug 575308
Make gnome-terminal session loading work
Last modified: 2009-04-16 20:24:21 UTC
There's no code at all to read the state file from saved session in gnome-terminal. Attached patch fixes this.
Created attachment 130619 [details] [review] Patch
Actually, this is not 100% correct since there's always a new window being opened with the default profile, in addition to the windows saved in the state file. (you'll need the patch from bug 552387 for gnome-session to test all this)
Created attachment 130644 [details] [review] Avoid opening a new window Opening a new window is caused by invoking ensure_top_tab in digest_options_callback which is a callback function of g_option_group_set_parse_hooks. So the window always opens.
I found another issue. After a gnome-terminal session which has several tabs is restored, I opened a new gnome-terminal, the new gnome-terminal is opened with with several tabs which are the same of the restored one.
Comment on attachment 130644 [details] [review] Avoid opening a new window Umm, this patch was wrong.
Created attachment 130653 [details] [review] Tackled to the issue I mentioned in comment #4
Why does the last patch remove checking the return value of terminal_options_merge_config()? Also I don't like how the default-window thing is moved from terminal-options to terminal-app; this should stay an internal thing. I'll try to think about how to do that...
(In reply to comment #7) > Why does the last patch remove checking the return value of > terminal_options_merge_config()? Also I don't like how the default-window thing > is moved from terminal-options to terminal-app; this should stay an internal > thing. I'll try to think about how to do that... Yes, I actually don't like that way too. Though I thought another way that calling egg_sm_client_is_resumed in digest_options_callback(), I don't like it too. I will think smart way.
(In reply to comment #7) > Why does the last patch remove checking the return value of > terminal_options_merge_config()? I thought it is good to go on the process even if merge config failed, but now I think it was misreading.
Created attachment 130723 [details] [review] another way I gave up the attempt to find smart way. So I attach another patch I mentioned in comment #8.
I couldn't think of a nicer way either, so I used the patch from attachment 130653 [details] [review] with only minor changes. Unfortunately I cannot test session resuming since I'm still using gnome 2.24; can you check it works? Testing shouldn't only test resuming a session saved by gnome-terminal 2.26, but also one saved from g-t 2.24. Also, resuming will only work if the resume process starts the terminal factory (i.e. not with factory already running), but that shouldn't be a problem.
(In reply to comment #11) > Unfortunately I cannot test session resuming since I'm still using gnome 2.24; > can you check it works? Testing shouldn't only test resuming a session saved by > gnome-terminal 2.26, but also one saved from g-t 2.24. I am sorry for my poor comprehension. I cannot understand what you are saying. You mean the steps like the following? 1. start gnome-terminal-2.24 2. log out with session saving 3. update gnome-terminal to 2.26 4. log in
Test1: single tab restoring 0. no gnome-terminal was running. 1. started gnome-terminal 2. the terminal had a tab. 3. logged out with session saving. 4. logged in. 5. gnome-terminal was restored with a tab. <= It's OK. Test2: multiple tabs restoring 0 - 2. same as Test1. 3. open three new tabs in the gnome-terminal. 4. logged out with session saving. 5. logged in. 6. gnome-terminal was restored with four tabs. <= It's OK. Test3: new gnome-terminal with factory 0 - 6: same as Test2. 7. start a new gnome-terminal. 8. the new terminal had a tab. <= It's OK. Test4: new gnome-terminal without factory 0 -8: same as Test3. 9. confirmed no gnome-terminal process runnig. 10. start a new gnome-terminal 11. the new terminal had a tab. <= It's OK.
(In reply to comment #13) > Test4: new gnome-terminal without factory > 0 -8: same as Test3. > 9. confirmed no gnome-terminal process runnig. > 10. start a new gnome-terminal > 11. the new terminal had a tab. <= It's OK. I forgot to write very important step. 8.5. I stopped all gnome-terminal processes.
(In reply to comment #12) > I am sorry for my poor comprehension. I cannot understand what you are saying. > You mean the steps like the following? > > 1. start gnome-terminal-2.24 > 2. log out with session saving > 3. update gnome-terminal to 2.26 > 4. log in Yes.
(In reply to comment #15) > > 1. start gnome-terminal-2.24 > > 2. log out with session saving > > 3. update gnome-terminal to 2.26 > > 4. log in Unfortunately this test failed. gnome-terminal-2.26 could not be restored from gnome-terminal-2.24 saved session. In other word, gnome-terminal-2.26 was not started by gnome-session. session file (~/.config/gnome-session/saved-session/XXXX.desktop) of gnome-terminal-2.24 slightly differs from gnome-terminal-2.26's one. Is this problem? -Exec=gnome-terminal --sm-config-prefix /gnome-terminal-M65mmk/ --sm-client-id 10aa88bf17eea4fe70123780473836094600000247480028 --screen 0 --window-with-profile-internal-id=Default --hide-menubar --role=gnome-terminal-window-25187--1305972804-1237804738 --working-directory /home/zoe --tab-with-profile-internal-id=Default --working-directory /home/zoe --tab-with-profile-internal-id=Default --working-directory /home/zoe --tab-with-profile-internal-id=Default --working-directory /home/zoe --tab-with-profile-internal-id=Default --active --geometry '80x24+182+104' --working-directory /home/zoe +Exec=gnome-terminal --sm-client-id 106ffdd4e584644728123780433531307000000189090028 --sm-client-state-file /home/zoe/.config/session-state/gnome-terminal-1237804352.desktop
That's because the --sm-config-prefix option isn't known by eggsmclient. I've fixed this in gnome-terminal's copy, and sent the patch upstream.
(In reply to comment #17) > That's because the --sm-config-prefix option isn't known by eggsmclient. I've > fixed this in gnome-terminal's copy, and sent the patch upstream. I confirmed that gnome-terminal rev. 3387 can be restored from gnome-terminal-2.24 session.
Thanks! Let's call this FIXED then and if you find any more issues with session save or restore, please open a new bug.
*** Bug 579208 has been marked as a duplicate of this bug. ***