From f855ea2dedcb0e9ecc1c338a7b6f4b4f69499770 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 4 Mar 2004 20:43:41 +0000 Subject: [PATCH] In list mode, set the background color of the cell view to the base color Thu Mar 4 21:45:43 2004 Matthias Clasen * gtk/gtkcombobox.c: In list mode, set the background color of the cell view to the base color of the style, instead of hardwiring white. (#136158) --- ChangeLog | 6 ++++++ ChangeLog.pre-2-10 | 6 ++++++ ChangeLog.pre-2-4 | 6 ++++++ ChangeLog.pre-2-6 | 6 ++++++ ChangeLog.pre-2-8 | 6 ++++++ gtk/gtkcombobox.c | 32 +++++++++++++++++++++++++++----- 6 files changed, 57 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index a3b6b982f2..6b58f0d512 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Mar 4 21:45:43 2004 Matthias Clasen + + * gtk/gtkcombobox.c: In list mode, set the background color + of the cell view to the base color of the style, instead of + hardwiring white. (#136158) + Thu Mar 4 01:32:19 2004 Jonathan Blandford * gtk/gtkpathbar.c (gtk_path_bar_set_path): Modified patch from diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index a3b6b982f2..6b58f0d512 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,9 @@ +Thu Mar 4 21:45:43 2004 Matthias Clasen + + * gtk/gtkcombobox.c: In list mode, set the background color + of the cell view to the base color of the style, instead of + hardwiring white. (#136158) + Thu Mar 4 01:32:19 2004 Jonathan Blandford * gtk/gtkpathbar.c (gtk_path_bar_set_path): Modified patch from diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index a3b6b982f2..6b58f0d512 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,9 @@ +Thu Mar 4 21:45:43 2004 Matthias Clasen + + * gtk/gtkcombobox.c: In list mode, set the background color + of the cell view to the base color of the style, instead of + hardwiring white. (#136158) + Thu Mar 4 01:32:19 2004 Jonathan Blandford * gtk/gtkpathbar.c (gtk_path_bar_set_path): Modified patch from diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index a3b6b982f2..6b58f0d512 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,9 @@ +Thu Mar 4 21:45:43 2004 Matthias Clasen + + * gtk/gtkcombobox.c: In list mode, set the background color + of the cell view to the base color of the style, instead of + hardwiring white. (#136158) + Thu Mar 4 01:32:19 2004 Jonathan Blandford * gtk/gtkpathbar.c (gtk_path_bar_set_path): Modified patch from diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index a3b6b982f2..6b58f0d512 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,9 @@ +Thu Mar 4 21:45:43 2004 Matthias Clasen + + * gtk/gtkcombobox.c: In list mode, set the background color + of the cell view to the base color of the style, instead of + hardwiring white. (#136158) + Thu Mar 4 01:32:19 2004 Jonathan Blandford * gtk/gtkpathbar.c (gtk_path_bar_set_path): Modified patch from diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c index c5a5c630e0..6c349378aa 100644 --- a/gtk/gtkcombobox.c +++ b/gtk/gtkcombobox.c @@ -190,6 +190,8 @@ static void gtk_combo_box_get_property (GObject *object, GValue *value, GParamSpec *spec); +static void gtk_combo_box_state_changed (GtkWidget *widget, + GtkStateType previous); static void gtk_combo_box_style_set (GtkWidget *widget, GtkStyle *previous); static void gtk_combo_box_button_toggled (GtkWidget *widget, @@ -414,6 +416,7 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass) widget_class->scroll_event = gtk_combo_box_scroll_event; widget_class->mnemonic_activate = gtk_combo_box_mnemonic_activate; widget_class->style_set = gtk_combo_box_style_set; + widget_class->state_changed = gtk_combo_box_state_changed; gtk_object_class = (GtkObjectClass *)klass; gtk_object_class->destroy = gtk_combo_box_destroy; @@ -594,6 +597,22 @@ gtk_combo_box_get_property (GObject *object, } } +static void +gtk_combo_box_state_changed (GtkWidget *widget, + GtkStateType previous) +{ + GtkComboBox *combo_box = GTK_COMBO_BOX (widget); + + if (GTK_WIDGET_REALIZED (widget)) + { + if (combo_box->priv->tree_view && combo_box->priv->cell_view) + gtk_cell_view_set_background_color (GTK_CELL_VIEW (combo_box->priv->cell_view), + &widget->style->base[GTK_WIDGET_STATE (widget)]); + } + + gtk_widget_queue_draw (widget); +} + static void gtk_combo_box_style_set (GtkWidget *widget, GtkStyle *previous) @@ -602,7 +621,7 @@ gtk_combo_box_style_set (GtkWidget *widget, GtkComboBox *combo_box = GTK_COMBO_BOX (widget); gtk_widget_queue_resize (widget); - + /* if wrap_width > 0, then we are in grid-mode and forced to use * unix style */ @@ -634,6 +653,11 @@ gtk_combo_box_style_set (GtkWidget *widget, if (!GTK_IS_MENU (combo_box->priv->popup_widget)) gtk_combo_box_menu_setup (combo_box, TRUE); } + + if (combo_box->priv->tree_view && combo_box->priv->cell_view) + gtk_cell_view_set_background_color (GTK_CELL_VIEW (combo_box->priv->cell_view), + &widget->style->base[GTK_WIDGET_STATE (widget)]); + } static void @@ -2113,10 +2137,8 @@ gtk_combo_box_list_setup (GtkComboBox *combo_box) gtk_frame_set_shadow_type (GTK_FRAME (combo_box->priv->cell_view_frame), GTK_SHADOW_IN); - g_object_set (G_OBJECT (combo_box->priv->cell_view), - "background", "white", - "background_set", TRUE, - NULL); + gtk_cell_view_set_background_color (GTK_CELL_VIEW (combo_box->priv->cell_view), + >K_WIDGET (combo_box)->style->base[GTK_WIDGET_STATE (combo_box)]); gtk_widget_show (combo_box->priv->cell_view_frame); }