[gedit-list] A solution for Bug #485471



HI, I wanted to learn about the internals of Gedit and so decided to start with fixing small bugs. I cam across this bug on bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=485471.

This bug still seems to be present in my version of Gedit , but I was wondering if it has been worked out in the latest development releases ?

I came up with the following solution and wanted your opinion and help on this:

1. On creating a new document/tab save it in ~/.gnome2/gedit/ directory with a name like ~yyyy-mm-dd-unsaved-document . I believe, if the file is once saved, then gedit will take care of autosaving it at set intervals ?

2. After this, when the user decides to save the document, we can check if the filename (uri ?) has this particular string format (~yyyy-mm-dd-unsaved-document) then we will open the file save as dialog box. (Also check the same when user closes the tab or the window)

3. Also, keep logging the list of new untitled files in a file (~/.gnome2/gedit/unsaved-files). When the user quits Gedit, we can safely delete this file. In case of a crash, Gedit won't be able to delete this file.

4. On each startup Gedit will try to read this file. If gedit was closed normally, then it won't find the file. But if it is able to read from the file, then it means that a crash had occurred, and it will ask the user if he would like to restore the unsaved files ?

I thought this would be an easy fix, but to start with, the gedit codebase is a bit overwhelming.
 I was thinking to start with adding a call to gedit_document_saver_save in gedit.c where it creates the new tab. I would appreciate if you provide some direction as in where to start ?

Thanks.
Abhinav


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]