GNOME Bugzilla – Bug 132333
Can't add a palette to the dialog of a color button
Last modified: 2012-12-03 23:29:49 UTC
It'd be nice to be able to add a palette to the dialog popped up by a GtkColorButton
This needs an API proposal.
Would be worthwhile to check the gtk-devel archives; we discussed palettes when the color button was added; IIRC we came to the conclusion that if you want a palette, quite possibly you're better off with something like a color combo (see testcombo.c in gtk+/tests)
Archived discussion: http://mail.gnome.org/archives/gtk-devel-list/2003-March/msg00052.html My feeling from re-reading the posts was that Matthias Clasen was rather in favour of the ColorButton while Jody Goldberg argued towards a combo-style thing (as found in gnumeric). Havoc Pennington brought in another proposal about a osx-style widget. In abiword we are starting to use the color button and our users are demanding the palette because they have used it in other apps too. I would very much like to see this happen for the sake of consistency. API Proposal: gboolean gtk_color_button_dialog_get_has_palette(GtkColorButton *colorbtn); void gtk_color_button_dialog_set_has_palette(GtkColorButton *colorbtn, gboolean has_palette);
*** Bug 144639 has been marked as a duplicate of this bug. ***
What is the status of this proposal?
If we are adding the has-palette property, we also have to add palette-loading/saving functionality...
"add palette-loading/saving functionality" - that would be excellent, i'd use this feature happily in Bluefish editor and other apps too, could we have it, please!
Created attachment 230428 [details] [review] Make sure add palette amends the dialog
The bug seems obsolete, however I'm surprised the gtk_color_button_add_palette does not work when no dialog has been created. Dialog is created only when button clicked. I'm attaching a patch to make this more understandable but it might be wrong.
Created attachment 230438 [details] [review] Make sure add palette works This patch is the same comment except it was tested
Review of attachment 230438 [details] [review]: The change makes sense to me - the other option would be to save the palettes in the button before the dialog is created and add them at creation, but it just seems harder for no good reasons. I only have a minor comment on the code itself. ::: gtk/gtkcolorbutton.c @@ +588,2 @@ static void +create_dialog (GtkColorButton *button) I'd rather you named this ensure_dialog() and added a if (button->priv->cs_dialog != NULL) return; check first thing in the function, instead of the caller needing to check if the dialog exists.
Created attachment 230591 [details] [review] Ensure dialog before adding palette Yes, another option would have be to save the palette. Anyway I sticked to the first way, just renamed the func and moved the check there.
Review of attachment 230591 [details] [review]: Thanks, looks good to me.
Review of attachment 230591 [details] [review]: .