diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2011-05-17 14:20:31 -0400 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2011-05-18 10:27:21 -0400 |
commit | c8a59a6f92e79461622ebd6da058d29094d696ef (patch) | |
tree | e56f5c7c78601976d092b43d174bdcf6adfd903e /gtk/gtkcombobox.c | |
parent | 61e49e159a0eb366251e921882392f01729fdf0d (diff) | |
download | gtk+-c8a59a6f92e79461622ebd6da058d29094d696ef.tar.gz |
all: avoid boxed structs copying where possible
Use the GtkStyleContext accessors for boxed properties where possible,
to reduce allocations.
https://bugzilla.gnome.org/show_bug.cgi?id=650420
Diffstat (limited to 'gtk/gtkcombobox.c')
-rw-r--r-- | gtk/gtkcombobox.c | 37 |
1 files changed, 13 insertions, 24 deletions
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c index dfd27d8b99..760e77f25b 100644 --- a/gtk/gtkcombobox.c +++ b/gtk/gtkcombobox.c @@ -1282,17 +1282,13 @@ gtk_combo_box_state_flags_changed (GtkWidget *widget, { GtkStyleContext *context; GtkStateFlags state; - GdkRGBA *color; + GdkRGBA color; context = gtk_widget_get_style_context (widget); state = gtk_widget_get_state_flags (widget); + gtk_style_context_get_background_color (context, state, &color); - gtk_style_context_get (context, state, - "background-color", &color, - NULL); - - gtk_cell_view_set_background_rgba (GTK_CELL_VIEW (priv->cell_view), color); - gdk_rgba_free (color); + gtk_cell_view_set_background_rgba (GTK_CELL_VIEW (priv->cell_view), &color); } } @@ -1374,17 +1370,14 @@ gtk_combo_box_style_updated (GtkWidget *widget) if (priv->tree_view && priv->cell_view) { GtkStyleContext *context; - GdkRGBA *color; - - context = gtk_widget_get_style_context (widget); - gtk_style_context_get (context, 0, - "background-color", &color, - NULL); + GtkStateFlags state; + GdkRGBA color; - gtk_cell_view_set_background_rgba (GTK_CELL_VIEW (priv->cell_view), - color); + context = gtk_widget_get_style_context (widget); + state = gtk_widget_get_state_flags (widget); + gtk_style_context_get_background_color (context, state, &color); - gdk_rgba_free (color); + gtk_cell_view_set_background_rgba (GTK_CELL_VIEW (priv->cell_view), &color); } child = gtk_bin_get_child (GTK_BIN (combo_box)); @@ -3292,17 +3285,13 @@ gtk_combo_box_list_setup (GtkComboBox *combo_box) { GtkStyleContext *context; GtkStateFlags state; - GdkRGBA *color; + GdkRGBA color; - context = gtk_widget_get_style_context (widget); + context = gtk_widget_get_style_context (widget); state = gtk_widget_get_state_flags (widget); + gtk_style_context_get_background_color (context, state, &color); - gtk_style_context_get (context, state, - "background-color", &color, - NULL); - - gtk_cell_view_set_background_rgba (GTK_CELL_VIEW (priv->cell_view), color); - gdk_rgba_free (color); + gtk_cell_view_set_background_rgba (GTK_CELL_VIEW (priv->cell_view), &color); priv->box = gtk_event_box_new (); gtk_event_box_set_visible_window (GTK_EVENT_BOX (priv->box), |