Skip to content
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

Restore tabs no longer works #14

Open
duck7000 opened this issue Oct 9, 2023 · 17 comments
Open

Restore tabs no longer works #14

duck7000 opened this issue Oct 9, 2023 · 17 comments

Comments

@duck7000
Copy link

duck7000 commented Oct 9, 2023

I'm using Manjaro and after update glibc to 2.38-7 restore tabs no longer works

During this update i noticed that amtk get replaced by libgedit-amtk, gedit now uses libgedit-amtk as required.

I did install restore tabs as described here but it didn't work.

Restore tabs is still in plugins section of gedit and checked but tabs are not restored

@raelgc
Copy link
Owner

raelgc commented Nov 27, 2023

Hi @duck7000 and sorry for the late response.

Which is the Gnome version?

@duck7000
Copy link
Author

duck7000 commented Nov 27, 2023

First of all thanks for making this and your reaction!

I don't know, i don't use Gnome.
I use xfce and have gedit installed (version 46.1)

@raelgc
Copy link
Owner

raelgc commented Nov 27, 2023

I see. I'm still using Ubuntu 22.04, which has version 41. I'll try Ubuntu 23.10 in a VM.

@duck7000
Copy link
Author

That is of course the big difference between a Arch based distro or Ubuntu based, i will hit problems much sooner than on Ubuntu.

In think it has something to do with amtk get replaced by libgedit-amtk but that is guessing as i only develop in php

@duck7000
Copy link
Author

Oeps wrong button

@duck7000 duck7000 reopened this Nov 27, 2023
@duck7000
Copy link
Author

I started gedit on the terminal, opened a few files and closed gedit this gives some interesting errors:

Traceback (most recent call last):
  File "/home/ed/.local/share/gedit/plugins/restoretabs.py", line 88, in on_tab_added
    if document.is_untitled() and len(window.get_documents()) > 1:
       ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Document' object has no attribute 'is_untitled'. Did you mean: 'is_untouched'?
Traceback (most recent call last):
  File "/home/ed/.local/share/gedit/plugins/restoretabs.py", line 88, in on_tab_added
    if document.is_untitled() and len(window.get_documents()) > 1:
       ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Document' object has no attribute 'is_untitled'. Did you mean: 'is_untouched'?
Traceback (most recent call last):
  File "/home/ed/.local/share/gedit/plugins/restoretabs.py", line 88, in on_tab_added
    if document.is_untitled() and len(window.get_documents()) > 1:
       ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Document' object has no attribute 'is_untitled'. Did you mean: 'is_untouched'?

I hope this may help you get started

@duck7000
Copy link
Author

Are you still working on this, as your last reaction was from 27 November 2023?

@raelgc
Copy link
Owner

raelgc commented Feb 16, 2024

Not yet. Probably you should try, as suggested by the error, replace all is_untitled with is_untouched on restoretabs.py and check if it works.

@duck7000
Copy link
Author

i tried that, result is the same.
Although it creates new problems with opening new files

@Batwam
Copy link

Batwam commented Jul 9, 2024

same issue here. If I replace is_untitled with is_untouched, I then get to the following error"

Traceback (most recent call last):
  File "/home/user/.local/share/gedit/plugins/restoretabs.py", line 77, in on_window_show
    self.window.create_tab_from_location(location, None, 0, 
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Window' object has no attribute 'create_tab_from_location'. Did you mean: 'get_tab_from_location'?

looks like there have been changes to the gedit API as I can see that some files from gedit-plugins also stopped working. https://gitlab.gnome.org/World/gedit/gedit-plugins/-/commits/master/plugins/sessionsaver/sessionsaver?ref_type=heads

@Batwam
Copy link

Batwam commented Jul 9, 2024

ok, I have managed to adress the missing 'create_tab_from_location' by replacing it with tab creation followed by document loading.

tab = self.window.create_tab(True) #create new tab and jump_to it
tab.load_file(location, None, 0, 0, True) #GFile *location,*encoding,line_pos,column_pos,create

is_untouched isn't a like for like replacement for is_untitled at all. I have commented the lines out for now which means that I'm left with an extra "Untitled Document 1" tab on startup but it's still better than having to reopen all my tabs by hand!

see updated file here: https://github.com/Batwam/gedit-restore-tabs/blob/master/restoretabs.py

@Batwam
Copy link

Batwam commented Jul 12, 2024

ok, I dug through the documentation and I think that I found a workaround to delete the Untitled Document tab.

See explanations in the pull request above.

@cfancsy
Copy link

cfancsy commented Dec 1, 2024

Thank you for fixing this, I couldn't figure it out but with your changes it works again.

@Batwam
Copy link

Batwam commented Dec 1, 2024

yeah, it's a bit of hacky to be honest and I occasionally find that I have to select a file twice for it to open but still better than nothing as I can't live without this feature ;-)

@raelgc
Copy link
Owner

raelgc commented Dec 2, 2024

I just switched to Ubuntu 24.04 (was using 22.04). I've noticed that the default editor, Gnome Text Editor already has a session management (i.e., it restores previous opened files).

@Batwam
Copy link

Batwam commented Dec 2, 2024

Yeah, Text Editor does have tab management, however it doesn't have any plugin to include a terminal within the editor. That's the main reason I'm still using gedit as I use it (mostly) as a light IDE for coding scripts.

@raelgc
Copy link
Owner

raelgc commented Dec 3, 2024

I've merged the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants