After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 608329 - Patch to add Color to Account tabs.
Patch to add Color to Account tabs.
Status: RESOLVED FIXED
Product: GnuCash
Classification: Other
Component: User Interface General
2.3.x
Other Linux
: Normal enhancement
: ---
Assigned To: David Hampton
Chris Shoemaker
Depends on:
Blocks:
 
 
Reported: 2010-01-28 11:35 UTC by Bob
Modified: 2018-06-29 22:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Diff file of changes (35.87 KB, patch)
2010-01-28 11:35 UTC, Bob
needs-work Details | Review
Screen shot of changes. (141.01 KB, image/png)
2010-01-28 11:36 UTC, Bob
  Details
New patch using KVP (31.16 KB, patch)
2010-02-03 11:19 UTC, Bob
accepted-commit_now Details | Review
New patch using KVP to fix PANGO errors. (31.37 KB, patch)
2010-02-05 15:02 UTC, Bob
committed Details | Review

Description Bob 2010-01-28 11:35:17 UTC
Created attachment 152478 [details] [review]
Diff file of changes

I wanted a way to select an account easily when I have several accounts open in the main window. I decided to add a color option to the account so that the tab can be set to a specific color and so easily identifiable. This could also be used to link like minded accounts together.

This is my first attempt at programming so there may be a better way of implementing but it compiles with no errors and warnings on my 64 bit Linux box so please let me know what you think.

Will attach a screen shot and a diff file for the changes made.
Comment 1 Bob 2010-01-28 11:36:08 UTC
Created attachment 152479 [details]
Screen shot of changes.
Comment 2 Bob 2010-01-28 20:12:55 UTC
I forgot to mention, using an xml file the upgrade appears to be seem less but when tested with sqlite3 database, the old database needs to be saved as with a new name so the additional field can be setup otherwise the new color field would have to be added some how.
Comment 3 Christian Stimming 2010-02-01 14:20:52 UTC
Comment on attachment 152478 [details] [review]
Diff file of changes

Thanks for this interesting new feature. In terms of the GUI side of this, the patch is fine. However, there is a problem with the data store of this: We cannot start to *write* new XML elements in the current version ("account_color"), because this will cause all previous versions to refuse reading these data files. But there is a different solution available: You need to store your account_color string in the "KVP" (key-value frame) of the account, with some key you invent for yourself. In contrast to "real XML elements", the KVP entries can transparently be added and they will also be correctly loaded and saved again even by earlier gnucash versions. See also src/engine/kvp_doc.txt
Comment 4 Christian Stimming 2010-02-01 14:21:53 UTC
See e.g. how xaccAccountGetNotes and SetNotes is implemented.
Comment 5 Bob 2010-02-03 11:19:25 UTC
Created attachment 152914 [details] [review]
New patch using KVP

I thought that it was OK for new program versions to open old files but not necessary the other way round. Any way I have changed the way the 'color' is saved to use KVP as you suggested, much easier than I thought and now an unpatched version can read the files.

Also I forgot to mention that the patch fixes the account tooltip not being updated when the name changes.
Comment 6 Christian Stimming 2010-02-03 12:10:04 UTC
Comment on attachment 152914 [details] [review]
New patch using KVP

Looks good to me. Thanks a lot!
Comment 7 Christian Stimming 2010-02-03 21:19:40 UTC
With this patch (and my unchanged file) I get the following warnings on the console:

CRIT <Pango> pango_color_parse: assertion `spec != NULL' failed

Can you look into this?
Comment 8 Andreas Köhler 2010-02-03 22:08:25 UTC
(In reply to comment #5)
> Also I forgot to mention that the patch fixes the account tooltip not being
> updated when the name changes.

May you please prepare separate patches for separate issues (I suppose they are).

After a quick glance on your changes to main_window_update_page_name, you probably leak a few strings (oldname, longname, maybe more). Honestly, I do not fully understand that function now. What is the relation between longname and oldname, and what is index?
I have not even looked at the rest of the patch yet, I am too confused ;-(
Comment 9 Bob 2010-02-05 15:02:12 UTC
Created attachment 153086 [details] [review]
New patch using KVP to fix PANGO errors.
Comment 10 Bob 2010-02-05 15:05:44 UTC
(In reply to comment #7)
> With this patch (and my unchanged file) I get the following warnings on the
> console:
> 
> CRIT <Pango> pango_color_parse: assertion `spec != NULL' failed
> 
> Can you look into this?

Sorry about this, I ran from a console and did not see any errors but failed to look in the gnucash.trace file, hopefully I have fixed these.
Comment 11 Bob 2010-02-05 15:14:06 UTC
(In reply to comment #8)
> (In reply to comment #5)
> > Also I forgot to mention that the patch fixes the account tooltip not being
> > updated when the name changes.
> 
> May you please prepare separate patches for separate issues (I suppose they
> are).
> 
> After a quick glance on your changes to main_window_update_page_name, you
> probably leak a few strings (oldname, longname, maybe more). Honestly, I do not
> fully understand that function now. What is the relation between longname and
> oldname, and what is index?
> I have not even looked at the rest of the patch yet, I am too confused ;-(

The tooltip fix is in the same area of my tab color changes and it seemed easier to combine them. I am sorry that you were confused, I have changed some of the variable names to hopefully make more sense.
Comment 12 Christian Stimming 2010-02-10 20:39:09 UTC
Comment on attachment 153086 [details] [review]
New patch using KVP to fix PANGO errors.

r18637, thanks a lot!
Comment 13 John Ralls 2018-06-29 22:34:14 UTC
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=608329. Please update any external references or bookmarks.