I am creating a text editor using gtk+-2.0 gtksourceview-2.0. I want to be able to save the tabs within the notebook for use after I close the editor and reopen it at a later date. I don’t see anything in devhelp under gtk_notebook_* that looks promising. I could save the paths to these files in a database table, then read the table from the db and create the tabs on application startup, but that seems a little clunky. Many editors have this functionality built in. For one geany, but I know there are others.
Is this possible in gtk? I’m relatively new to C, are there other ways to store these paths (other than in a database)? Thanks.
I initially thought that writing to/from a config file would be slow, I had similiar thoughts about writing to/from a db. While there were a couple of good suggestions provided: sqlite and config file parsers, ultimately I decided that writing/reading a few lines to/from a text file the old fashioned way wouldn’t be that costly.
I put together a demo program before I incorporate these concepts into my editor, which I have provided below. Feel free to critique this program, especially with regards to memory usage. This program demonstrates the following steps:
(if I make a list it seems to mess with my code block)
1) check to see if the config file exists, 2) remove the config file if it does exist, 3) write the paths to the config file, 4) read the paths from the config file