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 362790 - GtkComboBox has Color components private, unable to modify Color.
GtkComboBox has Color components private, unable to modify Color.
Status: RESOLVED WONTFIX
Product: gtk+
Classification: Platform
Component: Widget: GtkComboBox
2.10.x
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2006-10-17 07:24 UTC by Tom Gaudasinski
Modified: 2016-06-08 04:16 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
popup window can't change color (9.13 KB, image/jpeg)
2014-02-12 09:11 UTC, terrance__chen
Details

Description Tom Gaudasinski 2006-10-17 07:24:54 UTC
Please describe the problem:
In the implementation of GtkComboBox, unlike that of GtkCombo, it is impossible to set the color of a GtkComboBox due to key components that make up the ComboBox being in a private struct. GtkComboBox also does not respond to gtk_widget_modify_*().

Steps to reproduce:
Try setting gtk_widget_modify_bg() on a GtkComboBox, won't do squat. At least The GtkCombo allowed you to access the inner constituencies of the combobox for color modification.

Actual results:
You won't change the GtkComboBox's color.

Expected results:
The color of the combobox to change.

Does this happen every time?
Yes.

Other information:
Exposing the inner GtkComboBoxPrivate struct to the world would allow for access to the inner workings and thereby color modification. Alternatively, override the gtk_widget_modify functions to work with the GtkComboBox.
Comment 1 terrance__chen 2014-02-12 09:01:54 UTC
I met the same problem !
Comment 2 terrance__chen 2014-02-12 09:03:05 UTC
gtk_widget_modify_base
can change most widgets' color,but doesn't work with combobox
Comment 3 terrance__chen 2014-02-12 09:11:10 UTC
Created attachment 268890 [details]
popup window can't change color

If you only want to change combobox's color (not include popup menu)
I have a way to do this 
( but I also want to change the popup menu's color,any one can help ??? )
==============================================
I create a struct GtkComboBoxP like this :
==============================================
struct GtkComboBoxP
{
    GtkTreeModel *model;
    s32 col_column;
    s32 row_column;
    s32 wrap_width;
    GtkTreeRowReference *active_row;
    GtkWidget *tree_view;
    GtkTreeViewColumn *column;
    GtkWidget *cell_view;
    GtkWidget *cell_view_frame;
    GtkWidget *button;
    GtkWidget *box;
    GtkWidget *arrow;
    GtkWidget *separator;
    GtkWidget *popup_widget;
};
==============================================
then copy all memory:
==============================================
    struct GtkComboBoxP *priv =
            (struct GtkComboBoxP *) GTK_COMBO_BOX(combobox)->priv;
==============================================
then change color when focus change:
==============================================
    g_signal_connect(GTK_OBJECT(priv->button),
        "focus_in_event", G_CALLBACK(focus_in_widget_cbox), combobox);
    
void focus_in_widget_cbox(GtkWidget *widget, gpointer user_data)
{
    s32 j = focus1[CURR_WIN_INDEX].j_focus;
    s32 i = focus1[CURR_WIN_INDEX].i_focus;
    opera_data.focus_i = i;
    opera_data.focus_j = j;
    opera_data.type = win_widget_type[CURR_WIN_INDEX][i][j];    
    gtk_widget_modify_fg(widget, GTK_STATE_NORMAL, &color[YELLOW]);
    gtk_widget_modify_bg(widget, GTK_STATE_NORMAL, &color[YELLOW]);
    return;
}
==============================================
Comment 4 Leo Ufimtsev 2015-04-13 19:18:39 UTC
Similar bug but for Gtk3/css
https://bugzilla.gnome.org/show_bug.cgi?id=747798
Comment 5 Matthias Clasen 2016-06-08 04:16:50 UTC
I don't think we wil lfix this for gtk2 at this point