combobox: Reuse code rather than reimplementing it

We already have cell_layout_is_sensitive() to get whether at least one
cell in a Layout is sensitive, which we need because CellLayout/View
do not implement foreach(). So, since we wrote that, we can use it to
check our CellArea too, instead of doing foreach with a custom callback.
This commit is contained in:
Daniel Boles 2017-01-21 15:11:40 +00:00
parent c7e4c82df4
commit 36413a8eca

View File

@ -1465,17 +1465,6 @@ cell_layout_is_sensitive (GtkCellLayout *layout)
return sensitive;
}
static gboolean
cell_is_sensitive (GtkCellRenderer *cell,
gpointer data)
{
gboolean *sensitive = data;
g_object_get (cell, "sensitive", sensitive, NULL);
return *sensitive;
}
static gboolean
tree_column_row_is_sensitive (GtkComboBox *combo_box,
GtkTreeIter *iter)
@ -1489,20 +1478,8 @@ tree_column_row_is_sensitive (GtkComboBox *combo_box,
return FALSE;
}
if (priv->area)
{
gboolean sensitive;
gtk_cell_area_apply_attributes (priv->area, priv->model, iter, FALSE, FALSE);
sensitive = FALSE;
gtk_cell_area_foreach (priv->area, cell_is_sensitive, &sensitive);
return sensitive;
}
return TRUE;
gtk_cell_area_apply_attributes (priv->area, priv->model, iter, FALSE, FALSE);
return cell_layout_is_sensitive (GTK_CELL_LAYOUT (priv->area));
}
static void