I've started writing some plugins for geany on github, but I'm running into a problem. C is not my language of expertise, so I thought I would see if I'm just doing something stupid.
*The Problem:*
The basic problem is that I have a struct I'm using to pass information around like an object, but the information isn't staying with the struct when retrieving it from a TreeView.
*Steps to produce the issue:*
1. Open the plugin's configure window (Tools -> External Tools...) 2. Click the "New" button a few times. 3. Alternate which row of the TreeView is highlighted. 4. Note the checkboxes inconsistently are checked/unchecked on each item.
*The Code:*
https://github.com/sblatnick/geany-plugins/tree/external-tools/external-tool...
*Further Details:*
I create a GtkTreeView which I populate the only column with a struct called "Tool". Then, when the user clicks on a row in the table, it updates other UI components based on the Tool. I've already successfully overwritten the GtkTreeCellDataFunc to pull the name of the tool out, but for some reason the boolean checkboxes are updating rather randomly.
I'm guessing I'm not initializing the struct correctly, or that the pointer isn't handled correctly when storing/retreiving from the tree/table.
Also, one of the things I love about Geany is how little memory it uses, so feel free to give me pointers on when I need to free up memory, because I don't want my code to leak.
Currently I do a lot of Java, so any advice about pointers, memory allocation, and garbage clean-up are appreciated. Also, ideas for structuring C code into different files are appreciated.
Thanks,
Steve